diff options
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 48d0cac10e..7e4425bd34 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -155,6 +155,7 @@ Q_NORETURN #endif static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const QString &message); static void qt_message_print(QtMsgType, const QMessageLogContext &context, const QString &message); +static void qt_message_print(const QString &message); static int checked_var_value(const char *varname) { @@ -1214,20 +1215,10 @@ void QMessagePattern::setPattern(const QString &pattern) error += QLatin1String("QT_MESSAGE_PATTERN: %{if-*} cannot be nested\n"); else if (inIf) error += QLatin1String("QT_MESSAGE_PATTERN: missing %{endif}\n"); - if (!error.isEmpty()) { -#if defined(Q_OS_WINRT) - OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16())); - if (0) -#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) - if (!qt_logging_to_console()) { - OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16())); - } else -#endif - { - fprintf(stderr, "%s", error.toLocal8Bit().constData()); - fflush(stderr); - } - } + + if (!error.isEmpty()) + qt_message_print(error); + literals = new const char*[literalsVar.size() + 1]; literals[literalsVar.size()] = 0; memcpy(literals, literalsVar.constData(), literalsVar.size() * sizeof(const char*)); @@ -1743,6 +1734,21 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex } } +static void qt_message_print(const QString &message) +{ +#if defined(Q_OS_WINRT) + OutputDebugString(reinterpret_cast<const wchar_t*>(message.utf16())); + return; +#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) + if (!qt_logging_to_console()) { + OutputDebugString(reinterpret_cast<const wchar_t*>(message.utf16())); + return; + } +#endif + fprintf(stderr, "%s", message.toLocal8Bit().constData()); + fflush(stderr); +} + static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const QString &message) { #if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) |