aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-02-18 13:56:06 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-03-05 18:04:57 +0200
commit83b287064896de96d8757c604c276f7521b714b8 (patch)
tree72f62a1ca0a9c23c980b02dfffcfe0c9f715ce37
parenta0d02bacf31fbfe45c679bf176ece6bb4843f53a (diff)
downloadsubsurface-83b287064896de96d8757c604c276f7521b714b8.tar.gz
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>
-rw-r--r--core/qthelper.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 703e4e615..e7bf7dcf4 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -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);
}