mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: Don't call learnHash() in hashPicture()
hashPicture() calls hashFile(), which calls add_hash(). add_hash() updates the filename-to-hash and hash-to-filename maps. Therefore, there is no point in calling learnHash() in hashPicture(), which updates the filename-to-hash map. Note that learnHash() updates the picture-struct with the new hash, but since hashPicture() works on a cloned picture-struct, which is free()d in hashPicture(), these changes are lost anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a0d02bacf3
commit
83b2870648
1 changed files with 2 additions and 4 deletions
|
@ -1190,11 +1190,9 @@ void hashPicture(struct picture *picture)
|
|||
{
|
||||
if (!picture)
|
||||
return;
|
||||
char *oldHash = copy_string(picture->hash);
|
||||
learnHash(picture, hashFile(localFilePath(picture->filename)));
|
||||
if (!empty_string(picture->hash) && !same_string(picture->hash, oldHash))
|
||||
QByteArray hash = hashFile(localFilePath(picture->filename));
|
||||
if (!hash.isNull() && !same_string(hash.toHex().data(), picture->hash))
|
||||
mark_divelist_changed(true);
|
||||
free(oldHash);
|
||||
picture_free(picture);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue