diff options
author | m-holger <m-holger@kubitscheck.org> | 2023-02-17 14:58:21 +0100 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2023-02-18 09:35:45 +0100 |
commit | 1496472e1c2f64f46d2d7d76481aef1aa3fff869 (patch) | |
tree | 40ed2ee4ac78c8240c36396f3fb1824d7703f952 /libqpdf/QPDFObjectHandle.cc | |
parent | da14ab4dc7b1caee1708483cf714683f7d811ca7 (diff) | |
download | qpdf-1496472e1c2f64f46d2d7d76481aef1aa3fff869.tar.zst |
Add method QPDFValue::setChildDescription
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 7a37ffc2..cbe42995 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -36,6 +36,8 @@ #include <stdexcept> #include <stdlib.h> +using namespace std::literals; + namespace { class TerminateParsing @@ -813,13 +815,9 @@ QPDFObjectHandle::getArrayItem(int n) typeWarning("array", "returning null"); QTC::TC("qpdf", "QPDFObjectHandle array null for non-array"); } - QPDF* context = nullptr; - std::string description; - if (obj->getDescription(context, description)) { - result.setObjectDescription( - context, - description + " -> null returned from invalid array access"); - } + static auto constexpr msg = + " -> null returned from invalid array access"sv; + result.obj->setChildDescription(obj, msg, ""); } return result; } @@ -1038,14 +1036,9 @@ QPDFObjectHandle::getKey(std::string const& key) typeWarning("dictionary", "returning null for attempted key retrieval"); QTC::TC("qpdf", "QPDFObjectHandle dictionary null for getKey"); result = newNull(); - QPDF* qpdf = nullptr; - std::string description; - if (obj->getDescription(qpdf, description)) { - result.setObjectDescription( - qpdf, - (description + " -> null returned from getting key " + key + - " from non-Dictionary")); - } + static auto constexpr msg = + " -> null returned from getting key $VD from non-Dictionary"sv; + result.obj->setChildDescription(obj, msg, key); } return result; } |