summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/dive.c7
-rw-r--r--core/dive.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/core/dive.c b/core/dive.c
index d990f6a2f..4b103bfbd 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3838,9 +3838,10 @@ struct picture *clone_picture(struct picture *src)
return dst;
}
-void dive_remove_picture(char *filename)
+// Return true if picture was found and deleted
+bool dive_remove_picture(struct dive *d, char *filename)
{
- struct picture **picture = &current_dive->picture_list;
+ struct picture **picture = &d->picture_list;
while (*picture && !same_string((*picture)->filename, filename))
picture = &(*picture)->next;
if (*picture) {
@@ -3848,7 +3849,9 @@ void dive_remove_picture(char *filename)
picture_free(*picture);
*picture = temp;
invalidate_dive_cache(current_dive);
+ return true;
}
+ return false;
}
/* this always acts on the current divecomputer of the current dive */
diff --git a/core/dive.h b/core/dive.h
index 7b2f3d658..880bcbfe4 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -421,7 +421,7 @@ extern struct picture *clone_picture(struct picture *src);
extern bool dive_check_picture_time(struct dive *d, int shift_time, timestamp_t timestamp);
extern void dive_create_picture(struct dive *d, const char *filename, int shift_time, bool match_all);
extern void dive_add_picture(struct dive *d, struct picture *newpic);
-extern void dive_remove_picture(char *filename);
+extern bool dive_remove_picture(struct dive *d, char *filename);
extern unsigned int dive_get_picture_count(struct dive *d);
extern bool picture_check_valid(const char *filename, int shift_time);
extern void picture_load_exif_data(struct picture *p);