]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Cast unsigned long values to long for labs()
authorWolfgang Stöggl <c72578@yahoo.de>
Thu, 4 Apr 2019 13:35:18 +0000 (15:35 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Fri, 5 Apr 2019 07:06:17 +0000 (09:06 +0200)
- 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

src/rrd_fetch.c

index 0fca39a6f5a90fcfd72c165d0b03c90146368f27..43cf2ba1892ee1b5ee186eea586b6ea722d66b54 100644 (file)
@@ -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)) {