From 7eba65813ee4ac671f8a1427f695bafade9d2cb1 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 11 Dec 2023 09:55:20 +0100 Subject: [PATCH] stream: fix cache::read() to return state_t::eof correctly Signed-off-by: Simon Rozman --- include/stdex/stream.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; + } } }