Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-q.b-one.net (mx-q.one.com [91.198.169.248])
	by mail9.b-one.net (Postfix) with ESMTP id 05C43400614
	for <info@awaresystems.be>; Wed,  1 Dec 2010 18:54:33 +0100 (CET)
Received: by mx-q.b-one.net (Postfix, from userid 106)
	id F206E9780E3D; Wed,  1 Dec 2010 18:54:04 +0100 (CET)
X-Virus-Scanned: by one.com
X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "MIME-Version"
X-Spam-Flag: NO
X-Spam-Score: 0.001
X-Spam-Level: 
X-Spam-Status: No, score=0.001 tagged_above=0 required=4
 tests=[HTML_MESSAGE=0.001]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-q.b-one.net (Postfix) with ESMTP id DC7909775AD5 for
 <info@awaresystems.be>; Wed,  1 Dec 2010 18:53:22 +0100 (CET)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id A9AD11D187D96; Wed,  1 Dec 2010
 12:51:50 -0500 (EST)
Received: from mk-filter-2-a-1.mail.uk.tiscali.com
 (mk-filter-2-a-1.mail.uk.tiscali.com [212.74.100.53]) by lists.maptools.org
 (Postfix) with ESMTP id 35E5C1CFEF3E1 for <tiff@lists.maptools.org>; Wed,  1
 Dec 2010 12:40:43 -0500 (EST)
X-Trace:
 542267088/mk-filter-2.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/88.110.247.139/None/johne53@tiscali.co.uk
X-SBRS: None
X-RemoteIP: 88.110.247.139
X-IP-MAIL-FROM: johne53@tiscali.co.uk
X-SMTP-AUTH: 
X-Originating-Country: GB/UNITED KINGDOM
X-MUA: Apple Mail (2.1078)
X-IP-BHB: Once
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AgQGAAMX9kxYbveL/2dsb2JhbACVB44QcsQnghODNASNag
X-IronPort-AV: E=Sophos;i="4.59,284,1288569600"; 
 d="scan'208,217";a="542267088"
Received: from 88-110-247-139.dynamic.dsl.as9105.com (HELO mac-mini.lan)
 ([88.110.247.139]) by smtp.tiscali.co.uk with ESMTP; 01 Dec 2010 17:40:40
 +0000
From: John Emmas <johne53@tiscali.co.uk>
Mime-Version: 1.0 (Apple Message framework v1078)
Date: Wed, 1 Dec 2010 17:40:40 +0000
In-Reply-To: <4CF55000.7000109@telegraphics.com.au>
To: tiff@lists.maptools.org
References: <76394064-A6C2-46E1-BC59-DB187EDDD275@tiscali.co.uk>
 <4CF55000.7000109@telegraphics.com.au>
Message-Id: <43238C41-39B3-4E12-AAA4-27D02955407B@tiscali.co.uk>
X-Mailer: Apple Mail (2.1078)
Subject: Re: [Tiff] Win32 ReadFile() / WriteFile() heads-up
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
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>
Content-Type: multipart/mixed; boundary="===============1209510331=="
Mime-version: 1.0
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org


--===============1209510331==
Content-Type: multipart/alternative; boundary=Apple-Mail-1--614571989


--Apple-Mail-1--614571989
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


On 30 Nov 2010, at 19:26, Toby Thain wrote:

>=20
> Can't the existing tif_unix entry points be used, if the application
> wants to use POSIX file handles?
>=20
This does in fact work tantalizingly well, except for a problem (in =
libgdk_pixbuf) which I need some advice about, before I report it to =
them   Here's the sequence of events now that I'm using tif_unix.c =
instead of tif_win32.c:-

1)  libgdk_pixbuf begins by opening the TIFF file using _wfopen()
2)  To load the image, it seems to call TIFFFdOpen()
3)  Which in turn, calls TIFFClientOpen()
4)  Note that neither step 2 nor step 3 actually opens any file!
5)  Now that I've re-jigged the modules, read() is now used for reading =
the TIFF header and data, instead of ReadFile()
6)  After loading the image, libgdk_pixbuf now calls TIFFClose() on the =
value returned by TIFFFdOpen().  THIS CLOSES THE FILE!!!
7)  libgdk_pixbuf then goes on to call close() (which asserts, because =
the file is already closed!)

Since neither TIFFFdOpen() nor TIFFClientOpen() actually opened any =
file, I'm guessing that libgdk_pixbuf should only have called =
TIFFCleanup(), rather than TIFFClose().  Does that seem reasonable?

John=

--Apple-Mail-1--614571989
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; =
"><br><div><div>On 30 Nov 2010, at 19:26, Toby Thain wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div><font =
class=3D"Apple-style-span" color=3D"#006312"><br></font>Can't the =
existing tif_unix entry points be used, if the application<br>wants to =
use POSIX file handles?<br><br></div></blockquote><div>This does in fact =
work tantalizingly well, except for a problem (in libgdk_pixbuf) which I =
need some advice about, before I report it to them &nbsp; Here's the =
sequence of events now that I'm using tif_unix.c instead of =
tif_win32.c:-</div><div><br></div><div>1) &nbsp;libgdk_pixbuf begins by =
opening the TIFF file using _wfopen()</div><div>2) &nbsp;To load the =
image, it seems to call TIFFFdOpen()</div><div>3) &nbsp;Which in turn, =
calls TIFFClientOpen()</div><div>4) &nbsp;Note that neither step 2 nor =
step 3 actually opens any file!</div><div>5) &nbsp;Now that I've =
re-jigged the modules, read() is now used for reading the TIFF header =
and data, instead of ReadFile()</div><div>6) &nbsp;After loading the =
image, libgdk_pixbuf now calls TIFFClose() on the value returned by =
TIFFFdOpen(). &nbsp;THIS CLOSES THE FILE!!!</div><div>7) =
&nbsp;libgdk_pixbuf then goes on to call close() (which asserts, because =
the file is already closed!)</div><div><br></div><div>Since neither =
TIFFFdOpen() nor TIFFClientOpen() actually opened any file, I'm guessing =
that libgdk_pixbuf should only have called TIFFCleanup(), rather than =
TIFFClose(). &nbsp;Does that seem =
reasonable?</div><div><br></div><div>John</div></div></body></html>=

--Apple-Mail-1--614571989--

--===============1209510331==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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