mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-12 18:10:27 +01:00
actually store length in CZString
This commit is contained in:
parent
57ad051f67
commit
8a77037320
@ -164,7 +164,7 @@ private:
|
|||||||
duplicateOnCopy
|
duplicateOnCopy
|
||||||
};
|
};
|
||||||
CZString(ArrayIndex index);
|
CZString(ArrayIndex index);
|
||||||
CZString(const char* cstr, DuplicationPolicy allocate);
|
CZString(char const* cstr, unsigned length, DuplicationPolicy allocate);
|
||||||
CZString(const CZString& other);
|
CZString(const CZString& other);
|
||||||
~CZString();
|
~CZString();
|
||||||
CZString& operator=(CZString other);
|
CZString& operator=(CZString other);
|
||||||
|
@ -163,9 +163,9 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
|
|||||||
|
|
||||||
Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {}
|
Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {}
|
||||||
|
|
||||||
Value::CZString::CZString(const char* cstr, DuplicationPolicy allocate)
|
Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy allocate)
|
||||||
: cstr_(allocate == duplicate ? duplicateStringValue(cstr) : cstr),
|
: cstr_(allocate == duplicate ? duplicateStringValue(str) : str),
|
||||||
storage_({allocate, 0})
|
storage_({allocate, length})
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Value::CZString::CZString(const CZString& other)
|
Value::CZString::CZString(const CZString& other)
|
||||||
@ -175,7 +175,7 @@ Value::CZString::CZString(const CZString& other)
|
|||||||
storage_({(other.cstr_
|
storage_({(other.cstr_
|
||||||
? (other.storage_.policy_ == noDuplication
|
? (other.storage_.policy_ == noDuplication
|
||||||
? noDuplication : duplicate)
|
? noDuplication : duplicate)
|
||||||
: other.storage_.policy_), 0})
|
: other.storage_.policy_), other.storage_.length_})
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Value::CZString::~CZString() {
|
Value::CZString::~CZString() {
|
||||||
@ -849,7 +849,7 @@ Value& Value::resolveReference(const char* key, bool isStatic) {
|
|||||||
if (type_ == nullValue)
|
if (type_ == nullValue)
|
||||||
*this = Value(objectValue);
|
*this = Value(objectValue);
|
||||||
CZString actualKey(
|
CZString actualKey(
|
||||||
key, isStatic ? CZString::noDuplication : CZString::duplicateOnCopy);
|
key, strlen(key), isStatic ? CZString::noDuplication : CZString::duplicateOnCopy);
|
||||||
ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
|
ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
|
||||||
if (it != value_.map_->end() && (*it).first == actualKey)
|
if (it != value_.map_->end() && (*it).first == actualKey)
|
||||||
return (*it).second;
|
return (*it).second;
|
||||||
@ -873,7 +873,7 @@ const Value& Value::operator[](const char* key) const {
|
|||||||
"in Json::Value::operator[](char const*)const: requires objectValue");
|
"in Json::Value::operator[](char const*)const: requires objectValue");
|
||||||
if (type_ == nullValue)
|
if (type_ == nullValue)
|
||||||
return null;
|
return null;
|
||||||
CZString actualKey(key, CZString::noDuplication);
|
CZString actualKey(key, strlen(key), CZString::noDuplication);
|
||||||
ObjectValues::const_iterator it = value_.map_->find(actualKey);
|
ObjectValues::const_iterator it = value_.map_->find(actualKey);
|
||||||
if (it == value_.map_->end())
|
if (it == value_.map_->end())
|
||||||
return null;
|
return null;
|
||||||
@ -918,7 +918,7 @@ bool Value::removeMember(const char* key, Value* removed) {
|
|||||||
if (type_ != objectValue) {
|
if (type_ != objectValue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CZString actualKey(key, CZString::noDuplication);
|
CZString actualKey(key, strlen(key), CZString::noDuplication);
|
||||||
ObjectValues::iterator it = value_.map_->find(actualKey);
|
ObjectValues::iterator it = value_.map_->find(actualKey);
|
||||||
if (it == value_.map_->end())
|
if (it == value_.map_->end())
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user