From 6e6b74c0c7dbbde022ae1d01a6c6e486ed6010fc Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Fri, 11 May 2012 09:44:52 +0200 Subject: Use WChar method for reporting for Windows Switch to Unicode reporting, as Windows CE does only support UTF-16 functions and to not open up some other ifdefs just switch to unicode. Change-Id: I82613a131313235e313cecd315bf6d1488af0532 Reviewed-by: Kai Koehne Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/corelib/global/qlogging.cpp') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index b3ffeab0b8..9669572ce3 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -108,7 +108,17 @@ static void qEmergencyOut(QtMsgType msgType, const char *msg, va_list ap) qvsnprintf(emergency_buf, 255, msg, ap); #if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB) - OutputDebugStringA(emergency_buf); +#ifdef Q_OS_WINCE + OutputDebugStringW(reinterpret_cast ( + QString::fromLatin1(emergency_buf).utf16())); +#else + if (usingWinMain) { + OutputDebugStringA(emergency_buf); + } else { + fprintf(stderr, "%s", emergency_buf); + fflush(stderr); + } +#endif #else fprintf(stderr, "%s", emergency_buf); fflush(stderr); @@ -121,8 +131,10 @@ static void qEmergencyOut(QtMsgType msgType, const char *msg, va_list ap) // get the current report mode int reportMode = _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW); _CrtSetReportMode(_CRT_ERROR, reportMode); - int ret = _CrtDbgReport(_CRT_ERROR, __FILE__, __LINE__, QT_VERSION_STR, - msg); + int ret = _CrtDbgReportW(_CRT_ERROR, _CRT_WIDE(__FILE__), __LINE__, + _CRT_WIDE(QT_VERSION_STR), + reinterpret_cast ( + QString::fromLatin1(msg).utf16())); if (ret == 1) _CrtDbgBreak(); #endif -- cgit v1.2.3