curl_json plugin: Add compatibility code for libyajl v2.
[collectd.git] / src / target_scale.c
index 5c5e9aa..29fecdf 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 */
                {
@@ -302,11 +302,15 @@ static int ts_config_set_double (double *ret, oconfig_item_t *ci) /* {{{ */
 
 static int ts_destroy (void **user_data) /* {{{ */
 {
+       ts_data_t **data;
+
        if (user_data == NULL)
                return (-EINVAL);
 
-       free (*user_data);
-       *user_data = NULL;
+       data = (ts_data_t **) user_data;
+
+       free (*data);
+       *data = NULL;
 
        return (0);
 } /* }}} int ts_destroy */