Prefer appending character constants over string literals - correct patch.

Submitting correct patch for https://github.com/open-source-parsers/jsoncpp/issues/61
This commit is contained in:
Gaurav 2014-11-13 12:47:19 +05:30
parent 00b0a1b992
commit abc1e07543

View File

@ -217,28 +217,28 @@ void FastWriter::writeValue(const Value& value) {
document_ += valueToString(value.asBool());
break;
case arrayValue: {
document_ += "[";
document_ += '[';
int size = value.size();
for (int index = 0; index < size; ++index) {
if (index > 0)
document_ += ",";
document_ += ',';
writeValue(value[index]);
}
document_ += "]";
document_ += ']';
} break;
case objectValue: {
Value::Members members(value.getMemberNames());
document_ += "{";
document_ += '{';
for (Value::Members::iterator it = members.begin(); it != members.end();
++it) {
const std::string& name = *it;
if (it != members.begin())
document_ += ",";
document_ += ',';
document_ += valueToQuotedString(name.c_str());
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
writeValue(value[name]);
}
document_ += "}";
document_ += '}';
} break;
}
}
@ -302,7 +302,7 @@ void StyledWriter::writeValue(const Value& value) {
writeCommentAfterValueOnSameLine(childValue);
break;
}
document_ += ",";
document_ += ',';
writeCommentAfterValueOnSameLine(childValue);
}
unindent();
@ -336,7 +336,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
writeCommentAfterValueOnSameLine(childValue);
break;
}
document_ += ",";
document_ += ',';
writeCommentAfterValueOnSameLine(childValue);
}
unindent();