aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFTokenizer.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2013-01-20 21:26:45 +0100
committerJay Berkenbilt <ejb@ql.org>2013-01-20 21:35:39 +0100
commitf81152311e5737e5e0de9dd9462311f306c6921b (patch)
treee015c0efd7022cc259e898255db872fa52b73ca1 /libqpdf/QPDFTokenizer.cc
parent1d88955fa68fb7fb0fd2d705bc80655edb7a5972 (diff)
downloadqpdf-f81152311e5737e5e0de9dd9462311f306c6921b.tar.zst
Add QPDFObjectHandle::parseContentStream method
This method allows parsing of the PDF objects in a content stream or array of content streams.
Diffstat (limited to 'libqpdf/QPDFTokenizer.cc')
-rw-r--r--libqpdf/QPDFTokenizer.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc
index 1a20bb5a..a6333b73 100644
--- a/libqpdf/QPDFTokenizer.cc
+++ b/libqpdf/QPDFTokenizer.cc
@@ -22,7 +22,8 @@ static bool is_space(char ch)
}
QPDFTokenizer::QPDFTokenizer() :
- pound_special_in_name(true)
+ pound_special_in_name(true),
+ allow_eof(false)
{
reset();
}
@@ -35,6 +36,12 @@ QPDFTokenizer::allowPoundAnywhereInName()
}
void
+QPDFTokenizer::allowEOF()
+{
+ this->allow_eof = true;
+}
+
+void
QPDFTokenizer::reset()
{
state = st_top;
@@ -441,9 +448,17 @@ QPDFTokenizer::presentEOF()
}
else if (state != st_token_ready)
{
- QTC::TC("qpdf", "QPDF_Tokenizer EOF reading token");
- type = tt_bad;
- error_message = "EOF while reading token";
+ QTC::TC("qpdf", "QPDF_Tokenizer EOF reading token",
+ this->allow_eof ? 1 : 0);
+ if (this->allow_eof)
+ {
+ type = tt_eof;
+ }
+ else
+ {
+ type = tt_bad;
+ error_message = "EOF while reading token";
+ }
}
state = st_token_ready;