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