hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit a46fec79e31672466e371d4b5852a2ec07921bf8
parent ecbaae2bff7a92c4cd11d57a3980e709f20b9bbf
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat, 12 Mar 2022 18:24:18 +0100

compress::flate: use io::readall

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mcompress/flate/inflate.ha | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/compress/flate/inflate.ha b/compress/flate/inflate.ha @@ -106,13 +106,11 @@ fn bits(d: *decompressor, want: u32) (u32 | io::error) = { let val = d.bitbuf; for (d.cnt < want) { let buf: [_]u8 = [0]; - match (io::read(d.in, buf)?) { + match (io::readall(d.in, buf)?) { case io::EOF => return wraperror(inflate_err::EOF); - case let z: size => - if (z < 1) { - continue; // Short read, retry - }; + case size => + yield; }; val |= buf[0] << d.cnt; d.cnt += 8;