Skip to content

Commit ee83f88

Browse files
datadiodecdunn2001
datadiode
authored andcommitted
Trivial fixes in CZString constructors.
1 parent 5c44868 commit ee83f88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib_json/json_value.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
196196
Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {}
197197

198198
Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy allocate)
199-
: cstr_(allocate == duplicate ? duplicateStringValue(str) : str)
199+
: cstr_(allocate == duplicate ? duplicateStringValue(str, length) : str)
200200
{
201201
storage_.policy_ = allocate;
202202
storage_.length_ = length;
203203
}
204204

205205
Value::CZString::CZString(const CZString& other)
206206
: cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
207-
? duplicateStringValue(other.cstr_)
207+
? duplicateStringValue(other.cstr_, other.storage_.length_)
208208
: other.cstr_)
209209
{
210210
storage_.policy_ = (other.cstr_

0 commit comments

Comments
 (0)