aboutsummaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-11 13:09:48 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-11 13:09:48 -0800
commit91577f11b5373557dca50627b8e3348b6dee2514 (patch)
tree8f9179a9b1f42375f4a34743efc111594bb1a7c4 /parse-xml.c
parentc6ca263fb024bf06f76a5a89fbcd982f3f658d39 (diff)
parent563af1daa781a53fad308870320f99a1903d5058 (diff)
downloadsubsurface-91577f11b5373557dca50627b8e3348b6dee2514.tar.gz
Merge branch 'cns' into cns-merge
I foolishly changed visible_columns in both the (ill-named) cns branch and master... Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Conflicts: divelist.c gtk-gui.c profile.c
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/parse-xml.c b/parse-xml.c
index eb4d4832e..916a780d1 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -147,7 +147,7 @@ static struct {
} cur_event;
static struct tm cur_tm;
static int cur_cylinder_index, cur_ws_index;
-static int lastndl, laststoptime, laststopdepth;
+static int lastndl, laststoptime, laststopdepth, lastcns, lastpo2;
static enum import_source {
UNKNOWN,
@@ -463,6 +463,13 @@ static void get_index(char *buffer, void *_i)
free(buffer);
}
+static void double_to_permil(char *buffer, void *_i)
+{
+ int *i = _i;
+ *i = g_ascii_strtod(buffer, NULL) * 1000.0 + 0.5;
+ free(buffer);
+}
+
static void hex_value(char *buffer, void *_i)
{
uint32_t *i = _i;
@@ -654,6 +661,10 @@ static void try_to_fill_sample(struct sample *sample, const char *name, char *bu
return;
if (MATCH(".sample.stopdepth", depth, &sample->stopdepth))
return;
+ if (MATCH(".sample.cns", get_index, &sample->cns))
+ return;
+ if (MATCH(".sample.po2", double_to_permil, &sample->po2))
+ return;
switch (import_source) {
case DIVINGLOG:
@@ -1064,6 +1075,8 @@ static void sample_start(void)
cur_sample->ndl.seconds = lastndl;
cur_sample->stoptime.seconds = laststoptime;
cur_sample->stopdepth.mm = laststopdepth;
+ cur_sample->cns = lastcns;
+ cur_sample->po2 = lastpo2;
}
static void sample_end(void)
@@ -1075,6 +1088,8 @@ static void sample_end(void)
lastndl = cur_sample->ndl.seconds;
laststoptime = cur_sample->stoptime.seconds;
laststopdepth = cur_sample->stopdepth.mm;
+ lastcns = cur_sample->cns;
+ lastpo2 = cur_sample->po2;
cur_sample = NULL;
}
@@ -1099,7 +1114,7 @@ static void divecomputer_start(void)
/* .. this is the one we'll use */
cur_dc = dc;
- lastndl = laststoptime = laststopdepth = 0;
+ lastcns = lastpo2 = lastndl = laststoptime = laststopdepth = 0;
}
static void divecomputer_end(void)