image-rs / deflate-rs

An implementation of a DEFLATE encoder in rust
Apache License 2.0
53 stars 14 forks source link

Proper writer behaviour #14

Closed oyvindln closed 7 years ago

oyvindln commented 7 years ago

Write is only supposed to be called one on the wrapped writer in each write call. Currently we call write a fair number of times for each call to {deflate/zlibwriter}::write. In addition to being in violation with the trait, the current implementation assumes that the writer will write all bytes on each write call, which is wrong and can cause compression to fail. We also shouldn't solve this by using write_all internally, see https://github.com/alexcrichton/flate2-rs/issues/92