From 0b77f2cf2646019331d3adc21985052319bdba4c Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 4 Mar 2021 15:40:56 -0500 Subject: [PATCH] Revert non-binary-compatible handleWarning change -- see TODO (ABI) --- ChangeLog | 4 ---- TODO | 5 +++++ include/qpdf/QPDFObjectHandle.hh | 11 +---------- libqpdf/QPDFObjectHandle.cc | 17 ----------------- manual/qpdf-manual.xml | 9 --------- 5 files changed, 6 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index be57346e..8f63349a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -51,10 +51,6 @@ bugs where it removes unreferenced resources that it isn't supposed to. - * QPDFObjectHandle::ParserCallbacks: add virtual handleWarning - method, and provide default (empty) implementation of it and - handleEOF(). - * Add QPDF::numWarnings() -- useful to tell whether any warnings were issued by a specific bit of code. diff --git a/TODO b/TODO index e308927b..d327cc19 100644 --- a/TODO +++ b/TODO @@ -164,6 +164,11 @@ Comments appear in the code prefixed by "ABI" * Consider having addArrayItem, replaceKey, etc. return the new value so you can say auto oh = dict.replaceKey("/Key", QPDFObjectHandle::newSomething()); +* Added QPDFObjectHandle::ParserCallbacks::handleWarning but had to + revert because it was not binary compatible. Consider re-adding. The + commit that added this comment includes the reverting of the change. + The previous commit removes the code that was calling and using + handleWarning. Page splitting/merging ====================== diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 238dd6e3..e57179b5 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -224,16 +224,7 @@ class QPDFObjectHandle virtual void handleObject( QPDFObjectHandle, size_t offset, size_t length); - // handleWarning is called if a warning was issued during the - // parsing of the most recent object. There's no good way to - // get information about the warning, but implementors can use - // this to become aware that there was some problem while - // parsing this content stream. - QPDF_DLL - virtual void handleWarning(); - - QPDF_DLL - virtual void handleEOF(); + virtual void handleEOF() = 0; // Override this if you want to know the full size of the // contents, possibly after concatenation of multiple streams. diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index e7d84b4c..27740f09 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -151,16 +151,6 @@ QPDFObjectHandle::ParserCallbacks::handleObject( handleObject(oh); } -void -QPDFObjectHandle::ParserCallbacks::handleWarning() -{ -} - -void -QPDFObjectHandle::ParserCallbacks::handleEOF() -{ -} - void QPDFObjectHandle::ParserCallbacks::contentSize(size_t) { @@ -1983,15 +1973,9 @@ QPDFObjectHandle::parseContentStream_data( tokenizer.readToken(input, "content", true); qpdf_offset_t offset = input->getLastOffset(); input->seek(offset, SEEK_SET); - size_t before_nwarnings = (context ? context->numWarnings() : 0); QPDFObjectHandle obj = parseInternal(input, "content", tokenizer, empty, 0, context, true); - size_t after_nwarnings = (context ? context->numWarnings() : 0); - if (after_nwarnings > before_nwarnings) - { - callbacks->handleWarning(); - } if (! obj.isInitialized()) { // EOF @@ -2018,7 +2002,6 @@ QPDFObjectHandle::parseContentStream_data( QPDFExc(qpdf_e_damaged_pdf, input->getName(), "stream data", input->tell(), "EOF found while reading inline image")); - callbacks->handleWarning(); } else { diff --git a/manual/qpdf-manual.xml b/manual/qpdf-manual.xml index d6098563..59d4dfb3 100644 --- a/manual/qpdf-manual.xml +++ b/manual/qpdf-manual.xml @@ -5125,15 +5125,6 @@ print "\n"; ChangeLog file for details. - - - The virtual method - QPDFObjectHandle::ParserCallbacks::handleWarning - is now called whenever a warning is encountered while - parsing a content stream. Prior to this, the caller had no - way to know if this had happened. - - The method QPDF::numWarnings was added