AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2011.01.10 16:47 "[Tiff] [libtiff v3.9.4] TIFFClientOpen() & 'w' mode", by IMoL
2011.01.10 17:53 "Re: [Tiff] [libtiff v3.9.4] TIFFClientOpen() & 'w' mode", by Olivier Paquet
2011.01.11 03:17 "Re: [Tiff] [libtiff v3.9.4] TIFFClientOpen() & 'w' mode", by IMoL

2011.01.10 16:47 "[Tiff] [libtiff v3.9.4] TIFFClientOpen() & 'w' mode", by IMoL

[Sending again since it didn't seem to make it to the list.]

I've been trying to track down a problem with writing TIFF files to a networked drive using Qt and I ran across an oddity in TIFFClientOpen(). Don't think it has anything to do with my problem, but I'm curious.

If called with mode == 'w':

...
       m = _TIFFgetMode(mode, module);
// m will be O_RDWR|O_CREAT|O_TRUNC
...
       tif->tif_mode = m &~ (O_CREAT|O_TRUNC);
// tif->tif_mode will be O_RDWR
...
       /*
        * Read in TIFF header.
        */
       if (tif->tif_mode & O_TRUNC ||
           !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {
...

If I'm reading the code correctly, tif->tif_mode & O_TRUNC in the if statement will always be false. So shouldn't that be m & O_TRUNC?

Thanks for any insight.

-- Andy

[After writing this I found a post from 2005 about this: http://www.asmail.be/msg0055533963.html but I don't think his solution can be correct...]