diff options
author | m-holger <m-holger@kubitscheck.org> | 2022-12-16 18:48:34 +0100 |
---|---|---|
committer | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2022-12-31 16:23:59 +0100 |
commit | c833c25499257662ab3bad8083989283fdbe0736 (patch) | |
tree | 2002ebcb92fb0fbf518f65a1c32cffab51fc4525 | |
parent | e684d8169bc866c413b269005c7645fd28146d10 (diff) | |
download | qpdf-c833c25499257662ab3bad8083989283fdbe0736.tar.zst |
Delay adding ObjGen to object descriptions until necessary
-rw-r--r-- | libqpdf/qpdf/QPDFValue.hh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libqpdf/qpdf/QPDFValue.hh b/libqpdf/qpdf/QPDFValue.hh index d6fab5ca..c7e63d6c 100644 --- a/libqpdf/qpdf/QPDFValue.hh +++ b/libqpdf/qpdf/QPDFValue.hh @@ -36,9 +36,10 @@ class QPDFValue void setDefaultDescription(QPDF* a_qpdf, QPDFObjGen const& a_og) { + static auto default_description{ + std::make_shared<std::string>("object $OG")}; if (!object_description) { - object_description = - std::make_shared<std::string>("object " + a_og.unparse(' ')); + object_description = default_description; } qpdf = a_qpdf; og = a_og; @@ -48,6 +49,9 @@ class QPDFValue { qpdf_p = qpdf; description = object_description ? *object_description : ""; + if (auto pos = description.find("$OG"); pos != std::string::npos) { + description.replace(pos, 3, og.unparse(' ')); + } return qpdf != nullptr; } bool |