mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-08-04 10:36:23 -04:00
Merge 8b8dc99b775b3992052aede154ba0f0d3c045898 into ca98c98457b1163cca1f7d8db62827c115fec6d1
This commit is contained in:
commit
17b9d8c19d
@ -852,6 +852,7 @@ public:
|
||||
bool rejectDupKeys_;
|
||||
bool allowSpecialFloats_;
|
||||
bool skipBom_;
|
||||
bool skipEscapeString_;
|
||||
size_t stackLimit_;
|
||||
}; // OurFeatures
|
||||
|
||||
@ -1427,8 +1428,10 @@ bool OurReader::readObject(Token& token) {
|
||||
return true;
|
||||
name.clear();
|
||||
if (tokenName.type_ == tokenString) {
|
||||
if (!decodeString(tokenName, name))
|
||||
name = String(tokenName.start_ + 1, tokenName.end_ - 1);
|
||||
/*if (!decodeString(tokenName, name))
|
||||
return recoverFromError(tokenObjectEnd);
|
||||
*/
|
||||
} else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
|
||||
Value numberName;
|
||||
if (!decodeNumber(tokenName, numberName))
|
||||
@ -1639,6 +1642,10 @@ bool OurReader::decodeString(Token& token, String& decoded) {
|
||||
decoded.reserve(static_cast<size_t>(token.end_ - token.start_ - 2));
|
||||
Location current = token.start_ + 1; // skip '"'
|
||||
Location end = token.end_ - 1; // do not include '"'
|
||||
if (features_.skipEscapeString_) {
|
||||
decoded = String(current, end);
|
||||
return true;
|
||||
}
|
||||
while (current != end) {
|
||||
Char c = *current++;
|
||||
if (c == '"')
|
||||
@ -1884,6 +1891,7 @@ CharReader* CharReaderBuilder::newCharReader() const {
|
||||
features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool();
|
||||
features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool();
|
||||
features.skipBom_ = settings_["skipBom"].asBool();
|
||||
features.skipEscapeString_ = settings_["skipEscapeString"].asBool();
|
||||
return new OurCharReader(collectComments, features);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user