diff options
author | Robert C. Helling <helling@atdotde.de> | 2015-02-26 14:39:42 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-27 06:29:44 +0100 |
commit | b02bf002a677e45dbaa4d28edadbaafc89a7badc (patch) | |
tree | 86f26c0dc8edbf66999e602277a15bb6a09dc38e /save-xml.c | |
parent | ea00fdb36ab727b2f403a9feed5e8d96fb6659fc (diff) | |
download | subsurface-b02bf002a677e45dbaa4d28edadbaafc89a7badc.tar.gz |
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>
Diffstat (limited to 'save-xml.c')
-rw-r--r-- | save-xml.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/save-xml.c b/save-xml.c index 8366f87ff..c68b5b633 100644 --- a/save-xml.c +++ b/save-xml.c @@ -359,6 +359,8 @@ static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer put_format(b, " </divecomputer>\n"); } +extern char * hashstring(char * filename); + static void save_picture(struct membuffer *b, struct picture *pic) { put_string(b, " <picture filename='"); @@ -377,6 +379,9 @@ static void save_picture(struct membuffer *b, struct picture *pic) put_degrees(b, pic->latitude, " gps='", " "); put_degrees(b, pic->longitude, "", "'"); } + if (hashstring(pic->filename)) + put_format(b, " hash='%s'", hashstring(pic->filename)); + put_string(b, "/>\n"); } |