bug fix in deserialize

This commit is contained in:
simon 2019-11-08 09:03:44 -05:00
parent bc5f22b759
commit 152d2ddf8a
3 changed files with 13 additions and 8 deletions

View File

@ -208,14 +208,19 @@ void read_index(const char *path, const char index_id[UUID_STR_LEN], index_func
while (key != '\n') {
switch (key) {
case MetaWidth:
case MetaHeight:
case MetaMediaDuration:
case MetaMediaBitrate: {
case MetaHeight: {
int value;
fread(&value, sizeof(int), 1, file);
cJSON_AddNumberToObject(document, get_meta_key_text(key), value);
break;
}
case MetaMediaDuration:
case MetaMediaBitrate: {
long value;
fread(&value, sizeof(long), 1, file);
cJSON_AddNumberToObject(document, get_meta_key_text(key), value);
break;
}
case MetaMediaAudioCodec:
case MetaMediaVideoCodec: {
int value;
@ -245,7 +250,7 @@ void read_index(const char *path, const char index_id[UUID_STR_LEN], index_func
break;
}
default:
fprintf(stderr, "Invalid meta key (corrupt index): %x", key);
fprintf(stderr, "Invalid meta key (corrupt index): %x\n", key);
break;
}

View File

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

File diff suppressed because one or more lines are too long