mirror of
https://github.com/simon987/sist2.git
synced 2025-04-20 02:36:43 +00:00
bug fix in deserialize
This commit is contained in:
parent
bc5f22b759
commit
152d2ddf8a
@ -66,7 +66,7 @@ index_descriptor_t read_index_descriptor(char *path) {
|
|||||||
strcpy(descriptor.root, cJSON_GetObjectItem(json, "root")->valuestring);
|
strcpy(descriptor.root, cJSON_GetObjectItem(json, "root")->valuestring);
|
||||||
strcpy(descriptor.name, cJSON_GetObjectItem(json, "name")->valuestring);
|
strcpy(descriptor.name, cJSON_GetObjectItem(json, "name")->valuestring);
|
||||||
strcpy(descriptor.rewrite_url, cJSON_GetObjectItem(json, "rewrite_url")->valuestring);
|
strcpy(descriptor.rewrite_url, cJSON_GetObjectItem(json, "rewrite_url")->valuestring);
|
||||||
descriptor.root_len = (short)strlen(descriptor.root);
|
descriptor.root_len = (short) strlen(descriptor.root);
|
||||||
strcpy(descriptor.version, cJSON_GetObjectItem(json, "version")->valuestring);
|
strcpy(descriptor.version, cJSON_GetObjectItem(json, "version")->valuestring);
|
||||||
strcpy(descriptor.uuid, cJSON_GetObjectItem(json, "uuid")->valuestring);
|
strcpy(descriptor.uuid, cJSON_GetObjectItem(json, "uuid")->valuestring);
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ void read_index(const char *path, const char index_id[UUID_STR_LEN], index_func
|
|||||||
uuid_unparse(line.uuid, uuid_str);
|
uuid_unparse(line.uuid, uuid_str);
|
||||||
|
|
||||||
cJSON_AddStringToObject(document, "mime", mime_get_mime_text(line.mime));
|
cJSON_AddStringToObject(document, "mime", mime_get_mime_text(line.mime));
|
||||||
cJSON_AddNumberToObject(document, "size", (double)line.size);
|
cJSON_AddNumberToObject(document, "size", (double) line.size);
|
||||||
cJSON_AddNumberToObject(document, "mtime", line.mtime);
|
cJSON_AddNumberToObject(document, "mtime", line.mtime);
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
@ -208,14 +208,19 @@ void read_index(const char *path, const char index_id[UUID_STR_LEN], index_func
|
|||||||
while (key != '\n') {
|
while (key != '\n') {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case MetaWidth:
|
case MetaWidth:
|
||||||
case MetaHeight:
|
case MetaHeight: {
|
||||||
case MetaMediaDuration:
|
|
||||||
case MetaMediaBitrate: {
|
|
||||||
int value;
|
int value;
|
||||||
fread(&value, sizeof(int), 1, file);
|
fread(&value, sizeof(int), 1, file);
|
||||||
cJSON_AddNumberToObject(document, get_meta_key_text(key), value);
|
cJSON_AddNumberToObject(document, get_meta_key_text(key), value);
|
||||||
break;
|
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 MetaMediaAudioCodec:
|
||||||
case MetaMediaVideoCodec: {
|
case MetaMediaVideoCodec: {
|
||||||
int value;
|
int value;
|
||||||
@ -245,7 +250,7 @@ void read_index(const char *path, const char index_id[UUID_STR_LEN], index_func
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Invalid meta key (corrupt index): %x", key);
|
fprintf(stderr, "Invalid meta key (corrupt index): %x\n", key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
#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[] = {
|
static const char *const usage[] = {
|
||||||
"sist2 scan [OPTION]... PATH",
|
"sist2 scan [OPTION]... PATH",
|
||||||
"sist2 index [OPTION]... INDEX",
|
"sist2 index [OPTION]... INDEX",
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user