Skip to content

Commit

Permalink
Fix checksum of gzip files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Dec 4, 2014
1 parent 2497964 commit 44a46c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/gz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,20 @@ impl<R: Reader> DecoderReader<R> {
{
let flate = self.inner.inner();
let len = {
let remaining = flate.buf.slice_from(flate.buf.len());
let remaining = flate.buf.slice_from(flate.pos);
let len = cmp::min(remaining.len(), buf.len());
bytes::copy_memory(buf, remaining.slice_to(len));
len
};

if len < buf.len() {
try!(flate.read_at_least(buf.len() - len, buf));
match flate.inner.read(buf.slice_from_mut(len)) {
Ok(..) => {}
Err(ref e) if e.kind == io::EndOfFile => {
return Err(corrupt())
}
Err(e) => return Err(e)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct EncoderReader<R> {
pub struct DecoderReader<R> {
pub inner: R,
stream: Stream,
pos: uint,
pub pos: uint,
pub buf: Vec<u8>,
}

Expand Down

0 comments on commit 44a46c3

Please sign in to comment.