Skip to content

Commit

Permalink
fix merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Jan 17, 2024
1 parent 98eae35 commit 892eaea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
18 changes: 7 additions & 11 deletions src/codec/gzip/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,14 @@ impl GzipDecoder {
State::Decoding => {
let prior = output.written().len();

let done = inner(self, input, output).or_else(|e| match e {
// we need to make an exception, if output flushed
// from the decoder, to update the crc
e if e.kind() == std::io::ErrorKind::Other
&& output.written().len() > 0 =>
{
Ok(false)
}
_ => Err(e),
})?;
let res = inner(self, input, output);

self.crc.update(&output.written()[prior..]);
if (output.written().len() > prior) {
// update CRC even if there was an error
self.crc.update(&output.written()[prior..]);
}

let done = res?;

if done {
self.state = State::Footer(vec![0; 8].into())
Expand Down
8 changes: 3 additions & 5 deletions src/futures/bufread/generic/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,11 @@ impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
ready!(this.reader.as_mut().poll_fill_buf(cx))?
};

if input.is_empty() {
// Avoid attempting to reinitialise the decoder if the reader
// has returned EOF.
if input.is_empty() && !first {
// Avoid attempting to reinitialise the decoder if the
// reader has returned EOF.
*this.multiple_members = false;
}

if input.is_empty() && !first {
State::Flushing
} else {
let mut input = PartialBuffer::new(input);
Expand Down

0 comments on commit 892eaea

Please sign in to comment.