diff options
author | m-holger <m-holger@kubitscheck.org> | 2023-02-17 15:59:33 +0100 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2023-02-18 09:35:45 +0100 |
commit | 07bb5c3dd6213af9c9a64e17ae2d457cf4fc7190 (patch) | |
tree | 8372060bfb5d7b75675ed1eda7b03ac0ff037081 /libqpdf/QPDFObjectHandle.cc | |
parent | 1496472e1c2f64f46d2d7d76481aef1aa3fff869 (diff) | |
download | qpdf-07bb5c3dd6213af9c9a64e17ae2d457cf4fc7190.tar.zst |
Overload QPDF_Null::create to take a child object description
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index cbe42995..d474dcce 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -802,12 +802,10 @@ QPDFObjectHandle::getArrayNItems() QPDFObjectHandle QPDFObjectHandle::getArrayItem(int n) { - QPDFObjectHandle result; auto array = asArray(); if (array && (n < array->getNItems()) && (n >= 0)) { - result = array->getItem(n); + return array->getItem(n); } else { - result = newNull(); if (array) { objectWarning("returning null for out of bounds array access"); QTC::TC("qpdf", "QPDFObjectHandle array bounds"); @@ -817,9 +815,8 @@ QPDFObjectHandle::getArrayItem(int n) } static auto constexpr msg = " -> null returned from invalid array access"sv; - result.obj->setChildDescription(obj, msg, ""); + return QPDF_Null::create(obj, msg, ""); } - return result; } bool @@ -1028,19 +1025,15 @@ QPDFObjectHandle::hasKey(std::string const& key) QPDFObjectHandle QPDFObjectHandle::getKey(std::string const& key) { - QPDFObjectHandle result; - auto dict = asDictionary(); - if (dict) { - result = dict->getKey(key); + if (auto dict = asDictionary()) { + return dict->getKey(key); } else { typeWarning("dictionary", "returning null for attempted key retrieval"); QTC::TC("qpdf", "QPDFObjectHandle dictionary null for getKey"); - result = newNull(); static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv; - result.obj->setChildDescription(obj, msg, key); + return QPDF_Null::create(obj, msg, ""); } - return result; } QPDFObjectHandle |