summaryrefslogtreecommitdiffstats
path: root/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-08 23:03:10 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-08 23:03:10 -0800
commitfd997c1b15e798bdf2aa1088e0c58467793a511d (patch)
treed99849040ec7ae594aa6f49ca1a52c62a8866a19 /libdivecomputer.c
parent4be7604634221ba0cd8df1c342f8fb18a88b1448 (diff)
downloadsubsurface-fd997c1b15e798bdf2aa1088e0c58467793a511d.tar.gz
Fix previous commit to compile with older versions of libdivecomputer
That was silly :-( Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r--libdivecomputer.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 5a3020dc5..981061ba5 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -56,9 +56,10 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
const unsigned char *data)
{
static bool shown_warning = false;
- int i, rc, ntanks = 0;
+ int i, rc;
#if DC_VERSION_CHECK(0, 5, 0) && defined(DC_GASMIX_UNKNOWN)
+ int ntanks = 0;
rc = dc_parser_get_field(parser, DC_FIELD_TANK_COUNT, 0, &ntanks);
if (rc == DC_STATUS_SUCCESS) {
if (ntanks != ngases) {
@@ -66,12 +67,13 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
report_error("different number of gases (%d) and tanks (%d)", ngases, ntanks);
}
}
+ dc_tank_t tank = { 0 };
#endif
for (i = 0; i < ngases; i++) {
dc_gasmix_t gasmix = { 0 };
- dc_tank_t tank = { 0 };
int o2, he;
+ bool no_volume = true;
rc = dc_parser_get_field(parser, DC_FIELD_GASMIX, i, &gasmix);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED)
@@ -101,8 +103,8 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
dive->cylinder[i].gasmix.o2.permille = o2;
dive->cylinder[i].gasmix.he.permille = he;
- tank.volume = 0.0;
#if DC_VERSION_CHECK(0, 5, 0) && defined(DC_GASMIX_UNKNOWN)
+ tank.volume = 0.0;
if (i < ntanks) {
rc = dc_parser_get_field(parser, DC_FIELD_TANK, 0, &tank);
if (rc == DC_STATUS_SUCCESS) {
@@ -118,8 +120,10 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
}
}
}
+ if (!IS_FP_SAME(tank.volume, 0.0))
+ no_volume = false;
#endif
- if (IS_FP_SAME(tank.volume, 0.0)) {
+ if (no_volume) {
/* for the first tank, if there is no tanksize available from the
* dive computer, fill in the default tank information (if set) */
fill_default_cylinder(&dive->cylinder[i]);