diff --git a/src/corelib/text/qstringbuilder.h b/src/corelib/text/qstringbuilder.h index 291988697fb..17160c65b61 100644 --- a/src/corelib/text/qstringbuilder.h +++ b/src/corelib/text/qstringbuilder.h @@ -104,9 +104,11 @@ private: const qsizetype len = QConcatenable< QStringBuilder >::size(*this); T s(len, Qt::Uninitialized); - // we abuse const_cast / constData here because we know we've just - // allocated the data and we're the only reference count - typename T::iterator d = const_cast(s.constData()); + // Using data_ptr() here (private API) so we can bypass the + // isDetached() and the replacement of a null pointer with _empty in + // both QString and QByteArray's data() and constData(). The result is + // the same if len != 0. + auto d = reinterpret_cast(s.data_ptr().data()); if constexpr (QConcatenable>::ExactSize) { QConcatenable>::appendTo(*this, d); diff --git a/src/gui/image/qimagereaderwriterhelpers.cpp b/src/gui/image/qimagereaderwriterhelpers.cpp index 9074f1cfe69..502b0f95f0d 100644 --- a/src/gui/image/qimagereaderwriterhelpers.cpp +++ b/src/gui/image/qimagereaderwriterhelpers.cpp @@ -99,8 +99,6 @@ QList supportedImageFormats(Capability cap) static constexpr QByteArrayView imagePrefix() noexcept { return "image/"; } -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Warray-bounds") // QTBUG-116763 QList supportedMimeTypes(Capability cap) { QList mimeTypes; @@ -116,7 +114,6 @@ QList supportedMimeTypes(Capability cap) mimeTypes.erase(std::unique(mimeTypes.begin(), mimeTypes.end()), mimeTypes.end()); return mimeTypes; } -QT_WARNING_POP QList imageFormatsForMimeType(QByteArrayView mimeType, Capability cap) {