2014.04.21 14:54 "[Tiff] Correct use of TIFFGetField with FieldInfo", by Roger Leigh

2014.04.21 14:54 "[Tiff] Correct use of TIFFGetField with FieldInfo", by Roger Leigh

Hi,

Looking at the documentation, TIFFGetField appears to require calling TIFFFieldReadCount and TIFFFieldPassCount to determine which parameters need to be passed in the argument list.

However, taking TIFFTAG_BITSPERSAMPLE as an example, this has TIFFFieldReadCount == -1 (TIFF_VARIABLE) and TIFFFieldPassCount == 0. All the examples I've looked at in the source tree use a uint16 pointer directly to retrieve the value, but I'm not sure how this squares with a TIFF_VARIABLE read count. Why isn't the count 1? (I'm aware libtiff doesn't match the spec exactly for this tag, but why does it appear to be different from the implementated behaviour--is it possible to use this safely?)

Is it possible to safely call TIFF(Get|Set)Field using only the information available in FieldInfo, or are there any cases where this isn't correct and calling requires a priori knowledge of how the interface behaves?

Many thanks,

Roger

--
  .''`. Roger Leigh

 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools

   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800