Diff

Differences From Artifact [fb14cea935]:

To Artifact [62dbc078fa]:


453
454
455
456
457
458
459
460
461
462
463
464
465


466
467
468
469
470












471

472

473
474
475
476
477
478
479
	}

	return(retval);
}

static int appfs_getfileinfo_cb(void *_pathinfo, int columns, char **values, char **names) {
	struct appfs_pathinfo *pathinfo = _pathinfo;
	const char *type, *time, *source, *size;

	type = values[0];
	time = values[1];
	source = values[2];
	size = values[3];



	pathinfo->time = strtoull(time, NULL, 10);

	if (strcmp(type, "file") == 0) {
		pathinfo->type = APPFS_PATHTYPE_FILE;












		pathinfo->typeinfo.file.executable = 0;

		pathinfo->typeinfo.file.size = strtoull(size, NULL, 10);


		return(0);
	}

	if (strcmp(type, "directory") == 0) {
		pathinfo->type = APPFS_PATHTYPE_DIRECTORY;
		pathinfo->typeinfo.dir.childcount = 0;







|





>
>





>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>







453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
	}

	return(retval);
}

static int appfs_getfileinfo_cb(void *_pathinfo, int columns, char **values, char **names) {
	struct appfs_pathinfo *pathinfo = _pathinfo;
	const char *type, *time, *source, *size, *perms, *sha1;

	type = values[0];
	time = values[1];
	source = values[2];
	size = values[3];
	perms = values[4];
	sha1 = values[5];

	pathinfo->time = strtoull(time, NULL, 10);

	if (strcmp(type, "file") == 0) {
		pathinfo->type = APPFS_PATHTYPE_FILE;

		if (!size) {
			size = "0";
		}

		if (!perms) {
			perms = "";
		}

		pathinfo->typeinfo.file.size = strtoull(size, NULL, 10);

		if (strcmp(perms, "x") == 0) {
			pathinfo->typeinfo.file.executable = 1;
		} else {
			pathinfo->typeinfo.file.executable = 0;
		}

		return(0);
	}

	if (strcmp(type, "directory") == 0) {
		pathinfo->type = APPFS_PATHTYPE_DIRECTORY;
		pathinfo->typeinfo.dir.childcount = 0;
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
		file = path;
		directory = "";
	} else {
		*file = '\0';
		file++;
	}

	sql = sqlite3_mprintf("SELECT type, time, source, size FROM files WHERE package_sha1 = %Q AND file_directory = %Q AND file_name = %Q;", package_hash, directory, file);
	if (sql == NULL) {
		APPFS_DEBUG("Call to sqlite3_mprintf failed.");

		free(path);

		return(-EIO);
	}







|







529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
		file = path;
		directory = "";
	} else {
		*file = '\0';
		file++;
	}

	sql = sqlite3_mprintf("SELECT type, time, source, size, perms, file_sha1 FROM files WHERE package_sha1 = %Q AND file_directory = %Q AND file_name = %Q;", package_hash, directory, file);
	if (sql == NULL) {
		APPFS_DEBUG("Call to sqlite3_mprintf failed.");

		free(path);

		return(-EIO);
	}