summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingregistry.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2014-03-17 10:16:08 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-03 11:07:07 +0200
commitb11adb825c4dfc8429695947cef8f9e3253ad0c2 (patch)
tree6d5ca3c3ffe2d11494b3b51dd67c7ad64274db0d /src/corelib/io/qloggingregistry.cpp
parent828cfb4019939a39c84e5c5e17dc8cb52e9f63fd (diff)
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 <Friedemann.Kleint@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/corelib/io/qloggingregistry.cpp')
-rw-r--r--src/corelib/io/qloggingregistry.cpp13
1 files changed, 8 insertions, 5 deletions
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());