aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-08-09 22:34:34 +0200
committerm-holger <m-holger@kubitscheck.org>2022-09-01 15:29:38 +0200
commit23d50a2f14db56be4cb4efcc413b8ef44713613f (patch)
treedf92833a77061df2890cd9140008532a123faa39
parentc7005e8a6d626d1c66bd780314c2520d12b0ca9a (diff)
downloadqpdf-23d50a2f14db56be4cb4efcc413b8ef44713613f.tar.zst
Remove QPDFObjectHandle::initialized
-rw-r--r--include/qpdf/QPDFObjectHandle.hh9
-rw-r--r--libqpdf/QPDFObjectHandle.cc8
2 files changed, 6 insertions, 11 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index af454e75..1128c3ed 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -1584,7 +1584,6 @@ class QPDFObjectHandle
QPDF* qpdf,
QPDFObjGen const& og,
std::shared_ptr<QPDFObject> const& obj) :
- initialized(true),
qpdf(qpdf),
og(og),
obj(obj)
@@ -1640,8 +1639,6 @@ class QPDFObjectHandle
static void warn(QPDF*, QPDFExc const&);
void checkOwnership(QPDFObjectHandle const&) const;
- bool initialized;
-
// Moving members of QPDFObjectHandle into a smart pointer incurs
// a substantial performance penalty since QPDFObjectHandle
// objects are copied around so frequently.
@@ -1888,13 +1885,13 @@ QPDFObjectHandle::getGeneration() const
inline bool
QPDFObjectHandle::isIndirect() const
{
- return initialized && (getObjectID() != 0);
+ return (obj != nullptr) && (getObjectID() != 0);
}
inline bool
QPDFObjectHandle::isInitialized() const
{
- return initialized;
+ return obj != nullptr;
}
// Indirect object accessors
@@ -1915,7 +1912,7 @@ QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
{
// This is called during parsing on newly created direct objects,
// so we can't call dereference() here.
- if (initialized) {
+ if (isInitialized()) {
this->obj->setParsedOffset(offset);
}
}
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index 32988b53..c8611e07 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -236,13 +236,11 @@ LastChar::getLastChar()
}
QPDFObjectHandle::QPDFObjectHandle() :
- initialized(false),
qpdf(nullptr)
{
}
QPDFObjectHandle::QPDFObjectHandle(std::shared_ptr<QPDFObject> const& data) :
- initialized(true),
qpdf(nullptr),
obj(data)
{
@@ -369,7 +367,7 @@ QPDFObjectHandle::isDirectNull() const
// Don't call dereference() -- this is a const method, and we know
// objid == 0, so there's nothing to resolve.
return (
- initialized && (getObjectID() == 0) &&
+ isInitialized() && (getObjectID() == 0) &&
(obj->getTypeCode() == QPDFObject::ot_null));
}
@@ -2373,7 +2371,7 @@ QPDFObjectHandle::makeDirect(bool allow_streams)
void
QPDFObjectHandle::assertInitialized() const
{
- if (!initialized) {
+ if (!isInitialized()) {
throw std::logic_error("operation attempted on uninitialized "
"QPDFObjectHandle");
}
@@ -2608,7 +2606,7 @@ QPDFObjectHandle::assertPageObject()
bool
QPDFObjectHandle::dereference()
{
- if (!this->initialized) {
+ if (!isInitialized()) {
return false;
}
if (this->obj->getTypeCode() == QPDFObject::ot_unresolved) {