Skip to content

Commit

Permalink
Add cast to int in calls to isdigit() since some platforms complain a…
Browse files Browse the repository at this point in the history
…bout char being used as an array index.
  • Loading branch information
hawicz committed Feb 5, 2017
1 parent 3fab117 commit 9197715
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions json_pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 9197715

Please sign in to comment.