From b3f5473b66b8210d1276f197876e0e2d7bbd6fa7 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 4 Oct 2020 00:07:59 +0200 Subject: core: don't merge sample-derived pressures in merge_one_cylinder() These will be recalculated from the pressures in fixup_dive() anyway. Suggested-by: Linus Torvalds Signed-off-by: Berthold Stoeger --- core/dive.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/dive.c b/core/dive.c index 2c9de41a3..0658d73bc 100644 --- a/core/dive.c +++ b/core/dive.c @@ -2276,15 +2276,12 @@ static void merge_one_cylinder(cylinder_t *a, const cylinder_t *b) /* If either cylinder has manually entered pressures, try to merge them. * Use pressures from divecomputer samples if only one cylinder has such a value. - * Yes, this is an actual use case we encountered. */ + * Yes, this is an actual use case we encountered. + * Note that we don't merge the sample-derived pressure values, as this is + * perfomed after merging in fixup_dive() */ a->start = merge_pressures(a->start, a->sample_start, b->start, b->sample_start, false); a->end = merge_pressures(a->end, a->sample_end, b->end, b->sample_end, true); - if (a->sample_start.mbar && b->sample_start.mbar) - a->sample_start.mbar = a->sample_start.mbar > b->sample_start.mbar ? a->sample_start.mbar : b->sample_start.mbar; - if (a->sample_end.mbar && b->sample_end.mbar) - a->sample_end.mbar = a->sample_end.mbar < b->sample_end.mbar ? a->sample_end.mbar : b->sample_end.mbar; - /* Really? */ a->gas_used.mliter += b->gas_used.mliter; a->deco_gas_used.mliter += b->deco_gas_used.mliter; -- cgit v1.2.3-70-g09d2