diff options
author | Tomas Hoger <thoger@redhat.com> | 2011-09-11 09:18:10 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2011-09-11 09:18:10 +0200 |
commit | 487913d9a6355b21cc1cbb73dbf93e64d081e715 (patch) | |
tree | 0d87dde1606e0b966720fdbbbe0289f22abc13f1 /src/lzw/ftzopen.c | |
parent | 83cb6c0049f6cc5ea3f27d1d90891472f288ac5e (diff) | |
download | freetype2-487913d9a6355b21cc1cbb73dbf93e64d081e715.tar.gz |
Slightly improve LZW_CLEAR handling.
* src/lzw/ftzopen.c (ft_lzwstate_io) <FT_LZW_PHASE_CODE>:
Ensure that subsequent (modulo garbage byte(s)) LZW_CLEAR codes are
handled as clear codes. This also re-sets old_code and old_char to
predictable values, which is a little better than using `random'
ones if the code following LZW_CLEAR is invalid.
Diffstat (limited to 'src/lzw/ftzopen.c')
-rw-r--r-- | src/lzw/ftzopen.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lzw/ftzopen.c b/src/lzw/ftzopen.c index f55ee3a08..d7a64576b 100644 --- a/src/lzw/ftzopen.c +++ b/src/lzw/ftzopen.c @@ -321,11 +321,12 @@ /* why not LZW_FIRST-256 ? */ state->free_ent = ( LZW_FIRST - 1 ) - 256; state->buf_clear = 1; - c = ft_lzwstate_get_code( state ); - if ( c < 0 ) - goto Eof; - code = (FT_UInt)c; + /* not quite right, but at least more predictable */ + old_code = 0; + old_char = 0; + + goto NextCode; } in_code = code; /* save code for later */ |