Merge pull request #266 from cdunn2001/issue-252

Use unsigned for DuplicationPolicy, to fix a problem with "C++ Builder"
IDE.

Fixes #252.

Thanks to:

* Dan Liu -- http://blog.csdn.net/gzliudan/article/details/45264201)
* Victor Chen -- http://www.cppfans.com/sdk/json/jsoncpp.asp
This commit is contained in:
Christopher Dunn 2015-04-27 17:13:39 -07:00
commit 28d086e1d9
2 changed files with 16 additions and 1 deletions

View File

@ -211,7 +211,7 @@ private:
void swap(CZString& other);
struct StringStorage {
DuplicationPolicy policy_: 2;
unsigned policy_: 2;
unsigned length_: 30; // 1GB max
};

View File

@ -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);