summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-24 16:03:52 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commitd674c5028f45a5c3bc67a2aafa637c798c3874f0 (patch)
tree6fb18c28a4c8b30d798ceaa5e363a4b1736ef5b9 /core
parent64f0902e0d78ecf9a23016f8048c4e21167b527a (diff)
downloadsubsurface-d674c5028f45a5c3bc67a2aafa637c798c3874f0.tar.gz
Dive site: use pointer instead of uuid in uemis_helper
Another small step in removing dive-site UUIDs: use a pointer instead of a UUID in the "uemis_helper" structure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r--core/uemis-downloader.c5
-rw-r--r--core/uemis.c8
-rw-r--r--core/uemis.h2
3 files changed, 8 insertions, 7 deletions
diff --git a/core/uemis-downloader.c b/core/uemis-downloader.c
index dd111a92a..2b44a9852 100644
--- a/core/uemis-downloader.c
+++ b/core/uemis-downloader.c
@@ -992,8 +992,9 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
} else if (!is_log && dive && !strcmp(tag, "divespot_id")) {
int divespot_id = atoi(val);
if (divespot_id != -1) {
- dive->dive_site_uuid = create_dive_site("from Uemis", dive->when)->uuid;
- uemis_mark_divelocation(dive->dc.diveid, divespot_id, dive->dive_site_uuid);
+ struct dive_site *ds = create_dive_site("from Uemis", dive->when);
+ dive->dive_site_uuid = ds->uuid;
+ uemis_mark_divelocation(dive->dc.diveid, divespot_id, ds);
}
#if UEMIS_DEBUG & 2
fprintf(debugfile, "Created divesite %d for diveid : %d\n", dive->dive_site_uuid, dive->dc.diveid);
diff --git a/core/uemis.c b/core/uemis.c
index 7595131cf..a5b07a8e8 100644
--- a/core/uemis.c
+++ b/core/uemis.c
@@ -101,7 +101,7 @@ struct uemis_helper {
uint32_t diveid;
int lbs;
int divespot;
- int dive_site_uuid;
+ struct dive_site *dive_site;
struct uemis_helper *next;
};
static struct uemis_helper *uemis_helper = NULL;
@@ -146,11 +146,11 @@ int uemis_get_weight_unit(uint32_t diveid)
return 0;
}
-void uemis_mark_divelocation(int diveid, int divespot, uint32_t dive_site_uuid)
+void uemis_mark_divelocation(int diveid, int divespot, struct dive_site *ds)
{
struct uemis_helper *hp = uemis_get_helper(diveid);
hp->divespot = divespot;
- hp->dive_site_uuid = dive_site_uuid;
+ hp->dive_site = ds;
}
/* support finding a dive spot based on the diveid */
@@ -170,7 +170,7 @@ void uemis_set_divelocation(int divespot, char *text, double longitude, double l
struct uemis_helper *hp = uemis_helper;
while (hp) {
if (hp->divespot == divespot) {
- struct dive_site *ds = get_dive_site_by_uuid(hp->dive_site_uuid);
+ struct dive_site *ds = hp->dive_site;
if (ds) {
ds->name = strdup(text);
ds->location = create_location(latitude, longitude);
diff --git a/core/uemis.h b/core/uemis.h
index 28af7832d..9c0a70995 100644
--- a/core/uemis.h
+++ b/core/uemis.h
@@ -15,7 +15,7 @@ extern "C" {
void uemis_parse_divelog_binary(char *base64, void *divep);
int uemis_get_weight_unit(uint32_t diveid);
-void uemis_mark_divelocation(int diveid, int divespot, uint32_t dive_site_uuid);
+void uemis_mark_divelocation(int diveid, int divespot, struct dive_site *ds);
void uemis_set_divelocation(int divespot, char *text, double longitude, double latitude);
int uemis_get_divespot_id_by_diveid(uint32_t diveid);