diff options
author | Andreas Holzammer <andreas.holzammer@kdab.com> | 2012-05-11 09:44:52 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-11 19:41:25 +0200 |
commit | 6e6b74c0c7dbbde022ae1d01a6c6e486ed6010fc (patch) | |
tree | 2d4a1f45d44d5de9a26e3c84efb7f1429f3e9230 /src/corelib/global/qlogging.cpp | |
parent | 61a3615c4651c8c82a3e6804c506f68c247bdd12 (diff) |
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 <kai.koehne@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
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<const wchar_t *> ( + 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<const wchar_t *> ( + QString::fromLatin1(msg).utf16())); if (ret == 1) _CrtDbgBreak(); #endif |