Shnatsel commented on code in PR #169:
URL: https://github.com/apache/avro-rs/pull/169#discussion_r2022171260


##########
avro/src/codec.rs:
##########
@@ -120,14 +115,20 @@ impl Codec {
     pub fn decompress(self, stream: &mut Vec<u8>) -> AvroResult<()> {
         *stream = match self {
             Codec::Null => return Ok(()),
-            Codec::Deflate => {
-                let mut decoded = Vec::new();
-                let mut decoder = Decoder::new(&stream[..]);
-                decoder
-                    .read_to_end(&mut decoded)
-                    .map_err(Error::DeflateDecompress)?;
-                decoded
-            }
+            Codec::Deflate => 
miniz_oxide::inflate::decompress_to_vec(stream).map_err(|e| {
+                use miniz_oxide::inflate::TINFLStatus;
+                use std::io::ErrorKind;
+                let err_kind = match e.status {
+                    TINFLStatus::FailedCannotMakeProgress => 
ErrorKind::UnexpectedEof,
+                    TINFLStatus::BadParam => unreachable!(), // not possible 
for _to_vec()

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to