diff options
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/builds/windows/ftdebug.c')
-rw-r--r-- | Build/source/libs/freetype2/freetype-src/builds/windows/ftdebug.c | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/builds/windows/ftdebug.c b/Build/source/libs/freetype2/freetype-src/builds/windows/ftdebug.c index a1aedb8e049..94c22da7525 100644 --- a/Build/source/libs/freetype2/freetype-src/builds/windows/ftdebug.c +++ b/Build/source/libs/freetype2/freetype-src/builds/windows/ftdebug.c @@ -88,33 +88,62 @@ dlg_handler ft_default_log_handler = NULL; FT_Custom_Log_Handler custom_output_handler = NULL; -#endif /* FT_DEBUG_LOGGING*/ +#endif /* FT_DEBUG_LOGGING */ #ifdef FT_DEBUG_LEVEL_ERROR -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - +#define WIN32_LEAN_AND_MEAN #include <windows.h> +#ifdef _WIN32_WCE + + FT_LOACAL_DEF( void ) + OutputDebugStringA( LPCSTR lpOutputString ) + { + int len; + LPWSTR lpOutputStringW; + + + /* allocate memory space for converted string */ + len = MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS, + lpOutputString, -1, NULL, 0 ); + + lpOutputStringW = (LPWSTR)_alloca( len * sizeof ( WCHAR ) ); + + if ( !len || !lpOutputStringW ) + return; + + /* now it is safe to do the translation */ + MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS, + lpOutputString, -1, lpOutputStringW, len ); + + OutputDebugStringW( lpOutputStringW ); + } + +#endif /* _WIN32_WCE */ + + /* documentation is in ftdebug.h */ FT_BASE_DEF( void ) FT_Message( const char* fmt, ... ) { - static char buf[8192]; - va_list ap; + va_list ap; va_start( ap, fmt ); vfprintf( stderr, fmt, ap ); - /* send the string to the debugger as well */ - vsprintf( buf, fmt, ap ); - OutputDebugStringA( buf ); + if ( IsDebuggerPresent() ) + { + static char buf[1024]; + + + vsnprintf( buf, sizeof buf, fmt, ap ); + OutputDebugStringA( buf ); + } va_end( ap ); } @@ -125,13 +154,19 @@ FT_Panic( const char* fmt, ... ) { - static char buf[8192]; - va_list ap; + va_list ap; va_start( ap, fmt ); - vsprintf( buf, fmt, ap ); - OutputDebugStringA( buf ); + vfprintf( stderr, fmt, ap ); + if ( IsDebuggerPresent() ) + { + static char buf[1024]; + + + vsnprintf( buf, sizeof buf, fmt, ap ); + OutputDebugStringA( buf ); + } va_end( ap ); exit( EXIT_FAILURE ); |