Skip to content

Commit

Permalink
Remove broken QPDFTokenizer::expectInlineImage
Browse files Browse the repository at this point in the history
  • Loading branch information
jberkenbilt committed Jun 22, 2019
1 parent 25dd3c6 commit 45dac41
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 2,391 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
QPDF::copyForeignObject with an unused boolean parameter. If you
were, for some reason, calling this, just take the parameter away.

* Source-level incompatibility: remove the version
QPDF::copyForeignObject with an unused boolean parameter. If you
were, for some reason, calling this, just take the parameter away.

* Source-level incompatibility: rename QUtil::strcasecmp to
QUtil::str_compare_nocase. This is a non-compatible change, but
QUtil::strcasecmp is hardly the most important part of qpdf's API.
Expand Down
3 changes: 0 additions & 3 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
Next ABI
========

* Remove version of QPDFTokenizer::expectInlineImage with no
arguments.

* Build with -fvisibility=hidden by default. Fix QPDF_DLL. See #302
for discussion. See also https://gcc.gnu.org/wiki/Visibility

Expand Down
6 changes: 0 additions & 6 deletions include/qpdf/QPDFTokenizer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,6 @@ class QPDFTokenizer
QPDF_DLL
void expectInlineImage(PointerHolder<InputSource> input);

// Legacy version. New code should not call this. The token
// returned will include the EI keyword. The recipient of the
// token will have to remove it.
QPDF_DLL
void expectInlineImage();

private:
// Do not implement copy or assignment
QPDFTokenizer(QPDFTokenizer const&);
Expand Down
34 changes: 0 additions & 34 deletions libqpdf/QPDFTokenizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -542,20 +542,6 @@ QPDFTokenizer::presentCharacter(char ch)
this->m->inline_image_bytes = 0;
this->m->state = st_token_ready;
}
else if ((this->m->inline_image_bytes == 0) &&
(len >= 4) &&
isDelimiter(this->m->val.at(len-4)) &&
(this->m->val.at(len-3) == 'E') &&
(this->m->val.at(len-2) == 'I') &&
isDelimiter(this->m->val.at(len-1)))
{
QTC::TC("qpdf", "QPDFTokenizer found EI the old way");
this->m->val.erase(len - 1);
this->m->type = tt_inline_image;
this->m->unread_char = true;
this->m->char_to_unread = ch;
this->m->state = st_token_ready;
}
}
else
{
Expand Down Expand Up @@ -628,20 +614,6 @@ QPDFTokenizer::presentCharacter(char ch)
void
QPDFTokenizer::presentEOF()
{
if (this->m->state == st_inline_image)
{
size_t len = this->m->val.length();
if ((len >= 3) &&
isDelimiter(this->m->val.at(len-3)) &&
(this->m->val.at(len-2) == 'E') &&
(this->m->val.at(len-1) == 'I'))
{
QTC::TC("qpdf", "QPDFTokenizer inline image at EOF the old way");
this->m->type = tt_inline_image;
this->m->state = st_token_ready;
}
}

if (this->m->state == st_literal)
{
QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
Expand Down Expand Up @@ -669,12 +641,6 @@ QPDFTokenizer::presentEOF()
this->m->state = st_token_ready;
}

void
QPDFTokenizer::expectInlineImage()
{
expectInlineImage(PointerHolder<InputSource>());
}

void
QPDFTokenizer::expectInlineImage(PointerHolder<InputSource> input)
{
Expand Down
2 changes: 0 additions & 2 deletions qpdf/qpdf.testcov
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,7 @@ qpdf from_nr from repeat_nr 0
QPDF resolve duplicated page object 0
QPDF handle direct page object 0
QPDFTokenizer finder found wrong word 0
QPDFTokenizer found EI the old way 0
QPDFTokenizer found EI by byte count 0
QPDFTokenizer inline image at EOF the old way 0
QPDFTokenizer found EI after more than one try 0
QPDFPageObjectHelper externalize inline image 0
QPDFPageObjectHelper keep inline image 0
Expand Down
7 changes: 1 addition & 6 deletions qpdf/qtest/qpdf.test
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ foreach my $d (@eii_tests)
show_ntests();
# ----------
$td->notify("--- Tokenizer ---");
$n_tests += 5;
$n_tests += 4;

$td->runtest("tokenizer with no ignorable",
{$td->COMMAND => "test_tokenizer -no-ignorable tokens.pdf"},
Expand All @@ -808,11 +808,6 @@ $td->runtest("tokenizer",
{$td->FILE => "tokens.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);

$td->runtest("tokenizer with old inline image code",
{$td->COMMAND => "test_tokenizer -old-ei tokens.pdf"},
{$td->FILE => "tokens-old-ei.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);

$td->runtest("tokenizer with max_len",
{$td->COMMAND => "test_tokenizer -maxlen 50 tokens.pdf"},
{$td->FILE => "tokens-maxlen.out", $td->EXIT_STATUS => 0},
Expand Down
Loading

0 comments on commit 45dac41

Please sign in to comment.