aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2021-11-18 16:04:59 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2021-11-18 16:04:59 +0100
commit6a97ae3af1e98b2d7b064c8870aaccae44a47c7d (patch)
treedb4b07ecd48116d4451377f60f2d4fd10f5ad3b3
parent3fae33bd60f5575e63cfb1beec82a56a036e47fb (diff)
downloadnihav-6a97ae3af1e98b2d7b064c8870aaccae44a47c7d.tar.gz
core/io: hopefully fix BoundedFileReader::read_buf_some() for good
-rw-r--r--nihav-core/src/io/byteio.rs11
1 files 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<T: Read+Seek> ByteIO for BoundedFileReader<T> {
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)
}