From 249b82f6dc8bbee4da8b61e9688d48ccf98cf7f4 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 15 Jan 2024 21:39:14 +0100 Subject: [PATCH] pictures: make delta-time a 64-bit int When adjusting picture times, the offset in seconds is stored in a 32-bit int. Make it a 64-bit int. Sounds crazy, because why would you want to move the pictures by more than 70 years? Well, suppose it is the year 2039, for some strange reason your camera was set to unix epoch and you want to adjust the pictures to current time. Ok - that's a far-fetched scenario. The real reason is that this hopefully silences a Coverity warning and avoids integer casting. Signed-off-by: Berthold Stoeger --- core/picture.c | 4 ++-- core/picture.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/picture.c b/core/picture.c index 5981c8d23..26457ed54 100644 --- a/core/picture.c +++ b/core/picture.c @@ -123,7 +123,7 @@ static bool dive_check_picture_time(const struct dive *d, timestamp_t timestamp) * The caller is responsible for actually adding the picture to the dive. * If no appropriate dive was found, no picture is created and NULL is returned. */ -struct picture *create_picture(const char *filename, int shift_time, bool match_all, struct dive **dive) +struct picture *create_picture(const char *filename, timestamp_t shift_time, bool match_all, struct dive **dive) { struct metadata metadata; timestamp_t timestamp; @@ -146,7 +146,7 @@ struct picture *create_picture(const char *filename, int shift_time, bool match_ return picture; } -bool picture_check_valid_time(timestamp_t timestamp, int shift_time) +bool picture_check_valid_time(timestamp_t timestamp, timestamp_t shift_time) { int i; struct dive *dive; diff --git a/core/picture.h b/core/picture.h index b763adfe9..042fb9bae 100644 --- a/core/picture.h +++ b/core/picture.h @@ -46,8 +46,8 @@ extern void remove_from_picture_table(struct picture_table *, int idx); extern int get_picture_idx(const struct picture_table *, const char *filename); /* Return -1 if not found */ extern void sort_picture_table(struct picture_table *); -extern struct picture *create_picture(const char *filename, int shift_time, bool match_all, struct dive **dive); -extern bool picture_check_valid_time(timestamp_t timestamp, int shift_time); +extern struct picture *create_picture(const char *filename, timestamp_t shift_time, bool match_all, struct dive **dive); +extern bool picture_check_valid_time(timestamp_t timestamp, timestamp_t shift_time); #ifdef __cplusplus }