Skip to content
Snippets Groups Projects
Commit 67f35d670233 authored by jfp's avatar jfp
Browse files

Merge with default

No related branches found
No related tags found
No related merge requests found
1.7.13 (Apr 2, 2020)
======
Features:
---------
* add new API of cJSON_ParseWithLength without breaking changes. Thanks @caglarivriz, see [#358](https://github.com/DaveGamble/cJSON/pull/358)
* add new API of cJSON_GetNumberValue. Thanks @Intuition, see[#385](https://github.com/DaveGamble/cJSON/pull/385)
* add uninstall target function for CMake. See [#402](https://github.com/DaveGamble/cJSON/pull/402)
* 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)
* add new API of cJSON_SetValuestring, for changing the valuestring safely. See [#451](https://github.com/DaveGamble/cJSON/pull/451)
* add return value for cJSON_AddItemTo... and cJSON_ReplaceItem... (check if the operation successful). See [#453](https://github.com/DaveGamble/cJSON/pull/453)
Fixes:
------
* Fix clang -Wfloat-equal warning. Thanks @paulmalovanyi, see [#368](https://github.com/DaveGamble/cJSON/pull/368)
* Fix make failed in mac os. See [#405](https://github.com/DaveGamble/cJSON/pull/405)
* Fix memory leak in cJSONUtils_FindPointerFromObjectTo. Thanks @andywolk for reporting, see [#414](https://github.com/DaveGamble/cJSON/issues/414)
* Fix bug in encode_string_as_pointer. Thanks @AIChangJiang for reporting, see [#439](https://github.com/DaveGamble/cJSON/issues/439)
1.7.12 (May 17, 2019) 1.7.12 (May 17, 2019)
====== ======
Fixes: Fixes:
......
...@@ -223,7 +223,8 @@ ...@@ -223,7 +223,8 @@
"${CMAKE_CURRENT_SOURCE_DIR}/library_config/cJSONConfigVersion.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/library_config/cJSONConfigVersion.cmake.in"
${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake @ONLY) ${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake @ONLY)
if(ENABLE_TARGET_EXPORT)
# Install package config files # Install package config files
install(FILES ${PROJECT_BINARY_DIR}/cJSONConfig.cmake install(FILES ${PROJECT_BINARY_DIR}/cJSONConfig.cmake
${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake ${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake
DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON") DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
...@@ -226,7 +227,8 @@ ...@@ -226,7 +227,8 @@
# Install package config files # Install package config files
install(FILES ${PROJECT_BINARY_DIR}/cJSONConfig.cmake install(FILES ${PROJECT_BINARY_DIR}/cJSONConfig.cmake
${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake ${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake
DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON") DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
endif()
option(ENABLE_CJSON_TEST "Enable building cJSON test" ON) option(ENABLE_CJSON_TEST "Enable building cJSON test" ON)
if(ENABLE_CJSON_TEST) if(ENABLE_CJSON_TEST)
......
...@@ -1518,6 +1518,10 @@ ...@@ -1518,6 +1518,10 @@
success: success:
input_buffer->depth--; input_buffer->depth--;
if (head != NULL) {
head->prev = current_item;
}
item->type = cJSON_Array; item->type = cJSON_Array;
item->child = head; item->child = head;
...@@ -1690,6 +1694,10 @@ ...@@ -1690,6 +1694,10 @@
success: success:
input_buffer->depth--; input_buffer->depth--;
if (head != NULL) {
head->prev = current_item;
}
item->type = cJSON_Object; item->type = cJSON_Object;
item->child = head; item->child = head;
...@@ -2211,6 +2219,12 @@ ...@@ -2211,6 +2219,12 @@
/* first element */ /* first element */
parent->child = item->next; parent->child = item->next;
} }
else if (item->next == NULL)
{
/* last element */
parent->child->prev = item->prev;
}
/* make sure the detached item doesn't point anywhere anymore */ /* make sure the detached item doesn't point anywhere anymore */
item->prev = NULL; item->prev = NULL;
item->next = NULL; item->next = NULL;
...@@ -2308,6 +2322,10 @@ ...@@ -2308,6 +2322,10 @@
} }
if (parent->child == item) if (parent->child == item)
{ {
if (parent->child->prev == parent->child)
{
replacement->prev = replacement;
}
parent->child = replacement; parent->child = replacement;
} }
else else
...@@ -2319,6 +2337,10 @@ ...@@ -2319,6 +2337,10 @@
{ {
replacement->prev->next = replacement; replacement->prev->next = replacement;
} }
if (replacement->next == NULL)
{
parent->child->prev = replacement;
}
} }
item->next = NULL; item->next = NULL;
......
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
URL: https://github.com/DaveGamble/cJSON URL: https://github.com/DaveGamble/cJSON
Libs: -L${libdir} -lcjson Libs: -L${libdir} -lcjson
Libs.private: -lm Libs.private: -lm
Cflags: -I${includedir} Cflags: -I${includedir} -I${includedir}/cjson
...@@ -6,5 +6,5 @@ ...@@ -6,5 +6,5 @@
Description: An implementation of JSON Pointer, Patch and Merge Patch based on cJSON. Description: An implementation of JSON Pointer, Patch and Merge Patch based on cJSON.
URL: https://github.com/DaveGamble/cJSON URL: https://github.com/DaveGamble/cJSON
Libs: -L${libdir} -lcjson_utils Libs: -L${libdir} -lcjson_utils
Cflags: -I${includedir} Cflags: -I${includedir} -I${includedir}/cjson
Requires: libcjson Requires: libcjson
...@@ -90,7 +90,8 @@ ...@@ -90,7 +90,8 @@
assert_parse_array("[[]]"); assert_parse_array("[[]]");
assert_has_child(item); assert_has_child(item);
assert_is_array(item->child); TEST_ASSERT_NOT_NULL(item->child);
assert_has_type(item->child, cJSON_Array);
assert_has_no_child(item->child); assert_has_no_child(item->child);
reset(item); reset(item);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment