diff options
author | Guido Lerch <guido.lerch@gmail.com> | 2015-09-05 11:09:10 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-05 11:29:12 -0700 |
commit | 4ba5dd85d4078d320b4d16d94fb3f973e54fcadb (patch) | |
tree | 3f31c85d7a23ea3ee1839ed4c2f2d5b3ce747a57 /uemis-downloader.c | |
parent | b7f5871e597d8b0088d75ef858be10cc93e27ad3 (diff) | |
download | subsurface-4ba5dd85d4078d320b4d16d94fb3f973e54fcadb.tar.gz |
Uemis downloader: parse_divespot should return if it was successful
But sadly the code then doesn't actually use that return value, so this is
not quite perfect, yet.
[Dirk Hohndel: refactored one huge commit into smaller pieces]
Signed-off-by: Guido Lerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis-downloader.c')
-rw-r--r-- | uemis-downloader.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/uemis-downloader.c b/uemis-downloader.c index b263072ee..8c72354ef 100644 --- a/uemis-downloader.c +++ b/uemis-downloader.c @@ -637,7 +637,7 @@ fs_error: return false; } -static void parse_divespot(char *buf) +static bool parse_divespot(char *buf) { char *bp = buf + 1; char *tp = next_token(&bp); @@ -646,14 +646,17 @@ static void parse_divespot(char *buf) int divespot, len; double latitude = 0.0, longitude = 0.0; - + // dive spot got deleted, so fail here + if (strstr(bp, "deleted{bool{true")) + return false; + // not a dive spot, fail here if (strcmp(tp, "divespot")) - return; + return false; do tag = next_token(&bp); while (*tag && strcmp(tag, "object_id")); if (!*tag) - return; + return false; next_token(&bp); val = next_token(&bp); divespot = atoi(val); @@ -672,7 +675,9 @@ static void parse_divespot(char *buf) latitude = ascii_strtod(val, NULL); } } while (tag && *tag); + uemis_set_divelocation(divespot, locationstring, longitude, latitude); + return true; } static void track_divespot(char *val, int diveid, uint32_t dive_site_uuid) |