2003.02.17 13:12 "flushing of tiffs where only the directory has changed", by Axel Waggershauser

2003.02.17 13:12 "flushing of tiffs where only the directory has changed", by Axel Waggershauser

Hi,

I have to open an tiff file, change a custom field but no image data and save the changes. This seems no to be possible, since the TIFFFlush() function writes the directory only if the image data has been changed (TIFF_BEENWRITING is set). I find the following comment in tif_flush.c:

 * Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING
 * is not set, so that TIFFFlush() will proceed to write out the directory.
 * The documentation says returning 1 is an error indicator, but not having
 * been writing isn't exactly a an error.  Hopefully this doesn't cause
 * problems for other people.

but the subsequent lines look like:

        if ((tif->tif_flags & TIFF_BEENWRITING) == 0)
           return (0);

which looks like an inconsitancy to me. A "return 1;" as stated in the comment would solve my problem, I think. Does the fact, that 0 is returned, mean that the mentioned change has been a problem for someone?

Does anybody have an other idea how to solve this problem?

Thanks, Axel.