From 0fc7f695cea35b94832e03cbf2a0e74998293ba2 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 21 May 2003 18:25:24 +0000 Subject: [PATCH] Applied patch [ 740071 ] Make tiff errors/warnings use wxLog functions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/imagtiff.h | 8 +------- src/common/imagtiff.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/wx/imagtiff.h b/include/wx/imagtiff.h index 67657d6d4f..1f953b3f4a 100644 --- a/include/wx/imagtiff.h +++ b/include/wx/imagtiff.h @@ -25,13 +25,7 @@ class WXDLLEXPORT wxTIFFHandler: public wxImageHandler { public: - inline wxTIFFHandler() - { - m_name = wxT("TIFF file"); - m_extension = wxT("tif"); - m_type = wxBITMAP_TYPE_TIF; - m_mime = wxT("image/tiff"); - } + wxTIFFHandler(); #if wxUSE_STREAMS virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index 741bc36472..657ff82ac5 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -136,6 +136,22 @@ _tiffUnmapProc(thandle_t WXUNUSED(handle), { } +static void +TIFFwxWarningHandler(const char* module, const char* fmt, va_list ap) +{ + if (module != NULL) + wxLogWarning(_("tiff module: %s"), module); + wxLogWarning((wxChar *) fmt, ap); +} + +static void +TIFFwxErrorHandler(const char* module, const char* fmt, va_list ap) +{ + if (module != NULL) + wxLogError(_("tiff module: %s"), module); + wxVLogError((wxChar *) fmt, ap); +} + } // extern "C" TIFF* @@ -162,6 +178,16 @@ TIFFwxOpen(wxOutputStream &stream, const char* name, const char* mode) return tif; } +wxTIFFHandler::wxTIFFHandler() +{ + m_name = wxT("TIFF file"); + m_extension = wxT("tif"); + m_type = wxBITMAP_TYPE_TIF; + m_mime = wxT("image/tiff"); + TIFFSetWarningHandler((TIFFErrorHandler) TIFFwxWarningHandler); + TIFFSetErrorHandler((TIFFErrorHandler) TIFFwxErrorHandler); +} + bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ) { if (index == -1) -- 2.45.2