summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/text/qbytearrayview.h2
-rw-r--r--src/corelib/text/qstring.cpp2
-rw-r--r--src/corelib/text/qstring.h2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/text/qbytearrayview.h b/src/corelib/text/qbytearrayview.h
index e8ae1e2c80..e0e318249c 100644
--- a/src/corelib/text/qbytearrayview.h
+++ b/src/corelib/text/qbytearrayview.h
@@ -300,7 +300,7 @@ public:
[[nodiscard]] constexpr char last() const { return back(); }
friend inline bool operator==(QByteArrayView lhs, QByteArrayView rhs) noexcept
- { return lhs.size() == rhs.size() && QtPrivate::compareMemory(lhs, rhs) == 0; }
+ { return lhs.size() == rhs.size() && (!lhs.size() || memcmp(lhs.data(), rhs.data(), lhs.size()) == 0); }
friend inline bool operator!=(QByteArrayView lhs, QByteArrayView rhs) noexcept
{ return !(lhs == rhs); }
friend inline bool operator< (QByteArrayView lhs, QByteArrayView rhs) noexcept
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 5369e1c6cb..e8dd1a6ccd 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -1402,7 +1402,7 @@ bool QtPrivate::equalStrings(QLatin1StringView lhs, QStringView rhs) noexcept
bool QtPrivate::equalStrings(QLatin1StringView lhs, QLatin1StringView rhs) noexcept
{
- return lhs.size() == rhs.size() && (!lhs.size() || memcmp(lhs.data(), rhs.data(), lhs.size()) == 0);
+ return QByteArrayView(lhs) == QByteArrayView(rhs);
}
bool QtPrivate::equalStrings(QBasicUtf8StringView<false> lhs, QStringView rhs) noexcept
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index 3f15001ff8..d426b55e76 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -270,7 +270,7 @@ public:
{ return qTokenize(*this, std::forward<Needle>(needle), flags...); }
friend inline bool operator==(QLatin1StringView s1, QLatin1StringView s2) noexcept
- { return s1.size() == s2.size() && (!s1.size() || !memcmp(s1.latin1(), s2.latin1(), s1.size())); }
+ { return QByteArrayView(s1) == QByteArrayView(s2); }
friend inline bool operator!=(QLatin1StringView s1, QLatin1StringView s2) noexcept
{ return !(s1 == s2); }
friend inline bool operator<(QLatin1StringView s1, QLatin1StringView s2) noexcept