stream: fix cache::read() to return state_t::eof correctly

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2023-12-11 09:55:20 +01:00
parent 91ffe3f633
commit 7eba65813e

View File

@ -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;
}
}
}