From 22c94a3e6596f04c86d102098e542a88502410a9 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 23 Mar 2016 09:53:44 -0700 Subject: Don't try to force depth to be unsigned Trying to clean up the signed vs. unsigned issues it becomes clear that forcing depth to be unsigned causes way too many problems in the code. So this commit goes the opposite direction; since we clearly aren't limited INT_MAX vs UINT_MAX, simply make more of the depth related variables signed. Signed-off-by: Dirk Hohndel --- subsurface-core/deco.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'subsurface-core/deco.c') diff --git a/subsurface-core/deco.c b/subsurface-core/deco.c index dff88d338..3cd8c4a16 100644 --- a/subsurface-core/deco.c +++ b/subsurface-core/deco.c @@ -34,13 +34,13 @@ extern pressure_t first_ceiling_pressure; //! Option structure for Buehlmann decompression. struct buehlmann_config { - double satmult; //! safety at inert gas accumulation as percentage of effect (more than 100). - double desatmult; //! safety at inert gas depletion as percentage of effect (less than 100). - unsigned int last_deco_stop_in_mtr; //! depth of last_deco_stop. - double gf_high; //! gradient factor high (at surface). - double gf_low; //! gradient factor low (at bottom/start of deco calculation). - double gf_low_position_min; //! gf_low_position below surface_min_shallow. - bool gf_low_at_maxdepth; //! if true, gf_low applies at max depth instead of at deepest ceiling. + double satmult; //! safety at inert gas accumulation as percentage of effect (more than 100). + double desatmult; //! safety at inert gas depletion as percentage of effect (less than 100). + int last_deco_stop_in_mtr; //! depth of last_deco_stop. + double gf_high; //! gradient factor high (at surface). + double gf_low; //! gradient factor low (at bottom/start of deco calculation). + double gf_low_position_min; //! gf_low_position below surface_min_shallow. + bool gf_low_at_maxdepth; //! if true, gf_low applies at max depth instead of at deepest ceiling. }; struct buehlmann_config buehlmann_config = { @@ -572,9 +572,9 @@ void restore_deco_state(char *data) memcpy(&ci_pointing_to_guiding_tissue, data, sizeof(int)); } -unsigned int deco_allowed_depth(double tissues_tolerance, double surface_pressure, struct dive *dive, bool smooth) +int deco_allowed_depth(double tissues_tolerance, double surface_pressure, struct dive *dive, bool smooth) { - unsigned int depth; + int depth; double pressure_delta; /* Avoid negative depths */ -- cgit v1.2.3-70-g09d2