diff options
Diffstat (limited to 'src/uio.cc')
| -rw-r--r-- | src/uio.cc | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -50,6 +50,11 @@ class UnicodeReader : public io::Reader { return std::unexpected(io::ReadError::InvalidData); break; case u::ReadError::End: + if (in_eof_) { + // Only return eof if we have no bytes to output. + if (u_buffer_wptr_ == u_buffer_) + return std::unexpected(io::ReadError::Eof); + } break; case u::ReadError::Incomplete: if (in_eof_) { @@ -106,8 +111,8 @@ class UnicodeReader : public io::Reader { auto got = in_->read(wptr, in_avail_); if (got.has_value()) { byte_buffer_->commit(got.value()); - if (got.value() == 0) - in_eof_ = true; + } else if (got.error() == io::ReadError::Eof) { + in_eof_ = true; } else { return got.error(); } |
