mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-05-04 16:18:21 +02:00
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:
parent
00b0a1b992
commit
abc1e07543
@ -217,28 +217,28 @@ void FastWriter::writeValue(const Value& value) {
|
|||||||
document_ += valueToString(value.asBool());
|
document_ += valueToString(value.asBool());
|
||||||
break;
|
break;
|
||||||
case arrayValue: {
|
case arrayValue: {
|
||||||
document_ += "[";
|
document_ += '[';
|
||||||
int size = value.size();
|
int size = value.size();
|
||||||
for (int index = 0; index < size; ++index) {
|
for (int index = 0; index < size; ++index) {
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
document_ += ",";
|
document_ += ',';
|
||||||
writeValue(value[index]);
|
writeValue(value[index]);
|
||||||
}
|
}
|
||||||
document_ += "]";
|
document_ += ']';
|
||||||
} break;
|
} break;
|
||||||
case objectValue: {
|
case objectValue: {
|
||||||
Value::Members members(value.getMemberNames());
|
Value::Members members(value.getMemberNames());
|
||||||
document_ += "{";
|
document_ += '{';
|
||||||
for (Value::Members::iterator it = members.begin(); it != members.end();
|
for (Value::Members::iterator it = members.begin(); it != members.end();
|
||||||
++it) {
|
++it) {
|
||||||
const std::string& name = *it;
|
const std::string& name = *it;
|
||||||
if (it != members.begin())
|
if (it != members.begin())
|
||||||
document_ += ",";
|
document_ += ',';
|
||||||
document_ += valueToQuotedString(name.c_str());
|
document_ += valueToQuotedString(name.c_str());
|
||||||
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
|
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
|
||||||
writeValue(value[name]);
|
writeValue(value[name]);
|
||||||
}
|
}
|
||||||
document_ += "}";
|
document_ += '}';
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ void StyledWriter::writeValue(const Value& value) {
|
|||||||
writeCommentAfterValueOnSameLine(childValue);
|
writeCommentAfterValueOnSameLine(childValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
document_ += ",";
|
document_ += ',';
|
||||||
writeCommentAfterValueOnSameLine(childValue);
|
writeCommentAfterValueOnSameLine(childValue);
|
||||||
}
|
}
|
||||||
unindent();
|
unindent();
|
||||||
@ -336,7 +336,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
|
|||||||
writeCommentAfterValueOnSameLine(childValue);
|
writeCommentAfterValueOnSameLine(childValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
document_ += ",";
|
document_ += ',';
|
||||||
writeCommentAfterValueOnSameLine(childValue);
|
writeCommentAfterValueOnSameLine(childValue);
|
||||||
}
|
}
|
||||||
unindent();
|
unindent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user