aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-08-14 02:05:32 +0200
committerm-holger <m-holger@kubitscheck.org>2022-09-01 18:09:48 +0200
commit56e9bcabe984acd4479ff7fef9a2a0ca669abc76 (patch)
tree1367fba1ab799fddc65e615893607f8f7e6cef78 /libqpdf
parent89061d5b33baa7e8f4e3486d0c7ccf2447500b13 (diff)
downloadqpdf-56e9bcabe984acd4479ff7fef9a2a0ca669abc76.tar.zst
Add methods QPDFObject::setObjGen and QPDFObject::resetObjGen
Also, modify QPDFObject::swapWith to update the ObjGens of the swapped objects. Modify QPDF::newIndirect and QPDF::updateCache to keep object ObjGens up to date.
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDF.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index f33e2920..1e73f794 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -2109,6 +2109,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
QPDFObjectHandle
QPDF::newIndirect(QPDFObjGen const& og, std::shared_ptr<QPDFObject> const& obj)
{
+ obj->setObjGen(this, og);
if (!obj->hasDescription()) {
obj->setDescription(this, "object " + og.unparse(' '));
}
@@ -2122,8 +2123,10 @@ QPDF::updateCache(
qpdf_offset_t end_before_space,
qpdf_offset_t end_after_space)
{
+ object->setObjGen(this, og);
if (isCached(og)) {
auto& cache = m->obj_cache[og];
+ cache.object->resetObjGen();
cache.object->assign(object);
cache.end_before_space = end_before_space;
cache.end_after_space = end_after_space;