mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 00:33:24 +00:00
Fix remaining gps references when parsing XML files
Clearly I didn't run into these before in my testing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c109b98f19
commit
9ca600e114
1 changed files with 18 additions and 3 deletions
21
parse-xml.c
21
parse-xml.c
|
@ -1127,15 +1127,30 @@ degrees_t parse_degrees(char *buf, char **end)
|
|||
static void gps_lat(char *buffer, struct dive *dive)
|
||||
{
|
||||
char *end;
|
||||
|
||||
dive->latitude = parse_degrees(buffer, &end);
|
||||
degrees_t latitude = parse_degrees(buffer, &end);
|
||||
struct dive_site *ds = get_dive_site_for_dive(dive);
|
||||
if (!ds) {
|
||||
dive->dive_site_uuid = create_dive_site_with_gps(NULL, latitude, (degrees_t){0});
|
||||
} else {
|
||||
if (ds->latitude.udeg && ds->latitude.udeg != latitude.udeg)
|
||||
fprintf(stderr, "Oops, changing the latitude of existing dive site id %8x name %s; not good\n", ds->uuid, ds->name ?: "(unknown)");
|
||||
ds->latitude = latitude;
|
||||
}
|
||||
}
|
||||
|
||||
static void gps_long(char *buffer, struct dive *dive)
|
||||
{
|
||||
char *end;
|
||||
degrees_t longitude = parse_degrees(buffer, &end);
|
||||
struct dive_site *ds = get_dive_site_for_dive(dive);
|
||||
if (!ds) {
|
||||
dive->dive_site_uuid = create_dive_site_with_gps(NULL, (degrees_t){0}, longitude);
|
||||
} else {
|
||||
if (ds->longitude.udeg && ds->longitude.udeg != longitude.udeg)
|
||||
fprintf(stderr, "Oops, changing the longitude of existing dive site id %8x name %s; not good\n", ds->uuid, ds->name ?: "(unknown)");
|
||||
ds->longitude = longitude;
|
||||
}
|
||||
|
||||
dive->longitude = parse_degrees(buffer, &end);
|
||||
}
|
||||
|
||||
static void gps_location(char *buffer, struct dive_site *ds)
|
||||
|
|
Loading…
Add table
Reference in a new issue