X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=parse-xml.c;h=22ab8458e1f5871d932d4d5666c5df7ccc1a94dc;hb=2db85596e52ea0852bfe67f2fb67df8440b43d1b;hp=6bb78fdf6077e1db2a85ee6ee194e5793c8ae802;hpb=3a6652634b2152352f6f5a2b9ee3d549140ae337;p=ext%2Fsubsurface.git diff --git a/parse-xml.c b/parse-xml.c index 6bb78fd..22ab845 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -882,6 +882,20 @@ static int uddf_dive_match(struct dive *dive, const char *name, int len, char *b 0; } +static void gps_location(char *buffer, void *_dive) +{ + int i; + struct dive *dive = _dive; + double latitude, longitude; + + i = sscanf(buffer, "%lf %lf", &latitude, &longitude); + if (i == 2) { + dive->latitude = latitude; + dive->longitude = longitude; + } + free(buffer); +} + /* We're in the top-level dive xml. Try to convert whatever value to a dive value */ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf) { @@ -950,6 +964,8 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf) return; if (MATCH(".cylinderendpressure", pressure, &dive->cylinder[0].end)) return; + if (MATCH(".gps", gps_location, dive)) + return; if (MATCH(".location", utf8_string, &dive->location)) return; if (MATCH(".notes", utf8_string, &dive->notes))