From b11adb825c4dfc8429695947cef8f9e3253ad0c2 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 17 Mar 2014 10:16:08 +0100 Subject: Logging: Be also more strict with value of logging rule Only accept lower-case "true" and "false", as documented. The old check didn't match either the documentation, nor the QSettings/ QVariant behavior (where, for a boolean value, any lower-cased content that not empty, "0" or "false" is considered true). Change-Id: I317d29c16a27f862001b9dff02e8298df8acf5a6 Reviewed-by: Friedemann Kleint Reviewed-by: Alex Blasche --- src/corelib/io/qloggingregistry.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/corelib/io/qloggingregistry.cpp') diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 7e6883fd14..575150f148 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -218,11 +218,14 @@ void QLoggingSettingsParser::setContent(QTextStream &stream) if ((equalPos != -1) && (line.lastIndexOf(QLatin1Char('=')) == equalPos)) { const QStringRef pattern = line.leftRef(equalPos); - const QStringRef value = line.midRef(equalPos + 1); - bool enabled = (value.compare(QLatin1String("true"), - Qt::CaseInsensitive) == 0); - QLoggingRule rule(pattern, enabled); - if (rule.flags != 0) + const QStringRef valueStr = line.midRef(equalPos + 1); + int value = -1; + if (valueStr == QLatin1String("true")) + value = 1; + else if (valueStr == QLatin1String("false")) + value = 0; + QLoggingRule rule(pattern, (value == 1)); + if (rule.flags != 0 && (value != -1)) _rules.append(rule); else warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData()); -- cgit v1.2.3