diff --git a/ChangeLog b/ChangeLog index 1bf84f2c..9ee2c08c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2021-01-16 Jay Berkenbilt + + * Add warn() to QPDF's public API. + 2021-01-11 Jay Berkenbilt * Fix very old error in code that was finding attachment streams. diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 7dcfccc5..4e0984a7 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -246,6 +246,12 @@ class QPDF QPDF_DLL unsigned long long getUniqueId() const; + // Issue a warning on behalf of this QPDF object. It will be + // emitted with other warnings, following warning suppression + // rules, and it will be available with getWarnings(). + QPDF_DLL + void warn(QPDFExc const& e); + QPDF_DLL std::string getFilename() const; QPDF_DLL @@ -694,19 +700,6 @@ class QPDF }; friend class Resolver; - // Warner class allows QPDFObjectHandle to create warnings - class Warner - { - friend class QPDFObjectHandle; - friend class QPDF_Stream; - private: - static void warn(QPDF* qpdf, QPDFExc const& e) - { - qpdf->warn(e); - } - }; - friend class Warner; - // ParseGuard class allows QPDFObjectHandle to detect re-entrant // resolution class ParseGuard @@ -895,7 +888,6 @@ class QPDF void parse(char const* password); void inParse(bool); - void warn(QPDFExc const& e); void setTrailer(QPDFObjectHandle obj); void read_xref(qpdf_offset_t offset); void reconstruct_xref(QPDFExc& e); diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 60419720..de2221a4 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -3016,7 +3016,7 @@ QPDFObjectHandle::warn(QPDF* qpdf, QPDFExc const& e) // string, then just throw the exception. if (qpdf) { - QPDF::Warner::warn(qpdf, e); + qpdf->warn(e); } else { diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index 05cde8d8..b05137df 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -679,5 +679,5 @@ QPDF_Stream::replaceDict(QPDFObjectHandle new_dict) void QPDF_Stream::warn(QPDFExc const& e) { - QPDF::Warner::warn(this->qpdf, e); + this->qpdf->warn(e); } diff --git a/manual/qpdf-manual.xml b/manual/qpdf-manual.xml index d2c06a46..e770c3c4 100644 --- a/manual/qpdf-manual.xml +++ b/manual/qpdf-manual.xml @@ -4818,6 +4818,26 @@ print "\n"; --> + + 10.2.0: Month dd, YYYY + + + + + Library Enhancements + + + + + Add warn to + QPDF's public API. + + + + + + + 10.1.0: January 5, 2021