From: Wolfgang Stöggl Date: Thu, 4 Apr 2019 13:35:18 +0000 (+0200) Subject: Cast unsigned long values to long for labs() X-Git-Tag: v1.7.2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b646b3f6682827bc126deaf102cdf88d16b83b99;p=thirdparty%2Frrdtool-1.x.git Cast unsigned long values to long for labs() - Fixes the following clang compiler warning: rrd_fetch.c:391:29: warning: taking the absolute value of unsigned type 'unsigned long' has no effect [-Wabsolute-value] tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step --- diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c index 0fca39a6..43cf2ba1 100644 --- a/src/rrd_fetch.c +++ b/src/rrd_fetch.c @@ -388,8 +388,10 @@ int rrd_fetch_fn( rrd.stat_head->pdp_step * rrd.rra_def[i].pdp_cnt); #endif /* we need step difference in either full or partial case */ - tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step - * rrd.rra_def[i].pdp_cnt)); + tmp_step_diff = + labs((long) *step - + ((long) rrd.stat_head->pdp_step * + (long) rrd.rra_def[i].pdp_cnt)); /* best full match */ if (cal_start <= *start) { if (first_full || (tmp_step_diff < best_full_step_diff)) {