instead of returning an error.
For example, http://www.w3.org/Graphics/GIF/spec-gif89a.txt
explicitly says that GIF encoders can use a full table as is,
without needing to send a clear code.
R=r, dsymonds, nigeltao_gnome, r2
CC=golang-dev
https://golang.org/cl/
4518041
if _, err := w.Write(buf[i:]); err != nil {
return err
}
- // Save what the hi code expands to.
- suffix[hi] = uint8(c)
- prefix[hi] = last
+ if last != invalidCode {
+ // Save what the hi code expands to.
+ suffix[hi] = uint8(c)
+ prefix[hi] = last
+ }
default:
return os.NewError("lzw: invalid code")
}
last, hi = code, hi+1
- if hi == overflow {
+ if hi >= overflow {
if d.width == maxWidth {
- return os.NewError("lzw: missing clear code")
+ last = invalidCode
+ continue
}
d.width++
overflow <<= 1