summaryrefslogtreecommitdiffstats
path: root/core/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-11-27 00:25:15 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-09 20:58:04 -0800
commit7e33369dc8b27b20385ab055b662e06bbf369784 (patch)
treeaf674ccdd1ccb67d4de84d68cb585b481d020fb3 /core/parse-xml.c
parentec37c71f5eeb7d4b0c4b8719b52583fadb0b8f4c (diff)
downloadsubsurface-7e33369dc8b27b20385ab055b662e06bbf369784.tar.gz
Parser: add trip_table parameter to parsing functions
To allow parsing into arbitrary trip_tables, add the corresponding parameter to the parsing functions and the parser state. Currently, all callers pass the global trip_table so there should be no change in functionality. These arguments will be replaced in subsequent commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/parse-xml.c')
-rw-r--r--core/parse-xml.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c
index 931d12f6b..d779d3e56 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -1636,7 +1636,7 @@ 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, const char **params)
+ struct dive_table *table, struct trip_table *trips, const char **params)
{
UNUSED(size);
xmlDoc *doc;
@@ -1646,6 +1646,7 @@ int parse_xml_buffer(const char *url, const char *buffer, int size,
init_parser_state(&state);
state.target_table = table;
+ state.trips = trips;
doc = xmlReadMemory(res, strlen(res), url, NULL, 0);
if (!doc)
doc = xmlReadMemory(res, strlen(res), url, "latin1", 0);
@@ -1687,7 +1688,7 @@ 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)
+int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *table, struct trip_table *trips)
{
unsigned char *ptr = buffer;
unsigned char event;
@@ -1708,6 +1709,7 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *tabl
init_parser_state(&state);
state.target_table = table;
+ state.trips = trips;
// Check for the correct file magic
if (ptr[0] != 'D' || ptr[1] != 'i' || ptr[2] != 'v' || ptr[3] != 'E')