diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-09-10 20:40:25 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-09-10 14:23:59 -0700 |
commit | 6e4a2538968d945d471489270136c4891b47b270 (patch) | |
tree | dbe442feff12bdb1414712e926eac593deb8a1d9 /core/divelist.c | |
parent | c75f53a7a802fd9745376b837f6c307ba82d5b7b (diff) | |
download | subsurface-6e4a2538968d945d471489270136c4891b47b270.tar.gz |
Profile: fix SAC calculation for air dives
Commit f5b11daffd6f240268ce78d72c64be43670988ea changed gasmix
arguments and return values to be passed by value instead of
using pointers.
Notably, get_gasmix() is fed a default-value and returns a
new value. In the old code, NULL was passed in in a first
loop iteration and non-NULL was always returned in the first
iteration. Thus, an equality comparison of passed-in an
returned gasmix would always fail in the first loop iteration.
The new code passed in air as default. Now if air was also
returned, then the matching gases were not calculated in
calculate_sac(). To revert to the old behavior, pass in
an invalid gasmix.
Moreover, give names to the invalid and air gasmixes.
Reported-by: tormento <turment@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divelist.c')
-rw-r--r-- | core/divelist.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/divelist.c b/core/divelist.c index f643d14f6..1906d002a 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -405,7 +405,7 @@ static int calculate_sac(const struct dive *dive) static void add_dive_to_deco(struct deco_state *ds, struct dive *dive) { struct divecomputer *dc = &dive->dc; - struct gasmix gasmix = { 0 }; + struct gasmix gasmix = gasmix_air; int i; const struct event *ev = NULL, *evd = NULL; enum divemode_t current_divemode = UNDEF_COMP_TYPE; |