2010.11.30 19:15 "[Tiff] Win32 ReadFile() / WriteFile() heads-up", by John Emmas

2010.12.01 17:40 "Re: [Tiff] Win32 ReadFile() / WriteFile() heads-up", by John Emmas

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

>
> Can't the existing tif_unix entry points be used, if the application
> wants to use POSIX file handles?
>

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