Commit 0b77f2cf2646019331d3adc21985052319bdba4c
1 parent
f68e25c7
Revert non-binary-compatible handleWarning change -- see TODO (ABI)
Showing
5 changed files
with
6 additions
and
40 deletions
ChangeLog
| @@ -51,10 +51,6 @@ | @@ -51,10 +51,6 @@ | ||
| 51 | bugs where it removes unreferenced resources that it isn't | 51 | bugs where it removes unreferenced resources that it isn't |
| 52 | supposed to. | 52 | supposed to. |
| 53 | 53 | ||
| 54 | - * QPDFObjectHandle::ParserCallbacks: add virtual handleWarning | ||
| 55 | - method, and provide default (empty) implementation of it and | ||
| 56 | - handleEOF(). | ||
| 57 | - | ||
| 58 | * Add QPDF::numWarnings() -- useful to tell whether any warnings | 54 | * Add QPDF::numWarnings() -- useful to tell whether any warnings |
| 59 | were issued by a specific bit of code. | 55 | were issued by a specific bit of code. |
| 60 | 56 |
TODO
| @@ -164,6 +164,11 @@ Comments appear in the code prefixed by "ABI" | @@ -164,6 +164,11 @@ Comments appear in the code prefixed by "ABI" | ||
| 164 | * Consider having addArrayItem, replaceKey, etc. return the new value | 164 | * Consider having addArrayItem, replaceKey, etc. return the new value |
| 165 | so you can say | 165 | so you can say |
| 166 | auto oh = dict.replaceKey("/Key", QPDFObjectHandle::newSomething()); | 166 | auto oh = dict.replaceKey("/Key", QPDFObjectHandle::newSomething()); |
| 167 | +* Added QPDFObjectHandle::ParserCallbacks::handleWarning but had to | ||
| 168 | + revert because it was not binary compatible. Consider re-adding. The | ||
| 169 | + commit that added this comment includes the reverting of the change. | ||
| 170 | + The previous commit removes the code that was calling and using | ||
| 171 | + handleWarning. | ||
| 167 | 172 | ||
| 168 | Page splitting/merging | 173 | Page splitting/merging |
| 169 | ====================== | 174 | ====================== |
include/qpdf/QPDFObjectHandle.hh
| @@ -224,16 +224,7 @@ class QPDFObjectHandle | @@ -224,16 +224,7 @@ class QPDFObjectHandle | ||
| 224 | virtual void handleObject( | 224 | virtual void handleObject( |
| 225 | QPDFObjectHandle, size_t offset, size_t length); | 225 | QPDFObjectHandle, size_t offset, size_t length); |
| 226 | 226 | ||
| 227 | - // handleWarning is called if a warning was issued during the | ||
| 228 | - // parsing of the most recent object. There's no good way to | ||
| 229 | - // get information about the warning, but implementors can use | ||
| 230 | - // this to become aware that there was some problem while | ||
| 231 | - // parsing this content stream. | ||
| 232 | - QPDF_DLL | ||
| 233 | - virtual void handleWarning(); | ||
| 234 | - | ||
| 235 | - QPDF_DLL | ||
| 236 | - virtual void handleEOF(); | 227 | + virtual void handleEOF() = 0; |
| 237 | 228 | ||
| 238 | // Override this if you want to know the full size of the | 229 | // Override this if you want to know the full size of the |
| 239 | // contents, possibly after concatenation of multiple streams. | 230 | // contents, possibly after concatenation of multiple streams. |
libqpdf/QPDFObjectHandle.cc
| @@ -152,16 +152,6 @@ QPDFObjectHandle::ParserCallbacks::handleObject( | @@ -152,16 +152,6 @@ QPDFObjectHandle::ParserCallbacks::handleObject( | ||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | void | 154 | void |
| 155 | -QPDFObjectHandle::ParserCallbacks::handleWarning() | ||
| 156 | -{ | ||
| 157 | -} | ||
| 158 | - | ||
| 159 | -void | ||
| 160 | -QPDFObjectHandle::ParserCallbacks::handleEOF() | ||
| 161 | -{ | ||
| 162 | -} | ||
| 163 | - | ||
| 164 | -void | ||
| 165 | QPDFObjectHandle::ParserCallbacks::contentSize(size_t) | 155 | QPDFObjectHandle::ParserCallbacks::contentSize(size_t) |
| 166 | { | 156 | { |
| 167 | // Ignore by default; overriding this is optional. | 157 | // Ignore by default; overriding this is optional. |
| @@ -1983,15 +1973,9 @@ QPDFObjectHandle::parseContentStream_data( | @@ -1983,15 +1973,9 @@ QPDFObjectHandle::parseContentStream_data( | ||
| 1983 | tokenizer.readToken(input, "content", true); | 1973 | tokenizer.readToken(input, "content", true); |
| 1984 | qpdf_offset_t offset = input->getLastOffset(); | 1974 | qpdf_offset_t offset = input->getLastOffset(); |
| 1985 | input->seek(offset, SEEK_SET); | 1975 | input->seek(offset, SEEK_SET); |
| 1986 | - size_t before_nwarnings = (context ? context->numWarnings() : 0); | ||
| 1987 | QPDFObjectHandle obj = | 1976 | QPDFObjectHandle obj = |
| 1988 | parseInternal(input, "content", tokenizer, | 1977 | parseInternal(input, "content", tokenizer, |
| 1989 | empty, 0, context, true); | 1978 | empty, 0, context, true); |
| 1990 | - size_t after_nwarnings = (context ? context->numWarnings() : 0); | ||
| 1991 | - if (after_nwarnings > before_nwarnings) | ||
| 1992 | - { | ||
| 1993 | - callbacks->handleWarning(); | ||
| 1994 | - } | ||
| 1995 | if (! obj.isInitialized()) | 1979 | if (! obj.isInitialized()) |
| 1996 | { | 1980 | { |
| 1997 | // EOF | 1981 | // EOF |
| @@ -2018,7 +2002,6 @@ QPDFObjectHandle::parseContentStream_data( | @@ -2018,7 +2002,6 @@ QPDFObjectHandle::parseContentStream_data( | ||
| 2018 | QPDFExc(qpdf_e_damaged_pdf, input->getName(), | 2002 | QPDFExc(qpdf_e_damaged_pdf, input->getName(), |
| 2019 | "stream data", input->tell(), | 2003 | "stream data", input->tell(), |
| 2020 | "EOF found while reading inline image")); | 2004 | "EOF found while reading inline image")); |
| 2021 | - callbacks->handleWarning(); | ||
| 2022 | } | 2005 | } |
| 2023 | else | 2006 | else |
| 2024 | { | 2007 | { |
manual/qpdf-manual.xml
| @@ -5127,15 +5127,6 @@ print "\n"; | @@ -5127,15 +5127,6 @@ print "\n"; | ||
| 5127 | </listitem> | 5127 | </listitem> |
| 5128 | <listitem> | 5128 | <listitem> |
| 5129 | <para> | 5129 | <para> |
| 5130 | - The virtual method | ||
| 5131 | - <function>QPDFObjectHandle::ParserCallbacks::handleWarning</function> | ||
| 5132 | - is now called whenever a warning is encountered while | ||
| 5133 | - parsing a content stream. Prior to this, the caller had no | ||
| 5134 | - way to know if this had happened. | ||
| 5135 | - </para> | ||
| 5136 | - </listitem> | ||
| 5137 | - <listitem> | ||
| 5138 | - <para> | ||
| 5139 | The method <function>QPDF::numWarnings</function> was added | 5130 | The method <function>QPDF::numWarnings</function> was added |
| 5140 | so that you can tell whether any warnings happened during a | 5131 | so that you can tell whether any warnings happened during a |
| 5141 | specific block of code. | 5132 | specific block of code. |