mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Simplify image hashing logic
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
09c854fee0
commit
3ae6326847
2 changed files with 2 additions and 5 deletions
|
@ -1014,11 +1014,7 @@ QString fileFromHash(char *hash)
|
||||||
|
|
||||||
void updateHash(struct picture *picture) {
|
void updateHash(struct picture *picture) {
|
||||||
QByteArray hash = hashFile(fileFromHash(picture->hash));
|
QByteArray hash = hashFile(fileFromHash(picture->hash));
|
||||||
QMutexLocker locker(&hashOfMutex);
|
learnHash(picture, hash);
|
||||||
hashOf[QString(picture->filename)] = hash;
|
|
||||||
char *old = picture->hash;
|
|
||||||
picture->hash = strdup(hash.toHex());
|
|
||||||
free(old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hashPicture(struct picture *picture)
|
void hashPicture(struct picture *picture)
|
||||||
|
|
|
@ -25,6 +25,7 @@ void updateHash(struct picture *picture);
|
||||||
QByteArray hashFile(const QString filename);
|
QByteArray hashFile(const QString filename);
|
||||||
void learnImages(const QDir dir, int max_recursions, bool recursed);
|
void learnImages(const QDir dir, int max_recursions, bool recursed);
|
||||||
void add_hash(const QString filename, QByteArray hash);
|
void add_hash(const QString filename, QByteArray hash);
|
||||||
|
void hashPicture(struct picture *picture);
|
||||||
QString localFilePath(const QString originalFilename);
|
QString localFilePath(const QString originalFilename);
|
||||||
QString fileFromHash(char *hash);
|
QString fileFromHash(char *hash);
|
||||||
void learnHash(struct picture *picture, QByteArray hash);
|
void learnHash(struct picture *picture, QByteArray hash);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue