From fd4a555fed0d88033e2e5bbe3c84f9847fd1ec22 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 16 Aug 2010 10:32:27 +0200 Subject: [PATCH] src/utils_match.h: Fix a bug preventing derive values from being handled correctly. Due to the bit-wise check, the value for derive (0x30) matches the check for gauge (0x10), too. This commit fixes the behavior by assigning other numeric values to the defines. --- src/utils_match.c | 2 +- src/utils_match.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils_match.c b/src/utils_match.c index bdbad3f2..9dd2da7d 100644 --- a/src/utils_match.c +++ b/src/utils_match.c @@ -160,7 +160,7 @@ static int default_callback (const char __attribute__((unused)) *str, if (matches_num < 2) return (-1); - value = strtoll (matches[1], &endptr, 0); + value = (derive_t) strtoll (matches[1], &endptr, 0); if (matches[1] == endptr) return (-1); diff --git a/src/utils_match.h b/src/utils_match.h index 5a0c0337..e8f02a50 100644 --- a/src/utils_match.h +++ b/src/utils_match.h @@ -28,10 +28,10 @@ /* * Defines */ -#define UTILS_MATCH_DS_TYPE_GAUGE 0x10 -#define UTILS_MATCH_DS_TYPE_COUNTER 0x20 -#define UTILS_MATCH_DS_TYPE_DERIVE 0x30 -#define UTILS_MATCH_DS_TYPE_ABSOLUTE 0x40 +#define UTILS_MATCH_DS_TYPE_GAUGE 0x10 +#define UTILS_MATCH_DS_TYPE_COUNTER 0x20 +#define UTILS_MATCH_DS_TYPE_DERIVE 0x40 +#define UTILS_MATCH_DS_TYPE_ABSOLUTE 0x80 #define UTILS_MATCH_CF_GAUGE_AVERAGE 0x01 #define UTILS_MATCH_CF_GAUGE_MIN 0x02 -- 2.30.2