Fix uninitialized value detected by valgrind

Fix issue reported in https://github.com/open-source-parsers/jsoncpp/issues/578
For std::string variable, length() is more readable than size().
This commit is contained in:
Gaurav 2017-02-15 17:47:11 +05:30 committed by Christopher Dunn
parent 6062f9b848
commit 9006194139

View File

@ -103,7 +103,7 @@ Reader::Reader(const Features& features)
bool
Reader::parse(const std::string& document, Value& root, bool collectComments) {
JSONCPP_STRING documentCopy(document.data(), document.data() + document.capacity());
JSONCPP_STRING documentCopy(document.data(), document.data() + document.length());
std::swap(documentCopy, document_);
const char* begin = document_.c_str();
const char* end = begin + document_.length();