TIFFWriteDirectory() fails on network drive

Hsu, Justine Justine.Hsu@FlightSafety.com
Fri Jan 31 20:17:00 GMT 2014


The attached program tries to save a blank 64 x 64 TIFF image to specified path.
When the path specified is local, the images saves fine.
If the path is on a network drive on a Windows7, then it saves a corrupt file, even after applying this hotfix http://support.microsoft.com/kb/2732673 
Here is the relevant code:

        const int dim = 64;
        const int channels = 3;

        TIFF *tif = TIFFOpen(argv[1], "w");
        TIFFSetField(tif, TIFFTAG_IMAGEWIDTH,      dim);
        TIFFSetField(tif, TIFFTAG_IMAGELENGTH,     dim);
        TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, channels);
        TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,    1);
        TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE,   8);
        TIFFSetField(tif, TIFFTAG_PLANARCONFIG,    1);
        TIFFSetField(tif, TIFFTAG_PHOTOMETRIC,     PHOTOMETRIC_RGB);
        TIFFSetField(tif, TIFFTAG_COMPRESSION,     COMPRESSION_LZW);
        
        int i;
        for (i = 0; i < dim; i++)
        {
            TIFFWriteScanline(tif, buf + dim*channels*(dim - i - 1), i, 0);
        }

        TIFFWriteDirectory(tif);
        TIFFClose(tif);

Justine
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tiff_test.c
Type: application/octet-stream
Size: 1423 bytes
Desc: tiff_test.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140131/42c948a6/attachment.obj>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list