diff options
-rw-r--r-- | include/qpdf/QPDF.hh | 2 | ||||
-rw-r--r-- | libqpdf/QPDF.cc | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 9cfcb2c2..2fd0f493 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -351,6 +351,8 @@ class QPDF // QPDF with QPDFWriter if it has any reserved objects in it. QPDF_DLL QPDFObjectHandle newReserved(); + QPDF_DLL + QPDFObjectHandle newIndirectNull(); // Install this object handle as an indirect object and return an indirect reference to it. QPDF_DLL diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 739ad7ce..5249b8cb 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -1861,6 +1861,12 @@ QPDF::newReserved() } QPDFObjectHandle +QPDF::newIndirectNull() +{ + return makeIndirectFromQPDFObject(QPDF_Null::create()); +} + +QPDFObjectHandle QPDF::newStream() { return makeIndirectFromQPDFObject( @@ -2015,8 +2021,7 @@ QPDF::copyForeignObject(QPDFObjectHandle foreign) reserveObjects(foreign, obj_copier, true); if (!obj_copier.visiting.empty()) { - throw std::logic_error("obj_copier.visiting is not empty" - " after reserving objects"); + throw std::logic_error("obj_copier.visiting is not empty after reserving objects"); } // Copy any new objects and replace the reservations. @@ -2071,7 +2076,8 @@ QPDF::reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top) QTC::TC("qpdf", "QPDF copy indirect"); if (obj_copier.object_map.count(foreign_og) == 0) { obj_copier.to_copy.push_back(foreign); - obj_copier.object_map[foreign_og] = foreign.isStream() ? newStream() : newReserved(); + obj_copier.object_map[foreign_og] = + foreign.isStream() ? newStream() : newIndirectNull(); } } |