AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1993.09.21 01:51 "Patch to tif_lzw.c for Wi", by Eric Herrmann
1993.09.21 17:23 "Revised diffs for tif_lzw", by Eric Herrmann
1993.10.30 01:18 "Patch for Windows", by Eric Herrmann
1993.11.01 18:52 "Re: Patch (for Windows, but general)", by Richard Minner

1993.10.30 01:18 "Patch for Windows", by Eric Herrmann

This is for Tiff 3.3 under Windows 3.1.

The patch I earlier sent to fix LZW encoding was slightly erroneous. It assumed a 0 offset, which is not true if you use malloc() or some other non-GlobalAlloc allocation.

The following replacement code works better, and doesn't suffer from having to have windows.h included. I apologize for not submitting real diffs; I've made other changes I don't want to submit yet.

Eric Herrmann
Light Source
LS.BANZAI@AppleLink.Apple.Com

---------- Delete the following lines from near line 80

#ifdef _WINDOWS
/*
 * Must do some special pointer arithmetic.
 */
#include <windows.h>
#endif

---------- Substitute the following lines near line 1040.

#ifdef _WINDOWS
               /*
                * 64K segment pointer arithmetic! Yuk!
                * Subtracting a value from a pointer can easily become
                * negative, but with a segment:offset pointer the
                * offset is unsigned and thus wraps around.
                *
                * So instead we'll compute the index to the location.
                */
               if ( (h -= disp) < 0 )
                   h += HSIZE;
               hp = &sp->enc_hashtab[h];
#else
               if ((hp -= disp) < sp->enc_hashtab)
                   hp += HSIZE;
#endif