1
0
Fork 0

DBG: only store file hash in database if there is other data as well

This commit is contained in:
Duncan Ogilvie 2018-05-11 17:05:32 +02:00
parent 7d1afa0940
commit 9e68ea3900
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
1 changed files with 7 additions and 5 deletions

View File

@ -72,11 +72,6 @@ void DbSave(DbLoadSaveType saveType, const char* dbfile, bool disablecompression
TraceRecord.saveToDb(root);
BpCacheSave(root);
WatchCacheSave(root);
if(dbhash != 0)
{
json_object_set_new(root, "hashAlgorithm", json_string("murmurhash"));
json_object_set_new(root, "hash", json_hex(dbhash));
}
//save notes
char* text = nullptr;
@ -116,6 +111,13 @@ void DbSave(DbLoadSaveType saveType, const char* dbfile, bool disablecompression
if(json_object_size(pluginRoot))
json_object_set(root, "plugins", pluginRoot);
json_decref(pluginRoot);
//store the file hash only if other data is saved in the database
if(dbhash != 0 && json_object_size(root))
{
json_object_set_new(root, "hashAlgorithm", json_string("murmurhash"));
json_object_set_new(root, "hash", json_hex(dbhash));
}
}
auto wdbpath = StringUtils::Utf8ToUtf16(file);