From a6ddae873bbe4c3cc68949f5a2758b5458422e7c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 10 Oct 2015 10:34:46 +0200 Subject: QtCore: Don't compare QChars to literal 0s This is prone to ambiguities, even though we currently don't run into them. Use QChar::isNull() instead. Change-Id: I71843878b3f4f8a5deae2ef57a6f6628461be216 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/io/qdir.cpp | 2 +- src/corelib/tools/qstring.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index e1d9858a66..4d2b36632f 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -138,7 +138,7 @@ inline QChar QDirPrivate::getFilterSepChar(const QString &nameFilter) // static inline QStringList QDirPrivate::splitFilters(const QString &nameFilter, QChar sep) { - if (sep == 0) + if (sep.isNull()) sep = getFilterSepChar(nameFilter); QStringList ret = nameFilter.split(sep); for (int i = 0; i < ret.count(); ++i) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index e3a3cc79c6..ea220ed557 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1509,7 +1509,7 @@ QString::QString(const QChar *unicode, int size) } else { if (size < 0) { size = 0; - while (unicode[size] != 0) + while (!unicode[size].isNull()) ++size; } if (!size) { -- cgit v1.2.3