summaryrefslogtreecommitdiffstats
path: root/core/liquivision.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-09-28 13:59:01 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-28 15:06:00 -0700
commit32a4ce61694bfe8364227440ea5716df7cc61fd1 (patch)
tree257ac4f9204182b20d7e4bda7bc80911bc6303a6 /core/liquivision.c
parenta5db03c2b32115b14e4b83501a0771b186d87913 (diff)
downloadsubsurface-32a4ce61694bfe8364227440ea5716df7cc61fd1.tar.gz
Parser: parse text-based files into arbitrary table
In d815e0c9476ef62e6b84fb28ce48ab7cddefe77e a dive_table pointer was added to the parsing functions to allow parsing into tables other than the global dive table. This will be necessary for undo of import and implementation a cleaner interface. A few cases, notably CSV and proprietary formats were forgotten. Implement parsing into arbitrary tables also for these cases. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/liquivision.c')
-rw-r--r--core/liquivision.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/liquivision.c b/core/liquivision.c
index 28d571b3c..99641835c 100644
--- a/core/liquivision.c
+++ b/core/liquivision.c
@@ -132,7 +132,7 @@ static int handle_event_ver3(int code, const unsigned char *ps, unsigned int ps_
return skip;
}
-static void parse_dives (int log_version, const unsigned char *buf, unsigned int buf_size)
+static void parse_dives (int log_version, const unsigned char *buf, unsigned int buf_size, struct dive_table *table)
{
unsigned int ptr = 0;
unsigned char model;
@@ -428,7 +428,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
// End dive
dive->downloaded = true;
- record_dive(dive);
+ record_dive_to_table(dive, table);
dive = NULL;
mark_divelist_changed(true);
@@ -442,7 +442,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
free(dive);
}
-int try_to_open_liquivision(const char *filename, struct memblock *mem)
+int try_to_open_liquivision(const char *filename, struct memblock *mem, struct dive_table *table)
{
UNUSED(filename);
const unsigned char *buf = mem->buffer;
@@ -466,7 +466,7 @@ int try_to_open_liquivision(const char *filename, struct memblock *mem)
}
ptr += 4;
- parse_dives(log_version, buf + ptr, buf_size - ptr);
+ parse_dives(log_version, buf + ptr, buf_size - ptr, table);
return 1;
}