From: Willy Tarreau Date: Mon, 21 Dec 2020 07:40:04 +0000 (+0100) Subject: CONTRIB: halog: fix signed/unsigned build warnings on counts and timestamps X-Git-Tag: v2.1.11~16 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=824aa31093c7a4a0b143fae7b8b5879cf9e3557f;p=haproxy-2.1.git CONTRIB: halog: fix signed/unsigned build warnings on counts and timestamps Some variables were signed while they were compared to unsigned ones, causing warnings to be issued when -Wextra is enabled. (cherry picked from commit 03ca6054d02350e83cb5227608ccec13efdd3ade) Signed-off-by: Christopher Faulet (cherry picked from commit f87775390a22880b0f6b979d35343988fdd109a2) Signed-off-by: Christopher Faulet (cherry picked from commit 52381396cfe73d65c7ee841e674a6897fe81db19) Signed-off-by: Christopher Faulet --- diff --git a/contrib/halog/halog.c b/contrib/halog/halog.c index ea47744..9d1b98a 100644 --- a/contrib/halog/halog.c +++ b/contrib/halog/halog.c @@ -651,11 +651,11 @@ int convert_date_to_timestamp(const char *field) } if (likely(timeinfo)) { - if (timeinfo->tm_min == m && - timeinfo->tm_hour == h && - timeinfo->tm_mday == d && - timeinfo->tm_mon == mo - 1 && - timeinfo->tm_year == y - 1900) + if ((unsigned)timeinfo->tm_min == m && + (unsigned)timeinfo->tm_hour == h && + (unsigned)timeinfo->tm_mday == d && + (unsigned)timeinfo->tm_mon == mo - 1 && + (unsigned)timeinfo->tm_year == y - 1900) return last_res + s; } else { @@ -693,10 +693,10 @@ int main(int argc, char **argv) struct url_stat *ustat = NULL; int val, test; unsigned int uval; - int filter_acc_delay = 0, filter_acc_count = 0; + unsigned int filter_acc_delay = 0, filter_acc_count = 0; int filter_time_resp = 0; int filt_http_status_low = 0, filt_http_status_high = 0; - int filt2_timestamp_low = 0, filt2_timestamp_high = 0; + unsigned int filt2_timestamp_low = 0, filt2_timestamp_high = 0; int skip_fields = 1; void (*line_filter)(const char *accept_field, const char *time_field, struct timer **tptr) = NULL;