mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-23 18:58:44 +08:00
rejectDupKeys
This commit is contained in:
@@ -1432,6 +1432,11 @@ bool OurReader::readObject(Token& tokenStart) {
|
|||||||
"Missing ':' after object member name", colon, tokenObjectEnd);
|
"Missing ':' after object member name", colon, tokenObjectEnd);
|
||||||
}
|
}
|
||||||
if (name.length() >= (1U<<30)) throw std::runtime_error("keylength >= 2^30");
|
if (name.length() >= (1U<<30)) throw std::runtime_error("keylength >= 2^30");
|
||||||
|
if (features_.rejectDupKeys_ && currentValue().isMember(name)) {
|
||||||
|
std::string msg = "Duplicate key: '" + name + "'";
|
||||||
|
return addErrorAndRecover(
|
||||||
|
msg, tokenName, tokenObjectEnd);
|
||||||
|
}
|
||||||
Value& value = currentValue()[name];
|
Value& value = currentValue()[name];
|
||||||
nodes_.push(&value);
|
nodes_.push(&value);
|
||||||
bool ok = readValue();
|
bool ok = readValue();
|
||||||
|
Reference in New Issue
Block a user