diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-12-10 15:34:42 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-12-10 17:15:49 +0100 |
commit | 3340dbe9761ef35d580d77a73e17d204579624f1 (patch) | |
tree | 7c317cf30a7ce29019658d5b7bbf5172c036dfa4 /libqpdf | |
parent | b2b2a175c49c0a68018e329ee7637424d1ba3218 (diff) | |
download | qpdf-3340dbe9761ef35d580d77a73e17d204579624f1.tar.zst |
Use a specific error code for type warnings and clarify docs
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index af862bd4..1a8e3223 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -3048,23 +3048,17 @@ void QPDFObjectHandle::typeWarning(char const* expected_type, std::string const& warning) { - QPDF* context = 0; + QPDF* context = nullptr; std::string description; dereference(); - if (this->obj->getDescription(context, description)) - { - warn(context, - QPDFExc( - qpdf_e_damaged_pdf, + this->obj->getDescription(context, description); + // Null context handled by warn + warn(context, + QPDFExc(qpdf_e_object, "", description, 0, std::string("operation for ") + expected_type + " attempted on object of type " + getTypeName() + ": " + warning)); - } - else - { - assertType(expected_type, false); - } } void @@ -3091,7 +3085,12 @@ QPDFObjectHandle::warnIfPossible(std::string const& warning, void QPDFObjectHandle::objectWarning(std::string const& warning) { - warnIfPossible(warning, true); + QPDF* context = nullptr; + std::string description; + dereference(); + this->obj->getDescription(context, description); + // Null context handled by warn + warn(context, QPDFExc(qpdf_e_object, "", description, 0, warning)); } void |