aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-03-11 22:08:33 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-03-12 09:19:06 -0700
commit7bfeb95613b13c868bbe57a059bece513307b668 (patch)
tree1883766677d3ba4d2a171eb5b6e09b4b81a29bce
parente43e98686ceeb0bfd67ce5d6676f47b5a2a80aeb (diff)
downloadsubsurface-7bfeb95613b13c868bbe57a059bece513307b668.tar.gz
planner.c: fix a couple of float -> int cast warnings
Use lrint() to fix both: 1) core\planner.c:902:23: warning: conversion to 'int' from 'doub le' may alter its value [-Wfloat-conversion] 2) core\planner.c:907:21: warning: conversion to 'int32_t' from ' double' may alter its value [-Wfloat-conversion] Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/planner.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/planner.c b/core/planner.c
index eb7352739..90fe6294a 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -899,13 +899,13 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
&& dive->dc.divemode == OC && decoMode() != RECREATIONAL) {
/* Calculate minimum gas volume. */
volume_t mingasv;
- mingasv.mliter = prefs.problemsolvingtime * prefs.bottomsac * prefs.sacfactor / 100.0
+ mingasv.mliter = lrint(prefs.problemsolvingtime * prefs.bottomsac * prefs.sacfactor / 100.0
* depth_to_bar(lastbottomdp->depth.mm, dive)
- + cyl->deco_gas_used.mliter * prefs.sacfactor / 100.0;
+ + cyl->deco_gas_used.mliter * prefs.sacfactor / 100.0);
/* Calculate minimum gas pressure for cyclinder. */
pressure_t mingasp;
- mingasp.mbar = isothermal_pressure(&cyl->gasmix, 1.0,
- mingasv.mliter, cyl->type.size.mliter) * 1000;
+ mingasp.mbar = lrint(isothermal_pressure(&cyl->gasmix, 1.0,
+ mingasv.mliter, cyl->type.size.mliter) * 1000);
/* Translate all results into correct units */
mingas_volume = get_volume_units(mingasv.mliter, NULL, &unit);
mingas_pressure = get_pressure_units(mingasp.mbar, &pressure_unit);