From fe74f28dc4f269e4bf944ae61d77874f81f95daf Mon Sep 17 00:00:00 2001 From: m-holger Date: Wed, 15 Feb 2023 11:30:33 +0000 Subject: Refactor QPDFValue::setDefaultDescription --- libqpdf/QPDFValue.cc | 2 ++ libqpdf/qpdf/QPDFValue.hh | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libqpdf/QPDFValue.cc b/libqpdf/QPDFValue.cc index 7c5b30a6..41a00fa8 100644 --- a/libqpdf/QPDFValue.cc +++ b/libqpdf/QPDFValue.cc @@ -35,6 +35,8 @@ QPDFValue::getDescription() return description; } } + } else if (og.isIndirect()) { + return "object " + og.unparse(' '); } return {}; } diff --git a/libqpdf/qpdf/QPDFValue.hh b/libqpdf/qpdf/QPDFValue.hh index e7904253..8e9d4ea5 100644 --- a/libqpdf/qpdf/QPDFValue.hh +++ b/libqpdf/qpdf/QPDFValue.hh @@ -40,11 +40,6 @@ class QPDFValue void setDefaultDescription(QPDF* a_qpdf, QPDFObjGen const& a_og) { - static auto default_description{ - std::make_shared("object $OG")}; - if (!object_description) { - object_description = default_description; - } qpdf = a_qpdf; og = a_og; } @@ -52,7 +47,7 @@ class QPDFValue bool hasDescription() { - return object_description != nullptr; + return object_description || og.isIndirect(); } void setParsedOffset(qpdf_offset_t offset) -- cgit v1.2.3-54-g00ecf