418 Commits

Author SHA1 Message Date
Max Bruckner
08738673be Reorder the context fields 2018-03-25 23:32:03 +02:00
Max Bruckner
1b001ab047 parse: Pull length calculation out. 2018-03-25 23:32:03 +02:00
Max Bruckner
409c2aaea7 cJSON_MakeDuplicateRecursive 2018-03-25 23:32:03 +02:00
Max Bruckner
e8f56bd194 Context: Add duplicate_recursive for cJSON_Duplicate 2018-03-25 23:32:03 +02:00
Max Bruckner
064eec8208 Change name from Configuration to Context 2018-03-25 23:32:03 +02:00
Max Bruckner
050f982608 cJSON_DuplicateConfiguration 2018-03-25 23:32:03 +02:00
Max Bruckner
d2d19127d3 cJSON_ConfigurationChangeParseEnd -> cJSON_ConfigurationGetParseEnd
This is probably a better approach than potentially having a pointer
that points to garbage on the stack and gets written to by cJSON.
2018-03-25 23:32:03 +02:00
Max Bruckner
691a83a479 cJSON_CreateConfig: Don't allow configuration, always use default 2018-03-25 23:32:03 +02:00
Max Bruckner
ae9dc3e7db cJSON_ConfigurationChangeAllowDataAfterJson 2018-03-25 23:32:03 +02:00
Max Bruckner
eeaaaac63e cJSON_ConfigurationChangeCaseSensitivity 2018-03-25 23:32:03 +02:00
Max Bruckner
78b5bed9a0 cJSON_ConfigurationChangeFormat 2018-03-25 23:32:03 +02:00
Max Bruckner
1a8f732749 cJSON_ConfigurationChangePrebufferSize 2018-03-25 23:32:03 +02:00
Max Bruckner
88c39fa2e4 cJSON_ConfigurationChangeParseEnd
Add a pointer to an end position of parsing to the cJSON_Configuration
object. (Essentially like return_parse_end, but as offset instead of
pointer).
2018-03-25 23:32:03 +02:00
Max Bruckner
9d801d64ea cJSON_CreateConfiguration, cJSON_ConfigurationChange{Allocators,Userdata} 2018-03-25 23:32:03 +02:00
Max Bruckner
877fac0f90 allocation helpers for allocating with a configuration 2018-03-25 23:32:03 +02:00
Max Bruckner
98e0b586ca Add cJSON_Allocators new style allocator struct 2018-03-25 23:32:03 +02:00
Max Bruckner
dd1ba72ce2 cJSON_Compare: Extract compare with internal_configuration 2018-03-25 23:32:03 +02:00
Max Bruckner
515d11f55a default_configuration: Macro for the internal_configuration defaults 2018-03-25 23:32:03 +02:00
Max Bruckner
ba8fe0f479 internal_configuration: Add case_sensitive 2018-03-25 23:32:03 +02:00
Max Bruckner
f02f79ecbb cJSON_ParseWithOpts: Extract pasrse with internal_configuration
Also introduces a allow_data_after_json property in the internal
configuration.
2018-03-25 23:32:03 +02:00
Max Bruckner
d4e81cfe57 cJSON_Delete: Extract delete_item with internal_configuration 2018-03-25 23:32:03 +02:00
Max Bruckner
7030dc7c5b Put buffer_size into internal_configuration 2018-03-25 23:32:03 +02:00
Max Bruckner
27977adc93 Put format into internal_configuration 2018-03-25 23:32:03 +02:00
Max Bruckner
677f0cb1bb Rename internal_hooks -> internal_configuration, cJSON_New_item -> create_item 2018-03-25 23:32:03 +02:00
Max Bruckner
fd5281bdd8 cJSON: cjson_min: Wrap arguments in parentheses 2018-03-25 15:12:15 +02:00
Max Bruckner
1f4044a707 cJSON.c: Remove unused cast 2018-03-25 15:11:56 +02:00
Max Bruckner
08a2ad3c59 is_{nan,infinity}: Wrap macro arguments in parentheses 2018-03-25 14:25:46 +02:00
Max Bruckner
b06fb10f94 cJSON.c: Remove unnecessary includes 2018-03-25 14:20:48 +02:00
Max Bruckner
ce5f31ac47 Remove superfluous null checks in can_read/access_at_index macros 2018-03-25 13:01:49 +02:00
Max Bruckner
0715259635 cJSON_Compare: Performance improvement for objects
Check the size to prevent comparing objects equal if they are prefixes
of each other.
2018-03-25 13:01:10 +02:00
Max Bruckner
f4cc4d7c63 parse_value: Check only first character at first
This should improve performance
2018-03-25 13:01:10 +02:00
Max Bruckner
952b1017ab print_number: Introduce fast path for integers.
Thanks @Tangerino for suggesting this optimisation.
2018-03-25 13:01:10 +02:00
Max Bruckner
0914640d79 Extract helper: double_to_saturated_integer 2018-03-25 13:01:10 +02:00
Max Bruckner
5ed383a0d1 is_nan and is_infinity macros 2018-03-25 13:01:06 +02:00
Max Bruckner
b2bbc11d44 Fix #234: Different argument names between declaration and definition 2018-03-25 13:00:12 +02:00
Max Bruckner
06f4152008 print: Comment about why the buffer is reallocated 2018-03-25 13:00:12 +02:00
Max Bruckner
0e0c463491 Release version 1.7.5 2018-03-22 20:29:17 +01:00
Max Bruckner
5da9edc8b1 Release version 1.7.4 2018-03-02 19:57:36 +01:00
Max Bruckner
22a7d04fa0 add_item_to_object: Fix use-after-free when string is aliased
If the `string` property of the item that is added is an alias to the
`string` parameter of `add_item_to_object`, and `constant` is false,
`cJSON_strdup` would access the string after it has been freed.

Thanks @hhallen for reporting this in #248.
2018-03-02 19:49:55 +01:00
Max Bruckner
a559eac472 Release version 1.7.3 2018-02-07 21:16:35 +01:00
Max Bruckner
d514bb866e Fix #241, potential double free 2018-02-07 19:36:59 +01:00
Max Bruckner
27caa364b0 Release version 1.7.2 2018-02-06 11:38:41 +01:00
Max Bruckner
b60b5d3744 Update version to 1.7.1 2018-01-09 21:59:42 +01:00
Max Bruckner
4d84acf926 print_number: fix Off-By-One error
Thanks @liuyunbin for reporting this in #230
2018-01-09 21:40:55 +01:00
Max Bruckner
28d4410f42 print: fix: realloc was allocating too much memory
Thanks @liuyunbin for reporting this in #230
2018-01-09 20:53:33 +01:00
Max Bruckner
f33fa95f3d print: Fix default buffer size in printbuffer
Thanks @liuyunbin for reporting this in #230
2018-01-09 20:49:03 +01:00
Max Bruckner
13a2d337a8 Update version number to 1.7 2017-12-31 02:03:40 +01:00
Max Bruckner
5865faffa3 Convert cJSON_Add...ToObject macros into functions
These functions return the added object. Functions to add objects and
arrays have also been added.
2017-12-28 23:56:39 +01:00
Max Bruckner
de729a1635 Extract add_item_to_object function that returns a boolean 2017-12-28 21:40:24 +01:00
Max Bruckner
55c597c719 add_item_to_array with boolean return value 2017-12-28 12:45:28 +01:00