From 406e4287eb96e10ddfd22163f0e863e353470c68 Mon Sep 17 00:00:00 2001 From: Jeremie Guichard Date: Wed, 8 Mar 2017 13:41:41 +0700 Subject: 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 --- core/load-git.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'core/load-git.c') 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); -- cgit v1.2.3-70-g09d2