aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/JSON.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/JSON.cc')
-rw-r--r--libqpdf/JSON.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/libqpdf/JSON.cc b/libqpdf/JSON.cc
index 7bdf01d4..fd76e628 100644
--- a/libqpdf/JSON.cc
+++ b/libqpdf/JSON.cc
@@ -42,23 +42,18 @@ JSON::writeClose(Pipeline* p, bool first, size_t depth, char const* delimiter)
}
void
-JSON::writeIndent(Pipeline* p, size_t depth)
-{
- for (size_t i = 0; i < depth; ++i) {
- *p << " ";
- }
-}
-
-void
JSON::writeNext(Pipeline* p, bool& first, size_t depth)
{
if (first) {
first = false;
+ std::string s{"\n"};
+ s.append(2 * depth, ' ');
+ *p << s;
} else {
- *p << ",";
+ std::string s{",\n"};
+ s.append(2 * depth, ' ');
+ *p << s;
}
- *p << "\n";
- writeIndent(p, depth);
}
void