]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CONTRIB: halog: fix issue with array of type char
authorWilly Tarreau <w@1wt.eu>
Fri, 2 Apr 2021 15:47:21 +0000 (17:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 2 Apr 2021 15:47:21 +0000 (17:47 +0200)
I just noticed this in the windows build after moving the file to dev/:

   In file included from include/import/ist.h:32,
                   from include/haproxy/connection-t.h:32,
                   from dev/flags/flags.c:5:
  dev/flags/flags.c: In function `main':
  dev/flags/flags.c:442:20: error: array subscript has type `char' [-Werror=char-subscripts]
    442 |           (isalnum(*err) && toupper(*err) != 'U' && toupper(*err) != 'L'))
        |                    ^~~~
    LD      haproxy
  cc1: all warnings being treated as errors
  make: *** [Makefile:932: dev/flags/flags.o] Error 1
  make: *** Waiting for unfinished jobs....
  Error: Process completed with exit code 2.

Let's just cast it to uchar as is done everywhere else.

contrib/debug/flags.c

index 044221ea41fa4f4be50d61dc4dea20252e8d0adc..669bd090c9c9585a7c081138cc1c97c999fbe22e 100644 (file)
@@ -439,7 +439,7 @@ int main(int argc, char **argv)
                        /* stop at the end of the number and trim any C suffix like "UL" */
                        err = value;
                        while (*err == '-' || *err == '+' ||
-                              (isalnum(*err) && toupper(*err) != 'U' && toupper(*err) != 'L'))
+                              (isalnum((unsigned char)*err) && toupper((unsigned char)*err) != 'U' && toupper((unsigned char)*err) != 'L'))
                                err++;
                        if (err)
                                *err = 0;