Received: from mailgate001.isp.belgacom.be (mailgate001.isp.belgacom.be [195.238.6.86])
	by maildelivery006.isp.belgacom.be (Postfix) with ESMTP id 7EC9D340024
	for <joris.at.lebbeke@skynet.be>; Thu,  4 Oct 2007 15:57:54 +0200 (CEST)
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 04 Oct 2007 15:57:49 +0200
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l94DVs2p026463;
	Thu, 4 Oct 2007 09:32:44 -0400
Received: from rune.pobox.com (rune.pobox.com [208.210.124.79])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l94DVjOp026460
	for <tiff@lists.maptools.org>; Thu, 4 Oct 2007 09:31:46 -0400
Received: from rune (localhost [127.0.0.1])
	by rune.pobox.com (Postfix) with ESMTP id B180A1415E2
	for <tiff@lists.maptools.org>; Thu,  4 Oct 2007 09:32:06 -0400 (EDT)
Received: from [192.168.2.3] (dpc674728121.direcpc.com [67.47.28.121])
	by rune.sasl.smtp.pobox.com (Postfix) with ESMTP id 6589F1418C1
	for <tiff@lists.maptools.org>; Thu,  4 Oct 2007 09:31:59 -0400 (EDT)
Message-ID: <4705013D.3030607@pobox.com>
Date: Thu, 04 Oct 2007 11:05:33 -0400
From: Frank Warmerdam <warmerdam@pobox.com>
User-Agent: Thunderbird 1.5.0.9 (X11/20070104)
MIME-Version: 1.0
To: TIFF mailing list <tiff@lists.maptools.org>
Subject: Re: [Tiff] libtiff4, and the size of STRIPOFFSETs and TILEOFFSETs
References: <46F2E03D.6040905@pobox.com>
In-Reply-To: <46F2E03D.6040905@pobox.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.0000281d
X-MSP-STORE: Thu, 04 Oct 2007 15:57:54 +0200
Status: RO

Frank Warmerdam wrote:
> Joris, and others,
> 
> I discovered a problem today with GDAL's use of libtiff4.  The problem
> occurs because libtiff decides as it is writing directories whether to
> write fields like TILEOFFSETs as LONG (4byte) or LONG8 (8byte).  However,
> my code depends on the questionable assumption that I can rewrite a
> directory after altering (only) the tile/strip offset and size values.

Folks,

I have decided that my current approach of rewriting the whole directory
is too risk-prone (ie. still doesn't work with legitimate pre-existing
files) so I'm going to change my code to include custom mechanisms to
update the strip/tile offset/size tags "in place" without using the
libtiff "write directory" mechanism.  Once done, I'll back out the changes
I mentioned above.

I'm considering implementing this as a sort of auxilary libtiff function.
Something like "TIFFRewriteImageOffsetSize()" that would update the
current directory on disk with the "in memory" strip/tile offsets and sizes.
This might result in moving the lists to the end of the file if they change
in size (ie. shorts become longs, etc).  Do others feel this would be a useful
function to have available in libtiff?

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
