From e1cf523354bffcdf3dd013bf49e61d0b325baf39 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 20 Aug 2022 21:21:10 +0200 Subject: QScopedArrayPointer: port to qsizetype MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog][QtCore][QScopedArrayPointer] Is no longer limited to 2Gi elements in size. Task-number: QTBUG-103533 Change-Id: Ic591b3245c53d478e42ff054e01054d855b38685 Reviewed-by: Sona Kurazyan Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Thiago Macieira --- src/corelib/tools/qscopedpointer.cpp | 10 ++++++++-- src/corelib/tools/qscopedpointer.h | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index e569267c65..28cc39ae5d 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -276,24 +276,30 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template T *QScopedArrayPointer::operator[](int i) + \fn template T *QScopedArrayPointer::operator[](qsizetype i) Provides access to entry \a i of the scoped pointer's array of objects. If the contained pointer is \nullptr, behavior is undefined. + \note In Qt versions prior to 6.5, \a i was of type \c{int}, not + \c{qsizetype}, possibly causing truncation on 64-bit platforms. + \sa isNull() */ /*! - \fn template T *QScopedArrayPointer::operator[](int i) const + \fn template T *QScopedArrayPointer::operator[](qsizetype i) const Provides access to entry \a i of the scoped pointer's array of objects. If the contained pointer is \nullptr behavior is undefined. + \note In Qt versions prior to 6.5, \a i was of type \c{int}, not + \c{qsizetype}, possibly causing truncation on 64-bit platforms. + \sa isNull() */ diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 508816a7e7..1ad7acb0f4 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -201,12 +201,12 @@ public: { } - inline T &operator[](int i) + T &operator[](qsizetype i) { return this->d[i]; } - inline const T &operator[](int i) const + const T &operator[](qsizetype i) const { return this->d[i]; } -- cgit v1.2.3