Add hashes to images

Upon successfull reading an image file, this computes a SHA1 hash of the
image and saves it with the picture tag in the log file. When a file is
not successfully loaded (for example because the log was created on a
different computer) we look up the hash in a dictionary that maps hashes
to local file names.

That dictionary (actually two for both directions), is loaded on startup
and saved upon destruction of the main window.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-02-26 14:39:42 +01:00 committed by Dirk Hohndel
parent ea00fdb36a
commit b02bf002a6
11 changed files with 139 additions and 15 deletions

2
dive.c
View file

@ -392,6 +392,7 @@ static void copy_pl(struct picture *sp, struct picture *dp)
{
*dp = *sp;
dp->filename = copy_string(sp->filename);
dp->hash = copy_string(sp->hash);
}
/* copy an element in a list of tags */
@ -2936,6 +2937,7 @@ static void picture_free(struct picture *p)
if (!p)
return;
free(p->filename);
free(p->hash);
free(p);
}
void dive_remove_picture(char *filename)