-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On 11.10.2011 23:16, Aleksander Morgado wrote:
>> Changes sorted by line number (as in patch):
>> > [3]:
>> > -#define LZW_MAX_DICTSIZE  (1 << LZW_MAX_BITSIZE)
>> > +#define LZW_MAX_DICTSIZE  ((1 << LZW_MAX_BITSIZE) + 1)
>> >  #define LZW_NULL_INDEX    ~0U
>> > --------------------------------------------------------------------
> I really don't get this +1. I understand that currently the code needs
> the extra size, or we will write out of bounds, but the logic tells me
> that it shouldn't. The maximum size of the dictionary will be (should
> be) 212 = 4096, so therefore the fix is not to have the +1, but to try
> to avoid writing 4097 items.

this is also caused by the 1)3)2)-order (see my earlier mail). The
regular algorithm resets the dictionary before adding entry 4097. It
outputs a code that we output after reset. With +1 the output gets right.

But don't we miss a dictionary entry? (last one in old dict (#4097),
that should be in the new dict) Maybe this is a bug.

Regards,
Georg



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6pJsgACgkQ5sLITM1qIaJFpgCggo+GURBHpLXw+XzcKYae5ybX
JJAAmQHV99vHyow84EsrUFAifrCr5Ulo
=PMVO
-----END PGP SIGNATURE-----

Reply via email to