diff --git a/include/stdex/stream.hpp b/include/stdex/stream.hpp index c5e7e5b27..861ca19dd 100644 --- a/include/stdex/stream.hpp +++ b/include/stdex/stream.hpp @@ -1911,10 +1911,14 @@ namespace stdex } } load_cache(m_offset); - if (!ok() || m_cache.region.end <= m_offset) _Unlikely_ { + if (!ok()) _Unlikely_ { m_state = to_read < length ? state_t::ok : state_t::fail; return length - to_read; } + if (m_cache.region.end <= m_offset) _Unlikely_ { + m_state = to_read < length ? state_t::ok : state_t::eof; + return length - to_read; + } } }