mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
ea00fdb36a
commit
b02bf002a6
11 changed files with 139 additions and 15 deletions
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue