From 6a97ae3af1e98b2d7b064c8870aaccae44a47c7d Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 18 Nov 2021 16:04:59 +0100 Subject: [PATCH] core/io: hopefully fix BoundedFileReader::read_buf_some() for good --- nihav-core/src/io/byteio.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nihav-core/src/io/byteio.rs b/nihav-core/src/io/byteio.rs index 2bac190..0ff54cb 100644 --- a/nihav-core/src/io/byteio.rs +++ b/nihav-core/src/io/byteio.rs @@ -753,14 +753,13 @@ impl ByteIO for BoundedFileReader { if ret.is_err() { return Err(ByteIOError::ReadError); } let sz = ret.unwrap(); if sz < len { - if let Err(_err) = self.file.read(&mut buf[sz..][..1]) { - self.eof = true; - if sz == 0 { - return Err(ByteIOError::EOF); - } - } else { + if let Ok(1) = self.file.read(&mut buf[sz..][..1]) { return Ok(sz + 1); } + self.eof = true; + if sz == 0 { + return Err(ByteIOError::EOF); + } } Ok(sz) } -- 2.39.5