aboutsummaryrefslogtreecommitdiffstats
path: root/core/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-17 12:32:22 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-24 09:51:37 -0700
commita2614665942959b95eef8453730cd3ac66ac42a3 (patch)
treee8491231112634e6fa188a605ddab47910cfe8c2 /core/parse-xml.c
parent41975435a2a93733a0e46a7e594ffba193be6e87 (diff)
downloadsubsurface-a2614665942959b95eef8453730cd3ac66ac42a3.tar.gz
parser: add device_table to parser state
If we want to avoid the parsers to directly modify global data, we have to provide a device_table to parse into. This adds such a state and the corresponding function parameters. However, for now this is unused. Adding new parameters is very painful and this commit shows that we urgently need a "struct divelog" collecting all those tables! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/parse-xml.c')
-rw-r--r--core/parse-xml.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c
index d5bbf7ae0..b5b66c181 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -1722,7 +1722,8 @@ static const char *preprocess_divelog_de(const char *buffer)
int parse_xml_buffer(const char *url, const char *buffer, int size,
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
- struct filter_preset_table *filter_presets, const struct xml_params *params)
+ struct device_table *devices, struct filter_preset_table *filter_presets,
+ const const struct xml_params *params)
{
UNUSED(size);
xmlDoc *doc;
@@ -1734,6 +1735,7 @@ int parse_xml_buffer(const char *url, const char *buffer, int size,
state.target_table = table;
state.trips = trips;
state.sites = sites;
+ state.devices = devices;
state.filter_presets = filter_presets;
doc = xmlReadMemory(res, strlen(res), url, NULL, 0);
if (!doc)
@@ -1776,7 +1778,8 @@ static timestamp_t parse_dlf_timestamp(unsigned char *buffer)
return offset + 946684800;
}
-int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites)
+int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *table, struct trip_table *trips,
+ struct dive_site_table *sites, struct device_table *devices)
{
unsigned char *ptr = buffer;
unsigned char event;
@@ -1800,6 +1803,7 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *tabl
state.target_table = table;
state.trips = trips;
state.sites = sites;
+ state.devices = devices;
// Check for the correct file magic
if (ptr[0] != 'D' || ptr[1] != 'i' || ptr[2] != 'v' || ptr[3] != 'E')