Parser: parse into custom dive site table

To extend the undo system to dive sites, the importers and downloaders
must not parse directly into the global dive site table. Instead,
pass a dive_site_table argument to parse into.

For now, always pass the global dive_site_table so that this commit
should not cause any functional change.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-02-28 22:45:17 +01:00 committed by Dirk Hohndel
parent 926b6895bb
commit 37146c5742
36 changed files with 216 additions and 185 deletions

View file

@ -571,7 +571,7 @@ static void set_dc_serial(struct divecomputer *dc, const char *serial)
extern void parse_location(char *, location_t *);
static void parse_string_field(struct dive *dive, dc_field_string_t *str)
static void parse_string_field(device_data_t *devdata, struct dive *dive, dc_field_string_t *str)
{
// Our dive ID is the string hash of the "Dive ID" string
if (!strcmp(str->desc, "Dive ID")) {
@ -596,7 +596,7 @@ static void parse_string_field(struct dive *dive, dc_field_string_t *str)
parse_location(line, &location);
if (location.lat.udeg && location.lon.udeg)
dive->dive_site = create_dive_site_with_gps(str->value, &location, time(NULL), &dive_site_table);
dive->dive_site = create_dive_site_with_gps(str->value, &location, time(NULL), devdata->sites);
}
}
#endif
@ -712,7 +712,7 @@ static dc_status_t libdc_header_parser(dc_parser_t *parser, device_data_t *devda
break;
if (!str.desc || !str.value)
break;
parse_string_field(dive, &str);
parse_string_field(devdata, dive, &str);
}
#endif