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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-01-15 21:39:14 +01:00 committed by Dirk Hohndel
parent 8a3a0edb83
commit 249b82f6dc
2 changed files with 4 additions and 4 deletions

View file

@ -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;

View file

@ -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
}