Revert non-binary-compatible handleWarning change -- see TODO (ABI)

This commit is contained in:
Jay Berkenbilt 2021-03-04 15:40:56 -05:00
parent f68e25c7f2
commit 0b77f2cf26
5 changed files with 6 additions and 40 deletions

View File

@ -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.

5
TODO
View File

@ -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
======================

View File

@ -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.

View File

@ -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
{

View File

@ -5125,15 +5125,6 @@ print "\n";
<filename>ChangeLog</filename> file for details.
</para>
</listitem>
<listitem>
<para>
The virtual method
<function>QPDFObjectHandle::ParserCallbacks::handleWarning</function>
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.
</para>
</listitem>
<listitem>
<para>
The method <function>QPDF::numWarnings</function> was added