summaryrefslogtreecommitdiff
path: root/doc/functions/TIFFError.rst
blob: f03eef8c5a6c844847849b273c49bf3d31f72857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
TIFFError
=========

Synopsis
--------

.. highlight:: c

::

    #include <tiffio.h>
    #include <stdarg.h>

.. c:function:: void TIFFError(const char * module, const char * fmt, ...)

.. c:function:: void TIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...)

.. c:type:: void (*TIFFErrorHandler)(const char * module, const char* fmt, va_list ap)

.. c:type:: void (*TIFFErrorHandlerExt)(thandle_t fd, const char * module, const char* fmt, va_list ap)

.. c:function:: TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler)

.. c:function:: TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)

Description
-----------

:c:func:`TIFFError` invokes the library-wide error handling function to
(normally) write an error message to ``stderr``.  The *fmt* parameter is
a :c:func:`printf` format string, and any number arguments can be supplied.
The *module* parameter, if non-zero, is printed before the message; it
typically is used to identify the software module in which an error is detected.

Applications that desire to capture control in the event of an error should use
:c:func:`TIFFSetErrorHandler` to override the default error handler. A :c:macro:`NULL`
(0) error handling function may be installed to suppress error messages.

The function :c:func:`TIFFErrorExt` provides a file handle.
Within ``libtiff`` :c:func:`TIFFErrorExt` is called passing ``tif->tif_clientdata``
as *fd*, which represents the TIFF file handle (file descriptor).


.. TODO: Check description, how to setup a TIFFErrorExt handler and its file handle.

With :c:func:`TIFFSetErrorHandlerExt` an extra error handler can be setup.

Note
----

Both functions :c:func:`TIFFError` and :c:func:`TIFFErrorExt`
each attempt to call both handler functions if they are defined.
First :c:func:`TIFFErrorHandler` is called and then :c:func:`TIFFErrorHandlerExt`.
However, :c:func:`TIFFError` passes a "0" as a file handle to :c:func:`TIFFErrorHandlerExt`. 

Return values
-------------

:c:func:`TIFFSetErrorHandler` and :c:func:`TIFFSetErrorHandlerExt` returns
a reference to the previous error handling function.

See also
--------

:doc:`TIFFWarning` (3tiff),
:doc:`libtiff` (3tiff),
printf (3)