summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-12-19 12:36:56 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-19 20:07:28 -1000
commite897b95b6229575210dcb580bdb2b79adeaeae26 (patch)
treefe09bf47ed66ff626abc95e66cf987ae677d770a /parse-xml.c
parentf6bd9d1a1417c4d1b1838668b354cadcc2481e44 (diff)
downloadsubsurface-e897b95b6229575210dcb580bdb2b79adeaeae26.tar.gz
Prevent bleeding deco/ndl for XML files without divecomputer entries
Miika's xslt patch creates correct XML data without divecomputer entries. What happens is that the stop information at xml parse time is only cleared by the divecomputer entries, so if the XML lacks them, we will bleed stop data from one dive to the next. This patch makes sure that the deco/ndl information is cleared even if the dive has no divecomputer entry. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/parse-xml.c b/parse-xml.c
index dd35379fb..7d9a4694d 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -985,11 +985,17 @@ static gboolean is_dive(void)
(cur_dive->location || cur_dive->when || cur_dive->dc.samples));
}
+static void reset_dc_info(struct divecomputer *dc)
+{
+ lastcns = lastpo2 = lastndl = laststoptime = laststopdepth = 0;
+}
+
static void dive_start(void)
{
if (cur_dive)
return;
cur_dive = alloc_dive();
+ reset_dc_info(&cur_dive->dc);
memset(&cur_tm, 0, sizeof(cur_tm));
if (cur_trip) {
add_dive_to_trip(cur_dive, cur_trip);
@@ -1115,8 +1121,7 @@ static void divecomputer_start(void)
/* .. this is the one we'll use */
cur_dc = dc;
-
- lastcns = lastpo2 = lastndl = laststoptime = laststopdepth = 0;
+ reset_dc_info(dc);
}
static void divecomputer_end(void)