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.
This commit is contained in:
Jay Berkenbilt 2019-08-22 13:20:36 -04:00
parent 4b674b42e4
commit 3f3dbe22ea
6 changed files with 46 additions and 30 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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