/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_error.c,v 1.6 2017-07-04 12:54:42 erouault Exp $ */12/*3* Copyright (c) 1988-1997 Sam Leffler4* Copyright (c) 1991-1997 Silicon Graphics, Inc.5*6* Permission to use, copy, modify, distribute, and sell this software and7* its documentation for any purpose is hereby granted without fee, provided8* that (i) the above copyright notices and this permission notice appear in9* all copies of the software and related documentation, and (ii) the names of10* Sam Leffler and Silicon Graphics may not be used in any advertising or11* publicity relating to the software without the specific, prior written12* permission of Sam Leffler and Silicon Graphics.13*14* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,15* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY16* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.17*18* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR19* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,20* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,21* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF22* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE23* OF THIS SOFTWARE.24*/2526/*27* TIFF Library.28*/29#include "tiffiop.h"3031TIFFErrorHandlerExt _TIFFerrorHandlerExt = NULL;3233TIFFErrorHandler34TIFFSetErrorHandler(TIFFErrorHandler handler)35{36TIFFErrorHandler prev = _TIFFerrorHandler;37_TIFFerrorHandler = handler;38return (prev);39}4041TIFFErrorHandlerExt42TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)43{44TIFFErrorHandlerExt prev = _TIFFerrorHandlerExt;45_TIFFerrorHandlerExt = handler;46return (prev);47}4849void50TIFFError(const char* module, const char* fmt, ...)51{52va_list ap;53if (_TIFFerrorHandler) {54va_start(ap, fmt);55(*_TIFFerrorHandler)(module, fmt, ap);56va_end(ap);57}58if (_TIFFerrorHandlerExt) {59va_start(ap, fmt);60(*_TIFFerrorHandlerExt)(0, module, fmt, ap);61va_end(ap);62}63}6465void66TIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...)67{68va_list ap;69if (_TIFFerrorHandler) {70va_start(ap, fmt);71(*_TIFFerrorHandler)(module, fmt, ap);72va_end(ap);73}74if (_TIFFerrorHandlerExt) {75va_start(ap, fmt);76(*_TIFFerrorHandlerExt)(fd, module, fmt, ap);77va_end(ap);78}79}8081/*82* Local Variables:83* mode: c84* c-basic-offset: 885* fill-column: 7886* End:87*/888990