2019.04.09 17:49 "[Tiff] TIFFGetField argument meaning", by Larry Gritz
Can somebody explain exactly how the variable arguments to TIFFGetField are meant to work?
The vast majority of time,
TIFFGetField (tif, tag, ptr_to_my_data_buffer);
works fine, and almost all of the documentation is of this form. But other times it seems to want two optional arguments
TIFFGetField (tif, tag, &count, &ptr);
For tags that expect the second kind, using the first form of the call will often crash, because it's trying to write through a pointer that I didn't pass.
Can somebody please explain how we're to know which call sequence it expects, and the right idiom to use if one wants to defensively and robustly read fields with no possibility of botching it?
The man pages http://www.simplesystems.org/libtiff/man/TIFFGetField.3tiff.html are no help at all for this question.
Also... TIFFGetFieldDefaulted vs TIFFGetField? Is there harm in always using Defaulted?