Compare commits

..

No commits in common. "6f5fdc29357e057a1b7b8ce48c14c2dde599a642" and "22dd58e14088df6de73a8f3f40406fbeecd80dd7" have entirely different histories.

8 changed files with 21 additions and 46 deletions

View File

@ -40,8 +40,6 @@ typedef struct {
pcre_extra *exclude_extra;
int fast;
GHashTable *dbg_current_files;
scan_arc_ctx_t arc_ctx;
scan_comic_ctx_t comic_ctx;
scan_ebook_ctx_t ebook_ctx;

View File

@ -15,13 +15,9 @@ typedef struct {
char has_parent;
} line_t;
#define META_NEXT 0xFFFF
void skip_meta(FILE *file) {
enum metakey key;
fread(&key, sizeof(uint16_t), 1, file);
while (key != META_NEXT) {
enum metakey key = getc(file);
while (key != '\n') {
if (IS_META_INT(key)) {
fseek(file, sizeof(int), SEEK_CUR);
} else if (IS_META_LONG(key)) {
@ -30,7 +26,7 @@ void skip_meta(FILE *file) {
while ((getc(file))) {}
}
fread(&key, sizeof(uint16_t), 1, file);
key = getc(file);
}
}
@ -70,7 +66,7 @@ index_descriptor_t read_index_descriptor(char *path) {
}
char *buf = malloc(info.st_size + 1);
size_t ret = read(fd, buf, info.st_size);
int ret = read(fd, buf, info.st_size);
if (ret == -1) {
LOG_FATALF("serialize.c", "Could not read index descriptor: %s", strerror(errno));
}
@ -156,20 +152,8 @@ char *get_meta_key_text(enum metakey meta_key) {
return "thumbnail";
case MetaPages:
return "pages";
case MetaExifGpsLongitudeRef:
return "exif_gps_longitude_ref";
case MetaExifGpsLongitudeDMS:
return "exif_gps_longitude_dms";
case MetaExifGpsLongitudeDec:
return "exif_gps_longitude_dec";
case MetaExifGpsLatitudeRef:
return "exif_gps_latitude_ref";
case MetaExifGpsLatitudeDMS:
return "exif_gps_latitude_dms";
case MetaExifGpsLatitudeDec:
return "exif_gps_latitude_dec";
default:
LOG_FATALF("serialize.c", "FIXME: Unknown meta key: %d", meta_key)
return NULL;
}
}
@ -199,7 +183,7 @@ void write_document(document_t *doc) {
meta_line_t *meta = doc->meta_head;
while (meta != NULL) {
dyn_buffer_write_short(&buf, (uint16_t) meta->key);
dyn_buffer_write_char(&buf, meta->key);
if (IS_META_INT(meta->key)) {
dyn_buffer_write_int(&buf, meta->int_val);
@ -213,7 +197,7 @@ void write_document(document_t *doc) {
meta = meta->next;
free(tmp);
}
dyn_buffer_write_short(&buf, META_NEXT);
dyn_buffer_write_char(&buf, '\n');
int res = write(index_fd, buf.buf, buf.cur);
if (res == -1) {
@ -284,10 +268,9 @@ void read_index_bin(const char *path, const char *index_id, index_func func) {
cJSON_AddStringToObject(document, "path", "");
}
enum metakey key;
fread(&key, sizeof(short), 1, file);
size_t ret;
while (key != META_NEXT) {
enum metakey key = getc(file);
size_t ret = 0;
while (key != '\n') {
switch (key) {
case MetaPages:
case MetaWidth:
@ -325,12 +308,6 @@ void read_index_bin(const char *path, const char *index_id, index_func func) {
case MetaAuthor:
case MetaModifiedBy:
case MetaThumbnail:
case MetaExifGpsLongitudeDMS:
case MetaExifGpsLongitudeDec:
case MetaExifGpsLongitudeRef:
case MetaExifGpsLatitudeDMS:
case MetaExifGpsLatitudeDec:
case MetaExifGpsLatitudeRef:
case MetaTitle: {
buf.cur = 0;
while ((c = getc(file)) != 0) {
@ -346,7 +323,7 @@ void read_index_bin(const char *path, const char *index_id, index_func func) {
LOG_FATALF("serialize.c", "Invalid meta key (corrupt index): %x", key)
}
fread(&key, sizeof(uint16_t), 1, file);
key = getc(file);
}
cJSON *meta_obj = NULL;
@ -533,9 +510,9 @@ void incremental_copy(store_t *store, store_t *dst_store, const char *filepath,
enum metakey key;
while (1) {
fread(&key, sizeof(uint16_t), 1, file);
fwrite(&key, sizeof(uint16_t), 1, dst_file);
if (key == META_NEXT) {
key = getc(file);
fwrite(&key, sizeof(char), 1, dst_file);
if (key == '\n') {
break;
}

View File

@ -21,7 +21,7 @@
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
static const char *const Version = "2.10.1";
static const char *const Version = "2.9.1";
static const char *const usage[] = {
"sist2 scan [OPTION]... PATH",
"sist2 index [OPTION]... INDEX",

View File

@ -12,7 +12,7 @@
<nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="/">sist2</a>
<span class="badge badge-pill version">2.10.1</span>
<span class="badge badge-pill version">2.9.1</span>
<span class="tagline">Lightning-fast file system indexer and search tool </span>
<a class="btn ml-auto" href="stats">Stats</a>
<button class="btn" type="button" data-toggle="modal" data-target="#settings" onclick="loadSettings()">Settings

View File

@ -10,7 +10,7 @@
<nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="/">sist2</a>
<span class="badge badge-pill version">2.10.1</span>
<span class="badge badge-pill version">2.9.1</span>
<span class="tagline">Lightning-fast file system indexer and search tool </span>
<a style="margin-left: auto" class="btn" href="/">Back</a>
<button class="btn" type="button" data-toggle="modal" data-target="#settings"

File diff suppressed because one or more lines are too long

@ -1 +1 @@
Subproject commit 5957da0b44d485657edc863b0b924fe837e67b27
Subproject commit ffd9c23427d0cb105e27f27f0cf97b463b6a8bf8

2
third-party/libscan vendored

@ -1 +1 @@
Subproject commit ee9c98b488ab21ecb1a6e9e10dbbd16054865b58
Subproject commit 8ed4c943141876970e8761993915cfb48df3f189