summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-07-12 13:12:24 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-12 08:04:55 -0700
commit97597dfd97295517383336d2050d7a4b554b0d3c (patch)
tree3a3fc8f9c5da5ae1c5b95c5345e773c417368b83 /parse-xml.c
parent79015e17f890eee41fb4f8894468e17478ae3657 (diff)
downloadsubsurface-97597dfd97295517383336d2050d7a4b554b0d3c.tar.gz
Add type for gaschange events, if missing
Subsurface has saved gas change events without type attribute at some point. Thus we need to add the type when reading in log files, if it is missing. (Gas change logic relies on the type field nowadays.) Fixes #617 Fixes #600 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 5375e3202..606e25196 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -1337,6 +1337,12 @@ static void event_end(void)
pic->offset.seconds = cur_event.time.seconds;
dive_add_picture(cur_dive, pic);
} else {
+ /* At some point gas change events did not have any type. Thus we need to add
+ * one on import, if we encounter the type one missing.
+ */
+ if (cur_event.type == 0 && strcmp(cur_event.name, "gaschange") == 0)
+ cur_event.type = 25;
+
add_event(dc, cur_event.time.seconds,
cur_event.type, cur_event.flags,
cur_event.value, cur_event.name);