Skip to content

Commit

Permalink
examples/sslbackend: fix -Wchar-subscripts warning
Browse files Browse the repository at this point in the history
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
  • Loading branch information
MarcelRaad committed Oct 18, 2019
1 parent fff1ba7 commit 2292293
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/examples/sslbackend.c
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char **argv)

return 0;
}
else if(isdigit(*name)) {
else if(isdigit((int)(unsigned char)*name)) {
int id = atoi(name);

result = curl_global_sslset((curl_sslbackend)id, NULL, NULL);
Expand Down

0 comments on commit 2292293

Please sign in to comment.