The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

external/cjson: Update cJSON from upstream v1.7.15

GitOrigin-RevId: d348621ca93571343a56862df7de4ff3bc9b5667

+451 -247
+209 -172
src/external/cjson/cjson/CHANGELOG.md
··· 1 - 1.7.12 1 + 1.7.15 (Aug 25, 2021) 2 2 ====== 3 3 Fixes: 4 4 ------ 5 - * Fix infinite loop in `cJSON_Minify` (potential Denial of Service), thanks @Alanscut for reporting. See #354 6 - * Fix link error for Visual Studio. Thanks @tan-wei, see #352 7 - * Undefine `true` and `false` for `cJSON_Utils` before redefining them. Thanks @raiden00pl, see #347 5 + * Fix potential core dumped for strrchr, see [#546](https://github.com/DaveGamble/cJSON/pull/546) 6 + * Fix null pointer crash in cJSON_CreateXxArray, see [#538](https://github.com/DaveGamble/cJSON/pull/538) 7 + * Fix several null pointer problems on allocation failure, see [#526](https://github.com/DaveGamble/cJSON/pull/526) 8 + * Fix a possible dereference of null pointer, see [#519](https://github.com/DaveGamble/cJSON/pull/519) 9 + * Fix windows build failure about defining nan, see [#518](https://github.com/DaveGamble/cJSON/pull/518) 8 10 11 + 1.7.14 (Sep 3, 2020) 12 + ====== 13 + Fixes: 14 + ------ 15 + * optimize the way to find tail node, see [#503](https://github.com/DaveGamble/cJSON/pull/503) 16 + * Fix WError error on macosx because NAN is a float. Thanks @sappo, see [#484](https://github.com/DaveGamble/cJSON/pull/484) 17 + * Fix some bugs in detach and replace. Thanks @miaoerduo, see [#456](https://github.com/DaveGamble/cJSON/pull/456) 9 18 10 - 1.7.11 19 + 1.7.13 (Apr 2, 2020) 11 20 ====== 21 + Features: 22 + --------- 23 + * add new API of cJSON_ParseWithLength without breaking changes. Thanks @caglarivriz, see [#358](https://github.com/DaveGamble/cJSON/pull/358) 24 + * add new API of cJSON_GetNumberValue. Thanks @Intuition, see[#385](https://github.com/DaveGamble/cJSON/pull/385) 25 + * add uninstall target function for CMake. See [#402](https://github.com/DaveGamble/cJSON/pull/402) 26 + * Improve performance of adding item to array. Thanks @xiaomianhehe, see [#430](https://github.com/DaveGamble/cJSON/pull/430), [#448](https://github.com/DaveGamble/cJSON/pull/448) 27 + * add new API of cJSON_SetValuestring, for changing the valuestring safely. See [#451](https://github.com/DaveGamble/cJSON/pull/451) 28 + * add return value for cJSON_AddItemTo... and cJSON_ReplaceItem... (check if the operation successful). See [#453](https://github.com/DaveGamble/cJSON/pull/453) 29 + 12 30 Fixes: 13 31 ------ 14 - * Fix a bug where cJSON_Minify could overflow it's buffer, both reading and writing. This is a security issue. (see #338). Big thanks @bigric3 for reporting. 15 - * Unset `true` and `false` macros before setting them if they exist. See #339, thanks @raiden00pl for reporting 32 + * Fix clang -Wfloat-equal warning. Thanks @paulmalovanyi, see [#368](https://github.com/DaveGamble/cJSON/pull/368) 33 + * Fix make failed in mac os. See [#405](https://github.com/DaveGamble/cJSON/pull/405) 34 + * Fix memory leak in cJSONUtils_FindPointerFromObjectTo. Thanks @andywolk for reporting, see [#414](https://github.com/DaveGamble/cJSON/issues/414) 35 + * Fix bug in encode_string_as_pointer. Thanks @AIChangJiang for reporting, see [#439](https://github.com/DaveGamble/cJSON/issues/439) 16 36 17 - 1.7.10 37 + 1.7.12 (May 17, 2019) 18 38 ====== 19 39 Fixes: 20 40 ------ 21 - * Fix package config file for `libcjson`. Thanks @shiluotang for reporting (#321) 22 - * Correctly split lists in `cJSON_Utils`'s merge sort. Thanks @andysCaplin for the fix (#322) 41 + * Fix infinite loop in `cJSON_Minify` (potential Denial of Service). Thanks @Alanscut for reporting, see [#354](https://github.com/DaveGamble/cJSON/issues/354) 42 + * Fix link error for Visual Studio. Thanks @tan-wei, see [#352](https://github.com/DaveGamble/cJSON/pull/352). 43 + * Undefine `true` and `false` for `cJSON_Utils` before redefining them. Thanks @raiden00pl, see [#347](https://github.com/DaveGamble/cJSON/pull/347). 23 44 24 - 1.7.9 25 - ===== 45 + 1.7.11 (Apr 15, 2019) 46 + ====== 26 47 Fixes: 27 48 ------ 28 - * Fix a bug where `cJSON_GetObjectItemCaseSensitive` would pass a nullpointer to `strcmp` when called on an array (#315). Thanks @yuweol for reporting. 29 - * Fix error in `cJSON_Utils` where the case sensitivity was not respected (#317). Thanks @yuta-oxo for fixing. 30 - * Fix some warnings detected by the Visual Studio Static Analyzer (#307). Thanks @bnason-nf 49 + * Fix a bug where cJSON_Minify could overflow it's buffer, both reading and writing. This is a security issue, see [#338](https://github.com/DaveGamble/cJSON/issues/338). Big thanks @bigric3 for reporting. 50 + * Unset `true` and `false` macros before setting them if they exist. See [#339](https://github.com/DaveGamble/cJSON/issues/339), thanks @raiden00pl for reporting 31 51 32 - 1.7.8 52 + 1.7.10 (Dec 21, 2018) 53 + ====== 54 + Fixes: 55 + ------ 56 + * Fix package config file for `libcjson`. Thanks @shiluotang for reporting [#321](https://github.com/DaveGamble/cJSON/issues/321) 57 + * Correctly split lists in `cJSON_Utils`'s merge sort. Thanks @andysCaplin for the fix [#322](https://github.com/DaveGamble/cJSON/issues/322) 58 + 59 + 1.7.9 (Dec 16, 2018) 33 60 ===== 34 61 Fixes: 35 62 ------ 36 - * cJSON now works with the `__stdcall` calling convention on Windows, see #295, thanks @zhindes for contributing 63 + * Fix a bug where `cJSON_GetObjectItemCaseSensitive` would pass a nullpointer to `strcmp` when called on an array, see [#315](https://github.com/DaveGamble/cJSON/issues/315). Thanks @yuweol for reporting. 64 + * Fix error in `cJSON_Utils` where the case sensitivity was not respected, see [#317](https://github.com/DaveGamble/cJSON/pull/317). Thanks @yuta-oxo for fixing. 65 + * Fix some warnings detected by the Visual Studio Static Analyzer, see [#307](https://github.com/DaveGamble/cJSON/pull/307). Thanks @bnason-nf 37 66 38 - 1.7.7 67 + 1.7.8 (Sep 22, 2018) 68 + ====== 69 + Fixes: 70 + ------ 71 + * cJSON now works with the `__stdcall` calling convention on Windows, see [#295](https://github.com/DaveGamble/cJSON/pull/295), thanks @zhindes for contributing 72 + 73 + 1.7.7 (May 22, 2018) 39 74 ===== 40 75 Fixes: 41 76 ------ 42 - * Fix a memory leak when realloc fails (see #267), thanks @AlfieDeng for reporting 43 - * Fix a typo in the header file (see #266), thanks @zhaozhixu 77 + * Fix a memory leak when realloc fails, see [#267](https://github.com/DaveGamble/cJSON/issues/267), thanks @AlfieDeng for reporting 78 + * Fix a typo in the header file, see [#266](https://github.com/DaveGamble/cJSON/pull/266), thanks @zhaozhixu 44 79 45 - 1.7.6 80 + 1.7.6 (Apr 13, 2018) 46 81 ===== 47 82 Fixes: 48 83 ------ 49 - * Add `SONAME` to the ELF files built by the Makefile (see #252), thanks @YanhaoMo for reporting 50 - * Add include guards and `extern "C"` to `cJSON_Utils.h` (see #256), thanks @daschfg for reporting 84 + * Add `SONAME` to the ELF files built by the Makefile, see [#252](https://github.com/DaveGamble/cJSON/issues/252), thanks @YanhaoMo for reporting 85 + * Add include guards and `extern "C"` to `cJSON_Utils.h`, see [#256](https://github.com/DaveGamble/cJSON/issues/256), thanks @daschfg for reporting 51 86 52 87 Other changes: 53 - -------------- 54 88 * Mark the Makefile as deprecated in the README. 55 89 56 - 1.7.5 90 + 1.7.5 (Mar 23, 2018) 57 91 ===== 58 92 Fixes: 59 93 ------ 60 - * Fix a bug in the JSON Patch implementation of `cJSON Utils` (see #251), thanks @bobkocisko. 94 + * Fix a bug in the JSON Patch implementation of `cJSON Utils`, see [#251](https://github.com/DaveGamble/cJSON/pull/251), thanks @bobkocisko. 61 95 62 - 1.7.4 96 + 1.7.4 (Mar 3, 2018) 63 97 ===== 64 98 Fixes: 65 99 ------ 66 - * Fix potential use after free if the `string` parameter to `cJSON_AddItemToObject` is an alias of the `string` property of the object that is added (#248). Thanks @hhallen for reporting. 100 + * Fix potential use after free if the `string` parameter to `cJSON_AddItemToObject` is an alias of the `string` property of the object that is added,see [#248](https://github.com/DaveGamble/cJSON/issues/248). Thanks @hhallen for reporting. 67 101 68 - 1.7.3 102 + 1.7.3 (Feb 8, 2018) 69 103 ===== 70 104 Fixes: 71 105 ------ 72 - * Fix potential double free, thanks @projectgus for reporting (see #241) 106 + * Fix potential double free, thanks @projectgus for reporting [#241](https://github.com/DaveGamble/cJSON/issues/241) 73 107 74 - 1.7.2 108 + 1.7.2 (Feb 6, 2018) 75 109 ===== 76 110 Fixes: 77 111 ------ 78 - * Fix the use of GNUInstallDirs variables and the pkgconfig file. Thanks @zeerd for reporting (see #240) 112 + * Fix the use of GNUInstallDirs variables and the pkgconfig file. Thanks @zeerd for reporting [#240](https://github.com/DaveGamble/cJSON/pull/240) 79 113 80 - 1.7.1 114 + 1.7.1 (Jan 10, 2018) 81 115 ===== 82 116 Fixes: 83 117 ------ 84 - * Fixed an Off-By-One error that could lead to an out of bounds write. Thanks @liuyunbin for reporting (see #230) 85 - * Fixed two errors with buffered printing. Thanks @liuyunbin for reporting (see #230) 118 + * Fixed an Off-By-One error that could lead to an out of bounds write. Thanks @liuyunbin for reporting [#230](https://github.com/DaveGamble/cJSON/issues/230) 119 + * Fixed two errors with buffered printing. Thanks @liuyunbin for reporting [#230](https://github.com/DaveGamble/cJSON/issues/230) 86 120 87 - 1.7.0 121 + 1.7.0 (Dec 31, 2017) 88 122 ===== 89 123 Features: 90 124 --------- 91 - * Large rewrite of the documentation, see #215 125 + * Large rewrite of the documentation, see [#215](https://github.com/DaveGamble/cJSON/pull/215) 92 126 * Added the `cJSON_GetStringValue` function 93 127 * Added the `cJSON_CreateStringReference` function 94 128 * Added the `cJSON_CreateArrayReference` function 95 129 * Added the `cJSON_CreateObjectReference` function 96 - * The `cJSON_Add...ToObject` macros are now functions that return a pointer to the added item, see #226 130 + * The `cJSON_Add...ToObject` macros are now functions that return a pointer to the added item, see [#226](https://github.com/DaveGamble/cJSON/pull/226) 97 131 98 132 Fixes: 99 133 ------ 100 - * Fix a problem with `GNUInstallDirs` in the CMakeLists.txt, thanks @yangfl, see #210 101 - * Fix linking the tests when building as static library, see #213 102 - * New overrides for the CMake option `BUILD_SHARED_LIBS`, see #207 134 + * Fix a problem with `GNUInstallDirs` in the CMakeLists.txt, thanks @yangfl, see [#210](https://github.com/DaveGamble/cJSON/pull/210) 135 + * Fix linking the tests when building as static library, see [#213](https://github.com/DaveGamble/cJSON/issues/213) 136 + * New overrides for the CMake option `BUILD_SHARED_LIBS`, see [#207](https://github.com/DaveGamble/cJSON/issues/207) 103 137 104 138 Other Changes: 105 139 -------------- 106 - * Readme: Explain how to include cJSON, see #211 107 - * Removed some trailing spaces in the code, thanks @yangfl, see#212 140 + * Readme: Explain how to include cJSON, see [#211](https://github.com/DaveGamble/cJSON/pull/211) 141 + * Removed some trailing spaces in the code, thanks @yangfl, see [#212](https://github.com/DaveGamble/cJSON/pull/212) 108 142 * Updated [Unity](https://github.com/ThrowTheSwitch/Unity) and [json-patch-tests](https://github.com/json-patch/json-patch-tests) 109 143 110 - 1.6.0 144 + 1.6.0 (Oct 9, 2017) 111 145 ===== 112 146 Features: 113 147 --------- 114 - * You can now build cJSON as both shared and static library at once with CMake using `-DBUILD_SHARED_AND_STATIC_LIBS=On`, see #178 115 - * UTF-8 byte order marks are now ignored, see #184 116 - * Locales can now be disabled with the option `-DENABLE_LOCALES=Off`, see #202, thanks @Casperinous 148 + * You can now build cJSON as both shared and static library at once with CMake using `-DBUILD_SHARED_AND_STATIC_LIBS=On`, see [#178](https://github.com/DaveGamble/cJSON/issues/178) 149 + * UTF-8 byte order marks are now ignored, see [#184](https://github.com/DaveGamble/cJSON/issues/184) 150 + * Locales can now be disabled with the option `-DENABLE_LOCALES=Off`, see [#202](https://github.com/DaveGamble/cJSON/issues/202), thanks @Casperinous 117 151 * Better support for MSVC and Visual Studio 118 152 119 153 Other Changes: ··· 122 156 * More number printing tests. 123 157 * Continuous integration testing with AppVeyor (semi automatic at this point), thanks @simon-p-r 124 158 125 - 1.5.9 159 + 1.5.9 (Sep 8, 2017) 126 160 ===== 127 - * Set the global error pointer even if `return_parse_end` is passed to `cJSON_ParseWithOpts`. See #200, thanks @rmallins 161 + Fixes: 162 + ------ 163 + * Set the global error pointer even if `return_parse_end` is passed to `cJSON_ParseWithOpts`, see [#200](https://github.com/DaveGamble/cJSON/pull/200), thanks @rmallins 128 164 129 - 1.5.8 165 + 1.5.8 (Aug 21, 2017) 130 166 ===== 131 - * Fix `make test` in the Makefile, thanks @YanhaoMo for reporting this (#195) 167 + Fixes: 168 + ------ 169 + * Fix `make test` in the Makefile, thanks @YanhaoMo for reporting this [#195](https://github.com/DaveGamble/cJSON/issues/195) 132 170 133 - 1.5.7 171 + 1.5.7 (Jul 13, 2017) 134 172 ===== 135 173 Fixes: 136 174 ------ 137 - * Fix a bug where realloc failing would return a pointer to an invalid memory address. This is a security issue as it could potentially be used by an attacker to write to arbitrary memory addresses. (see #189), fixed in (954d61e5e7cb9dc6c480fc28ac1cdceca07dd5bd), big thanks @timothyjohncarney for reporting this issue 138 - * Fix a spelling mistake in the AFL fuzzer dictionary (#185), thanks @jwilk 175 + * Fix a bug where realloc failing would return a pointer to an invalid memory address. This is a security issue as it could potentially be used by an attacker to write to arbitrary memory addresses, see [#189](https://github.com/DaveGamble/cJSON/issues/189), fixed in [954d61e](https://github.com/DaveGamble/cJSON/commit/954d61e5e7cb9dc6c480fc28ac1cdceca07dd5bd), big thanks @timothyjohncarney for reporting this issue 176 + * Fix a spelling mistake in the AFL fuzzer dictionary, see [#185](https://github.com/DaveGamble/cJSON/pull/185), thanks @jwilk 139 177 140 - 1.5.6 178 + 1.5.6 (Jun 28, 2017) 141 179 ===== 142 180 Fixes: 143 181 ------ 144 - * Make cJSON a lot more tolerant about passing NULL pointers to its functions, it should now fail safely instead of dereferencing the pointer. (#183) Thanks @msichal for reporting #182 182 + * Make cJSON a lot more tolerant about passing NULL pointers to its functions, it should now fail safely instead of dereferencing the pointer, see [#183](https://github.com/DaveGamble/cJSON/pull/183). Thanks @msichal for reporting [#182](https://github.com/DaveGamble/cJSON/issues/182) 145 183 146 - 1.5.5 184 + 1.5.5 (Jun 15, 2017) 147 185 ===== 148 186 Fixes: 149 187 ------ 150 - * Fix pointers to nested arrays in cJSON_Utils (9abe75e072050f34732a7169740989a082b65134) 151 - * Fix an error with case sensitivity handling in cJSON_Utils (b9cc911831b0b3e1bb72f142389428e59f882b38) 152 - * Fix cJSON_Compare for arrays that are prefixes of the other and objects that are a subset of the other (03ba72faec115160d1f3aea5582d9b6af5d3e473) See #180, thanks @zhengqb for reporting 188 + * Fix pointers to nested arrays in cJSON_Utils, see [9abe](https://github.com/DaveGamble/cJSON/commit/9abe75e072050f34732a7169740989a082b65134) 189 + * Fix an error with case sensitivity handling in cJSON_Utils, see [b9cc911](https://github.com/DaveGamble/cJSON/commit/b9cc911831b0b3e1bb72f142389428e59f882b38) 190 + * Fix cJSON_Compare for arrays that are prefixes of the other and objects that are a subset of the other, see [03ba72f](https://github.com/DaveGamble/cJSON/commit/03ba72faec115160d1f3aea5582d9b6af5d3e473) and [#180](https://github.com/DaveGamble/cJSON/issues/180), thanks @zhengqb for reporting 153 191 154 - 1.5.4 155 - ===== 192 + 1.5.4 (Jun 5, 2017) 193 + ====== 156 194 Fixes: 157 195 ------ 158 - * Fix build with GCC 7.1.1 and optimization level `-O2` (bfbd8fe0d85f1dd21e508748fc10fc4c27cc51be) 196 + * Fix build with GCC 7.1.1 and optimization level `-O2`, see [bfbd8fe](https://github.com/DaveGamble/cJSON/commit/bfbd8fe0d85f1dd21e508748fc10fc4c27cc51be) 159 197 160 198 Other Changes: 161 199 -------------- 162 200 * Update [Unity](https://github.com/ThrowTheSwitch/Unity) to 3b69beaa58efc41bbbef70a32a46893cae02719d 163 201 164 - 1.5.3 202 + 1.5.3 (May 23, 2017) 165 203 ===== 166 204 Fixes: 167 205 ------ 168 - * Fix `cJSON_ReplaceItemInObject` not keeping the name of an item (#174) 206 + * Fix `cJSON_ReplaceItemInObject` not keeping the name of an item, see [#174](https://github.com/DaveGamble/cJSON/issues/174) 169 207 170 - 1.5.2 208 + 1.5.2 (May 10, 2017) 171 209 ===== 172 210 Fixes: 173 211 ------ 174 - * Fix a reading buffer overflow in `parse_string` (a167d9e381e5c84bc03de4e261757b031c0c690d) 175 - * Fix compiling with -Wcomma (186cce3ece6ce6dfcb58ac8b2a63f7846c3493ad) 176 - * Remove leftover attribute from tests (b537ca70a35680db66f1f5b8b437f7114daa699a) 212 + * Fix a reading buffer overflow in `parse_string`, see [a167d9e](https://github.com/DaveGamble/cJSON/commit/a167d9e381e5c84bc03de4e261757b031c0c690d) 213 + * Fix compiling with -Wcomma, see [186cce3](https://github.com/DaveGamble/cJSON/commit/186cce3ece6ce6dfcb58ac8b2a63f7846c3493ad) 214 + * Remove leftover attribute from tests, see [b537ca7](https://github.com/DaveGamble/cJSON/commit/b537ca70a35680db66f1f5b8b437f7114daa699a) 177 215 178 - 1.5.1 216 + 1.5.1 (May 6, 2017) 179 217 ===== 180 218 Fixes: 181 219 ------ 182 - * Add gcc version guard to the Makefile (#164), thanks @juvasquezg 183 - * Fix incorrect free in `cJSON_Utils` if custom memory allocator is used (#166), thanks @prefetchnta 220 + * Add gcc version guard to the Makefile, see [#164](https://github.com/DaveGamble/cJSON/pull/164), thanks @juvasquezg 221 + * Fix incorrect free in `cJSON_Utils` if custom memory allocator is used, see [#166](https://github.com/DaveGamble/cJSON/pull/166), thanks @prefetchnta 184 222 185 - 1.5.0 223 + 1.5.0 (May 2, 2017) 186 224 ===== 187 225 Features: 188 - --------- 189 - * cJSON finally prints numbers without losing precision (#153) thanks @DeboraG 190 - * `cJSON_Compare` recursively checks if two cJSON items contain the same values (#148) 191 - * Provide case sensitive versions of every function where it matters (#158, #159) 226 + * cJSON finally prints numbers without losing precision, see [#153](https://github.com/DaveGamble/cJSON/pull/153), thanks @DeboraG 227 + * `cJSON_Compare` recursively checks if two cJSON items contain the same values, see [#148](https://github.com/DaveGamble/cJSON/pull/148) 228 + * Provide case sensitive versions of every function where it matters, see [#158](https://github.com/DaveGamble/cJSON/pull/158) and [#159](https://github.com/DaveGamble/cJSON/pull/159) 192 229 * Added `cJSON_ReplaceItemViaPointer` and `cJSON_DetachItemViaPointer` 193 - * Added `cJSON_free` and `cJSON_malloc` that expose the internal configured memory allocators. (02a05eea4e6ba41811f130b322660bea8918e1a0) 230 + * Added `cJSON_free` and `cJSON_malloc` that expose the internal configured memory allocators. see [02a05ee](https://github.com/DaveGamble/cJSON/commit/02a05eea4e6ba41811f130b322660bea8918e1a0) 194 231 195 232 196 233 Enhancements: ··· 204 241 205 242 Fixes: 206 243 ------ 207 - * Fix some warnings with the Microsoft compiler (#139) thanks @PawelWMS 244 + * Fix some warnings with the Microsoft compiler, see [#139](https://github.com/DaveGamble/cJSON/pull/139), thanks @PawelWMS 208 245 * Fix several bugs in cJSON_Utils, mostly found with [json-patch-tests](https://github.com/json-patch/json-patch-tests) 209 246 * Prevent a stack overflow by specifying a maximum nesting depth `CJSON_NESTING_LIMIT` 210 247 ··· 212 249 -------------- 213 250 * Move generated files in the `library_config` subdirectory. 214 251 215 - 1.4.7 252 + 1.4.7 (Apr 19, 2017) 216 253 ===== 217 254 Fixes: 218 255 ------ 219 - * Fix `cJSONUtils_ApplyPatches`, it was completely broken and apparently nobody noticed (or at least reported it) (075a06f40bdc4f836c7dd7cad690d253a57cfc50) 220 - * Fix inconsistent prototype for `cJSON_GetObjectItemCaseSensitive` (51d3df6c9f7b56b860c8fb24abe7bab255cd4fa9) thanks @PawelWMS 256 + * Fix `cJSONUtils_ApplyPatches`, it was completely broken and apparently nobody noticed (or at least reported it), see [075a06f](https://github.com/DaveGamble/cJSON/commit/075a06f40bdc4f836c7dd7cad690d253a57cfc50) 257 + * Fix inconsistent prototype for `cJSON_GetObjectItemCaseSensitive`, see [51d3df6](https://github.com/DaveGamble/cJSON/commit/51d3df6c9f7b56b860c8fb24abe7bab255cd4fa9), thanks @PawelWMS 221 258 222 - 1.4.6 259 + 1.4.6 (Apr 9, 2017) 223 260 ===== 224 261 Fixes: 225 262 ------ 226 263 * Several corrections in the README 227 264 * Making clear that `valueint` should not be written to 228 - * Fix overflow detection in `ensure` (2683d4d9873df87c4bdccc523903ddd78d1ad250) 229 - * Fix a potential null pointer dereference in cJSON_Utils (795c3acabed25c9672006b2c0f40be8845064827) 230 - * Replace incorrect `sizeof('\0')` with `sizeof("")` (84237ff48e69825c94261c624eb0376d0c328139) 231 - * Add caveats section to the README (50b3c30dfa89830f8f477ce33713500740ac3b79) 232 - * Make cJSON locale independent (#146) Thanks @peterh for reporting 233 - * Fix compiling without CMake with MSVC (#147) Thanks @dertuxmalwieder for reporting 265 + * Fix overflow detection in `ensure`, see [2683d4d](https://github.com/DaveGamble/cJSON/commit/2683d4d9873df87c4bdccc523903ddd78d1ad250) 266 + * Fix a potential null pointer dereference in cJSON_Utils, see [795c3ac](https://github.com/DaveGamble/cJSON/commit/795c3acabed25c9672006b2c0f40be8845064827) 267 + * Replace incorrect `sizeof('\0')` with `sizeof("")`, see [84237ff](https://github.com/DaveGamble/cJSON/commit/84237ff48e69825c94261c624eb0376d0c328139) 268 + * Add caveats section to the README, see [50b3c30](https://github.com/DaveGamble/cJSON/commit/50b3c30dfa89830f8f477ce33713500740ac3b79) 269 + * Make cJSON locale independent, see [#146](https://github.com/DaveGamble/cJSON/pull/146), Thanks @peterh for reporting 270 + * Fix compiling without CMake with MSVC, see [#147](https://github.com/DaveGamble/cJSON/pull/147), Thanks @dertuxmalwieder for reporting 234 271 235 - 1.4.5 272 + 1.4.5 (Mar 28, 2017) 236 273 ===== 237 274 Fixes: 238 275 ------ 239 - * Fix bug in `cJSON_SetNumberHelper`, thanks @mmkeeper (#138 ef34500693e8c4a2849d41a4bd66fd19c9ec46c2) 276 + * Fix bug in `cJSON_SetNumberHelper`, thanks @mmkeeper, see [#138](https://github.com/DaveGamble/cJSON/issues/138) and [ef34500](https://github.com/DaveGamble/cJSON/commit/ef34500693e8c4a2849d41a4bd66fd19c9ec46c2) 240 277 * Workaround for internal compiler error in GCC 5.4.0 and 6.3.1 on x86 (2f65e80a3471d053fdc3f8aed23d01dd1782a5cb [GCC bugreport](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80097)) 241 278 242 - 1.4.4 279 + 1.4.4 (Mar 24, 2017) 243 280 ===== 244 281 Fixes: 245 - -------- 246 - * Fix a theoretical integer overflow, (not sure if it is possible on actual hardware) e58f7ec027d00b7cdcbf63e518c1b5268b29b3da 247 - * Fix an off by one error (cc84a446be20cc283bafdc4d94c050ba1111ac02), thanks @gatzka 248 - * Double check the offset of the print buffer in `ensure` (1934059554b9a0971e00f79e96900f422cfdd114) 282 + ------ 283 + * Fix a theoretical integer overflow, (not sure if it is possible on actual hardware), see [e58f7ec](https://github.com/DaveGamble/cJSON/commit/e58f7ec027d00b7cdcbf63e518c1b5268b29b3da) 284 + * Fix an off by one error, see [cc84a44](https://github.com/DaveGamble/cJSON/commit/cc84a446be20cc283bafdc4d94c050ba1111ac02), thanks @gatzka 285 + * Double check the offset of the print buffer in `ensure`, see [1934059](https://github.com/DaveGamble/cJSON/commit/1934059554b9a0971e00f79e96900f422cfdd114) 249 286 250 287 Improvements: 251 - ------------- 252 - * Add a note in the header about required buffer size when using `cJSON_PrintPreallocated` (4bfb88009342fb568295a7f6dc4b7fee74fbf022) 288 + * Add a note in the header about required buffer size when using `cJSON_PrintPreallocated`, see [4bfb8800](https://github.com/DaveGamble/cJSON/commit/4bfb88009342fb568295a7f6dc4b7fee74fbf022) 253 289 254 - 1.4.3 290 + 1.4.3 (Mar 19, 2017) 255 291 ===== 256 292 Fixes: 257 293 ------ 258 - * Fix compilation of the tests on 32 bit PowerPC and potentially other systems (4ec6e76ea2eec16f54b58e8c95b4c734e59481e4) 259 - * Fix compilation with old GCC compilers (4.3+ were tested) (227d3398d6b967879761ebe02c1b63dbd6ea6e0d, 466eb8e3f8a65080f2b3ca4a79ab7b72bd539dba), see also #126 294 + * Fix compilation of the tests on 32 bit PowerPC and potentially other systems, see [4ec6e76](https://github.com/DaveGamble/cJSON/commit/4ec6e76ea2eec16f54b58e8c95b4c734e59481e4) 295 + * Fix compilation with old GCC compilers (4.3+ were tested), see [227d33](https://github.com/DaveGamble/cJSON/commit/227d3398d6b967879761ebe02c1b63dbd6ea6e0d), [466eb8e](https://github.com/DaveGamble/cJSON/commit/466eb8e3f8a65080f2b3ca4a79ab7b72bd539dba), see also [#126](https://github.com/DaveGamble/cJSON/issues/126) 260 296 261 - 1.4.2 297 + 1.4.2 (Mar 16, 2017) 262 298 ===== 263 299 Fixes: 264 300 ------ 265 - * Fix minimum required cmake version (30e1e7af7c63db9b55f5a3cda977a6c032f0b132) 266 - * Fix detection of supported compiler flags (76e5296d0d05ceb3018a9901639e0e171b44a557) 267 - * Run `cJSON_test` and `cJSON_test_utils` along with unity tests (c597601cf151a757dcf800548f18034d4ddfe2cb) 301 + * Fix minimum required cmake version, see [30e1e7a](https://github.com/DaveGamble/cJSON/commit/30e1e7af7c63db9b55f5a3cda977a6c032f0b132) 302 + * Fix detection of supported compiler flags, see [76e5296](https://github.com/DaveGamble/cJSON/commit/76e5296d0d05ceb3018a9901639e0e171b44a557) 303 + * Run `cJSON_test` and `cJSON_test_utils` along with unity tests, see [c597601](https://github.com/DaveGamble/cJSON/commit/c597601cf151a757dcf800548f18034d4ddfe2cb) 268 304 269 - 1.4.1 305 + 1.4.1 (Mar 16, 2017) 270 306 ===== 271 - Fix: Make `print_number` abort with a failure in out of memory situations (cf1842dc6f64c49451a022308b4415e4d468be0a) 307 + Fixes: 308 + ------ 309 + * Make `print_number` abort with a failure in out of memory situations, see [cf1842](https://github.com/DaveGamble/cJSON/commit/cf1842dc6f64c49451a022308b4415e4d468be0a) 272 310 273 - 1.4.0 311 + 1.4.0 (Mar 4, 2017) 274 312 ===== 275 313 Features 276 314 -------- 277 - * Functions to check the type of an item (#120) 278 - * Use dllexport on windows and fvisibility on Unix systems for public functions (#116), thanks @mjerris 279 - * Remove trailing zeroes from printed numbers (#123) 280 - * Expose the internal boolean type `cJSON_bool` in the header (2d3520e0b9d0eb870e8886e8a21c571eeddbb310) 315 + * Functions to check the type of an item, see [#120](https://github.com/DaveGamble/cJSON/pull/120) 316 + * Use dllexport on windows and fvisibility on Unix systems for public functions, see [#116](https://github.com/DaveGamble/cJSON/pull/116), thanks @mjerris 317 + * Remove trailing zeroes from printed numbers, see [#123](https://github.com/DaveGamble/cJSON/pull/123) 318 + * Expose the internal boolean type `cJSON_bool` in the header, see [2d3520e](https://github.com/DaveGamble/cJSON/commit/2d3520e0b9d0eb870e8886e8a21c571eeddbb310) 281 319 282 320 Fixes 283 - ----- 284 - * Fix handling of NULL pointers in `cJSON_ArrayForEach` (b47d0e34caaef298edfb7bd09a72cfff21d231ff) 285 - * Make it compile with GCC 7 (fix -Wimplicit-fallthrough warning) (9d07917feb1b613544a7513d19233d4c851ad7ad) 321 + * Fix handling of NULL pointers in `cJSON_ArrayForEach`, see [b47d0e3](https://github.com/DaveGamble/cJSON/commit/b47d0e34caaef298edfb7bd09a72cfff21d231ff) 322 + * Make it compile with GCC 7 (fix -Wimplicit-fallthrough warning), see [9d07917](https://github.com/DaveGamble/cJSON/commit/9d07917feb1b613544a7513d19233d4c851ad7ad) 286 323 287 324 Other Improvements 288 - ------------------ 289 - * internally use realloc if available (#110) 290 - * builtin support for fuzzing with [afl](http://lcamtuf.coredump.cx/afl/) (#111) 291 - * unit tests for the print functions (#112) 292 - * Always use buffered printing (#113) 293 - * simplify the print functions (#114) 294 - * Add the compiler flags `-Wdouble-conversion`, `-Wparentheses` and `-Wcomma` (#122) 325 + * internally use realloc if available ([#110](https://github.com/DaveGamble/cJSON/pull/110)) 326 + * builtin support for fuzzing with [afl](http://lcamtuf.coredump.cx/afl/) ([#111](https://github.com/DaveGamble/cJSON/pull/111)) 327 + * unit tests for the print functions ([#112](https://github.com/DaveGamble/cJSON/pull/112)) 328 + * Always use buffered printing ([#113](https://github.com/DaveGamble/cJSON/pull/113)) 329 + * simplify the print functions ([#114](https://github.com/DaveGamble/cJSON/pull/114)) 330 + * Add the compiler flags `-Wdouble-conversion`, `-Wparentheses` and `-Wcomma` ([#122](https://github.com/DaveGamble/cJSON/pull/122)) 295 331 296 - 1.3.2 332 + 1.3.2 (Mar 1, 2017) 297 333 ===== 298 - Fix: 299 - ---- 300 - - Don't build the unity library if testing is disabled ( #121 ). Thanks @ffontaine 334 + Fixes: 335 + ------ 336 + * Don't build the unity library if testing is disabled, see [#121](https://github.com/DaveGamble/cJSON/pull/121). Thanks @ffontaine 301 337 302 - 1.3.1 338 + 1.3.1 (Feb 27, 2017) 303 339 ===== 304 - Bugfix release that fixes an out of bounds read #118. This shouldn't have any security implications. 340 + Fixes: 341 + ------ 342 + * Bugfix release that fixes an out of bounds read, see [#118](https://github.com/DaveGamble/cJSON/pull/118). This shouldn't have any security implications. 305 343 306 - 1.3.0 344 + 1.3.0 (Feb 17, 2017) 307 345 ===== 308 346 This release includes a lot of rework in the parser and includes the Cunity unit testing framework, as well as some fixes. I increased the minor version number because there were quite a lot of internal changes. 309 347 310 348 Features: 311 - --------- 312 - - New type for cJSON structs: `cJSON_Invalid` (#108) 349 + * New type for cJSON structs: `cJSON_Invalid`, see [#108](https://github.com/DaveGamble/cJSON/pull/108) 313 350 314 351 Fixes: 315 352 ------ 316 - - runtime checks for a lot of potential integer overflows 317 - - fix incorrect return in cJSON_PrintBuffered (cf9d57d56cac21fc59465b8d26cf29bf6d2a87b3) 318 - - fix several potential issues found by [Coverity](https://scan.coverity.com/projects/cjson) 319 - - fix potentially undefined behavior when assigning big numbers to `valueint` (41e2837df1b1091643aff073f2313f6ff3cc10f4) 320 - - Numbers exceeding `INT_MAX` or lower than `INT_MIN` will be explicitly assigned to `valueint` as `INT_MAX` and `INT_MIN` respectively (saturation on overflow). 321 - - fix the `cJSON_SetNumberValue` macro (87f77274de6b3af00fb9b9a7f3b900ef382296c2), this slightly changes the behavior, see commit message 353 + * runtime checks for a lot of potential integer overflows 354 + * fix incorrect return in cJSON_PrintBuffered [cf9d57d](https://github.com/DaveGamble/cJSON/commit/cf9d57d56cac21fc59465b8d26cf29bf6d2a87b3) 355 + * fix several potential issues found by [Coverity](https://scan.coverity.com/projects/cjson) 356 + * fix potentially undefined behavior when assigning big numbers to `valueint` ([41e2837](https://github.com/DaveGamble/cJSON/commit/41e2837df1b1091643aff073f2313f6ff3cc10f4)) 357 + * Numbers exceeding `INT_MAX` or lower than `INT_MIN` will be explicitly assigned to `valueint` as `INT_MAX` and `INT_MIN` respectively (saturation on overflow). 358 + * fix the `cJSON_SetNumberValue` macro ([87f7727](https://github.com/DaveGamble/cJSON/commit/87f77274de6b3af00fb9b9a7f3b900ef382296c2)), this slightly changes the behavior, see commit message 322 359 323 360 Introduce unit tests 324 361 -------------------- 325 362 326 - Started writing unit tests with the [Cunity](https://github.com/ThrowTheSwitch/Unity) testing framework. Currently this covers the parser functions. 363 + * Started writing unit tests with the [Cunity](https://github.com/ThrowTheSwitch/Unity) testing framework. Currently this covers the parser functions. 327 364 328 365 Also: 329 - - Support for running the tests with [Valgrind](http://valgrind.org) 330 - - Support for compiling the tests with [AddressSanitizer](https://github.com/google/sanitizers) and [UndefinedBehaviorSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html). 331 - - `travis.yml` file for running unit tests on travis. (not enabled for the repository yet though #102) 366 + * Support for running the tests with [Valgrind](http://valgrind.org) 367 + * Support for compiling the tests with [AddressSanitizer](https://github.com/google/sanitizers) and [UndefinedBehaviorSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html). 368 + * `travis.yml` file for running unit tests on travis. (not enabled for the repository yet though [#102](https://github.com/DaveGamble/cJSON/issues/102) 332 369 333 370 Simplifications 334 371 --------------- 335 372 336 373 After having unit tests for the parser function in place, I started refactoring the parser functions (as well as others) and making them easier to read and maintain. 337 - - Use `strtod` from the standard library for parsing numbers (074766997246481dfc72bfa78f07898a2716473f) 338 - - Use goto-fail in several parser functions (#100) 339 - - Rewrite/restructure all of the parsing functions to be easier to understand and have less code paths doing the same as another. (#109) 340 - - Simplify the buffer allocation strategy to always doubling the needed amount (9f6fa94c91a87b71e4c6868dbf2ce431a48517b0) 341 - - Combined `cJSON_AddItemToObject` and `cJSON_AddItemToObjectCS` to one function (cf862d0fed7f9407e4b046d78d3d8050d2080d12) 374 + * Use `strtod` from the standard library for parsing numbers ([0747669](https://github.com/DaveGamble/cJSON/commit/074766997246481dfc72bfa78f07898a2716473f)) 375 + * Use goto-fail in several parser functions ([#100](https://github.com/DaveGamble/cJSON/pull/100)) 376 + * Rewrite/restructure all of the parsing functions to be easier to understand and have less code paths doing the same as another. ([#109](https://github.com/DaveGamble/cJSON/pull/109)) 377 + * Simplify the buffer allocation strategy to always doubling the needed amount ([9f6fa94](https://github.com/DaveGamble/cJSON/commit/9f6fa94c91a87b71e4c6868dbf2ce431a48517b0)) 378 + * Combined `cJSON_AddItemToObject` and `cJSON_AddItemToObjectCS` to one function ([cf862d](https://github.com/DaveGamble/cJSON/commit/cf862d0fed7f9407e4b046d78d3d8050d2080d12)) 342 379 343 380 Other changes 344 381 ------------- 345 - - Prevent the usage of incompatible C and header versions via preprocessor directive (123bb1af7bfae41d805337fef4b41045ef6c7d25) 346 - - Let CMake automatically detect compiler flags 347 - - Add new compiler flags (`-Wundef`, `-Wswitch-default`, `-Wconversion`, `-fstack-protector-strong`) (#98) 348 - - Change internal sizes from `int` to `size_t` (ecd5678527a6bc422da694e5be9e9979878fe6a0) 349 - - Change internal strings from `char*` to `unsigned char*` (28b9ba4334e0f7309e867e874a31f395c0ac2474) 350 - - Add `const` in more places 382 + * Prevent the usage of incompatible C and header versions via preprocessor directive ([123bb1](https://github.com/DaveGamble/cJSON/commit/123bb1af7bfae41d805337fef4b41045ef6c7d25)) 383 + * Let CMake automatically detect compiler flags 384 + * Add new compiler flags (`-Wundef`, `-Wswitch-default`, `-Wconversion`, `-fstack-protector-strong`) ([#98](https://github.com/DaveGamble/cJSON/pull/98)) 385 + * Change internal sizes from `int` to `size_t` ([ecd5678](https://github.com/DaveGamble/cJSON/commit/ecd5678527a6bc422da694e5be9e9979878fe6a0)) 386 + * Change internal strings from `char*` to `unsigned char*` ([28b9ba4](https://github.com/DaveGamble/cJSON/commit/28b9ba4334e0f7309e867e874a31f395c0ac2474)) 387 + * Add `const` in more places 351 388 352 - 1.2.1 389 + 1.2.1 (Jan 31, 2017) 353 390 ===== 354 391 Fixes: 355 392 ------ 356 - - Fixes a potential null pointer dereference in cJSON_Utils, discovered using clang's static analyzer by @bnason-nf (#96) 393 + * Fixes a potential null pointer dereference in cJSON_Utils, discovered using clang's static analyzer by @bnason-nf, see [#96](https://github.com/DaveGamble/cJSON/issues/96) 357 394 358 - 1.2.0 395 + 1.2.0 (Jan 9, 2017) 359 396 ===== 360 397 Features: 361 398 --------- 362 - - Add a new type of cJSON item for raw JSON and support printing it. Thanks @loigu (#65, #90) 399 + * Add a new type of cJSON item for raw JSON and support printing it. Thanks @loigu, see [#65](https://github.com/DaveGamble/cJSON/pull/65), [#90](https://github.com/DaveGamble/cJSON/pull/90) 363 400 364 401 Fixes: 365 402 ------ 366 - - Compiler warning if const is casted away, Thanks @gatzka (#83) 367 - - Fix compile error with strict-overflow on PowerPC, (#85) 368 - - Fix typo in the README, thanks @MicroJoe (#88) 369 - - Add compile flag for compatibility with C++ compilers 403 + * Compiler warning if const is casted away, Thanks @gatzka, see [#83](https://github.com/DaveGamble/cJSON/pull/83) 404 + * Fix compile error with strict-overflow on PowerPC, see [#85](https://github.com/DaveGamble/cJSON/issues/85) 405 + * Fix typo in the README, thanks @MicroJoe, see [#88](https://github.com/DaveGamble/cJSON/pull/88) 406 + * Add compile flag for compatibility with C++ compilers 370 407 371 - 1.1.0 408 + 1.1.0 (Dec 6, 2016) 372 409 ===== 373 - - Add a function `cJSON_PrintPreallocated` to print to a preallocated buffer, thanks @ChisholmKyle (#72) 374 - - More compiler warnings when using Clang or GCC, thanks @gatzka (#75, #78) 375 - - fixed a memory leak in `cJSON_Duplicate`, thanks @alperakcan (#81) 376 - - fix the `ENABLE_CUSTOM_COMPILER_FLAGS` cmake option 410 + * Add a function `cJSON_PrintPreallocated` to print to a preallocated buffer, thanks @ChisholmKyle, see [#72](https://github.com/DaveGamble/cJSON/pull/72) 411 + * More compiler warnings when using Clang or GCC, thanks @gatzka, see [#75](https://github.com/DaveGamble/cJSON/pull/75), [#78](https://github.com/DaveGamble/cJSON/pull/78) 412 + * fixed a memory leak in `cJSON_Duplicate`, thanks @alperakcan, see [#81](https://github.com/DaveGamble/cJSON/pull/81) 413 + * fix the `ENABLE_CUSTOM_COMPILER_FLAGS` cmake option 377 414 378 - 1.0.2 415 + 1.0.2 (Nov 25, 2016) 379 416 ===== 380 - Rename internal boolean type, see #71. 417 + * Rename internal boolean type, see [#71](https://github.com/DaveGamble/cJSON/issues/71). 381 418 382 - 1.0.1 419 + 1.0.1 (Nov 20, 2016) 383 420 ===== 384 421 Small bugfix release. 385 - - Fixes a bug with the use of the cJSON structs type in cJSON_Utils, see d47339e2740360e6e0994527d5e4752007480f3a 386 - - improve code readability 387 - - initialize all variables 422 + * Fixes a bug with the use of the cJSON structs type in cJSON_Utils, see [d47339e](https://github.com/DaveGamble/cJSON/commit/d47339e2740360e6e0994527d5e4752007480f3a) 423 + * improve code readability 424 + * initialize all variables 388 425 389 - 1.0.0 426 + 1.0.0 (Nov 17, 2016) 390 427 ===== 391 428 This is the first official versioned release of cJSON. It provides an API version for the shared library and improved Makefile and CMake build files.
+28 -3
src/external/cjson/cjson/CONTRIBUTORS.md
··· 1 1 Contributors 2 2 ============ 3 3 4 - Original Author: [Dave Gamble](https://github.com/DaveGamble) 5 - Current Maintainer: [Max Bruckner](https://github.com/FSMaxB) 4 + Original Author: 5 + - [Dave Gamble](https://github.com/DaveGamble) 6 + 7 + Current Maintainer: 8 + - [Max Bruckner](https://github.com/FSMaxB) 9 + - [Alan Wang](https://github.com/Alanscut) 6 10 11 + Contributors: 7 12 * [Ajay Bhargav](https://github.com/ajaybhargav) 8 13 * [Alper Akcan](https://github.com/alperakcan) 14 + * [Andrew Tang](https://github.com/singku) 9 15 * [Anton Sergeev](https://github.com/anton-sergeev) 10 16 * [Benbuck Nason](https://github.com/bnason-nf) 17 + * [Bernt Johan Damslora](https://github.com/bjda) 11 18 * [Bob Kocisko](https://github.com/bobkocisko) 12 19 * [Christian Schulze](https://github.com/ChristianSch) 13 20 * [Casperinous](https://github.com/Casperinous) 21 + * [ChenYuan](https://github.com/zjuchenyuan) 14 22 * [Debora Grosse](https://github.com/DeboraG) 15 23 * [dieyushi](https://github.com/dieyushi) 16 24 * [Dōngwén Huáng (黄东文)](https://github.com/DongwenHuang) 17 25 * [Donough Liu](https://github.com/ldm0) 26 + * [Erez Oxman](https://github.com/erez-o) 18 27 * Eswar Yaganti 19 28 * [Evan Todd](https://github.com/etodd) 20 29 * [Fabrice Fontaine](https://github.com/ffontaine) 21 30 * Ian Mobley 22 31 * Irwan Djadjadi 32 + * [HuKeping](https://github.com/HuKeping) 23 33 * [IvanVoid](https://github.com/npi3pak) 24 34 * [Jakub Wilk](https://github.com/jwilk) 25 35 * [Jiri Zouhar](https://github.com/loigu) 26 36 * [Jonathan Fether](https://github.com/jfether) 37 + * [Julian Ste](https://github.com/julian-st) 27 38 * [Julián Vásquez](https://github.com/juvasquezg) 28 39 * [Kevin Branigan](https://github.com/kbranigan) 40 + * [Kevin Sapper](https://github.com/sappo) 29 41 * [Kyle Chisholm](https://github.com/ChisholmKyle) 30 42 * [Linus Wallgren](https://github.com/ecksun) 43 + * [Mateusz Szafoni](https://github.com/raiden00pl) 31 44 * Mike Pontillo 45 + * [miaoerduo](https://github.com/miaoerduo) 32 46 * [Mike Jerris](https://github.com/mjerris) 33 47 * [Mike Robinson](https://github.com/mhrobinson) 48 + * [Moorthy](https://github.com/moorthy-bs) 49 + * [myd7349](https://github.com/myd7349) 50 + * [NancyLi1013](https://github.com/NancyLi1013) 34 51 * Paulo Antonio Alvarez 52 + * [Paweł Malowany](https://github.com/PawelMalowany) 35 53 * [Pawel Winogrodzki](https://github.com/PawelWMS) 36 54 * [prefetchnta](https://github.com/prefetchnta) 37 55 * [Rafael Leal Dias](https://github.com/rafaeldias) 56 + * [Randy](https://github.com/randy408) 38 57 * [raiden00pl](https://github.com/raiden00pl) 39 58 * [Robin Mallinson](https://github.com/rmallins) 40 59 * [Rod Vagg](https://github.com/rvagg) 41 60 * [Roland Meertens](https://github.com/rmeertens) 42 61 * [Romain Porte](https://github.com/MicroJoe) 62 + * [SANJEEV BA](https://github.com/basanjeev) 63 + * [Sang-Heon Jeon](https://github.com/lntuition) 64 + * [Simon Sobisch](https://github.com/GitMensch) 43 65 * [Simon Ricaldone](https://github.com/simon-p-r) 66 + * [Square789](https://github.com/Square789) 44 67 * [Stephan Gatzka](https://github.com/gatzka) 45 - * [tan-wei](https://github.com/tan-wei) 68 + * [Vemake](https://github.com/vemakereporter) 69 + * [Wei Tan](https://github.com/tan-wei) 46 70 * [Weston Schmidt](https://github.com/schmidtw) 71 + * [xiaomianhehe](https://github.com/xiaomianhehe) 47 72 * [yangfl](https://github.com/yangfl) 48 73 * [yuta-oxo](https://github.com/yuta-oxo) 49 74 * [Zach Hindes](https://github.com/zhindes)
+197 -60
src/external/cjson/cjson/cJSON.c
··· 43 43 #include <stdlib.h> 44 44 #include <limits.h> 45 45 #include <ctype.h> 46 + #include <float.h> 46 47 47 48 #ifdef ENABLE_LOCALES 48 49 #include <locale.h> ··· 68 69 #endif 69 70 #define false ((cJSON_bool)0) 70 71 72 + /* define isnan and isinf for ANSI C, if in C99 or above, isnan and isinf has been defined in math.h */ 73 + #ifndef isinf 74 + #define isinf(d) (isnan((d - d)) && !isnan(d)) 75 + #endif 76 + #ifndef isnan 77 + #define isnan(d) (d != d) 78 + #endif 79 + 80 + #ifndef NAN 81 + #ifdef _WIN32 82 + #define NAN sqrt(-1.0) 83 + #else 84 + #define NAN 0.0/0.0 85 + #endif 86 + #endif 87 + 71 88 typedef struct { 72 89 const unsigned char *json; 73 90 size_t position; ··· 79 96 return (const char*) (global_error.json + global_error.position); 80 97 } 81 98 82 - CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item) { 83 - if (!cJSON_IsString(item)) { 99 + CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item) 100 + { 101 + if (!cJSON_IsString(item)) 102 + { 84 103 return NULL; 85 104 } 86 105 87 106 return item->valuestring; 88 107 } 89 108 109 + CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item) 110 + { 111 + if (!cJSON_IsNumber(item)) 112 + { 113 + return (double) NAN; 114 + } 115 + 116 + return item->valuedouble; 117 + } 118 + 90 119 /* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ 91 - #if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 12) 120 + #if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 15) 92 121 #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. 93 122 #endif 94 123 ··· 368 397 return object->valuedouble = number; 369 398 } 370 399 400 + CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring) 401 + { 402 + char *copy = NULL; 403 + /* if object's type is not cJSON_String or is cJSON_IsReference, it should not set valuestring */ 404 + if (!(object->type & cJSON_String) || (object->type & cJSON_IsReference)) 405 + { 406 + return NULL; 407 + } 408 + if (strlen(valuestring) <= strlen(object->valuestring)) 409 + { 410 + strcpy(object->valuestring, valuestring); 411 + return object->valuestring; 412 + } 413 + copy = (char*) cJSON_strdup((const unsigned char*)valuestring, &global_hooks); 414 + if (copy == NULL) 415 + { 416 + return NULL; 417 + } 418 + if (object->valuestring != NULL) 419 + { 420 + cJSON_free(object->valuestring); 421 + } 422 + object->valuestring = copy; 423 + 424 + return copy; 425 + } 426 + 371 427 typedef struct 372 428 { 373 429 unsigned char *buffer; ··· 455 511 456 512 return NULL; 457 513 } 458 - if (newbuffer) 459 - { 460 - memcpy(newbuffer, p->buffer, p->offset + 1); 461 - } 514 + 515 + memcpy(newbuffer, p->buffer, p->offset + 1); 462 516 p->hooks.deallocate(p->buffer); 463 517 } 464 518 p->length = newsize; ··· 480 534 buffer->offset += strlen((const char*)buffer_pointer); 481 535 } 482 536 537 + /* securely comparison of floating-point variables */ 538 + static cJSON_bool compare_double(double a, double b) 539 + { 540 + double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b); 541 + return (fabs(a - b) <= maxVal * DBL_EPSILON); 542 + } 543 + 483 544 /* Render the number nicely from the given item into a string. */ 484 545 static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) 485 546 { ··· 497 558 } 498 559 499 560 /* This checks for NaN and Infinity */ 500 - if ((d * 0) != 0) 561 + if (isnan(d) || isinf(d)) 501 562 { 502 563 length = sprintf((char*)number_buffer, "null"); 503 564 } ··· 507 568 length = sprintf((char*)number_buffer, "%1.15g", d); 508 569 509 570 /* Check whether the original double can be recovered */ 510 - if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || ((double)test != d)) 571 + if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d)) 511 572 { 512 573 /* If not, print with 17 decimal places of precision */ 513 574 length = sprintf((char*)number_buffer, "%1.17g", d); ··· 977 1038 return NULL; 978 1039 } 979 1040 1041 + if (cannot_access_at_index(buffer, 0)) 1042 + { 1043 + return buffer; 1044 + } 1045 + 980 1046 while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32)) 981 1047 { 982 1048 buffer->offset++; ··· 1006 1072 return buffer; 1007 1073 } 1008 1074 1009 - /* Parse an object - create a new root, and populate. */ 1010 1075 CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) 1011 1076 { 1077 + size_t buffer_length; 1078 + 1079 + if (NULL == value) 1080 + { 1081 + return NULL; 1082 + } 1083 + 1084 + /* Adding null character size due to require_null_terminated. */ 1085 + buffer_length = strlen(value) + sizeof(""); 1086 + 1087 + return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated); 1088 + } 1089 + 1090 + /* Parse an object - create a new root, and populate. */ 1091 + CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated) 1092 + { 1012 1093 parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; 1013 1094 cJSON *item = NULL; 1014 1095 ··· 1016 1097 global_error.json = NULL; 1017 1098 global_error.position = 0; 1018 1099 1019 - if (value == NULL) 1100 + if (value == NULL || 0 == buffer_length) 1020 1101 { 1021 1102 goto fail; 1022 1103 } 1023 1104 1024 1105 buffer.content = (const unsigned char*)value; 1025 - buffer.length = strlen((const char*)value) + sizeof(""); 1106 + buffer.length = buffer_length; 1026 1107 buffer.offset = 0; 1027 1108 buffer.hooks = global_hooks; 1028 1109 ··· 1092 1173 return cJSON_ParseWithOpts(value, 0, 0); 1093 1174 } 1094 1175 1095 - #define cjson_min(a, b) ((a < b) ? a : b) 1176 + CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length) 1177 + { 1178 + return cJSON_ParseWithLengthOpts(value, buffer_length, 0, 0); 1179 + } 1180 + 1181 + #define cjson_min(a, b) (((a) < (b)) ? (a) : (b)) 1096 1182 1097 1183 static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) 1098 1184 { ··· 1199 1285 return (char*)p.buffer; 1200 1286 } 1201 1287 1202 - CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_bool fmt) 1288 + CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format) 1203 1289 { 1204 1290 printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; 1205 1291 1206 - if ((len < 0) || (buf == NULL)) 1292 + if ((length < 0) || (buffer == NULL)) 1207 1293 { 1208 1294 return false; 1209 1295 } 1210 1296 1211 - p.buffer = (unsigned char*)buf; 1212 - p.length = (size_t)len; 1297 + p.buffer = (unsigned char*)buffer; 1298 + p.length = (size_t)length; 1213 1299 p.offset = 0; 1214 1300 p.noalloc = true; 1215 - p.format = fmt; 1301 + p.format = format; 1216 1302 p.hooks = global_hooks; 1217 1303 1218 1304 return print_value(item, &p); ··· 1425 1511 success: 1426 1512 input_buffer->depth--; 1427 1513 1514 + if (head != NULL) { 1515 + head->prev = current_item; 1516 + } 1517 + 1428 1518 item->type = cJSON_Array; 1429 1519 item->child = head; 1430 1520 ··· 1597 1687 success: 1598 1688 input_buffer->depth--; 1599 1689 1690 + if (head != NULL) { 1691 + head->prev = current_item; 1692 + } 1693 + 1600 1694 item->type = cJSON_Object; 1601 1695 item->child = head; 1602 1696 ··· 1859 1953 { 1860 1954 cJSON *child = NULL; 1861 1955 1862 - if ((item == NULL) || (array == NULL)) 1956 + if ((item == NULL) || (array == NULL) || (array == item)) 1863 1957 { 1864 1958 return false; 1865 1959 } 1866 1960 1867 1961 child = array->child; 1868 - 1962 + /* 1963 + * To find the last item in array quickly, we use prev in array 1964 + */ 1869 1965 if (child == NULL) 1870 1966 { 1871 1967 /* list is empty, start new one */ 1872 1968 array->child = item; 1969 + item->prev = item; 1970 + item->next = NULL; 1873 1971 } 1874 1972 else 1875 1973 { 1876 1974 /* append to the end */ 1877 - while (child->next) 1975 + if (child->prev) 1878 1976 { 1879 - child = child->next; 1977 + suffix_object(child->prev, item); 1978 + array->child->prev = item; 1880 1979 } 1881 - suffix_object(child, item); 1882 1980 } 1883 1981 1884 1982 return true; 1885 1983 } 1886 1984 1887 1985 /* Add item to array/object. */ 1888 - CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item) 1986 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item) 1889 1987 { 1890 - add_item_to_array(array, item); 1988 + return add_item_to_array(array, item); 1891 1989 } 1892 1990 1893 1991 #if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) ··· 1911 2009 char *new_key = NULL; 1912 2010 int new_type = cJSON_Invalid; 1913 2011 1914 - if ((object == NULL) || (string == NULL) || (item == NULL)) 2012 + if ((object == NULL) || (string == NULL) || (item == NULL) || (object == item)) 1915 2013 { 1916 2014 return false; 1917 2015 } ··· 1943 2041 return add_item_to_array(object, item); 1944 2042 } 1945 2043 1946 - CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) 2044 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) 1947 2045 { 1948 - add_item_to_object(object, string, item, &global_hooks, false); 2046 + return add_item_to_object(object, string, item, &global_hooks, false); 1949 2047 } 1950 2048 1951 2049 /* Add an item to an object with constant string as key */ 1952 - CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) 2050 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) 1953 2051 { 1954 - add_item_to_object(object, string, item, &global_hooks, true); 2052 + return add_item_to_object(object, string, item, &global_hooks, true); 1955 2053 } 1956 2054 1957 - CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) 2055 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) 1958 2056 { 1959 2057 if (array == NULL) 1960 2058 { 1961 - return; 2059 + return false; 1962 2060 } 1963 2061 1964 - add_item_to_array(array, create_reference(item, &global_hooks)); 2062 + return add_item_to_array(array, create_reference(item, &global_hooks)); 1965 2063 } 1966 2064 1967 - CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) 2065 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) 1968 2066 { 1969 2067 if ((object == NULL) || (string == NULL)) 1970 2068 { 1971 - return; 2069 + return false; 1972 2070 } 1973 2071 1974 - add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); 2072 + return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); 1975 2073 } 1976 2074 1977 2075 CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) ··· 2089 2187 return NULL; 2090 2188 } 2091 2189 2092 - if (item->prev != NULL) 2190 + if (item != parent->child) 2093 2191 { 2094 2192 /* not the first element */ 2095 2193 item->prev->next = item->next; ··· 2105 2203 /* first element */ 2106 2204 parent->child = item->next; 2107 2205 } 2206 + else if (item->next == NULL) 2207 + { 2208 + /* last element */ 2209 + parent->child->prev = item->prev; 2210 + } 2211 + 2108 2212 /* make sure the detached item doesn't point anywhere anymore */ 2109 2213 item->prev = NULL; 2110 2214 item->next = NULL; ··· 2152 2256 } 2153 2257 2154 2258 /* Replace array/object items with new ones. */ 2155 - CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) 2259 + CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) 2156 2260 { 2157 2261 cJSON *after_inserted = NULL; 2158 2262 2159 2263 if (which < 0) 2160 2264 { 2161 - return; 2265 + return false; 2162 2266 } 2163 2267 2164 2268 after_inserted = get_array_item(array, (size_t)which); 2165 2269 if (after_inserted == NULL) 2166 2270 { 2167 - add_item_to_array(array, newitem); 2168 - return; 2271 + return add_item_to_array(array, newitem); 2169 2272 } 2170 2273 2171 2274 newitem->next = after_inserted; ··· 2179 2282 { 2180 2283 newitem->prev->next = newitem; 2181 2284 } 2285 + return true; 2182 2286 } 2183 2287 2184 2288 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) ··· 2200 2304 { 2201 2305 replacement->next->prev = replacement; 2202 2306 } 2203 - if (replacement->prev != NULL) 2204 - { 2205 - replacement->prev->next = replacement; 2206 - } 2207 2307 if (parent->child == item) 2208 2308 { 2309 + if (parent->child->prev == parent->child) 2310 + { 2311 + replacement->prev = replacement; 2312 + } 2209 2313 parent->child = replacement; 2210 2314 } 2315 + else 2316 + { /* 2317 + * To find the last item in array quickly, we use prev in array. 2318 + * We can't modify the last item's next pointer where this item was the parent's child 2319 + */ 2320 + if (replacement->prev != NULL) 2321 + { 2322 + replacement->prev->next = replacement; 2323 + } 2324 + if (replacement->next == NULL) 2325 + { 2326 + parent->child->prev = replacement; 2327 + } 2328 + } 2211 2329 2212 2330 item->next = NULL; 2213 2331 item->prev = NULL; ··· 2216 2334 return true; 2217 2335 } 2218 2336 2219 - CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) 2337 + CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) 2220 2338 { 2221 2339 if (which < 0) 2222 2340 { 2223 - return; 2341 + return false; 2224 2342 } 2225 2343 2226 - cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); 2344 + return cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); 2227 2345 } 2228 2346 2229 2347 static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) ··· 2241 2359 replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); 2242 2360 replacement->type &= ~cJSON_StringIsConst; 2243 2361 2244 - cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); 2245 - 2246 - return true; 2362 + return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); 2247 2363 } 2248 2364 2249 - CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) 2365 + CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) 2250 2366 { 2251 - replace_item_in_object(object, string, newitem, false); 2367 + return replace_item_in_object(object, string, newitem, false); 2252 2368 } 2253 2369 2254 - CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) 2370 + CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) 2255 2371 { 2256 - replace_item_in_object(object, string, newitem, true); 2372 + return replace_item_in_object(object, string, newitem, true); 2257 2373 } 2258 2374 2259 2375 /* Create basic types: */ ··· 2290 2406 return item; 2291 2407 } 2292 2408 2293 - CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool b) 2409 + CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean) 2294 2410 { 2295 2411 cJSON *item = cJSON_New_Item(&global_hooks); 2296 2412 if(item) 2297 2413 { 2298 - item->type = b ? cJSON_True : cJSON_False; 2414 + item->type = boolean ? cJSON_True : cJSON_False; 2299 2415 } 2300 2416 2301 2417 return item; ··· 2430 2546 } 2431 2547 2432 2548 a = cJSON_CreateArray(); 2549 + 2433 2550 for(i = 0; a && (i < (size_t)count); i++) 2434 2551 { 2435 2552 n = cJSON_CreateNumber(numbers[i]); ··· 2447 2564 suffix_object(p, n); 2448 2565 } 2449 2566 p = n; 2567 + } 2568 + 2569 + if (a && a->child) { 2570 + a->child->prev = n; 2450 2571 } 2451 2572 2452 2573 return a; ··· 2485 2606 p = n; 2486 2607 } 2487 2608 2609 + if (a && a->child) { 2610 + a->child->prev = n; 2611 + } 2612 + 2488 2613 return a; 2489 2614 } 2490 2615 ··· 2502 2627 2503 2628 a = cJSON_CreateArray(); 2504 2629 2505 - for(i = 0;a && (i < (size_t)count); i++) 2630 + for(i = 0; a && (i < (size_t)count); i++) 2506 2631 { 2507 2632 n = cJSON_CreateNumber(numbers[i]); 2508 2633 if(!n) ··· 2521 2646 p = n; 2522 2647 } 2523 2648 2649 + if (a && a->child) { 2650 + a->child->prev = n; 2651 + } 2652 + 2524 2653 return a; 2525 2654 } 2526 2655 ··· 2557 2686 p = n; 2558 2687 } 2559 2688 2689 + if (a && a->child) { 2690 + a->child->prev = n; 2691 + } 2692 + 2560 2693 return a; 2561 2694 } 2562 2695 ··· 2627 2760 next = newchild; 2628 2761 } 2629 2762 child = child->next; 2763 + } 2764 + if (newitem && newitem->child) 2765 + { 2766 + newitem->child->prev = newchild; 2630 2767 } 2631 2768 2632 2769 return newitem; ··· 2839 2976 2840 2977 CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) 2841 2978 { 2842 - if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a)) 2979 + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF))) 2843 2980 { 2844 2981 return false; 2845 2982 } ··· 2876 3013 return true; 2877 3014 2878 3015 case cJSON_Number: 2879 - if (a->valuedouble == b->valuedouble) 3016 + if (compare_double(a->valuedouble, b->valuedouble)) 2880 3017 { 2881 3018 return true; 2882 3019 }
+17 -12
src/external/cjson/cjson/cJSON.h
··· 81 81 /* project version */ 82 82 #define CJSON_VERSION_MAJOR 1 83 83 #define CJSON_VERSION_MINOR 7 84 - #define CJSON_VERSION_PATCH 12 84 + #define CJSON_VERSION_PATCH 15 85 85 86 86 #include <stddef.h> 87 87 ··· 146 146 /* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ 147 147 /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ 148 148 CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); 149 + CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length); 149 150 /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ 150 151 /* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ 151 152 CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); 153 + CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); 152 154 153 155 /* Render a cJSON entity to text for transfer/storage. */ 154 156 CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); ··· 173 175 /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ 174 176 CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); 175 177 176 - /* Check if the item is a string and return its valuestring */ 178 + /* Check item type and return its value */ 177 179 CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item); 180 + CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item); 178 181 179 182 /* These functions check the type of an item */ 180 183 CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); ··· 216 219 CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count); 217 220 218 221 /* Append item to the specified array/object. */ 219 - CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item); 220 - CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); 222 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); 223 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); 221 224 /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. 222 225 * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before 223 226 * writing to `item->string` */ 224 - CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); 227 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); 225 228 /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ 226 - CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); 227 - CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); 229 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); 230 + CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); 228 231 229 232 /* Remove/Detach items from Arrays/Objects. */ 230 233 CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); ··· 236 239 CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); 237 240 238 241 /* Update array items. */ 239 - CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ 242 + CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ 240 243 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); 241 - CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); 242 - CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); 243 - CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); 244 + CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); 245 + CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); 246 + CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); 244 247 245 248 /* Duplicate a cJSON item */ 246 249 CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); ··· 253 256 254 257 /* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. 255 258 * The input pointer json cannot point to a read-only address area, such as a string constant, 256 - * but should point to a readable and writable adress area. */ 259 + * but should point to a readable and writable address area. */ 257 260 CJSON_PUBLIC(void) cJSON_Minify(char *json); 258 261 259 262 /* Helper functions for creating and adding items to an object at the same time. ··· 273 276 /* helper for the cJSON_SetNumberValue macro */ 274 277 CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number); 275 278 #define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) 279 + /* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */ 280 + CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring); 276 281 277 282 /* Macro for iterating over an array or object */ 278 283 #define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)