else {
json_debug_trace((1,
"Non-WS when expecting object start.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_OBSTART;
}
break;
else {
json_debug_trace((1, "Non-WS when expecting attribute.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_ATTRSTART;
}
break;
case in_attr:
if (pattr == NULL) {
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_NULLPTR;
}
pval = valbuf;
} else if (pattr >= attrbuf + JSON_ATTR_MAX - 1) {
json_debug_trace((1, "Attribute name too long.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_ATTRLEN;
} else
if (cursor->type != t_array) {
json_debug_trace((1,
"Saw [ when not expecting array.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_NOARRAY;
}
} else if (cursor->type == t_array) {
json_debug_trace((1,
"Array element was specified, but no [.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_NOBRAK;
} else if (*cp == '"') {
break;
case in_val_string:
if (pval == NULL) {
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_NULLPTR;
}
} else if (pval > valbuf + JSON_VAL_MAX - 1
|| pval > valbuf + maxlen) {
json_debug_trace((1, "String value too long.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_STRLONG; /* */
} else
break;
case in_escape:
if (pval == NULL) {
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_NULLPTR;
}
break;
case in_val_token:
if (pval == NULL) {
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_NULLPTR;
}
--cp;
} else if (pval > valbuf + JSON_VAL_MAX - 1) {
json_debug_trace((1, "Token value too long.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_TOKLONG;
} else
&& cursor->type != t_ignore && cursor->map == 0)) {
json_debug_trace((1,
"Saw quoted value when expecting non-string.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_QNONSTRING;
}
|| cursor->map != 0)) {
json_debug_trace((1,
"Didn't see quoted value when expecting string.\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_NONQSTRING;
}
}
json_debug_trace((1, "Invalid enumerated value string %s.\n",
valbuf));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_BADENUM;
foundit:
break;
case t_character:
if (strlen(valbuf) > 1) {
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_STRLONG;
}
json_debug_trace((1,
"Required attribute value %s not present.\n",
cursor->dflt.check));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_CHECKFAIL;
}
goto good_parse;
} else {
json_debug_trace((1, "Garbage while expecting comma or }\n"));
- if (end)
+ if (end != NULL)
*end = cp;
return JSON_ERR_BADTRAIL;
}