From fcbab02e4a2d17ce775eed21a3e7de6dba8690ab Mon Sep 17 00:00:00 2001 From: Dan Liu Date: Mon, 27 Apr 2015 05:20:05 +0100 Subject: [PATCH 1/2] fix crash for "C++ Builder" IDE http://blog.csdn.net/gzliudan/article/details/45264201 --- include/json/value.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/json/value.h b/include/json/value.h index 26bb38b..426b0f7 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -211,7 +211,7 @@ private: void swap(CZString& other); struct StringStorage { - DuplicationPolicy policy_: 2; + unsigned policy_: 2; unsigned length_: 30; // 1GB max }; From a0a7c5f6def1bcdcd0716af0d7dfa413c30cd005 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Mon, 27 Apr 2015 09:57:58 -0700 Subject: [PATCH 2/2] a little test for issue 252, but does not fail for me --- src/test_lib_json/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp index 09c3903..0d4284e 100644 --- a/src/test_lib_json/main.cpp +++ b/src/test_lib_json/main.cpp @@ -257,6 +257,20 @@ JSONTEST_FIXTURE(ValueTest, arrays) { JSONTEST_ASSERT_EQUAL(Json::Value(17), got); JSONTEST_ASSERT_EQUAL(false, array1_.removeIndex(2, &got)); // gone now } +JSONTEST_FIXTURE(ValueTest, arrayIssue252) +{ + int count = 5; + Json::Value root; + Json::Value item; + root["array"] = Json::Value::nullRef; + for (int i = 0; i < count; i++) + { + item["a"] = i; + item["b"] = i; + root["array"][i] = item; + } + //JSONTEST_ASSERT_EQUAL(5, root["array"].size()); +} JSONTEST_FIXTURE(ValueTest, null) { JSONTEST_ASSERT_EQUAL(Json::nullValue, null_.type()); @@ -2326,6 +2340,7 @@ int main(int argc, const char* argv[]) { JSONTEST_REGISTER_FIXTURE(runner, ValueTest, memberCount); JSONTEST_REGISTER_FIXTURE(runner, ValueTest, objects); JSONTEST_REGISTER_FIXTURE(runner, ValueTest, arrays); + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, arrayIssue252); JSONTEST_REGISTER_FIXTURE(runner, ValueTest, null); JSONTEST_REGISTER_FIXTURE(runner, ValueTest, strings); JSONTEST_REGISTER_FIXTURE(runner, ValueTest, bools);