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/load-git.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/load-git.c')
-rw-r--r-- | core/load-git.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/load-git.c b/core/load-git.c index 05d2112b5..03e7f8694 100644 --- a/core/load-git.c +++ b/core/load-git.c @@ -81,40 +81,40 @@ static temperature_t get_temperature(const char *line) static depth_t get_depth(const char *line) { depth_t d; - d.mm = rint(1000*ascii_strtod(line, NULL)); + d.mm = lrint(1000*ascii_strtod(line, NULL)); return d; } static volume_t get_volume(const char *line) { volume_t v; - v.mliter = rint(1000*ascii_strtod(line, NULL)); + v.mliter = lrint(1000*ascii_strtod(line, NULL)); return v; } static weight_t get_weight(const char *line) { weight_t w; - w.grams = rint(1000*ascii_strtod(line, NULL)); + w.grams = lrint(1000*ascii_strtod(line, NULL)); return w; } static pressure_t get_pressure(const char *line) { pressure_t p; - p.mbar = rint(1000*ascii_strtod(line, NULL)); + p.mbar = lrint(1000*ascii_strtod(line, NULL)); return p; } static int get_salinity(const char *line) { - return rint(10*ascii_strtod(line, NULL)); + return lrint(10*ascii_strtod(line, NULL)); } static fraction_t get_fraction(const char *line) { fraction_t f; - f.permille = rint(10*ascii_strtod(line, NULL)); + f.permille = lrint(10*ascii_strtod(line, NULL)); return f; } @@ -568,10 +568,10 @@ static char *parse_sample_unit(struct sample *sample, double val, char *unit) /* The units are "°C", "m" or "bar", so let's just look at the first character */ switch (*unit) { case 'm': - sample->depth.mm = rint(1000*val); + sample->depth.mm = lrint(1000*val); break; case 'b': - sample->cylinderpressure.mbar = rint(1000*val); + sample->cylinderpressure.mbar = lrint(1000*val); break; default: sample->temperature.mkelvin = C_to_mkelvin(val); |