diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-08 11:55:03 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-08 12:42:51 -0700 |
commit | 543f3ac5844c433c481f42380c4ac344fdadd3bc (patch) | |
tree | bef87810d2b7994c74ec286cd0475082efbb7d70 /dive.c | |
parent | e7ecb690ed2afa5475ec204a378b43b812b8305d (diff) | |
download | subsurface-543f3ac5844c433c481f42380c4ac344fdadd3bc.tar.gz |
Picture handling: don't add the same picture more than once
It confuses us elsewhere (the model suddenly doesn't match the list of
pictures as the model doesn't reflect the duplicate pictures).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -2272,8 +2272,19 @@ struct picture *alloc_picture() return pic; } +static bool new_picture_for_dive(struct dive *d, char *filename) +{ + FOR_EACH_PICTURE(d) { + if (same_string(picture->filename, filename)) + return false; + } + return true; +} + void dive_create_picture(struct dive *d, char *filename, int shift_time) { + if (!new_picture_for_dive(d, filename)) + return; struct picture *p = alloc_picture(); p->filename = filename; picture_load_exif_data(p); |