| 59 | } |
| 60 | |
| 61 | void json_get_normalized_string(json_engine_t *je, String *res, |
| 62 | int *error, MEM_ROOT *current_mem_root, |
| 63 | json_engine_t *temp_je, |
| 64 | MEM_ROOT_DYNAMIC_ARRAY *stack) |
| 65 | { |
| 66 | char *val_begin= (char*)je->value, *val_end= NULL; |
| 67 | String val("",0,je->s.cs); |
| 68 | DYNAMIC_STRING a_res; |
| 69 | |
| 70 | if (init_dynamic_string(&a_res, NULL, 0, 0)) |
| 71 | goto error; |
| 72 | |
| 73 | if (!json_value_scalar(je)) |
| 74 | { |
| 75 | if (json_skip_level(je)) |
| 76 | goto error; |
| 77 | } |
| 78 | |
| 79 | val_end= json_value_scalar(je) ? val_begin+je->value_len : |
| 80 | (char *)je->s.c_str; |
| 81 | val.set((const char*)val_begin, val_end-val_begin, je->s.cs); |
| 82 | |
| 83 | if (je->value_type == JSON_VALUE_NUMBER || |
| 84 | je->value_type == JSON_VALUE_ARRAY || |
| 85 | je->value_type == JSON_VALUE_OBJECT) |
| 86 | { |
| 87 | if (json_normalize(&a_res, (const char*)val.ptr(), |
| 88 | val_end-val_begin, je->s.cs, current_mem_root, temp_je, stack)) |
| 89 | goto error; |
| 90 | } |
| 91 | else if(je->value_type == JSON_VALUE_STRING) |
| 92 | { |
| 93 | dynstr_set(&a_res, val.c_ptr()); |
| 94 | a_res.length= je->value_len; |
| 95 | } |
| 96 | |
| 97 | res->append(a_res.str, a_res.length, je->s.cs); |
| 98 | *error= 0; |
| 99 | |
| 100 | error: |
| 101 | dynstr_free(&a_res); |
| 102 | |
| 103 | return; |
| 104 | } |
no test coverage detected