summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-04-24 10:48:43 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-04-26 09:12:05 +0000
commite8085de21641cc98ef39faaffc737023b33be079 (patch)
treedb8451a5ac04c8b2ff9bd50c34225d5e4f41e925
parent979f9f4d3442ef9373e823cd681c5c23f84cc55b (diff)
QString: add internal qt_compare_strings(QL1S, QSV)
... and adapt qCompareString(QLatin1String, QStringView) to call it instead of performing the negation itself. This function will be needed for QLatin1String::startsWith(QStringView). Change-Id: I8f19dfe0c5274a80c88b43d05f9efda8a91eac46 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/tools/qstring.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 5d250df99c..caf4ba6573 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -693,6 +693,11 @@ static int qt_compare_strings(QStringView lhs, QLatin1String rhs, Qt::CaseSensit
return ucstricmp(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
+static int qt_compare_strings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
+{
+ return -qt_compare_strings(rhs, lhs, cs);
+}
+
static int qt_compare_strings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
{
if (lhs.isEmpty())
@@ -761,7 +766,7 @@ int qCompareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs)
*/
int qCompareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
{
- return -qt_compare_strings(rhs, lhs, cs);
+ return qt_compare_strings(lhs, rhs, cs);
}
/*!