From: Eric Haszlakiewicz Date: Sun, 5 Feb 2017 04:34:05 +0000 (+0000) Subject: Add cast to int in calls to isdigit() since some platforms complain about char being... X-Git-Tag: json-c-0.13-20171207~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91977159ee8037ee529f1f1f75f0fa3309ce351b;p=json-c Add cast to int in calls to isdigit() since some platforms complain about char being used as an array index. --- diff --git a/json_pointer.c b/json_pointer.c index 380d6e5..d106e9e 100644 --- a/json_pointer.c +++ b/json_pointer.c @@ -43,7 +43,7 @@ static int is_valid_index(struct json_object *jo, const char *path, int32_t *idx /* this code-path optimizes a bit, for when we reference the 0-9 index range in a JSON array and because leading zeros not allowed */ if (len == 1) { - if (isdigit(path[0])) { + if (isdigit((int)path[0])) { *idx = (path[0] - '0'); goto check_oob; } @@ -57,7 +57,7 @@ static int is_valid_index(struct json_object *jo, const char *path, int32_t *idx } /* RFC states base-10 decimals */ for (i = 0; i < len; i++) { - if (!isdigit(path[i])) { + if (!isdigit((int)path[i])) { errno = EINVAL; return 0; }