Max Bruckner
bb2f868126
refactor cJSONUtils_GenerateMergePatch
2017-05-02 01:30:58 +02:00
Max Bruckner
11b8a8cd76
refactor cJSONUtils_MergePatch
2017-05-02 01:30:58 +02:00
Max Bruckner
01d656bebc
refactor cJSONUtils_SortObject
2017-05-02 01:30:58 +02:00
Max Bruckner
7bf62ff4dc
refactor cJSONUtils_SortList
2017-05-02 01:30:58 +02:00
Max Bruckner
f030058183
refactor cJSONUtils_GeneratePatches
2017-05-02 01:30:58 +02:00
Max Bruckner
a67c24c451
refactor cJSONUtils_CompareToPatch
2017-05-02 01:30:58 +02:00
Max Bruckner
512c313111
refactor cJSONUtils_AddPatchToArray
2017-05-02 01:30:58 +02:00
Max Bruckner
e591d4173a
refactor cJSONUtils_GeneratePatch
2017-05-02 01:30:58 +02:00
Max Bruckner
bde341edd8
refactor cJSONUtils_ApplyPatches
2017-05-02 01:30:58 +02:00
Max Bruckner
48c97985d6
refactor cJSONUtils_ApplyPatch
2017-05-02 01:30:58 +02:00
Max Bruckner
63db67bfeb
refactor cJSONUtils_Compare
2017-05-02 01:30:58 +02:00
Max Bruckner
2040ce9004
refactor cJSONUtils_PatchDetach
2017-05-02 01:30:58 +02:00
Max Bruckner
4ba6bafe34
refactor cJSONUtils_InplaceDecodePointerString
2017-05-02 01:30:58 +02:00
Max Bruckner
378a333ee2
refactor cJSONUtils_GetPointer
2017-05-02 01:30:58 +02:00
Max Bruckner
4642d6575f
refactor decode_array_index_from_pointer
2017-05-02 01:30:58 +02:00
Max Bruckner
4932c80f26
refactor cJSONUtils_FindPointerFromObjectTo
2017-05-02 01:30:58 +02:00
Max Bruckner
674a678819
refactor cJSONUtils_PointerEncodedstrcpy
2017-05-02 01:30:58 +02:00
Max Bruckner
b8e3673d0f
refactor cJSONUtils_PointerEncodedstrlen
2017-05-02 01:30:58 +02:00
Max Bruckner
b16bcc3c19
refactor cJSONUtils_Pstrcasecmp
2017-05-02 01:30:58 +02:00
Max Bruckner
44d313212b
refactor cJSONUtils_strcasecmp
2017-05-02 01:30:58 +02:00
Max Bruckner
055c7007e5
refactor cJSONUtils_strdup
2017-05-02 01:30:58 +02:00
Max Bruckner
ee3c3bc80e
cJSONUtils_GeneratePatches: Fix multiple removes in arrays
2017-04-27 21:32:18 +02:00
Max Bruckner
609bb75421
cJSON_Utils: Use cJSON_free and cJSON_malloc
2017-04-12 21:28:31 +02:00
Max Bruckner
134ebf5e89
cJSONUtils_ApplyPatches: Handle replacement of root
2017-04-12 20:50:04 +02:00
Max Bruckner
d67b008d4b
decode_array_index_from_pointer: parse manually
...
This allows checking for leading zeroes and invalid characters after the index
2017-04-12 12:06:27 +02:00
Max Bruckner
c66342d871
cJSON_Utils: Use enum for opcode
2017-04-12 11:36:14 +02:00
Max Bruckner
c960b2b853
cJSON_Utils: Fix size_t support of cJSONUtils_GetPointer
2017-04-12 11:21:48 +02:00
Max Bruckner
3056d85f01
cJSON_Utils: Use new helper function
2017-04-12 11:21:21 +02:00
Max Bruckner
b470d918f3
cJSONUtils: add decode_array_index_from_pointer as common helper function
2017-04-12 11:07:21 +02:00
Max Bruckner
8efb287ae2
cJSONUtils_ApplyPatches: Fail if removal failed
2017-04-12 10:44:29 +02:00
Max Bruckner
a1602f484b
cJSONUtils_ApplyPatches: Don't accept invalid array indices
2017-04-12 10:34:15 +02:00
Max Bruckner
d058a9cd8f
cJSON_ApplyPatches: Don't allow adding to array out of bounds
2017-04-11 17:40:43 +02:00
Max Bruckner
62ba68fc7d
cJSONUtils_ApplyPatches: Fix not accepting arrays
...
This was completely broken, arrays weren't accepted.
2017-04-11 16:38:51 +02:00
Max Bruckner
281df6997c
Update copyright
2017-04-08 17:56:27 +02:00
Max Bruckner
795c3acabe
cJSON_Utils: Fix potential null pointer dereference
...
Found by coverity
2017-04-05 17:36:25 +02:00
Max Bruckner
466eb8e3f8
Fix wconversion with old gcc (e.g. 4.3)
2017-03-18 17:52:04 +01:00
Max Bruckner
5f783fff11
cJSON_Utils: Add gcc pragma to use default visibility for system headers
2017-03-03 00:45:50 +01:00
Max Bruckner
b056d7cb74
Add -Wcomma compiler flag
2017-03-01 11:57:06 +01:00
Max Bruckner
024f690289
Merge pull request #116 from mjerris/fschanges
...
add CJSON_DECLARE macros to support gcc visibility and windows dllexport
2017-02-27 21:51:55 +01:00
Mike Jerris
039b1cc653
add CJSON_PUBLIC macro to public functions to support visibility and dllimport/dllexport
2017-02-27 13:47:06 -06:00
Max Bruckner
ed8dc53699
cJSON_Utils: Use new typecheck functions
2017-02-26 21:26:34 +01:00
Max Bruckner
c3bd4463be
cJSON_Utils: Guard use of %lu format string for size_t
2017-02-15 13:09:32 +01:00
Max Bruckner
9d7e8f1175
cJSON_Utils: Add casts to unsigned long, fix #103
...
Thanks @rrvirtual for the suggestion.
2017-02-09 15:09:06 +01:00
Max Bruckner
4047de4f6e
fix potential NULL dereferences found by coverity
2017-02-08 03:00:44 +01:00
Max Bruckner
9ed906758e
fix null pointer dereferences found by coverity
2017-02-07 19:07:18 +01:00
Max Bruckner
3d3bfc6a4d
Compiler flag -Wconversion
...
Makes type conversions explicit, if they alter a value
2017-02-03 18:36:13 +01:00
Max Bruckner
ecd5678527
Change all internal sizes to size_t
2017-02-03 18:36:12 +01:00
Max Bruckner
28b9ba4334
Change all internal strings to unsigned char*
2017-02-03 15:59:00 +01:00
Max Bruckner
ff0681e4fd
Utils: PatchDetach: Check for invalid patch string
2017-01-30 19:30:16 +01:00
Max Bruckner
a2309a509d
Utils: InplaceDecodePointerString: Check for NULL
2017-01-30 19:29:52 +01:00
Max Bruckner
b88da9b0de
Initialize all variables
2016-11-19 17:29:21 +07:00
Max Bruckner
a5ff796c20
Replace 0 with more expressive NULL or '\0'
2016-11-19 17:28:14 +07:00
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.
2016-11-18 22:52:52 +07:00
Max Bruckner
1dff6f160f
cJSON_Utils: own strdup for C89 compatibility
2016-11-08 00:57:57 +07:00
Max Bruckner
c0b17dc651
reformatting: cJSONUtils_GenerateMergePatch
2016-10-29 22:44:45 +07:00
Max Bruckner
01a813f642
reformatting: cJSONUtils_MergePatch
2016-10-29 22:44:45 +07:00
Max Bruckner
c65514fcb4
reformatting: cJSONUtils_SortObject
2016-10-29 22:44:44 +07:00
Max Bruckner
8964287ec4
reformatting: cJSONUtils_SortList
2016-10-29 22:44:44 +07:00
Max Bruckner
ec9d1cfedb
reformatting: cJSONUtils_GeneratePatches
2016-10-29 22:44:44 +07:00
Max Bruckner
8879ed5dbc
reformatting: cJSONUtils_CompareToPatch
2016-10-29 22:44:44 +07:00
Max Bruckner
52e53acfc3
reformatting: cJSON_AddPatchToArray
2016-10-29 22:44:43 +07:00
Max Bruckner
d6a6abeca0
reformatting: cJSONUtils_GeneratePatch
2016-10-29 22:44:43 +07:00
Max Bruckner
e8a67f0e4b
reformatting: cJSONUtils_ApplyPatches
2016-10-29 22:44:43 +07:00
Max Bruckner
d883f9b9b0
reformatting: cJSONUtils_ApplyPatch
2016-10-29 22:44:43 +07:00
Max Bruckner
284a8017b7
reformatting: cJSONUtils_Compare
2016-10-29 22:44:43 +07:00
Max Bruckner
1235c62235
reformatting: cJSONUtils_PatchDetach
2016-10-29 22:44:42 +07:00
Max Bruckner
a21a124d40
reformatting: cJSONUtils_InplaceDecodePointerString
2016-10-29 22:44:42 +07:00
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.
2016-10-29 22:42:04 +07:00
Max Bruckner
158ddceab3
reformatting: cJSONUtils_FindPointerFromObjectTo
2016-10-14 00:05:58 +07:00
Max Bruckner
7771225e35
reformatting: cJSONUtils_PointerEncodedstrcpy
2016-10-13 23:47:40 +07:00
Max Bruckner
3f6716e63a
reformatting: cJSONUtils_PointerEncodedstrlen
2016-10-13 23:42:34 +07:00
Max Bruckner
2f002879c0
reformatting: cJSONUtils_Pstrcasecmp
2016-10-13 23:40:02 +07:00
Max Bruckner
cb6445f47b
reformatting: cJSON_strcasecmp
2016-10-13 23:26:53 +07:00
Dave Gamble
3a7bd6924a
Utility function to generate the patch between two objects.
2016-05-29 18:16:19 +01:00
Dave Gamble
e79fa9472b
cJSONUtils_MergePatch with tests from the RFC.
2016-05-29 17:39:54 +01:00
Kevin Branigan
361b9a58cb
Merge pull request #19 from FSMaxB/fix_boolean
...
fix boolean expression
2015-10-18 17:03:47 -04:00
Max Bruckner
58bc383b28
fix memory leaks
2015-10-14 11:02:56 +02:00
Max Bruckner
ec71726ef8
fix boolean expression
...
This expression was always false.
2015-10-13 20:33:37 +02:00
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
2015-02-13 20:33:06 +00:00
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
2015-02-13 20:31:33 +00:00
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
2015-02-13 19:53:27 +00:00
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
2015-02-13 19:19:26 +00:00
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
2015-02-11 01:29:40 +00:00
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
2015-02-10 14:17:59 +00:00
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
2015-02-10 12:14:59 +00:00
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
2015-02-09 18:29:05 +00:00