Skip to content

Commit 31e4d38

Browse files
committed
Fix DataSource_Stream::end_of_data
C++ streams are not my favorite IO library
1 parent 60398e3 commit 31e4d38

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/utils/data_src.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ size_t DataSource_Stream::peek(uint8_t out[], size_t length, size_t offset) cons
168168
* Check if the stream is empty or in error
169169
*/
170170
bool DataSource_Stream::end_of_data() const {
171+
/*
172+
Peek to trigger EOF indicator if positioned at the end of the stream.
173+
Without this, good() returns true even when all data has been read.
174+
*/
175+
m_source.peek();
171176
return (!m_source.good());
172177
}
173178

0 commit comments

Comments
 (0)