2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Make newly created name/number trees indirect objects

This commit is contained in:
Jay Berkenbilt 2021-02-07 18:49:30 -05:00
parent 553ac7f353
commit bfbeec5497
4 changed files with 62 additions and 48 deletions

View File

@ -6,7 +6,17 @@
1 0 obj
<<
/Example <<
/NameTree <<
/NameTree 2 0 R
/NumberTree 3 0 R
>>
/Pages 4 0 R
/Type /Catalog
>>
endobj
%% Original object ID: 3 0
2 0 obj
<<
/Names [
(B)
(bishop)
@ -18,25 +28,35 @@
(rook)
]
>>
/NumberTree <<
endobj
%% Original object ID: 4 0
3 0 obj
<<
/Kids [
2 0 R
3 0 R
4 0 R
5 0 R
6 0 R
7 0 R
]
/Limits [
7
343
]
>>
>>
/Pages 5 0 R
/Type /Catalog
endobj
%% Original object ID: 2 0
4 0 obj
<<
/Count 0
/Kids [
]
/Type /Pages
>>
endobj
%% Original object ID: 3 0
2 0 obj
%% Original object ID: 5 0
5 0 obj
<<
/Limits [
7
@ -73,8 +93,8 @@ endobj
>>
endobj
%% Original object ID: 4 0
3 0 obj
%% Original object ID: 6 0
6 0 obj
<<
/Limits [
119
@ -111,8 +131,8 @@ endobj
>>
endobj
%% Original object ID: 5 0
4 0 obj
%% Original object ID: 7 0
7 0 obj
<<
/Limits [
231
@ -151,29 +171,21 @@ endobj
>>
endobj
%% Original object ID: 2 0
5 0 obj
<<
/Count 0
/Kids [
]
/Type /Pages
>>
endobj
xref
0 6
0 8
0000000000 65535 f
0000000052 00000 n
0000000448 00000 n
0000000775 00000 n
0000001130 00000 n
0000001505 00000 n
0000000194 00000 n
0000000339 00000 n
0000000462 00000 n
0000000551 00000 n
0000000878 00000 n
0000001233 00000 n
trailer <<
/Root 1 0 R
/Size 6
/Size 8
/ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
>>
startxref
1567
1581
%%EOF

View File

@ -60,7 +60,8 @@ QPDFNameTreeObjectHelper
QPDFNameTreeObjectHelper::newEmpty(QPDF& qpdf, bool auto_repair)
{
return QPDFNameTreeObjectHelper(
QPDFObjectHandle::parse("<< /Names [] >>"), qpdf, auto_repair);
qpdf.makeIndirectObject(
QPDFObjectHandle::parse("<< /Names [] >>")), qpdf, auto_repair);
}
QPDFNameTreeObjectHelper::iterator::iterator(

View File

@ -56,7 +56,8 @@ QPDFNumberTreeObjectHelper
QPDFNumberTreeObjectHelper::newEmpty(QPDF& qpdf, bool auto_repair)
{
return QPDFNumberTreeObjectHelper(
QPDFObjectHandle::parse("<< /Nums [] >>"), qpdf, auto_repair);
qpdf.makeIndirectObject(
QPDFObjectHandle::parse("<< /Nums [] >>")), qpdf, auto_repair);
}
QPDFNumberTreeObjectHelper::iterator::iterator(

View File

@ -487,7 +487,7 @@ void read_from_file_test()
Pl_Buffer b2("buffer");
// QUtil::file_provider also exercises QUtil::pipe_file
QUtil::file_provider("other-file")(&b2);
auto buf2 = b2.getBuffer();
PointerHolder<Buffer> buf2 = b2.getBuffer();
assert(buf2->getSize() == size);
assert(memcmp(buf2->getBuffer(), p, size) == 0);
}