Commit c9a9fe9c2f8837bdfdd2b0e58fce9a82b0a64881
1 parent
0b612755
Avoid traversing same object twice when copying objects
This is a performance fix. The output is unchanged. Fixes #28.
Showing
3 changed files
with
14 additions
and
0 deletions
ChangeLog
| 1 | +2013-12-26 Jay Berkenbilt <ejb@ql.org> | |
| 2 | + | |
| 3 | + * Bug fix: when copying foreign objects (which occurs during page | |
| 4 | + splitting among other cases), avoid traversing the same object | |
| 5 | + more than once if it appears more than once in the same direct | |
| 6 | + object. This bug is performance-only and does not affect the | |
| 7 | + actual output. | |
| 8 | + | |
| 1 | 9 | 2013-12-17 Jay Berkenbilt <ejb@ql.org> |
| 2 | 10 | |
| 3 | 11 | * 5.1.0: release | ... | ... |
libqpdf/QPDF.cc
| ... | ... | @@ -1755,6 +1755,11 @@ QPDF::reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, |
| 1755 | 1755 | QTC::TC("qpdf", "QPDF loop reserving objects"); |
| 1756 | 1756 | return; |
| 1757 | 1757 | } |
| 1758 | + if (obj_copier.object_map.find(foreign_og) != obj_copier.object_map.end()) | |
| 1759 | + { | |
| 1760 | + QTC::TC("qpdf", "QPDF already reserved object"); | |
| 1761 | + return; | |
| 1762 | + } | |
| 1758 | 1763 | QTC::TC("qpdf", "QPDF copy indirect"); |
| 1759 | 1764 | obj_copier.visiting.insert(foreign_og); |
| 1760 | 1765 | std::map<QPDFObjGen, QPDFObjectHandle>::iterator mapping = | ... | ... |