diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qurlidna.cpp | 3 | ||||
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 4 | ||||
-rw-r--r-- | src/corelib/text/qbytearray.h | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index f034509bcc..9542122a82 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -2548,8 +2548,7 @@ QString qt_ACE_do(QStringView domain, AceOperation op, AceLeadingDot dot) // ACE form domains contain only ASCII characters, but we can't consider them simple // is this an ACE form? // the shortest valid ACE domain is 6 characters long (U+0080 would be 1, but it's not allowed) - static const ushort acePrefixUtf16[] = { 'x', 'n', '-', '-' }; - if (memcmp(result.constData() + prevLen, acePrefixUtf16, sizeof acePrefixUtf16) == 0) + if (QStringView{result}.sliced(prevLen).startsWith(u"xn--")) simple = false; } diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 299c723a55..ee559c6d75 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -3104,6 +3104,10 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba) \sa QByteArray::compare() */ +bool operator==(const QByteArray &a1, const QByteArray &a2) noexcept +{ + return (a1.size() == a2.size()) && (memcmp(a1.constData(), a2.constData(), a1.size())==0); +} /*! \fn bool operator==(const QByteArray &a1, const char *a2) \relates QByteArray diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 045a05c54a..1e0a671981 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -567,8 +567,7 @@ inline int QByteArray::compare(const QByteArray &a, Qt::CaseSensitivity cs) cons return cs == Qt::CaseSensitive ? qstrcmp(*this, a) : qstrnicmp(data(), size(), a.data(), a.size()); } -inline bool operator==(const QByteArray &a1, const QByteArray &a2) noexcept -{ return (a1.size() == a2.size()) && (memcmp(a1.constData(), a2.constData(), a1.size())==0); } +Q_CORE_EXPORT bool operator==(const QByteArray &a1, const QByteArray &a2) noexcept; inline bool operator==(const QByteArray &a1, const char *a2) noexcept { return a2 ? qstrcmp(a1,a2) == 0 : a1.isEmpty(); } inline bool operator==(const char *a1, const QByteArray &a2) noexcept |