From bcea54fcaa16a7d5feff0c4cd038fea51d1359ea Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 27 Oct 2020 10:51:41 -0400 Subject: Revert removal of unreadCh change for performance Turns out unreadCh is much more efficient than seek(-1, SEEK_CUR). Update comments and code to reflect this. --- include/qpdf/InputSource.hh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/qpdf/InputSource.hh b/include/qpdf/InputSource.hh index 22e3abcd..02254bb3 100644 --- a/include/qpdf/InputSource.hh +++ b/include/qpdf/InputSource.hh @@ -85,14 +85,12 @@ class QPDF_DLL_CLASS InputSource virtual size_t read(char* buffer, size_t length) = 0; // Note: you can only unread the character you just read. The - // specific character is ignored by some implementations. unreadCh - // will be removed from the API in qpdf 11. + // specific character is ignored by some implementations, and the + // implementation doesn't check this. Use of unreadCh is + // semantically equivalent to seek(-1, SEEK_CUR) but is much more + // efficient. virtual void unreadCh(char ch) = 0; - // ABI: delete unreadCh, and direct people to seek backward by 1 - // character instead. - // virtual void unreadCh(char ch) final = delete; - protected: qpdf_offset_t last_offset; -- cgit v1.2.3-54-g00ecf