Lines Matching defs:string

38 #include <string.h>
66 static unsigned char* cJSONUtils_strdup(const unsigned char* const string)
71 length = strlen((const char*)string) + sizeof("");
77 memcpy(copy, string, length);
82 /* string comparison which doesn't consider NULL pointers equal */
149 /* one string has ended, the other not */
156 /* calculate the length of a string if encoded as JSON pointer with ~0 and ~1 escape sequences */
157 static size_t pointer_encoded_length(const unsigned char *string)
160 for (length = 0; *string != '\0'; (void)string++, length++)
163 if ((*string == '~') || (*string == '/'))
172 /* copy a string while escaping '~' and '/' with ~0 and ~1 JSON pointer escape codes */
242 unsigned char *full_pointer = (unsigned char*)cJSON_malloc(strlen((char*)target_pointer) + pointer_encoded_length((unsigned char*)current_child->string) + 2);
244 encode_string_as_pointer(full_pointer + 1, (unsigned char*)current_child->string);
328 while ((current_element != NULL) && !compare_pointers((unsigned char*)current_element->string, (const unsigned char*)pointer, case_sensitive))
338 /* skip to the next path token or end of string */
359 static void decode_pointer_inplace(unsigned char *string)
361 unsigned char *decoded_string = string;
363 if (string == NULL) {
367 for (; *string; (void)decoded_string++, string++)
369 if (string[0] == '~')
371 if (string[1] == '0')
375 else if (string[1] == '1')
385 string++;
498 while ((current_item != NULL) && (current_item->next != NULL) && (compare_strings((unsigned char*)current_item->string, (unsigned char*)current_item->next->string, case_sensitive) < 0))
538 if (compare_strings((unsigned char*)first->string, (unsigned char*)second->string, case_sensitive) < 0)
642 /* string mismatch. */
679 if (compare_strings((unsigned char*)a->string, (unsigned char*)b->string, case_sensitive))
808 if (root->string != NULL)
810 cJSON_free(root->string);
892 /* the string "value" isn't needed */
893 if (object->string != NULL)
895 cJSON_free(object->string);
896 object->string = NULL;
1255 diff = compare_strings((unsigned char*)from_child->string, (unsigned char*)to_child->string, case_sensitive);
1262 size_t from_child_name_length = pointer_encoded_length((unsigned char*)from_child->string);
1266 encode_string_as_pointer(new_path + path_length + 1, (unsigned char*)from_child->string);
1278 compose_patch(patches, (const unsigned char*)"remove", path, (unsigned char*)from_child->string, NULL);
1285 compose_patch(patches, (const unsigned char*)"add", path, (unsigned char*)to_child->string, to_child);
1363 cJSON_DeleteItemFromObjectCaseSensitive(target, patch_child->string);
1367 cJSON_DeleteItemFromObject(target, patch_child->string);
1377 replace_me = cJSON_DetachItemFromObjectCaseSensitive(target, patch_child->string);
1381 replace_me = cJSON_DetachItemFromObject(target, patch_child->string);
1391 cJSON_AddItemToObject(target, patch_child->string, replacement);
1440 diff = strcmp(from_child->string, to_child->string);
1455 cJSON_AddItemToObject(patch, from_child->string, cJSON_CreateNull());
1462 cJSON_AddItemToObject(patch, to_child->string, cJSON_Duplicate(to_child, 1));
1472 cJSON_AddItemToObject(patch, to_child->string, cJSONUtils_GenerateMergePatch(from_child, to_child));