diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-08-22 19:20:36 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-08-22 23:55:16 +0200 |
commit | 3f3dbe22eaae56df48af304c35a1c0b5dd976135 (patch) | |
tree | fdbc1ce25eca82315310c1d0c9a012a4da9c450d | |
parent | 4b674b42e4c1b9b470dd4ca8b84ac4db1d430055 (diff) | |
download | qpdf-3f3dbe22eaae56df48af304c35a1c0b5dd976135.tar.zst |
Remove array null flattening
For some reason, qpdf from the beginning was replacing indirect
references to null with literal null in arrays even after removing the
old behavior of flattening scalar references. This seems like a bad
idea.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | libqpdf/QPDFWriter.cc | 8 | ||||
-rw-r--r-- | qpdf/qpdf.testcov | 1 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/dangling-refs-dangling-out.pdf | bin | 893 -> 934 bytes | |||
-rw-r--r-- | qpdf/qtest/qpdf/merge-three-files-1.pdf | bin | 8396 -> 8699 bytes | |||
-rw-r--r-- | qpdf/qtest/qpdf/three-files-collate-out.pdf | 62 |
6 files changed, 46 insertions, 30 deletions
@@ -1,3 +1,8 @@ +2019-08-22 Jay Berkenbilt <ejb@ql.org> + + * Stop replacing indirect references to null with literal null in + arrays when writing output with QPDFWriter. + 2019-08-19 Jay Berkenbilt <ejb@ql.org> * Accept (and warn for) extraneous whitespace preceding the xref diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 2df18452..6c92338d 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -2390,13 +2390,7 @@ QPDFWriter::prepareFileForWrite() for (int i = 0; i < nitems; ++i) { QPDFObjectHandle oh = node.getArrayItem(i); - if (oh.isIndirect() && oh.isNull()) - { - QTC::TC("qpdf", "QPDFWriter flatten array null"); - oh.makeDirect(); - node.setArrayItem(i, oh); - } - else if (! oh.isScalar()) + if (! oh.isScalar()) { queue.push_back(oh); } diff --git a/qpdf/qpdf.testcov b/qpdf/qpdf.testcov index f1acee76..e8e5bf3e 100644 --- a/qpdf/qpdf.testcov +++ b/qpdf/qpdf.testcov @@ -27,7 +27,6 @@ QPDF lin outlines in part 1 QPDF lin nshared_total > nshared_first_page 1 QPDF lin part 8 empty 1 QPDF lin check shared past first page 0 -QPDFWriter flatten array null 0 main QTest implicit 0 main QTest indirect 1 main QTest null 0 diff --git a/qpdf/qtest/qpdf/dangling-refs-dangling-out.pdf b/qpdf/qtest/qpdf/dangling-refs-dangling-out.pdf Binary files differindex 96f81068..8ca87ebe 100644 --- a/qpdf/qtest/qpdf/dangling-refs-dangling-out.pdf +++ b/qpdf/qtest/qpdf/dangling-refs-dangling-out.pdf diff --git a/qpdf/qtest/qpdf/merge-three-files-1.pdf b/qpdf/qtest/qpdf/merge-three-files-1.pdf Binary files differindex d90b97d7..42e84a22 100644 --- a/qpdf/qtest/qpdf/merge-three-files-1.pdf +++ b/qpdf/qtest/qpdf/merge-three-files-1.pdf diff --git a/qpdf/qtest/qpdf/three-files-collate-out.pdf b/qpdf/qtest/qpdf/three-files-collate-out.pdf index f6fe42f9..36b1c8d0 100644 --- a/qpdf/qtest/qpdf/three-files-collate-out.pdf +++ b/qpdf/qtest/qpdf/three-files-collate-out.pdf @@ -775,12 +775,12 @@ endobj << /Count -2 /Dest [ - null + 57 0 R /FitV 100 ] - /First 57 0 R - /Last 58 0 R + /First 58 0 R + /Last 59 0 R /Next 54 0 R /Parent 19 0 R /Title (Isosicle 1.1.1 -> 12: /FitV 100) @@ -793,14 +793,14 @@ endobj << /Count 1 /Dest [ - null + 57 0 R /XYZ null null null ] - /First 59 0 R - /Last 59 0 R + /First 60 0 R + /Last 60 0 R /Parent 19 0 R /Prev 53 0 R /Title (Isosicle 1.1.2 -> 12: /XYZ null null null) @@ -843,17 +843,22 @@ endobj >> endobj -%% Original object ID: 44 0 +%% Original object ID: 12 0 57 0 obj +null +endobj + +%% Original object ID: 44 0 +58 0 obj << /Dest [ - null + 61 0 R /XYZ null null null ] - /Next 58 0 R + /Next 59 0 R /Parent 53 0 R /Title (Isosicle 1.1.1.1 -> 18: /XYZ null null null) /Type /Outline @@ -861,7 +866,7 @@ endobj endobj %% Original object ID: 45 0 -58 0 obj +59 0 obj << /Dest [ null @@ -871,17 +876,17 @@ endobj null ] /Parent 53 0 R - /Prev 57 0 R + /Prev 58 0 R /Title (Isosicle 1.1.1.2 -> 19: /XYZ null null null) /Type /Outline >> endobj %% Original object ID: 46 0 -59 0 obj +60 0 obj << /Dest [ - null + 62 0 R /XYZ null null @@ -893,8 +898,18 @@ endobj >> endobj +%% Original object ID: 15 0 +61 0 obj +null +endobj + +%% Original object ID: 17 0 +62 0 obj +null +endobj + xref -0 60 +0 63 0000000000 65535 f 0000000052 00000 n 0000000853 00000 n @@ -949,17 +964,20 @@ xref 0000007949 00000 n 0000008052 00000 n 0000008100 00000 n -0000008327 00000 n -0000008581 00000 n -0000008801 00000 n -0000009014 00000 n -0000009228 00000 n -0000009442 00000 n +0000008329 00000 n +0000008585 00000 n +0000008805 00000 n +0000009018 00000 n +0000009068 00000 n +0000009284 00000 n +0000009498 00000 n +0000009699 00000 n +0000009749 00000 n trailer << /Root 1 0 R - /Size 60 + /Size 63 /ID [<d3fab8d0603e683dc94e42ac31141868><31415926535897932384626433832795>] >> startxref -9613 +9771 %%EOF |