aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_json.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-07-30 19:32:59 +0200
committerJay Berkenbilt <ejb@ql.org>2022-07-31 16:32:55 +0200
commit0e3d4cdc9753ae59d42ff8478b0769196899032b (patch)
treeb6919e42f14ba4e63290d8b5658659e3e18cdb9a /libqpdf/QPDF_json.cc
parent8ad39a6c9ab29f933d2f5fa2a0aee4e5e093b068 (diff)
downloadqpdf-0e3d4cdc9753ae59d42ff8478b0769196899032b.tar.zst
Fix/clarify meaning of depth parameter to json write methods
Diffstat (limited to 'libqpdf/QPDF_json.cc')
-rw-r--r--libqpdf/QPDF_json.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/libqpdf/QPDF_json.cc b/libqpdf/QPDF_json.cc
index 5527318c..59aac05e 100644
--- a/libqpdf/QPDF_json.cc
+++ b/libqpdf/QPDF_json.cc
@@ -739,7 +739,7 @@ QPDF::writeJSONStream(
obj.getStreamJSON(
version, json_stream_data, decode_level, stream_p, filename));
- JSON::writeDictionaryItem(p, first, key, j, 2);
+ JSON::writeDictionaryItem(p, first, key, j, 3);
if (f) {
f_pl->finish();
f_pl = nullptr;
@@ -757,7 +757,7 @@ QPDF::writeJSONObject(
{
auto j = JSON::makeDictionary();
j.addDictionaryMember("value", obj.getJSON(version, true));
- JSON::writeDictionaryItem(p, first, key, j, 2);
+ JSON::writeDictionaryItem(p, first, key, j, 3);
}
void
@@ -774,19 +774,23 @@ QPDF::writeJSON(
"QPDF::writeJSON: only version 2 is supported");
}
bool first = true;
- JSON::writeDictionaryOpen(p, first, 0);
- JSON::writeDictionaryKey(p, first, "qpdf-v2", 0);
+ if (complete) {
+ JSON::writeDictionaryOpen(p, first, 0);
+ } else {
+ first = first_key;
+ }
+ JSON::writeDictionaryKey(p, first, "qpdf-v2", 1);
bool first_qpdf = true;
- JSON::writeDictionaryOpen(p, first_qpdf, 1);
+ JSON::writeDictionaryOpen(p, first_qpdf, 2);
JSON::writeDictionaryItem(
- p, first_qpdf, "pdfversion", JSON::makeString(getPDFVersion()), 1);
+ p, first_qpdf, "pdfversion", JSON::makeString(getPDFVersion()), 2);
JSON::writeDictionaryItem(
p,
first_qpdf,
"maxobjectid",
JSON::makeInt(QIntC::to_longlong(getObjectCount())),
- 1);
- JSON::writeDictionaryKey(p, first_qpdf, "objects", 1);
+ 2);
+ JSON::writeDictionaryKey(p, first_qpdf, "objects", 2);
bool first_object = true;
JSON::writeDictionaryOpen(p, first_object, 2);
bool all_objects = wanted_objects.empty();