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.09.21 17:23 "Revised diffs for tif_lzw", by Eric Herrmann

This is a correction of my earlier mail about tif_lzw.c for Microsoft Visual C++ 1.0 for Windows.

Thank you to Soren (PINGEL@DAIMI.AAU.DK) who points out that the code field in hash_t need only be a 16 bit int. (I apparently did not get an earlier mail about this.) This produces the following revised diff for 3.30 beta of the Tiff library.

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

--------------------- tif_lzw.c:
65c65
< #define MAXCODE(n)   ((1<<(n))-1)
---
> #define MAXCODE(n)   ((1L<<(n))-1)
77c77,85
< #define  HSIZE       9001        /* 91% occupancy */
---
> #define  HSIZE       9001L       /* 91% occupancy */
>
> #ifdef _WINDOWS
> /*
>  * Must do some special pointer arithmetic.
>  */
> #include <windows.h>
> #endif
>
144c152
<  long    code;
---
>  int     code;
334c342
<      tif->tif_data = _TIFFmalloc(sizeof (LZWDecodeState));
---
>      tif->tif_data = (tidata_t)_TIFFmalloc(sizeof (LZWDecodeState));
891c899
<      tif->tif_data = _TIFFmalloc(sizeof (LZWEncodeState));
---
>      tif->tif_data = (tidata_t)_TIFFmalloc(sizeof (LZWEncodeState));
1012a1021,1035
> #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.
>               * This code is for MSVC 1.0.
>               */
>              register long   offset;
>
>              offset = (long) OFFSETOF( hp ) - disp * sizeof( hash_t );
>              if ( offset < FIELDOFFSET( LZWEncodeState, enc_hashtab ) )
>                  offset += HSIZE * sizeof( hash_t);
>              hp = (hash_t *) MAKELP( SELECTOROF( hp ), offset );
> #else
1014a1038
> #endif
1218a1243
>