1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-16 22:45:03 -05:00

examples/sslbackend: fix -Wchar-subscripts warning

With the `isdigit` implementation that comes with MSYS2, the argument
is used as an array subscript, resulting in a -Wchar-subscripts
warning. `isdigit`'s behavior is undefined if the argument is negative
and not EOF [0]. As done in lib/curl_ctype.h, cast the `char` variable
to `unsigned char` to avoid that.

[0] https://en.cppreference.com/w/c/string/byte/isdigit

Closes https://github.com/curl/curl/pull/4503
This commit is contained in:
Marcel Raad 2019-10-18 08:19:47 +02:00
parent 700438c556
commit 650677461f
No known key found for this signature in database
GPG Key ID: 33C416EFAE4D6F02

View File

@ -56,7 +56,7 @@ int main(int argc, char **argv)
return 0; return 0;
} }
else if(isdigit(*name)) { else if(isdigit((int)(unsigned char)*name)) {
int id = atoi(name); int id = atoi(name);
result = curl_global_sslset((curl_sslbackend)id, NULL, NULL); result = curl_global_sslset((curl_sslbackend)id, NULL, NULL);