From 0341bf2e979264b9f7606bd57e594a41c27a38cc Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 22 May 2020 11:26:21 +0200 Subject: Make QArrayDataPointer::size a qsizetype This is a next step towards making QList, QString and QByteArray able to deal with large sizes. Change-Id: Icad49b33f503401ac4912678b2f88584c6f91a63 Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydataops.h | 4 ++-- src/corelib/tools/qarraydatapointer.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index bea585e69ab..a97f2da175c 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -690,7 +690,7 @@ struct QMovableArrayOps struct Mover { - Mover(T *&start, const T *finish, int &sz) + Mover(T *&start, const T *finish, qsizetype &sz) : destination(start) , source(start) , n(finish - start) @@ -707,7 +707,7 @@ struct QMovableArrayOps T *&destination; const T *const source; size_t n; - int &size; + qsizetype &size; } mover(e, this->end(), this->size); // destroy the elements we're erasing diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index aff603c32be..a7e8429469a 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -70,17 +70,17 @@ public: ref(); } - constexpr QArrayDataPointer(Data *header, T *adata, size_t n = 0) noexcept - : d(header), ptr(adata), size(int(n)) + constexpr QArrayDataPointer(Data *header, T *adata, qsizetype n = 0) noexcept + : d(header), ptr(adata), size(n) { } - explicit QArrayDataPointer(QPair *, T *> adata, size_t n = 0) noexcept - : d(adata.first), ptr(adata.second), size(int(n)) + explicit QArrayDataPointer(QPair *, T *> adata, qsizetype n = 0) noexcept + : d(adata.first), ptr(adata.second), size(n) { } - static QArrayDataPointer fromRawData(const T *rawData, size_t length) noexcept + static QArrayDataPointer fromRawData(const T *rawData, qsizetype length) noexcept { Q_ASSERT(rawData || !length); return { nullptr, const_cast(rawData), length }; @@ -212,7 +212,7 @@ protected: T *ptr; public: - int size; + qsizetype size; }; template -- cgit v1.2.3