[PATCH 1/3] dive: paren error in set point handling

Stephen Hemminger stephen at networkplumber.org
Sun Dec 27 14:33:16 PST 2015


This probably is a serious bug, found by cppcheck.
Original code had paren's in probably the wrong place!

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 subsurface-core/dive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/subsurface-core/dive.c b/subsurface-core/dive.c
index 46129b8..f0baf07 100644
--- a/subsurface-core/dive.c
+++ b/subsurface-core/dive.c
@@ -933,7 +933,7 @@ void update_setpoint_events(struct divecomputer *dc)
 				next = get_next_event(ev, "gaschange");
 			}
 			fill_pressures(&pressures, calculate_depth_to_mbar(dc->sample[i].depth.mm, dc->surface_pressure, 0), gasmix ,0, OC);
-			if (abs(dc->sample[i].setpoint.mbar - (int)(1000 * pressures.o2) <= 50))
+			if (abs(dc->sample[i].setpoint.mbar - (int)(1000 * pressures.o2)) <= 50)
 				dc->sample[i].setpoint.mbar = 0;
 		}
 	}
-- 
2.1.4



More information about the subsurface mailing list