From: Jeff R. Allen Date: Wed, 17 Jun 2015 12:07:13 +0000 (+0200) Subject: compress/lzw: mention relation between litWidth and input bytes X-Git-Tag: go1.5beta1~188 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2a5745d81e9a5b3af1f0b42f5cbc0d6ba4ba6ec2;p=gostls13.git compress/lzw: mention relation between litWidth and input bytes Add sentences to the docs explaining the limit on input bytes implicit in the choice of litWidth, and the fact that compress and decompress litWidth must match. Fixes #11142. Change-Id: I20cfb4df35739f7bfeb50b92c78249df3d47942c Reviewed-on: https://go-review.googlesource.com/11063 Reviewed-by: Nigel Tao --- diff --git a/src/compress/lzw/reader.go b/src/compress/lzw/reader.go index 6800e8323b..28e9f7514f 100644 --- a/src/compress/lzw/reader.go +++ b/src/compress/lzw/reader.go @@ -227,7 +227,8 @@ func (d *decoder) Close() error { // It is the caller's responsibility to call Close on the ReadCloser when // finished reading. // The number of bits to use for literal codes, litWidth, must be in the -// range [2,8] and is typically 8. +// range [2,8] and is typically 8. It must equal the litWidth +// used during compression. func NewReader(r io.Reader, order Order, litWidth int) io.ReadCloser { d := new(decoder) switch order { diff --git a/src/compress/lzw/writer.go b/src/compress/lzw/writer.go index 961b25f94f..e9314fc474 100644 --- a/src/compress/lzw/writer.go +++ b/src/compress/lzw/writer.go @@ -230,7 +230,7 @@ func (e *encoder) Close() error { // It is the caller's responsibility to call Close on the WriteCloser when // finished writing. // The number of bits to use for literal codes, litWidth, must be in the -// range [2,8] and is typically 8. +// range [2,8] and is typically 8. Input bytes must be less than 1<