summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-06-08 14:16:08 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-06-08 21:35:54 +0000
commitf0d9eed0649f96e2ea1d289e66d7e1a661a2d982 (patch)
tree80edcd4289dca0c763e3f5df8ada73b212a45211 /src
parente672fd543299f07d178cfba1795d1ad2a0f909ef (diff)
QString: fix QChar <> QLatin1String relational operators for non-US-ASCII
The implementation used the QString::compare_helper(QChar*, int, char*, int) overload, which, however, interprets the rhs as a UTF-8 sequence, not as Latin-1. Fix by using the (QChar*, int, QLatin1String) overload. Extend the test to cover this case, too. Change-Id: I59b26d63d0caec036b80ef8818c75d0cebe519d2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qstring.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 06287c056d..d2410f83e6 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1635,11 +1635,11 @@ inline bool operator>=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return
// QChar <> QLatin1String
inline bool operator==(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW
-{ return QString::compare_helper(&lhs, 1, rhs.latin1(), rhs.size()) == 0; }
+{ return QString::compare_helper(&lhs, 1, rhs) == 0; }
inline bool operator< (QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW
-{ return QString::compare_helper(&lhs, 1, rhs.latin1(), rhs.size()) < 0; }
+{ return QString::compare_helper(&lhs, 1, rhs) < 0; }
inline bool operator> (QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW
-{ return QString::compare_helper(&lhs, 1, rhs.latin1(), rhs.size()) > 0; }
+{ return QString::compare_helper(&lhs, 1, rhs) > 0; }
inline bool operator!=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs == rhs); }
inline bool operator<=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs > rhs); }