From: Mathieu Desnoyers Date: Fri, 10 Apr 2020 12:30:54 +0000 (-0400) Subject: Fix: tap array subscript has type char warning X-Git-Tag: v0.9.7~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e47125e0384ad3a37bdd67bf92af66a68b05bccd;p=userspace-rcu.git Fix: tap array subscript has type char warning On architectures where "char" is signed, it should be cast to unsigned char before being passed as parameter to isdigit or isspace. Based on their man page: These functions check whether c, which must have the value of an unsigned char or EOF, falls into a certain character class according to the specified locale. Passing a signed char as parameter is invalid if the values fall into the negative range of the signed char. Signed-off-by: Mathieu Desnoyers --- diff --git a/tests/utils/tap.c b/tests/utils/tap.c index 6acab66..ee1fdb0 100644 --- a/tests/utils/tap.c +++ b/tests/utils/tap.c @@ -95,7 +95,8 @@ _gen_result(int ok, const char *func, char *file, unsigned int line, if(local_test_name) { name_is_digits = 1; for(c = local_test_name; *c != '\0'; c++) { - if(!isdigit(*c) && !isspace(*c)) { + if(!isdigit((unsigned char)*c) && + !isspace((unsigned char)*c)) { name_is_digits = 0; break; }