2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-30 08:50:51 +00:00

Delay adding ObjGen to object descriptions until necessary

This commit is contained in:
m-holger 2022-12-16 17:48:34 +00:00 committed by Jay Berkenbilt
parent e684d8169b
commit c833c25499

View File

@ -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