Render a value to text. */
| 495 | |
| 496 | /* Render a value to text. */ |
| 497 | static char *print_value(cJSON *item, int depth, int fmt) |
| 498 | { |
| 499 | char *out = 0; |
| 500 | if (!item) |
| 501 | return 0; |
| 502 | switch ((item->type) & 255) |
| 503 | { |
| 504 | case cJSON_NULL: |
| 505 | out = cJSON_strdup("null"); |
| 506 | break; |
| 507 | case cJSON_False: |
| 508 | out = cJSON_strdup("false"); |
| 509 | break; |
| 510 | case cJSON_True: |
| 511 | out = cJSON_strdup("true"); |
| 512 | break; |
| 513 | case cJSON_Int: |
| 514 | out = print_int(item); |
| 515 | break; |
| 516 | case cJSON_Double: |
| 517 | out = print_double(item); |
| 518 | break; |
| 519 | case cJSON_String: |
| 520 | out = print_string(item); |
| 521 | break; |
| 522 | case cJSON_Array: |
| 523 | out = print_array(item, depth, fmt); |
| 524 | break; |
| 525 | case cJSON_Object: |
| 526 | out = print_object(item, depth, fmt); |
| 527 | break; |
| 528 | } |
| 529 | return out; |
| 530 | } |
| 531 | |
| 532 | /* Build an array from input text. */ |
| 533 | static const char *parse_array(cJSON *item, const char *value, const char **ep) |
no test coverage detected