Commit 6226b69dbaf4e31942f6b2c9bdacf7ac92432764
1 parent
fc88837d
Add warn() to QPDF's public API
Showing
5 changed files
with
32 additions
and
16 deletions
ChangeLog
| 1 | +2021-01-16 Jay Berkenbilt <ejb@ql.org> | ||
| 2 | + | ||
| 3 | + * Add warn() to QPDF's public API. | ||
| 4 | + | ||
| 1 | 2021-01-11 Jay Berkenbilt <ejb@ql.org> | 5 | 2021-01-11 Jay Berkenbilt <ejb@ql.org> |
| 2 | 6 | ||
| 3 | * Fix very old error in code that was finding attachment streams. | 7 | * Fix very old error in code that was finding attachment streams. |
include/qpdf/QPDF.hh
| @@ -246,6 +246,12 @@ class QPDF | @@ -246,6 +246,12 @@ class QPDF | ||
| 246 | QPDF_DLL | 246 | QPDF_DLL |
| 247 | unsigned long long getUniqueId() const; | 247 | unsigned long long getUniqueId() const; |
| 248 | 248 | ||
| 249 | + // Issue a warning on behalf of this QPDF object. It will be | ||
| 250 | + // emitted with other warnings, following warning suppression | ||
| 251 | + // rules, and it will be available with getWarnings(). | ||
| 252 | + QPDF_DLL | ||
| 253 | + void warn(QPDFExc const& e); | ||
| 254 | + | ||
| 249 | QPDF_DLL | 255 | QPDF_DLL |
| 250 | std::string getFilename() const; | 256 | std::string getFilename() const; |
| 251 | QPDF_DLL | 257 | QPDF_DLL |
| @@ -694,19 +700,6 @@ class QPDF | @@ -694,19 +700,6 @@ class QPDF | ||
| 694 | }; | 700 | }; |
| 695 | friend class Resolver; | 701 | friend class Resolver; |
| 696 | 702 | ||
| 697 | - // Warner class allows QPDFObjectHandle to create warnings | ||
| 698 | - class Warner | ||
| 699 | - { | ||
| 700 | - friend class QPDFObjectHandle; | ||
| 701 | - friend class QPDF_Stream; | ||
| 702 | - private: | ||
| 703 | - static void warn(QPDF* qpdf, QPDFExc const& e) | ||
| 704 | - { | ||
| 705 | - qpdf->warn(e); | ||
| 706 | - } | ||
| 707 | - }; | ||
| 708 | - friend class Warner; | ||
| 709 | - | ||
| 710 | // ParseGuard class allows QPDFObjectHandle to detect re-entrant | 703 | // ParseGuard class allows QPDFObjectHandle to detect re-entrant |
| 711 | // resolution | 704 | // resolution |
| 712 | class ParseGuard | 705 | class ParseGuard |
| @@ -895,7 +888,6 @@ class QPDF | @@ -895,7 +888,6 @@ class QPDF | ||
| 895 | 888 | ||
| 896 | void parse(char const* password); | 889 | void parse(char const* password); |
| 897 | void inParse(bool); | 890 | void inParse(bool); |
| 898 | - void warn(QPDFExc const& e); | ||
| 899 | void setTrailer(QPDFObjectHandle obj); | 891 | void setTrailer(QPDFObjectHandle obj); |
| 900 | void read_xref(qpdf_offset_t offset); | 892 | void read_xref(qpdf_offset_t offset); |
| 901 | void reconstruct_xref(QPDFExc& e); | 893 | void reconstruct_xref(QPDFExc& e); |
libqpdf/QPDFObjectHandle.cc
| @@ -3016,7 +3016,7 @@ QPDFObjectHandle::warn(QPDF* qpdf, QPDFExc const& e) | @@ -3016,7 +3016,7 @@ QPDFObjectHandle::warn(QPDF* qpdf, QPDFExc const& e) | ||
| 3016 | // string, then just throw the exception. | 3016 | // string, then just throw the exception. |
| 3017 | if (qpdf) | 3017 | if (qpdf) |
| 3018 | { | 3018 | { |
| 3019 | - QPDF::Warner::warn(qpdf, e); | 3019 | + qpdf->warn(e); |
| 3020 | } | 3020 | } |
| 3021 | else | 3021 | else |
| 3022 | { | 3022 | { |
libqpdf/QPDF_Stream.cc
| @@ -679,5 +679,5 @@ QPDF_Stream::replaceDict(QPDFObjectHandle new_dict) | @@ -679,5 +679,5 @@ QPDF_Stream::replaceDict(QPDFObjectHandle new_dict) | ||
| 679 | void | 679 | void |
| 680 | QPDF_Stream::warn(QPDFExc const& e) | 680 | QPDF_Stream::warn(QPDFExc const& e) |
| 681 | { | 681 | { |
| 682 | - QPDF::Warner::warn(this->qpdf, e); | 682 | + this->qpdf->warn(e); |
| 683 | } | 683 | } |
manual/qpdf-manual.xml
| @@ -4819,6 +4819,26 @@ print "\n"; | @@ -4819,6 +4819,26 @@ print "\n"; | ||
| 4819 | </varlistentry> | 4819 | </varlistentry> |
| 4820 | --> | 4820 | --> |
| 4821 | <varlistentry> | 4821 | <varlistentry> |
| 4822 | + <term>10.2.0: Month dd, YYYY</term> | ||
| 4823 | + <listitem> | ||
| 4824 | + <itemizedlist> | ||
| 4825 | + <listitem> | ||
| 4826 | + <para> | ||
| 4827 | + Library Enhancements | ||
| 4828 | + </para> | ||
| 4829 | + <itemizedlist> | ||
| 4830 | + <listitem> | ||
| 4831 | + <para> | ||
| 4832 | + Add <function>warn</function> to | ||
| 4833 | + <classname>QPDF</classname>'s public API. | ||
| 4834 | + </para> | ||
| 4835 | + </listitem> | ||
| 4836 | + </itemizedlist> | ||
| 4837 | + </listitem> | ||
| 4838 | + </itemizedlist> | ||
| 4839 | + </listitem> | ||
| 4840 | + </varlistentry> | ||
| 4841 | + <varlistentry> | ||
| 4822 | <term>10.1.0: January 5, 2021</term> | 4842 | <term>10.1.0: January 5, 2021</term> |
| 4823 | <listitem> | 4843 | <listitem> |
| 4824 | <itemizedlist> | 4844 | <itemizedlist> |