Parser core - when encountering text, process appropriately. */
| 280 | |
| 281 | /* Parser core - when encountering text, process appropriately. */ |
| 282 | static const char *parse_value(cJSON *item,const char *value) |
| 283 | { |
| 284 | if (!value) return nullptr; /* Fail on null. */ |
| 285 | if (!strncmp(value,"null",4)) { item->type=cJSON_NULL; return value+4; } |
| 286 | if (!strncmp(value,"false",5)) { item->type=cJSON_False; return value+5; } |
| 287 | if (!strncmp(value,"true",4)) { item->type=cJSON_True; item->valueint=1; return value+4; } |
| 288 | if (*value=='\"') { return parse_string(item,value); } |
| 289 | if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); } |
| 290 | if (*value=='[') { return parse_array(item,value); } |
| 291 | if (*value=='{') { return parse_object(item,value); } |
| 292 | |
| 293 | ep=value;return nullptr; /* failure. */ |
| 294 | } |
| 295 | |
| 296 | /* Render a value to text. */ |
| 297 | static char *print_value(cJSON *item,int depth,int fmt) |
no test coverage detected