Code

scale target: Fix C90 warning (which is upgraded to an error by default).
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sun, 13 Sep 2009 12:45:58 +0000 (14:45 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sun, 13 Sep 2009 12:45:58 +0000 (14:45 +0200)
Should fix this warning:
-- 8< --
 target_scale.c: In function 'ts_invoke_counter':
 target_scale.c:90: warning: this decimal constant is unsigned only in ISO C90
 target_scale.c:91: warning: this decimal constant is unsigned only in ISO C90
 target_scale.c:93: warning: integer constant is too large for 'unsigned long' type
-- >8 --

src/target_scale.c

index 5c5e9aac330ee9be2038c8ba886bfe257b3c5ced..6b261c7cb84e12c06e1d1c799cd35f5edabaad6e 100644 (file)
@@ -87,10 +87,10 @@ static int ts_invoke_counter (const data_set_t *ds, value_list_t *vl, /* {{{ */
                /* Calcualte the rate */
                if (prev_counter > curr_counter) /* => counter overflow */
                {
-                       if (prev_counter <= 4294967295) /* 32 bit overflow */
-                               difference = (4294967295 - prev_counter) + curr_counter;
+                       if (prev_counter <= 4294967295UL) /* 32 bit overflow */
+                               difference = (4294967295UL - prev_counter) + curr_counter;
                        else /* 64 bit overflow */
-                               difference = (18446744073709551615U - prev_counter) + curr_counter;
+                               difference = (18446744073709551615ULL - prev_counter) + curr_counter;
                }
                else /* no overflow */
                {