diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2012-04-02 13:48:06 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-20 08:37:06 +0200 |
commit | d9a1c2dff85635076ecaee3507427d750846c85c (patch) | |
tree | 5c60ddcb7815b6ea1789c84c7972ddda2e0a4e85 /tests/auto/corelib/global/qlogging | |
parent | a3f90fd44f822ae9d77c9d115934e18a9c7466fd (diff) |
Logging: Change arguments of message handler to avoid conversions
Introduce a new QtMessageHandler that takes QString instead of
char *: This avoids converting to local8bit , only to convert it back
to utf16 for Windows.
The old QMessageHandler is kept for a transition period, but will
be removed before Qt 5.0.
Also fix qEmergencyOut (that is called in OOM situations) to not rely
on the default message handler.
Change-Id: Iee0ce5838f97175c98788b847964273dd22d4a37
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/global/qlogging')
-rw-r--r-- | tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index aaec46fe64..1d6aa89035 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -73,13 +73,13 @@ int s_line; const char *s_function; static QString s_message; -void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const char *msg) +void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { s_type = type; s_file = context.file; s_line = context.line; s_function = context.function; - s_message = QString::fromLocal8Bit(msg); + s_message = msg; } void customMsgHandler(QtMsgType type, const char *msg) @@ -101,7 +101,7 @@ void tst_qmessagehandler::initTestCase() void tst_qmessagehandler::cleanup() { qInstallMsgHandler(0); - qInstallMessageHandler(0); + qInstallMessageHandler((QtMessageHandler)0); s_type = QtFatalMsg; s_file = 0; s_line = 0; @@ -117,7 +117,7 @@ void tst_qmessagehandler::defaultHandler() void tst_qmessagehandler::installMessageHandler() { - QMessageHandler oldHandler = qInstallMessageHandler(customMessageHandler); + QtMessageHandler oldHandler = qInstallMessageHandler(customMessageHandler); qDebug("installMessageHandler"); int line = __LINE__; @@ -127,7 +127,7 @@ void tst_qmessagehandler::installMessageHandler() QCOMPARE(s_function, Q_FUNC_INFO); QCOMPARE(s_line, line); - QMessageHandler myHandler = qInstallMessageHandler(oldHandler); + QtMessageHandler myHandler = qInstallMessageHandler(oldHandler); QCOMPARE((void*)myHandler, (void*)customMessageHandler); } |