2012.07.26 02:50 "[Tiff] Confused about 4.0 API changes: TIFFField vs TIFFFieldInfo", by Tom Lane

2012.07.26 02:50 "[Tiff] Confused about 4.0 API changes: TIFFField vs TIFFFieldInfo", by Tom Lane

I was trying to fix the freeimage source code to work with libtiff 4.0, and ran into an API compatibility issue that I don't understand the rationale for, nor how to work around what seems like loss of functionality.

TIFFFieldWithTag() and related functions used to return const TIFFFieldInfo*, and you could look into the struct and do something with the information. Now they return const TIFFField*, which so far as I can see is an opaque type for which no operations are provided in tiffio.h. So these functions have been lobotomized into mere boolean probes: you can find out whether the TIFF file contains such a tag, but you can't learn anything else about it. What was the intention here?

What the freeimage source code is doing with the TIFFFieldInfo stuff is determining the tag data type and the number of values, so that it can figure out how to call TIFFGetField to copy the data, without needing bespoke code for every possible tag. I suppose I could replace that with hard-wired code for each tag they care about, but that surely does not seem like an improvement.

Can anyone explain to me how to do this with the 4.0 API? If it's not possible, isn't that a rather serious functionality regression?

regards, tom lane