2009.02.12 20:12 "[Tiff] Accessing tif->tif_clientdata within my own error and warning functions", by Philip Watkinson

2009.02.17 21:11 "Re: [Tiff] Accessing tif->tif_clientdata within my own errorandwarning functions", by


Within TIFFWarning(), a warning extension function such as TIFFWarningExt() can now be called. The first parameter in TIFFWarningExt() is a pointer to the client data. But when TIFFWarningExt() is called from within TIFFWarning(), a NULL(0) pointer is used for the client data because a pointer to TIFF is not passed to TIFFWarning(). How can I access the client data (tif->tif_clientdata)?

The thing is, TIFFWarning() is there for backwards compatibility for people that placed extensions inside the LibTiff code, or brew their own subcodecs and such. We're likely overly cautious providing the backwards compatible warning raiser, likely only the backwards compatible warning handler is really used, but better safe then sorry. The core library, as distributed, does not ever call TIFFWarning(). Instead, it calls TIFFWarningExt() and provides the tif->tif_clientdata parameter.

If I remember correctly, there might be one or two exceptions inside library initialization code, where no TIFF or tif->tif_clientdata is present. So your handler should check and see if tif->tif_clientdata is NULL, and if it is, that means something vital went wrong in library initialization, independent of the encoding or decoding inside a specific TIFF context.

Best regards,