summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-04-06 12:11:40 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-04-06 22:29:34 +0000
commitaee197da01b6fd6b5bd56e203388c60ca64ed6a6 (patch)
tree7945dc6a089218c101dcafc9c455b71943e921a7 /src
parent5f8bd44adaab322a7564855a089edf7b3247ad1b (diff)
QStringRef: fix some QStringRef <> const char * relational operators
Their implementations were swapped. Found while extending tst_qstringapisymmetry, which only exists in dev, so test will be added to dev once this change has merged up. [ChangeLog][QtCore][QStringRef] Fixed relational operators against (const char*) to return the correct result. Change-Id: I3f331037571b9a543a6885802836b768143d1c1a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qstring.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 1fbcff35d1..886973fe10 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1535,9 +1535,9 @@ inline QT_ASCII_CAST_WARN bool QStringRef::operator!=(const char *s) const
inline QT_ASCII_CAST_WARN bool QStringRef::operator<(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) < 0; }
inline QT_ASCII_CAST_WARN bool QStringRef::operator<=(const char *s) const
-{ return QString::compare_helper(constData(), size(), s, -1) > 0; }
-inline QT_ASCII_CAST_WARN bool QStringRef::operator>(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) <= 0; }
+inline QT_ASCII_CAST_WARN bool QStringRef::operator>(const char *s) const
+{ return QString::compare_helper(constData(), size(), s, -1) > 0; }
inline QT_ASCII_CAST_WARN bool QStringRef::operator>=(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) >= 0; }
@@ -1546,13 +1546,13 @@ inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QStringRef &s2)
inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QStringRef &s2)
{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) != 0; }
inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QStringRef &s2)
-{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; }
-inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QStringRef &s2)
{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) > 0; }
+inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QStringRef &s2)
+{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; }
inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QStringRef &s2)
-{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; }
+{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QStringRef &s2)
-{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; }
+{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; }
#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const