diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-12-02 14:04:59 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-12-09 16:33:31 +0100 |
commit | e3cc171d0210cc3230754d50285233ccb8759081 (patch) | |
tree | 4e771ed6045d69e0826c5fa4ca5c87f6a63f4286 /libqpdf/qpdf-c.cc | |
parent | bef2c2222a0b9429276b34d8f5024f31b8e86495 (diff) | |
download | qpdf-e3cc171d0210cc3230754d50285233ccb8759081.tar.zst |
C API: qpdf_oh_is_initialized
Diffstat (limited to 'libqpdf/qpdf-c.cc')
-rw-r--r-- | libqpdf/qpdf-c.cc | 12 |
1 files changed, 9 insertions, 3 deletions
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"); |