aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-12-16 17:19:15 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-12-31 16:23:59 +0100
commit218f069a69ef74d0b0cc9c7ba0796e9360cef379 (patch)
tree089b93f71c4dbbf953c10b4070d7280c5f349f14 /libqpdf
parentd03ca88275e5f5d83701502f9ab29de833e772db (diff)
downloadqpdf-218f069a69ef74d0b0cc9c7ba0796e9360cef379.tar.zst
Add new method QPDFObject::setDefaultDescription
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDF.cc9
-rw-r--r--libqpdf/qpdf/QPDFObject_private.hh8
-rw-r--r--libqpdf/qpdf/QPDFValue.hh9
3 files changed, 17 insertions, 9 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 86846675..b1eefd3b 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -1848,9 +1848,7 @@ QPDF::resolve(QPDFObjGen og)
}
auto result(this->m->obj_cache[og].object);
- if (!result->hasDescription()) {
- result->setDescription(this, ("object " + og.unparse(' ')));
- }
+ result->setDefaultDescription(this, og);
}
void
@@ -1946,10 +1944,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(' '));
- }
+ obj->setDefaultDescription(this, og);
return QPDFObjectHandle::Factory::newIndirect(obj);
}
diff --git a/libqpdf/qpdf/QPDFObject_private.hh b/libqpdf/qpdf/QPDFObject_private.hh
index 2efda859..3356e3e5 100644
--- a/libqpdf/qpdf/QPDFObject_private.hh
+++ b/libqpdf/qpdf/QPDFObject_private.hh
@@ -68,7 +68,6 @@ class QPDFObject
{
return value->og;
}
-
void
setDescription(
QPDF* qpdf, std::string const& description, qpdf_offset_t offset = -1)
@@ -112,9 +111,14 @@ class QPDFObject
}
void
- setObjGen(QPDF* qpdf, QPDFObjGen const& og)
+ setDefaultDescription(QPDF* qpdf, QPDFObjGen const& og)
{
// Intended for use by the QPDF class
+ value->setDefaultDescription(qpdf, og);
+ }
+ void
+ setObjGen(QPDF* qpdf, QPDFObjGen const& og)
+ {
value->qpdf = qpdf;
value->og = og;
}
diff --git a/libqpdf/qpdf/QPDFValue.hh b/libqpdf/qpdf/QPDFValue.hh
index 9a0e8cba..e4c038b6 100644
--- a/libqpdf/qpdf/QPDFValue.hh
+++ b/libqpdf/qpdf/QPDFValue.hh
@@ -31,6 +31,15 @@ class QPDFValue
object_description = description;
setParsedOffset(offset);
}
+ void
+ setDefaultDescription(QPDF* a_qpdf, QPDFObjGen const& a_og)
+ {
+ if (object_description.empty()) {
+ object_description = "object " + a_og.unparse(' ');
+ }
+ qpdf = a_qpdf;
+ og = a_og;
+ }
bool
getDescription(QPDF*& qpdf_p, std::string& description)
{