mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
b7f5871e59
commit
4ba5dd85d4
1 changed files with 9 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue