Browse Source

Add cast to int in calls to isdigit() since some platforms complain about char being used as an array index.

tags/json-c-0.13-20171207
Eric Haszlakiewicz 8 years ago
parent
commit
91977159ee
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      json_pointer.c

+ 2
- 2
json_pointer.c View File

@@ -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 /* 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 */ and because leading zeros not allowed */
if (len == 1) { if (len == 1) {
if (isdigit(path[0])) {
if (isdigit((int)path[0])) {
*idx = (path[0] - '0'); *idx = (path[0] - '0');
goto check_oob; 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 */ /* RFC states base-10 decimals */
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
if (!isdigit(path[i])) {
if (!isdigit((int)path[i])) {
errno = EINVAL; errno = EINVAL;
return 0; return 0;
} }


Loading…
Cancel
Save