Avoid printing output bytes on decompress error

Instead, print the number of bytes decompressed so far

Fixes #452
This commit is contained in:
Tristan 2022-10-07 03:50:33 +01:00 committed by Josh Holmer
parent 9479f5f4f5
commit 86a72ea127

View file

@ -27,8 +27,13 @@ pub mod cfzlib {
/// Decompress a data stream using the DEFLATE algorithm
pub fn inflate(data: &[u8]) -> PngResult<Vec<u8>> {
miniz_oxide::inflate::decompress_to_vec_zlib(data)
.map_err(|e| PngError::new(&format!("Error on decompress: {:?}", e)))
miniz_oxide::inflate::decompress_to_vec_zlib(data).map_err(|e| {
PngError::new(&format!(
"Error on decompress: {:?} (after {:?} decompressed bytes)",
e.status,
e.output.len()
))
})
}
/// Compress a data stream using the DEFLATE algorithm