From b02bf002a677e45dbaa4d28edadbaafc89a7badc Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 26 Feb 2015 14:39:42 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- load-git.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'load-git.c') diff --git a/load-git.c b/load-git.c index 053a7140e..be25e8e94 100644 --- a/load-git.c +++ b/load-git.c @@ -828,6 +828,12 @@ static void parse_picture_gps(char *line, struct membuffer *str, void *_pic) pic->longitude = parse_degrees(line, &line); } +static void parse_picture_hash(char *line, struct membuffer *str, void *_pic) +{ + struct picture *pic = _pic; + pic->hash = get_utf8(str); +} + /* These need to be sorted! */ struct keyword_action dc_action[] = { #undef D @@ -900,7 +906,7 @@ static void settings_parser(char *line, struct membuffer *str, void *_unused) static struct keyword_action picture_action[] = { #undef D #define D(x) { #x, parse_picture_ ## x } - D(filename), D(gps) + D(filename), D(gps), D(hash) }; static void picture_parser(char *line, struct membuffer *str, void *_pic) -- cgit v1.2.3-70-g09d2