summaryrefslogtreecommitdiffstats
path: root/core/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-26 22:26:11 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commitf6e7bdc5ef99d5a5fe71ac4f32511900fa82e804 (patch)
tree398efefad3b84b33eb5e488bdfa5b2482f345cdd /core/parse-xml.c
parent36644dc9f7540886801bda6131dff36241d9e879 (diff)
downloadsubsurface-f6e7bdc5ef99d5a5fe71ac4f32511900fa82e804.tar.gz
Dive site: add dive site table parameter to dive site functions
To enable undo of dive site functions, it is crucial to work with different dive site tables. Therefore add a dive site table parameter to dive site functions. For now, always pass the global dive site table. Thus, this commit shouldn't alter any functionality. After this change, a simple search for dive_site_table reveals all places where the global dive site table is accessed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/parse-xml.c')
-rw-r--r--core/parse-xml.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c
index 1244e0003..68b78a861 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -562,7 +562,7 @@ static void dive_site(char *buffer, struct dive_site **ds)
{
uint32_t uuid;
hex_value(buffer, &uuid);
- *ds = get_dive_site_by_uuid(uuid);
+ *ds = get_dive_site_by_uuid(uuid, &dive_site_table);
}
static void get_notrip(char *buffer, bool *notrip)
@@ -983,9 +983,9 @@ static void divinglog_place(char *place, struct dive_site **ds, struct parser_st
state->city ? state->city : "",
state->country ? ", " : "",
state->country ? state->country : "");
- *ds = get_dive_site_by_name(buffer);
+ *ds = get_dive_site_by_name(buffer, &dive_site_table);
if (!*ds)
- *ds = create_dive_site(buffer, state->cur_dive->when);
+ *ds = create_dive_site(buffer, state->cur_dive->when, &dive_site_table);
// TODO: capture the country / city info in the taxonomy instead
free(state->city);
@@ -1137,7 +1137,7 @@ static void gps_lat(char *buffer, struct dive *dive)
location.lat = parse_degrees(buffer, &end);
if (!ds) {
- dive->dive_site = create_dive_site_with_gps(NULL, &location, dive->when);
+ dive->dive_site = create_dive_site_with_gps(NULL, &location, dive->when, &dive_site_table);
} else {
if (ds->location.lat.udeg && ds->location.lat.udeg != location.lat.udeg)
fprintf(stderr, "Oops, changing the latitude of existing dive site id %8x name %s; not good\n", ds->uuid, ds->name ?: "(unknown)");
@@ -1153,7 +1153,7 @@ static void gps_long(char *buffer, struct dive *dive)
location.lon = parse_degrees(buffer, &end);
if (!ds) {
- dive->dive_site = create_dive_site_with_gps(NULL, &location, dive->when);
+ dive->dive_site = create_dive_site_with_gps(NULL, &location, dive->when, &dive_site_table);
} else {
if (ds->location.lon.udeg && ds->location.lon.udeg != location.lon.udeg)
fprintf(stderr, "Oops, changing the longitude of existing dive site id %8x name %s; not good\n", ds->uuid, ds->name ?: "(unknown)");
@@ -1184,7 +1184,7 @@ static void gps_in_dive(char *buffer, struct dive *dive, struct parser_state *st
parse_location(buffer, &location);
if (!ds) {
// check if we have a dive site within 20 meters of that gps fix
- ds = get_dive_site_by_gps_proximity(&location, 20);
+ ds = get_dive_site_by_gps_proximity(&location, 20, &dive_site_table);
if (ds) {
// found a site nearby; in case it turns out this one had a different name let's
@@ -1192,7 +1192,7 @@ static void gps_in_dive(char *buffer, struct dive *dive, struct parser_state *st
state->cur_location = location;
dive->dive_site = ds;
} else {
- dive->dive_site = create_dive_site_with_gps("", &location, dive->when);
+ dive->dive_site = create_dive_site_with_gps("", &location, dive->when, &dive_site_table);
}
} else {
if (dive_site_has_gps_location(ds) &&
@@ -2120,7 +2120,7 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *tabl
/* Measure GPS */
state.cur_location.lat.udeg = (int)((ptr[7] << 24) + (ptr[6] << 16) + (ptr[5] << 8) + (ptr[4] << 0));
state.cur_location.lon.udeg = (int)((ptr[11] << 24) + (ptr[10] << 16) + (ptr[9] << 8) + (ptr[8] << 0));
- state.cur_dive->dive_site = create_dive_site_with_gps("DLF imported", &state.cur_location, state.cur_dive->when);
+ state.cur_dive->dive_site = create_dive_site_with_gps("DLF imported", &state.cur_location, state.cur_dive->when, &dive_site_table);
break;
default:
break;