Received: by whizzer.wpd.sgi.com (921026.SGI.NOSTRIP/911001.SGI)
	 id AA02366; Tue, 15 Jun 93 18:09:06 GMT
Received: from sgi.sgi.com by whizzer.wpd.sgi.com via SMTP (921026.SGI.NOSTRIP/911001.SGI)
	for /usr/people/sam/majordomo/wrapper resend -l tiff -h sgi.sgi.com -f tiff-owner -s -m "-oi -odq -om" tiff-list id AA02359; Tue, 15 Jun 93 11:09:04 -0700
Received: from pyro.ei.dupont.com by sgi.sgi.com via SMTP (920330.SGI/910110.SGI)
	for tiff-relay@whizzer.wpd.sgi.com id AA14850; Tue, 15 Jun 93 11:08:50 -0700
Received: by pyro.ei.dupont.com (4.1/SMI-4.1)
	id AA00299; Tue, 15 Jun 93 13:47:20 EST
From: reawn@ei.dupont.com (Nigel Rea)
Message-Id: <9306151847.AA00299@pyro.ei.dupont.com>
Subject: seek bugfix for mac
To: tiff@sgi.sgi.com
Date: Tue, 15 Jun 93 13:47:12 EST
Cc: reawn@ei.dupont.com (Nigel Rea)
X-Mailer: ELM [version 2.2 PL13]
Sender: tiff-owner@sgi.sgi.com


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



