diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-06-27 14:57:58 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-07-06 21:31:40 +0200 |
commit | 563fbe79e52cfbf904d2e26d775a2160980fa41a (patch) | |
tree | 901ee0a25e007a94c8101573c444290cde7b463d /src/corelib/io/qurlidna.cpp | |
parent | 9117e3850b9d395a9741fa4b63c5b59ea7767390 (diff) |
Try to workaround bogus compiler warning in gcc 9 for ARMv7
../../src/corelib/io/qurlidna.cpp: In function ‘QString qt_ACE_do(QStringView, AceOperation, AceLeadingDot)’:
../../src/corelib/io/qurlidna.cpp:2543:23: error: ‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’
reading 8 bytes from a region of size 2 [-Werror=stringop-overflow=]
if (memcmp(result.constData() + prevLen, acePrefixUtf16, sizeof acePrefixUtf16) == 0)
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
In function ‘bool operator==(const QByteArray&, const QByteArray&)’,
inlined from ‘virtual void (* QLinuxFbIntegration::platformFunction(const QByteArray&) const)()’
at ../../src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp:185:18:
include/QtCore/../../../../src/corelib/text/qbytearray.h:571:45: error:
‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’ reading 17 bytes from
a region of size 1 [-Werror=stringop-overflow=]
The warnings/errors are bogus. Fix them by using QStringView::sliced() and de-inlining the
comparison operator for QByteArray.
Change-Id: I24956fe74a7989e75cd03d717570b8fca493ab23
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qurlidna.cpp')
-rw-r--r-- | src/corelib/io/qurlidna.cpp | 3 |
1 files changed, 1 insertions, 2 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; } |