Max Bruckner
c3bd4463be
cJSON_Utils: Guard use of %lu format string for size_t
8 years ago
Max Bruckner
9d7e8f1175
cJSON_Utils: Add casts to unsigned long, fix #103
Thanks @rrvirtual for the suggestion.
8 years ago
Max Bruckner
4047de4f6e
fix potential NULL dereferences found by coverity
8 years ago
Max Bruckner
9ed906758e
fix null pointer dereferences found by coverity
8 years ago
Max Bruckner
3d3bfc6a4d
Compiler flag -Wconversion
Makes type conversions explicit, if they alter a value
8 years ago
Max Bruckner
ecd5678527
Change all internal sizes to size_t
8 years ago
Max Bruckner
28b9ba4334
Change all internal strings to unsigned char*
8 years ago
Max Bruckner
ff0681e4fd
Utils: PatchDetach: Check for invalid patch string
8 years ago
Max Bruckner
a2309a509d
Utils: InplaceDecodePointerString: Check for NULL
8 years ago
Max Bruckner
b88da9b0de
Initialize all variables
8 years ago
Max Bruckner
a5ff796c20
Replace 0 with more expressive NULL or '\0'
8 years ago
Max Bruckner
d47339e274
cJSON_Utils: Fix comparing of cJSON_ types
When comparing the type, it has to be masked with 0xFF because of
cJSON_IsConst and cJSON_IsReference.
8 years ago
Max Bruckner
1dff6f160f
cJSON_Utils: own strdup for C89 compatibility
8 years ago
Max Bruckner
c0b17dc651
reformatting: cJSONUtils_GenerateMergePatch
8 years ago
Max Bruckner
01a813f642
reformatting: cJSONUtils_MergePatch
8 years ago
Max Bruckner
c65514fcb4
reformatting: cJSONUtils_SortObject
8 years ago
Max Bruckner
8964287ec4
reformatting: cJSONUtils_SortList
8 years ago
Max Bruckner
ec9d1cfedb
reformatting: cJSONUtils_GeneratePatches
8 years ago
Max Bruckner
8879ed5dbc
reformatting: cJSONUtils_CompareToPatch
8 years ago
Max Bruckner
52e53acfc3
reformatting: cJSON_AddPatchToArray
8 years ago
Max Bruckner
d6a6abeca0
reformatting: cJSONUtils_GeneratePatch
8 years ago
Max Bruckner
e8a67f0e4b
reformatting: cJSONUtils_ApplyPatches
8 years ago
Max Bruckner
d883f9b9b0
reformatting: cJSONUtils_ApplyPatch
8 years ago
Max Bruckner
284a8017b7
reformatting: cJSONUtils_Compare
8 years ago
Max Bruckner
1235c62235
reformatting: cJSONUtils_PatchDetach
8 years ago
Max Bruckner
a21a124d40
reformatting: cJSONUtils_InplaceDecodePointerString
8 years ago
Max Bruckner
5713edb710
reformatting: cJSON_Utils_GetPointer
NOTE: This can change the assembly slightly, in my case it reordered two
instructions. This is due to the change from:
which = (10 * which) + *pointer++ - '0';
to
which = (10 * which) + (*pointer++ - '0');
This means that after the change, the subtraction runs before the
addition instead of after that. That shouldn't change the behavior
though.
8 years ago
Max Bruckner
158ddceab3
reformatting: cJSONUtils_FindPointerFromObjectTo
8 years ago
Max Bruckner
7771225e35
reformatting: cJSONUtils_PointerEncodedstrcpy
8 years ago
Max Bruckner
3f6716e63a
reformatting: cJSONUtils_PointerEncodedstrlen
8 years ago
Max Bruckner
2f002879c0
reformatting: cJSONUtils_Pstrcasecmp
8 years ago
Max Bruckner
cb6445f47b
reformatting: cJSON_strcasecmp
8 years ago
Dave Gamble
3a7bd6924a
Utility function to generate the patch between two objects.
9 years ago
Dave Gamble
e79fa9472b
cJSONUtils_MergePatch with tests from the RFC.
9 years ago
Max Bruckner
58bc383b28
fix memory leaks
9 years ago
Max Bruckner
ec71726ef8
fix boolean expression
This expression was always false.
9 years ago
Dave Gamble
8004ed3115
Fix bug with the sort.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@73 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
174c62902c
Since we anticipate repeated comparisons, add in a test for sorted lists, which can reduce
cost for sorted objects to O(N)
git-svn-id: svn://svn.code.sf.net/p/cjson/code@72 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
491cf029b2
Rework cJSON_Utils object compare functions to use an O(N) algorithm on sorted lists.
It's a bit of a shame to use the sorts, because cJSON is otherwise incredibly stable (json->cJSON->json is unmodified modulo formatting),
but it means we get usable performance, rather than O(N^2) which will make CPUs cry.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@71 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
c4ddd7aaa3
Correct comment and variable declaration style to be more compatible. Added cJSONUtils_SortObject for sorting the members of an object alphabetically.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@70 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
060e6563c0
Add more patch functionality and some more utils.
Also add a new #define to cJSON.h for SetNumberValue.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@66 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
3c6b3cc617
start of JSON Patch implementation. cJSON gained a cJSON_InsertItemToArray which pushes elements up by one.
This is needed for JSON Patch. Everything but Test is implemented for ApplyPatches.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@65 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
858671cc7f
rework cJSONUtils_GetPointer to avoid malloc/free by using strcmp with pointer-encoding awareness.
git-svn-id: svn://svn.code.sf.net/p/cjson/code@64 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago
Dave Gamble
c0f5e2056b
add cJSON_Utils which includes JSON Pointer implementation
git-svn-id: svn://svn.code.sf.net/p/cjson/code@63 e3330c51-1366-4df0-8b21-3ccf24e3d50e
10 years ago