Skip to content

Commit 788ceb2

Browse files
committed
Flush data on BzDecoder::finish
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
1 parent fcf91fd commit 788ceb2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

crates/compression-codecs/src/bzip2/decoder.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ impl Decode for BzDecoder {
105105
&mut self,
106106
_output: &mut PartialBuffer<impl AsRef<[u8]> + AsMut<[u8]>>,
107107
) -> io::Result<bool> {
108-
Ok(true)
108+
match self.decode(
109+
&mut PartialBuffer::new(&[][..]),
110+
output,
111+
)? {
112+
Status::Ok
113+
| Status::FlushOk
114+
| Status::RunOk
115+
| Status::FinishOk => Ok(false),
116+
Status::StreamEnd => Ok(true),
117+
Status::MemNeeded => Err(io::ErrorKind::OutOfMemory.into()),
118+
}
109119
}
110120
}

0 commit comments

Comments
 (0)