Commit 18b34a564906c7ef36daefab081b44ebfd9ee64b
1 parent
9a4d3534
InputSource::unreadCh -- only unread most recently read character
This is all that ever worked. The test suite was trying to do something different from ClosedFileInputSource.
Showing
3 changed files
with
11 additions
and
2 deletions
TODO
| ... | ... | @@ -315,6 +315,12 @@ I find it useful to make reference to them in this list |
| 315 | 315 | * Investigate whether there is a way to automate the memory checker |
| 316 | 316 | tests for Windows. |
| 317 | 317 | |
| 318 | + * Part of closed_file_input_source.cc is disabled on Windows because | |
| 319 | + of odd failures. It might be worth investigating so we can fully | |
| 320 | + exercise this in the test suite. That said, ClosedFileInputSource | |
| 321 | + is exercised elsewhere in qpdf's test suite, so this is not that | |
| 322 | + pressing. | |
| 323 | + | |
| 318 | 324 | * Support user-pluggable stream filters. This would enable external |
| 319 | 325 | code to provide interpretation for filters that are missing from |
| 320 | 326 | qpdf. Make it possible for user-provided filters to override | ... | ... |
include/qpdf/InputSource.hh
| ... | ... | @@ -83,6 +83,9 @@ class QPDF_DLL_CLASS InputSource |
| 83 | 83 | virtual void seek(qpdf_offset_t offset, int whence) = 0; |
| 84 | 84 | virtual void rewind() = 0; |
| 85 | 85 | virtual size_t read(char* buffer, size_t length) = 0; |
| 86 | + | |
| 87 | + // Note: you can only unread the character you just read. The | |
| 88 | + // specific character is ignored by some implementations. | |
| 86 | 89 | virtual void unreadCh(char ch) = 0; |
| 87 | 90 | |
| 88 | 91 | protected: | ... | ... |
libtests/closed_file_input_source.cc
| ... | ... | @@ -38,9 +38,9 @@ void do_tests(InputSource* is) |
| 38 | 38 | is->seek(521, SEEK_SET); |
| 39 | 39 | is->read(b, 1); |
| 40 | 40 | #else |
| 41 | - is->unreadCh('Q'); | |
| 41 | + is->unreadCh('\n'); | |
| 42 | 42 | check("read unread character", 1 == is->read(b, 1)); |
| 43 | - check("got character", 'Q' == b[0]); | |
| 43 | + check("got character", '\n' == b[0]); | |
| 44 | 44 | #endif |
| 45 | 45 | check("last offset after read unread", 521 == is->getLastOffset()); |
| 46 | 46 | is->seek(0, SEEK_END); | ... | ... |