aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/qpdf/JSON.hh1
-rw-r--r--libqpdf/JSON.cc17
2 files changed, 6 insertions, 12 deletions
diff --git a/include/qpdf/JSON.hh b/include/qpdf/JSON.hh
index 77c4b108..64f3792c 100644
--- a/include/qpdf/JSON.hh
+++ b/include/qpdf/JSON.hh
@@ -338,7 +338,6 @@ class JSON
static std::string encode_string(std::string const& utf8);
static void
writeClose(Pipeline* p, bool first, size_t depth, char const* delimeter);
- static void writeIndent(Pipeline* p, size_t depth);
struct JSON_value
{
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