Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx015.isp.belgacom.be (inmx015.isp.belgacom.be [195.238.2.218])
        by mailst006.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id i7PHaYWZ026845
        for <joris.at.lebbeke@skynet.be>; Wed, 25 Aug 2004 19:36:34 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx015.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id i7PHa3lL021694
        for <joris.at.lebbeke@skynet.be>; Wed, 25 Aug 2004 19:36:05 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id EC3AF251B08; Wed, 25 Aug 2004 13:35:30 -0400 (EDT)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from outmx021.isp.belgacom.be (outmx021.isp.belgacom.be
	[195.238.2.202])
	by xserve.flids.com (Postfix) with ESMTP id 584DA251AD3
	for <tiff@remotesensing.org>; Wed, 25 Aug 2004 13:35:11 -0400 (EDT)
Received: from outmx021.isp.belgacom.be (localhost [127.0.0.1])
	by outmx021.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with
	ESMTP id i7PHYt2l013401
	for <tiff@remotesensing.org>; Wed, 25 Aug 2004 19:34:55 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (186.10-201-80.adsl.skynet.be [80.201.10.186])
	by outmx021.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with SMTP
	id i7PHYkbr013322
	for <tiff@remotesensing.org>; Wed, 25 Aug 2004 19:34:46 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <000701c48ac9$f30b9a60$ba0ac950@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "Tiff mailing list" <tiff@remotesensing.org>
Date: Wed, 25 Aug 2004 19:35:41 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Subject: [Tiff] Not-a-bug report, TIFFFdOpen (tif_win32) - TIFFClientOpen
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 350e61936fb275d51a98d1dc01a760e0

In TIFFFdOpen, in tif_win32, there is a call to TIFFClientOpen. It feeds the
file handle as clientdata the parameter. TIFFClientOpen sets the clientdata
member of the newborn TIFF structure.

 tif->tif_clientdata = clientdata;

That is needed, since there is next some calls to reading functions and the
like, that may need this clientdata (as is the case in the tif_win32 of the file
reading functions). The clientdata member is fed to the platform-dependent
functions as 'fd' parameter.

#define ReadOK(tif, buf, size) \
 (TIFFReadFile(tif, (tdata_t) buf, (tsize_t)(size)) == (tsize_t)(size))

#define TIFFReadFile(tif, buf, size) \
 ((*(tif)->tif_readproc)((tif)->tif_clientdata,buf,size))

Upon return to TIFFdOpen, in tif_win32, this one, in turn, sets the fd member of
the TIFF structure, with the same file handle value.

if (tif)
  tif->tif_fd = ifd;

All equivalents of tif_win32 for all other platforms seem to do the same.
However, throughout the library, this tif_fd member seems not ever used, as far
as I can see. It would be too late for read procedures to use it anyway, they've
already been called before this tif_fd value gets set.

Thus, tif_fd seems redundant. And what's more, without this tif_fd setting in
TIFFFdOpen, the complete platform dependent files like tif_win32 would be
treating the TIFF* as opaque, which is a helpfull feature for some.

Is there something I'm missing?



Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html

_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
