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>
This commit is contained in:
Linus Torvalds 2012-12-19 12:36:56 -08:00 committed by Dirk Hohndel
parent f6bd9d1a14
commit e897b95b62

View file

@ -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)