mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-01-06 00:31:10 +01:00
fix Builders::validate()
This commit is contained in:
parent
99822b27cd
commit
626cfcdbb8
@ -1915,7 +1915,6 @@ bool CharReaderBuilder::validate(Json::Value* invalid) const
|
|||||||
Json::Value my_invalid;
|
Json::Value my_invalid;
|
||||||
if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL
|
if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL
|
||||||
Json::Value& inv = *invalid;
|
Json::Value& inv = *invalid;
|
||||||
bool valid = true;
|
|
||||||
std::set<std::string> valid_keys;
|
std::set<std::string> valid_keys;
|
||||||
getValidReaderKeys(&valid_keys);
|
getValidReaderKeys(&valid_keys);
|
||||||
Value::Members keys = settings_.getMemberNames();
|
Value::Members keys = settings_.getMemberNames();
|
||||||
@ -1926,7 +1925,7 @@ bool CharReaderBuilder::validate(Json::Value* invalid) const
|
|||||||
inv[key] = settings_[key];
|
inv[key] = settings_[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return valid;
|
return 0u == inv.size();
|
||||||
}
|
}
|
||||||
// static
|
// static
|
||||||
void CharReaderBuilder::strictMode(Json::Value* settings)
|
void CharReaderBuilder::strictMode(Json::Value* settings)
|
||||||
|
@ -1110,7 +1110,6 @@ bool StreamWriterBuilder::validate(Json::Value* invalid) const
|
|||||||
Json::Value my_invalid;
|
Json::Value my_invalid;
|
||||||
if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL
|
if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL
|
||||||
Json::Value& inv = *invalid;
|
Json::Value& inv = *invalid;
|
||||||
bool valid = true;
|
|
||||||
std::set<std::string> valid_keys;
|
std::set<std::string> valid_keys;
|
||||||
getValidWriterKeys(&valid_keys);
|
getValidWriterKeys(&valid_keys);
|
||||||
Value::Members keys = settings_.getMemberNames();
|
Value::Members keys = settings_.getMemberNames();
|
||||||
@ -1121,7 +1120,7 @@ bool StreamWriterBuilder::validate(Json::Value* invalid) const
|
|||||||
inv[key] = settings_[key];
|
inv[key] = settings_[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return valid;
|
return 0u == inv.size();
|
||||||
}
|
}
|
||||||
// static
|
// static
|
||||||
void StreamWriterBuilder::setDefaults(Json::Value* settings)
|
void StreamWriterBuilder::setDefaults(Json::Value* settings)
|
||||||
|
Loading…
Reference in New Issue
Block a user