]> Cypherpunks repositories - gostls13.git/commit
compress/flate: make compression level 0 consistent
authorKlaus Post <klauspost@gmail.com>
Sat, 15 Oct 2016 12:37:19 +0000 (14:37 +0200)
committerJoe Tsai <thebrokentoaster@gmail.com>
Thu, 27 Oct 2016 00:58:30 +0000 (00:58 +0000)
commit461adfd817eea64ee6b96f5711a48854bcda6241
treee6a96b1582272c4c110b6b974df4e90c3ff73fa1
parent2e196b15b94e48009369aae25299a59cbc7d45f4
compress/flate: make compression level 0 consistent

Tests for determinism was not working as intended since io.Copybuffer
uses the io.WriterTo if available.

This exposed that level 0 (no compression) changed output
based on the number of writes and buffers given to the
writer.

Previously, Write would emit a new raw block (BTYPE=00) for
every non-empty call to Write.

This CL fixes it such that a raw block is only emitted upon
the following conditions:
  * A full window is obtained (every 65535 bytes)
  * Flush is called
  * Close is called

Change-Id: I807f866d97e2db7820f11febab30a96266a6cbf1
Reviewed-on: https://go-review.googlesource.com/31174
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
src/compress/flate/deflate.go
src/compress/flate/writer_test.go