summaryrefslogtreecommitdiffstats
path: root/core/dive.h
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@libreoffice.org>2018-05-18 17:46:12 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-05-18 21:27:37 +0300
commit6034b25cb2f2c5226ba140d14fae413336854c39 (patch)
treedd1ebd91295a8fd1daf22d1d0e93364742722f4b /core/dive.h
parent262e994bbcb3c278635f57a7022448e1b22298eb (diff)
downloadsubsurface-6034b25cb2f2c5226ba140d14fae413336854c39.tar.gz
core: removed clang warnings from dive.h
interpolate, rel_mbar_to_depth, gas_mod and gas_mnd returns int but uses a function that returns long, causing clang to warn about conversion loss due to implicit conversion. Adding a cast, shows that it is correct. Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'core/dive.h')
-rw-r--r--core/dive.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/dive.h b/core/dive.h
index 9b1640f9c..31a568667 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -151,7 +151,7 @@ static inline int interpolate(int a, int b, int part, int whole)
/* It is doubtful that we actually need floating point for this, but whatever */
if (whole) {
double x = (double)a * (whole - part) + (double)b * part;
- return lrint(x / whole);
+ return (int)lrint(x / whole);
}
return (a+b)/2;
}
@@ -452,7 +452,7 @@ static inline int rel_mbar_to_depth(int mbar, struct dive *dive)
if (dive->dc.salinity)
specific_weight = dive->dc.salinity / 10000.0 * 0.981;
/* whole mbar gives us cm precision */
- cm = lrint(mbar / specific_weight);
+ cm = (int)lrint(mbar / specific_weight);
return cm * 10;
}
@@ -471,7 +471,7 @@ static inline depth_t gas_mod(struct gasmix *mix, pressure_t po2_limit, struct d
depth_t rounded_depth;
double depth = (double) mbar_to_depth(po2_limit.mbar * 1000 / get_o2(mix), dive);
- rounded_depth.mm = lrint(depth / roundto) * roundto;
+ rounded_depth.mm = (int)lrint(depth / roundto) * roundto;
return rounded_depth;
}
@@ -481,8 +481,8 @@ static inline depth_t gas_mnd(struct gasmix *mix, depth_t end, struct dive *dive
pressure_t ppo2n2;
ppo2n2.mbar = depth_to_mbar(end.mm, dive);
- int maxambient = lrint(ppo2n2.mbar / (1 - get_he(mix) / 1000.0));
- rounded_depth.mm = lrint(((double)mbar_to_depth(maxambient, dive)) / roundto) * roundto;
+ int maxambient = (int)lrint(ppo2n2.mbar / (1 - get_he(mix) / 1000.0));
+ rounded_depth.mm = (int)lrint(((double)mbar_to_depth(maxambient, dive)) / roundto) * roundto;
return rounded_depth;
}