diff options
author | Jeremie Guichard <djebrest@gmail.com> | 2017-03-08 13:41:41 +0700 |
---|---|---|
committer | Jeremie Guichard <djebrest@gmail.com> | 2017-03-08 14:04:17 +0700 |
commit | 406e4287eb96e10ddfd22163f0e863e353470c68 (patch) | |
tree | 1a859821cdd37485b7d9ce4c0404f73fdf68e78b /core/dive.c | |
parent | 9c2619ea3bcf8a0ad40a758692c26a5aec350c7f (diff) | |
download | subsurface-406e4287eb96e10ddfd22163f0e863e353470c68.tar.gz |
Change calls to rint into lrint avoiding conversion warnings
Using gcc option "-Wfloat-conversion" is useful to catch
potential conversion errors (where lrint should be used).
rint returns double and still raises the same warning,
this is why this change updates all rint calls to lrint.
In few places, where input type is a float, corresponding
lrinf is used.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/dive.c b/core/dive.c index 48dd929f4..6c438b1a3 100644 --- a/core/dive.c +++ b/core/dive.c @@ -243,15 +243,15 @@ double get_volume_units(unsigned int ml, int *frac, const char **units) int units_to_sac(double volume) { if (get_units()->volume == CUFT) - return rint(cuft_to_l(volume) * 1000.0); + return lrint(cuft_to_l(volume) * 1000.0); else - return rint(volume * 1000); + return lrint(volume * 1000); } unsigned int units_to_depth(double depth) { if (get_units()->length == METERS) - return rint(depth * 1000); + return lrint(depth * 1000); return feet_to_mm(depth); } @@ -872,7 +872,7 @@ int gas_volume(cylinder_t *cyl, pressure_t p) { double bar = p.mbar / 1000.0; double z_factor = gas_compressibility_factor(&cyl->gasmix, bar); - return rint(cyl->type.size.mliter * bar_to_atm(bar) / z_factor); + return lrint(cyl->type.size.mliter * bar_to_atm(bar) / z_factor); } /* @@ -1019,7 +1019,7 @@ static void match_standard_cylinder(cylinder_type_t *type) default: return; } - len = snprintf(buffer, sizeof(buffer), fmt, (int)rint(cuft)); + len = snprintf(buffer, sizeof(buffer), fmt, (int)lrint(cuft)); p = malloc(len + 1); if (!p) return; @@ -1056,7 +1056,7 @@ static void sanitize_cylinder_type(cylinder_type_t *type) volume_of_air = cuft_to_l(type->size.mliter); /* milliliters at 1 atm: not corrected for compressibility! */ volume = volume_of_air / bar_to_atm(bar); - type->size.mliter = rint(volume); + type->size.mliter = lrint(volume); } /* Ok, we have both size and pressure: try to match a description */ |