AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
February 2009

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2009.02.12 20:12 "Accessing tif->tif_clientdata within my own error and warning functions", by Philip Watkinson
2009.02.13 08:13 "Re: Accessing tif->tif_clientdata within my own error andwarning functions", by Joris Van Damme
2009.02.17 16:17 "Re: Accessing tif->tif_clientdata within my own error andwarning functions", by Philip Watkinson
2009.02.17 17:04 "FW: Accessing tif->tif_clientdata within my own error andwarning functions", by Philip Watkinson
2009.02.17 18:24 "Re: FW: Accessing tif->tif_clientdata within my own error andwarning functions", by Bob Friesenhahn
2009.02.17 21:36 "Re: Accessing tif->tif_clientdata within my own error andwarning functions", by Joris Van Damme
2009.02.17 21:11 "Re: Accessing tif->tif_clientdata within my own errorandwarning functions", by Joris Van Damme

2009.02.13 08:13 "Re: Accessing tif->tif_clientdata within my own error andwarning functions", by Joris Van Damme

Philip,

> For error and warning handling, the default action is write errors and
> warnings to standard error. You can create your own error and warning
> functions and set them with TIFFSetErrorHandler() (tif_error.c) and
> TIFFSetWarningHandler() (tif_warning.c). Error and warning messages are
> created with TIFFError() and TIFFWarning(). These functions can then call 
> my
> own error and warning functions.
>
> I would like to be able to access my structure pointed to by
> TIFF->tif_clientdata within my functions. I would like to buffer error and
> warning messages in my structure instead of using stderr. Unfortunately a
> pointer to TIFF is not passed to TIFFError() or TIFFWarning().
>
> Is there another to control warning and error messages? I'm using version
> 3.7.1.
>
> Is it possible in a future release to include access to 
> tif->tif_clientdata
> for custom error and warning functions?

We've all had the same problem at one time or another, and I've cured it 
recently. In recent versions, the interface you describe here still exists 
for backwards compatibility, but there is an added interface that is much 
the same only it has an 'Ext' appended to the function names and it includes 
the tif->tif_clientdata so as to enable retrieving the context when handling 
warnings and errors.

I can't say from the top of my head in what version the extended interface 
got added. I don't think 3.7.1 has it. Do a library-wide search on 
'TIFFSetErrorHandlerExt'. If that doesn't yield any search results, then 
you're out of luck and might need to upgrade to a newer version.

Some people manage to get a context from a global var. Of course, that only 
works as long as you've at most one TIFF object in your total application at 
any given time. Some get a context from a threadvar. Of course, that only 
works if you've at most one TIFF object per thread at any given time. If 
even the last condition does not apply to your setup, you will indeed need 
to use the 'Ext' error/warning handler interface in newer versions.


Best regards,

Joris