From 7e33369dc8b27b20385ab055b662e06bbf369784 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 27 Nov 2018 00:25:15 +0100 Subject: 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 --- core/parse-xml.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core/parse-xml.c') 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') -- cgit v1.2.3-70-g09d2