LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
tif_error.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 1988-1997 Sam Leffler
3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and
6 * its documentation for any purpose is hereby granted without fee, provided
7 * that (i) the above copyright notices and this permission notice appear in
8 * all copies of the software and related documentation, and (ii) the names of
9 * Sam Leffler and Silicon Graphics may not be used in any advertising or
10 * publicity relating to the software without the specific, prior written
11 * permission of Sam Leffler and Silicon Graphics.
12 *
13 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
18 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22 * OF THIS SOFTWARE.
23 */
24
25/*
26 * TIFF Library.
27 */
33#include "tiffiop.h"
34
36
43
50
51void TIFFError(const char *module, const char *fmt, ...)
52{
53 va_list ap;
55 {
56 va_start(ap, fmt);
57 (*_TIFFerrorHandler)(module, fmt, ap);
58 va_end(ap);
59 }
61 {
62 va_start(ap, fmt);
63 (*_TIFFerrorHandlerExt)(0, module, fmt, ap);
64 va_end(ap);
65 }
66}
67
68void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt, ...)
69{
70 va_list ap;
72 {
73 va_start(ap, fmt);
74 (*_TIFFerrorHandler)(module, fmt, ap);
75 va_end(ap);
76 }
78 {
79 va_start(ap, fmt);
80 (*_TIFFerrorHandlerExt)(fd, module, fmt, ap);
81 va_end(ap);
82 }
83}
84
86 const char *module, const char *fmt, ...)
87{
88 va_list ap;
89 if (opts && opts->errorhandler)
90 {
91 va_start(ap, fmt);
92 int stop = opts->errorhandler(NULL, opts->errorhandler_user_data,
93 module, fmt, ap);
94 va_end(ap);
95 if (stop)
96 return;
97 }
99 {
100 va_start(ap, fmt);
101 (*_TIFFerrorHandler)(module, fmt, ap);
102 va_end(ap);
103 }
105 {
106 va_start(ap, fmt);
107 (*_TIFFerrorHandlerExt)(clientdata, module, fmt, ap);
108 va_end(ap);
109 }
110}
111
112void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt, ...)
113{
114 va_list ap;
115 if (tif && tif->tif_errorhandler)
116 {
117 va_start(ap, fmt);
118 int stop = (*tif->tif_errorhandler)(
119 tif, tif->tif_errorhandler_user_data, module, fmt, ap);
120 va_end(ap);
121 if (stop)
122 return;
123 }
125 {
126 va_start(ap, fmt);
127 (*_TIFFerrorHandler)(module, fmt, ap);
128 va_end(ap);
129 }
131 {
132 va_start(ap, fmt);
133 (*_TIFFerrorHandlerExt)(tif ? tif->tif_clientdata : NULL, module, fmt,
134 ap);
135 va_end(ap);
136 }
137}
TIFFErrorHandlerExt _TIFFerrorHandlerExt
Store the global extended error callback.
Definition tif_error.c:35
TIFFErrorHandler _TIFFerrorHandler
Store the global error callback.
Definition tif_unix.c:553
void _TIFFErrorEarly(TIFFOpenOptions *opts, thandle_t clientdata, const char *module, const char *fmt,...)
Report an opening error before a complete TIFF handle is available.
Definition tif_error.c:85
void(* TIFFErrorHandlerExt)(thandle_t fd, const char *module, const char *fmt, va_list ap)
Handle a library-wide error or warning diagnostic.
Definition tiffio.h:858
TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)
Replace the library-wide error extended handler.
Definition tif_error.c:44
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Dispatch a error diagnostic to the configured handlers.
Definition tif_error.c:68
void TIFFError(const char *module, const char *fmt,...)
Dispatch a error diagnostic to the configured handlers.
Definition tif_error.c:51
void(* TIFFErrorHandler)(const char *module, const char *fmt, va_list ap)
Handle a library-wide error or warning diagnostic.
Definition tiffio.h:835
TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler)
Replace the library-wide error handler.
Definition tif_error.c:37
void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt,...)
Dispatch a error diagnostic to the configured handlers.
Definition tif_error.c:112
void * thandle_t
Carry an opaque client I/O context through library callbacks.
Definition tiffio.h:161
Hold allocation limits and diagnostics used when opening a TIFF handle.
Definition tiffiop.h:791
void * errorhandler_user_data
Borrowed error-callback context, or NULL.
Definition tiffiop.h:795
TIFFErrorHandlerExtR errorhandler
Optional per-handle error callback, or NULL.
Definition tiffiop.h:793
Hold private state for one open TIFF library instance.
Definition tiffiop.h:389
TIFFErrorHandlerExtR tif_errorhandler
Per-handle error callback, or NULL for the default handling path.
Definition tiffiop.h:758
void * tif_errorhandler_user_data
Borrowed context passed to tif_errorhandler.
Definition tiffiop.h:760
thandle_t tif_clientdata
Client I/O context passed unchanged to the I/O callbacks.
Definition tiffiop.h:712
Declare private library state, callbacks, and implementation helpers.