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

Avoid traversing same object twice when copying objects

This is a performance fix.  The output is unchanged.

Fixes #28.
This commit is contained in:
Jay Berkenbilt 2013-12-26 11:51:50 -05:00
parent 0b6127558d
commit c9a9fe9c2f
3 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2013-12-26 Jay Berkenbilt <ejb@ql.org>
* Bug fix: when copying foreign objects (which occurs during page
splitting among other cases), avoid traversing the same object
more than once if it appears more than once in the same direct
object. This bug is performance-only and does not affect the
actual output.
2013-12-17 Jay Berkenbilt <ejb@ql.org>
* 5.1.0: release

View File

@ -1755,6 +1755,11 @@ QPDF::reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier,
QTC::TC("qpdf", "QPDF loop reserving objects");
return;
}
if (obj_copier.object_map.find(foreign_og) != obj_copier.object_map.end())
{
QTC::TC("qpdf", "QPDF already reserved object");
return;
}
QTC::TC("qpdf", "QPDF copy indirect");
obj_copier.visiting.insert(foreign_og);
std::map<QPDFObjGen, QPDFObjectHandle>::iterator mapping =

View File

@ -268,3 +268,4 @@ QPDF xref space 2
qpdf pages range omitted at end 0
qpdf pages range omitted in middle 0
qpdf npages 0
QPDF already reserved object 0