From 924405d5b31b9ff37a67abd1e294892758f6379a Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 26 Feb 2018 11:34:14 +0100 Subject: [PATCH] Remove builtin support for GUI warning and error message boxes Now warnings always go to the console by default unless applications define their own warning and error handlers. GUI applications (and Windows CE) are required to define such handlers. Signed-off-by: Stefan Weil --- libtiff/tif_win32.c | 39 --------------------------------------- libtiff/tif_wince.c | 3 --- nmake.opt | 14 -------------- 3 files changed, 56 deletions(-) diff --git a/libtiff/tif_win32.c b/libtiff/tif_win32.c index cde4f6dc..088880e7 100644 --- a/libtiff/tif_win32.c +++ b/libtiff/tif_win32.c @@ -405,60 +405,21 @@ _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c) static void Win32WarningHandler(const char* module, const char* fmt, va_list ap) { -#ifndef TIF_PLATFORM_CONSOLE - LPTSTR szTitle; - LPTSTR szTmp; - LPCTSTR szTitleText = "%s Warning"; - LPCTSTR szDefaultModule = "LIBTIFF"; - LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module; - SIZE_T nBufSize = (strlen(szTmpModule) + - strlen(szTitleText) + strlen(fmt) + 256)*sizeof(char); - - if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, nBufSize)) == NULL) - return; - sprintf(szTitle, szTitleText, szTmpModule); - szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char); - vsnprintf(szTmp, nBufSize-(strlen(szTitle)+2)*sizeof(char), fmt, ap); - MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONINFORMATION); - LocalFree(szTitle); - - return; -#else if (module != NULL) fprintf(stderr, "%s: ", module); fprintf(stderr, "Warning, "); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); -#endif } TIFFErrorHandler _TIFFwarningHandler = Win32WarningHandler; static void Win32ErrorHandler(const char* module, const char* fmt, va_list ap) { -#ifndef TIF_PLATFORM_CONSOLE - LPTSTR szTitle; - LPTSTR szTmp; - LPCTSTR szTitleText = "%s Error"; - LPCTSTR szDefaultModule = "LIBTIFF"; - LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module; - SIZE_T nBufSize = (strlen(szTmpModule) + - strlen(szTitleText) + strlen(fmt) + 256)*sizeof(char); - - if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, nBufSize)) == NULL) - return; - sprintf(szTitle, szTitleText, szTmpModule); - szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char); - vsnprintf(szTmp, nBufSize-(strlen(szTitle)+2)*sizeof(char), fmt, ap); - MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONEXCLAMATION); - LocalFree(szTitle); - return; -#else if (module != NULL) fprintf(stderr, "%s: ", module); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); -#endif } TIFFErrorHandler _TIFFerrorHandler = Win32ErrorHandler; diff --git a/libtiff/tif_wince.c b/libtiff/tif_wince.c index 5bd7daf5..b3b168f1 100644 --- a/libtiff/tif_wince.c +++ b/libtiff/tif_wince.c @@ -34,9 +34,6 @@ #include "tiffiop.h" #include -/* Turn off console support on Windows CE. */ -#undef TIF_PLATFORM_CONSOLE - COMPILATION SHOULD FAIL This file is not yet updated to reflect changes in LibTiff 4.0. If you have the opportunity to update and test this file, please contact LibTiff folks diff --git a/nmake.opt b/nmake.opt index c354bdfc..ae544670 100644 --- a/nmake.opt +++ b/nmake.opt @@ -34,13 +34,6 @@ ###### Edit the following lines to choose a feature set you need. ####### # -# -# Select WINMODE_CONSOLE to build a library which reports errors to stderr, or -# WINMODE_WINDOWED to build such that errors are reported via MessageBox(). -# -WINMODE_CONSOLE = 1 -#WINMODE_WINDOWED = 1 - # # Comment out the following lines to disable internal codecs. # @@ -159,13 +152,6 @@ DLLNAME = libtiff.dll # Set the native cpu bit order EXTRAFLAGS = -DFILLODER_LSB2MSB $(EXTRAFLAGS) -!IFDEF WINMODE_WINDOWED -EXTRAFLAGS = -DTIF_PLATFORM_WINDOWED $(EXTRAFLAGS) -LIBS = user32.lib $(LIBS) -!ELSE -EXTRAFLAGS = -DTIF_PLATFORM_CONSOLE $(EXTRAFLAGS) -!ENDIF - # Codec stuff !IFDEF CCITT_SUPPORT EXTRAFLAGS = -DCCITT_SUPPORT $(EXTRAFLAGS)