]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CONTRIB: halog: fix signed/unsigned build warnings on counts and timestamps
authorWilly Tarreau <w@1wt.eu>
Mon, 21 Dec 2020 07:40:04 +0000 (08:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 21 Dec 2020 07:43:09 +0000 (08:43 +0100)
Some variables were signed while they were compared to unsigned ones,
causing warnings to be issued when -Wextra is enabled.

contrib/halog/halog.c

index 820325ade179df1f92e3467f2cb3899f737127ab..5d256209b5d953bd03b6fc7efd78c53248c4f558 100644 (file)
@@ -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;