aboutsummaryrefslogtreecommitdiffstats
path: root/load-git.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-16 23:11:18 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-16 23:20:39 +0000
commit23304f69c04f13ba87f32e8574a75c08212a3608 (patch)
tree7925373ac99b32cb1306cd885b43ffe3f084f8ab /load-git.c
parent202c5cbfeb6888b05ae4b14b4f563666bc6ca763 (diff)
downloadsubsurface-23304f69c04f13ba87f32e8574a75c08212a3608.tar.gz
Load and save the dc type for CCR dives
Oddly we already had code to load this from XML, but nothing else. This makes the load from XML work like the rest of our code and adds the save to XML plus the load and save for the git format. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'load-git.c')
-rw-r--r--load-git.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/load-git.c b/load-git.c
index 9cf6baf6c..54d349bd0 100644
--- a/load-git.c
+++ b/load-git.c
@@ -130,6 +130,15 @@ static duration_t get_duration(const char *line)
return d;
}
+static enum dive_comp_type get_dctype(const char *line)
+{
+ for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) {
+ if (strcmp(line, dctype_text[i]) == 0)
+ return i;
+ }
+ return 0;
+}
+
static int get_index(const char *line)
{ return atoi(line); }
static int get_hex(const char *line)
@@ -500,6 +509,9 @@ static void parse_dc_diveid(char *line, struct membuffer *str, void *_dc)
static void parse_dc_duration(char *line, struct membuffer *str, void *_dc)
{ struct divecomputer *dc = _dc; dc->duration = get_duration(line); }
+static void parse_dc_dctype(char *line, struct membuffer *str, void *_dc)
+{ struct divecomputer *dc = _dc; dc->dctype = get_dctype(line); }
+
static void parse_dc_maxdepth(char *line, struct membuffer *str, void *_dc)
{ struct divecomputer *dc = _dc; dc->maxdepth = get_depth(line); }
@@ -732,7 +744,7 @@ static void parse_picture_gps(char *line, struct membuffer *str, void *_pic)
struct keyword_action dc_action[] = {
#undef D
#define D(x) { #x, parse_dc_ ## x }
- D(airtemp), D(date), D(deviceid), D(diveid), D(duration),
+ D(airtemp), D(date), D(dctype), D(deviceid), D(diveid), D(duration),
D(event), D(keyvalue), D(maxdepth), D(meandepth), D(model), D(salinity),
D(surfacepressure), D(surfacetime), D(time), D(watertemp),
};