From ee83f8891c28103fcf38a3e949e2409df0f258a5 Mon Sep 17 00:00:00 2001 From: datadiode Date: Sat, 7 Mar 2015 12:19:40 +0100 Subject: [PATCH] Trivial fixes in CZString constructors. --- src/lib_json/json_value.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 6d68002..e128eec 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -196,7 +196,7 @@ void Value::CommentInfo::setComment(const char* text, size_t len) { Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {} Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy allocate) - : cstr_(allocate == duplicate ? duplicateStringValue(str) : str) + : cstr_(allocate == duplicate ? duplicateStringValue(str, length) : str) { storage_.policy_ = allocate; storage_.length_ = length; @@ -204,7 +204,7 @@ Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy al Value::CZString::CZString(const CZString& other) : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0 - ? duplicateStringValue(other.cstr_) + ? duplicateStringValue(other.cstr_, other.storage_.length_) : other.cstr_) { storage_.policy_ = (other.cstr_