AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

1993.06.15 18:47 "seek bugfix for mac", by Nigel Rea

Hi all,

Here is a patch that fixes a bug with libtiff on the mac. It only seems to show up if I have a lot of string tags (e.g. imagedescription). The original source was 3.2 with the patch file installed.

The problem comes up in TIFFClose, when the tags are written out to disk. SEEKOK is called and fails, the error routine is called, and the program stops with a bus error in TIFFError. I first thought it was a memory pointer problem, but I think it'sjust some strange side effect of the seek failing.

sun490:~/tiff/libtiff/> diff tif_apple.old tif_apple.c
86c86
<               if (SetFPos((short) fd, fsFromLEOF, off) != noErr)
---
>               if (SetFPos((short) fd, fsFromStart, off + size) != noErr)
92c92
<               if (SetFPos((short) fd, fsFromLEOF, off - size) != noErr)
---
>               if (SetFPos((short) fd, fsFromStart, off) != noErr)

If anyone is interested, you can compile the lzw compression stuff on the mac if you use the gnu c compiler (I think it's on sumex-aim) with the MPW C headers. It's not a particularly good port of gcc, but it does seem to handle the tricky files that MPW C chokes on. I just use it to compile the lzw stuff, and let MPW C compile the rest.

have fun,
...nige

reawn@pyro.ei.dupont.com AKA wnr@crosfield.co.uk