summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlogging.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r--src/corelib/global/qlogging.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 0e9dd3b5ee..52a565aa45 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1069,8 +1069,8 @@ static const char emptyTokenC[] = "";
static const char defaultPattern[] = "%{if-category}%{category}: %{endif}%{message}";
-
-struct QMessagePattern {
+struct QMessagePattern
+{
QMessagePattern();
~QMessagePattern();
@@ -1078,13 +1078,14 @@ struct QMessagePattern {
// 0 terminated arrays of literal tokens / literal or placeholder tokens
std::unique_ptr<std::unique_ptr<const char[]>[]> literals;
- std::unique_ptr<const char*[]> tokens;
- QList<QString> timeArgs; // timeFormats in sequence of %{time
+ std::unique_ptr<const char *[]> tokens;
+ QList<QString> timeArgs; // timeFormats in sequence of %{time
#ifndef QT_BOOTSTRAPPED
QElapsedTimer timer;
#endif
#ifdef QLOGGING_HAVE_BACKTRACE
- struct BacktraceParams {
+ struct BacktraceParams
+ {
QString backtraceSeparator;
int backtraceDepth;
};
@@ -1115,8 +1116,7 @@ QMessagePattern::QMessagePattern()
}
}
-QMessagePattern::~QMessagePattern()
- = default;
+QMessagePattern::~QMessagePattern() = default;
void QMessagePattern::setPattern(const QString &pattern)
{
@@ -1158,7 +1158,7 @@ void QMessagePattern::setPattern(const QString &pattern)
// tokenizer
std::vector<std::unique_ptr<const char[]>> literalsVar;
- tokens.reset(new const char*[lexemes.size() + 1]);
+ tokens.reset(new const char *[lexemes.size() + 1]);
tokens[lexemes.size()] = nullptr;
bool nestedIfError = false;
@@ -1290,7 +1290,7 @@ static QStringList backtraceFramesForLogMessage(int frameCount)
// This code is protected by QMessagePattern::mutex so it is thread safe on all compilers
static const QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$"));
- QVarLengthArray<void*, 32> buffer(8 + frameCount);
+ QVarLengthArray<void *, 32> buffer(8 + frameCount);
int n = backtrace(buffer.data(), buffer.size());
if (n > 0) {
int numberPrinted = 0;
@@ -1642,11 +1642,21 @@ static bool android_default_message_handler(QtMsgType type,
android_LogPriority priority = ANDROID_LOG_DEBUG;
switch (type) {
- case QtDebugMsg: priority = ANDROID_LOG_DEBUG; break;
- case QtInfoMsg: priority = ANDROID_LOG_INFO; break;
- case QtWarningMsg: priority = ANDROID_LOG_WARN; break;
- case QtCriticalMsg: priority = ANDROID_LOG_ERROR; break;
- case QtFatalMsg: priority = ANDROID_LOG_FATAL; break;
+ case QtDebugMsg:
+ priority = ANDROID_LOG_DEBUG;
+ break;
+ case QtInfoMsg:
+ priority = ANDROID_LOG_INFO;
+ break;
+ case QtWarningMsg:
+ priority = ANDROID_LOG_WARN;
+ break;
+ case QtCriticalMsg:
+ priority = ANDROID_LOG_ERROR;
+ break;
+ case QtFatalMsg:
+ priority = ANDROID_LOG_FATAL;
+ break;
};
__android_log_print(priority, qPrintable(QCoreApplication::applicationName()), "%s\n", qPrintable(formattedMessage));
@@ -1666,8 +1676,8 @@ static void win_outputDebugString_helper(QStringView message)
OutputDebugString(reinterpret_cast<const wchar_t *>(message.utf16()));
} else {
wchar_t *messagePart = new wchar_t[maxOutputStringLength + 1];
- for (int i = 0; i < message.length(); i += maxOutputStringLength ) {
- const int length = std::min(message.length() - i, maxOutputStringLength );
+ for (int i = 0; i < message.length(); i += maxOutputStringLength) {
+ const int length = std::min(message.length() - i, maxOutputStringLength);
const int len = message.mid(i, length).toWCharArray(messagePart);
Q_ASSERT(len == length);
messagePart[len] = 0;