Skip to content

Commit

Permalink
Prefer appending character constants over string literals - correct p…
Browse files Browse the repository at this point in the history
…atch.

Submitting correct patch for open-source-parsers#61
  • Loading branch information
ya1gaurav committed Nov 13, 2014
1 parent 00b0a1b commit abc1e07
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib_json/json_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -302,7 +302,7 @@ void StyledWriter::writeValue(const Value& value) {
writeCommentAfterValueOnSameLine(childValue);
break;
}
document_ += ",";
document_ += ',';
writeCommentAfterValueOnSameLine(childValue);
}
unindent();
Expand Down Expand Up @@ -336,7 +336,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
writeCommentAfterValueOnSameLine(childValue);
break;
}
document_ += ",";
document_ += ',';
writeCommentAfterValueOnSameLine(childValue);
}
unindent();
Expand Down

0 comments on commit abc1e07

Please sign in to comment.