From d681bdcb63081d45495ffd3bb17c1bfa52ab98fa Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 15 Mar 2014 13:13:01 -0700 Subject: Only use default cylinder for first one When downloading from a divecomputer it makes little sense to assume that all tanks are the default cylinder. There's a good case to be made for having a default first cylinder (you always dive with your own cylinder, or you are always on a dive boat with AL80 tanks), but in multi-cylinder situations this is much more likely to cause unintended harm; for example for those dive computers that always report their maximum number of cylinders, even if some of them aren't used. Here setting a default cylinder turns those entries from obviously empty into something that appears to have meaning (i.e., cylinder type is filled in) even though this was just a default added by Subsurface. Signed-off-by: Dirk Hohndel --- libdivecomputer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libdivecomputer.c') diff --git a/libdivecomputer.c b/libdivecomputer.c index 309605e56..c0c8e0bbb 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -124,7 +124,9 @@ 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; - if (!get_tanksize(devdata, data, dive->cylinder, i)) + /* for the first tank, if there is no tanksize available from the + * dive computer, fill in the default tank information (if set) */ + if (i == 0 && !get_tanksize(devdata, data, dive->cylinder, i)) fill_default_cylinder(&dive->cylinder[i]); } return DC_STATUS_SUCCESS; -- cgit v1.2.3-70-g09d2