rust-lang / flate2-rs

DEFLATE, gzip, and zlib bindings for Rust
https://docs.rs/flate2
Apache License 2.0
891 stars 158 forks source link

Use the error message from z_stream.msg for [De]CompressError #270

Closed coolreader18 closed 3 years ago

coolreader18 commented 3 years ago

Not sure if I should put a #[cfg] on the msg field of the errors for only when zlib is used, since the other backends don't produce errors, or if that would be needlessly complicated.

coolreader18 commented 3 years ago

I did end up changing the error types so that there's no overhead to this when using miniz/miniz_oxide, I don't think it's too complicated. Also, I noticed that some of the cfgs from a previous contribution of mine ([De]Compress::new_gzip) as well as the bindings in ffi::c were inaccurate/verbose, so I tidied that up as well. Let me know if you'd rather I split that out to a separate PR.

alexcrichton commented 3 years ago

Nah this looks good, thanks!