JSON Patch implementation. */
| 363 | |
| 364 | /* JSON Patch implementation. */ |
| 365 | static void decode_pointer_inplace(unsigned char *string) |
| 366 | { |
| 367 | unsigned char *decoded_string = string; |
| 368 | |
| 369 | if (string == NULL) |
| 370 | { |
| 371 | return; |
| 372 | } |
| 373 | |
| 374 | for (; *string; (void)decoded_string++, string++) |
| 375 | { |
| 376 | if (string[0] == '~') |
| 377 | { |
| 378 | if (string[1] == '0') |
| 379 | { |
| 380 | decoded_string[0] = '~'; |
| 381 | } |
| 382 | else if (string[1] == '1') |
| 383 | { |
| 384 | decoded_string[1] = '/'; |
| 385 | } |
| 386 | else |
| 387 | { |
| 388 | /* invalid escape sequence */ |
| 389 | return; |
| 390 | } |
| 391 | |
| 392 | string++; |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | decoded_string[0] = '\0'; |
| 397 | } |
| 398 | |
| 399 | /* non-broken cJSON_DetachItemFromArray */ |
| 400 | static cJSON *detach_item_from_array(cJSON *array, size_t which) |
no outgoing calls
no test coverage detected