From e3cc171d0210cc3230754d50285233ccb8759081 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 2 Dec 2021 08:04:59 -0500 Subject: C API: qpdf_oh_is_initialized --- libqpdf/qpdf-c.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libqpdf') diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc index 618b926d..85dda3b9 100644 --- a/libqpdf/qpdf-c.cc +++ b/libqpdf/qpdf-c.cc @@ -881,8 +881,7 @@ qpdf_oh_valid_internal(qpdf_data qpdf, qpdf_oh oh) { auto i = qpdf->oh_cache.find(oh); bool result = ((i != qpdf->oh_cache.end()) && - (i->second).getPointer() && - (i->second)->isInitialized()); + (i->second).getPointer()); if (! result) { QTC::TC("qpdf", "qpdf-c invalid object handle"); @@ -892,11 +891,18 @@ qpdf_oh_valid_internal(qpdf_data qpdf, qpdf_oh oh) qpdf->qpdf->getFilename(), std::string("C API object handle ") + QUtil::uint_to_string(oh), - 0, "attempted access to unknown/uninitialized object handle")); + 0, "attempted access to unknown object handle")); } return result; } +QPDF_BOOL qpdf_oh_is_initialized(qpdf_data qpdf, qpdf_oh oh) +{ + QTC::TC("qpdf", "qpdf-c called qpdf_oh_is_initialized"); + return (qpdf_oh_valid_internal(qpdf, oh) && + qpdf->oh_cache[oh]->isInitialized()); +} + QPDF_BOOL qpdf_oh_is_bool(qpdf_data qpdf, qpdf_oh oh) { QTC::TC("qpdf", "qpdf-c called qpdf_oh_is_bool"); -- cgit v1.2.3-54-g00ecf