From 12406786f161a757c1497178a42f412a0f091b20 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 11 Mar 2022 22:38:14 +0100 Subject: [PATCH] core: pass dc-number to update_event_name() The dive was passed as an argument to update_event_name(), but the divecomputer was derived from the global dc_number variable. That makes no sense. Therefore, pass the dc_number as argument and update the only caller (smtk-import). Signed-off-by: Berthold Stoeger --- core/dive.c | 2 +- core/dive.h | 2 +- smtk-import/smartrak.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/dive.c b/core/dive.c index eb6872bc8..03eb82e70 100644 --- a/core/dive.c +++ b/core/dive.c @@ -123,7 +123,7 @@ void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int second * have to actually remove the existing event and replace it with a new one. * WARNING, WARNING... this may end up freeing event in case that event is indeed * WARNING, WARNING... part of this divecomputer on this dive! */ -void update_event_name(struct dive *d, struct event *event, const char *name) +void update_event_name(struct dive *d, int dc_number, struct event *event, const char *name) { if (!d || !event) return; diff --git a/core/dive.h b/core/dive.h index 0e4f4f84e..f6f610e52 100644 --- a/core/dive.h +++ b/core/dive.h @@ -193,7 +193,7 @@ extern bool is_cylinder_used(const struct dive *dive, int idx); extern bool is_cylinder_prot(const struct dive *dive, int idx); extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx); extern struct event *create_gas_switch_event(struct dive *dive, struct divecomputer *dc, int seconds, int idx); -extern void update_event_name(struct dive *d, struct event *event, const char *name); +extern void update_event_name(struct dive *d, int dc_number, struct event *event, const char *name); extern void per_cylinder_mean_depth(const struct dive *dive, struct divecomputer *dc, int *mean, int *duration); extern int get_cylinder_index(const struct dive *dive, const struct event *ev); extern struct gasmix get_gasmix_from_event(const struct dive *, const struct event *ev); diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c index 1b1172368..9e44f0295 100644 --- a/smtk-import/smartrak.c +++ b/smtk-import/smartrak.c @@ -806,7 +806,7 @@ static void smtk_parse_bookmarks(MdbHandle *mdb, struct dive *d, char *dive_idx) tmp = strdup(bound_values[2]); ev = find_bookmark(d->dc.events, time); if (ev) - update_event_name(d, ev, tmp); + update_event_name(d, 0, ev, tmp); else if (!add_event(&d->dc, time, SAMPLE_EVENT_BOOKMARK, 0, 0, tmp)) report_error("[smtk-import] Error - Couldn't add bookmark, dive %d, Name = %s",