diff options
author | m-holger <m-holger@kubitscheck.org> | 2022-08-27 00:55:56 +0200 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2022-08-27 00:55:56 +0200 |
commit | 69a5fb70472a2112d2bbb938ee3718250d2364cf (patch) | |
tree | a95bef3322f7989534e5f9dc8f6af9f61a5d1e3f /libqpdf | |
parent | 13ef50cd27f13687040da9342b398079567b7521 (diff) | |
download | qpdf-69a5fb70472a2112d2bbb938ee3718250d2364cf.tar.zst |
Add methods InputSource::fastRead, fastUnRead and fastTell
Provide buffered input for QPDFTokenizer.
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFTokenizer.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc index 721ea7ea..56550266 100644 --- a/libqpdf/QPDFTokenizer.cc +++ b/libqpdf/QPDFTokenizer.cc @@ -974,11 +974,11 @@ QPDFTokenizer::readToken( bool allow_bad, size_t max_len) { - qpdf_offset_t offset = input->tell(); + qpdf_offset_t offset = input->fastTell(); while (this->state != st_token_ready) { char ch; - if (input->read(&ch, 1) == 0) { + if (!input->fastRead(ch)) { presentEOF(); if ((this->type == tt_eof) && (!this->allow_eof)) { @@ -1013,9 +1013,7 @@ QPDFTokenizer::readToken( bool unread_char; char char_to_unread; getToken(token, unread_char, char_to_unread); - if (unread_char) { - input->unreadCh(char_to_unread); - } + input->fastUnread(unread_char); if (token.getType() != tt_eof) { input->setLastOffset(offset); |