Debian Codegraph @

texk/xdvipsk/thirdparty/libtiff/doc/functions/TIFFWarning.rst

raw
1 TIFFWarning
2 ===========
3
4 Synopsis
5 --------
6
7 .. highlight:: c
8
9 ::
10
11 #include <tiffio.h>
12 #include <stdarg.h>
13
14 .. c:function:: void TIFFWarning(const char* module, const char* fmt, ...)
15
16 .. c:function:: void TIFFWarningExt(thandle_t fd, const char* module, const char* fmt, ...)
17
18 .. c:function:: void TIFFWarningExtR(TIFF *tif, const char* module, const char* fmt, ...)
19
20 .. c:type:: void (*TIFFWarningHandler)(const char * module, const char* fmt, va_list ap)
21
22 .. c:type:: void (*TIFFWarningHandlerExt)(thandle_t fd, const char* module, const char* fmt, va_list ap)
23
24 .. c:type:: int (*TIFFWarningHandlerExtR)(TIFF* tif, void* user_data, const char* module, const char* fmt, va_list ap)
25
26 .. c:function:: TIFFWarningHandler TIFFSetWarningHandler(TIFFWarningHandler handler)
27
28 .. c:function:: TIFFWarningHandlerExt TIFFSetWarningHandlerExt(TIFFWarningHandlerExt handler)
29
30 Description
31 -----------
32
33 :c:func:`TIFFWarning` invokes the library-wide warning handler function
34 to (normally) write a warning message to the ``stderr``.
35 The *fmt* parameter is a :c:func:`printf` format string, and any number
36 arguments can be supplied. The *module* parameter is interpreted as a
37 string that, if non-zero, should be printed before the message; it
38 typically is used to identify the software module in which a warning is
39 detected.
40
41 Applications that desire to capture control in the event of a warning
42 should use :c:func:`TIFFSetWarningHandler` to override the default
43 warning handler. A :c:macro:`NULL` (0) warning handler function may be
44 installed to suppress warning messages.
45
46 Two more application-specific warning handler callbacks are available,
47 each with different call parameters and passing parameters to the handler.
48 Each handler is also linked with a warning message function, i.e.
49 :c:func:`TIFFWarningExt` and :c:func:`TIFFWarningExtR` if the application
50 intends to call the handler with those extended parameters.
51
52 :c:func:`TIFFWarningExt` provides a file handle as parameter.
53 Within ``libtiff`` :c:func:`TIFFWarningExt` is called passing ``tif->tif_clientdata``
54 as *fd*, which represents the TIFF file handle (file descriptor).
55 The application-specific and library-wide handler for :c:func:`TIFFWarningExt`
56 is setup with :c:func:`TIFFSetWarningHandlerExt`.
57
58 :c:func:`TIFFWarningExtR` (introduced with libtiff 4.5) is called with its
59 TIFF handle and thus provides access to a per-TIFF handle (re-entrant)
60 warning handler. That means for different TIFF handles, different warning
61 handlers can be setup. This application-specific handler
62 can be setup when a TIFF file is opened with one of the following functions:
63 :c:func:`TIFFOpenExt`, :c:func:`TIFFOpenWExt`, :c:func:`TIFFFdOpenExt`
64 or :c:func:`TIFFClientOpenExt`.
65 Furthermore, a **custom defined data structure** *user_data* for the
66 warning handler can be given along.
67
68 Note
69 ----
70
71 Both functions :c:func:`TIFFWarning` and :c:func:`TIFFWarningExt`
72 each attempt to call both handler functions if they are defined.
73 First :c:func:`TIFFWarningHandler` is called and then :c:func:`TIFFWarningHandlerExt`.
74 However, :c:func:`TIFFWarning` passes a "0" as a file handle to
75 :c:func:`TIFFWarningHandlerExt`.
76
77 :c:func:`TIFFWarningExtR` tries first to call the per-TIFF handle defined
78 warning handler. If :c:func:`TIFFWarningHandlerExtR` is not defined or
79 returns 0, :c:func:`TIFFWarningHandler` and then :c:func:`TIFFWarningHandlerExt`
80 are called. From libtiff 4.5 onwards :c:func:`TIFFWarningExtR` is used
81 within the ``libtiff`` library.
82
83 Return values
84 -------------
85
86 :c:func:`TIFFSetWarningHandler` and :c:func:`TIFFSetWarningHandlerExt`
87 returns a reference to the previous warning handler function.
88
89 :c:func:`TIFFWarningHandlerExtR` returns an integer as "stop" to control the call
90 of furhter warning handler functions within :c:func:`TIFFWarningExtR`:
91
92 - 0: both functions :c:func:`TIFFWarningHandler` and :c:func:`TIFFWarningHandlerExt` are called.
93 - non-zero: no further warning message function is called.
94
95 See also
96 --------
97
98 :doc:`TIFFError` (3tiff),
99 :doc:`TIFFOpen` (3tiff),
100 :doc:`libtiff` (3tiff),
101 printf (3)