From 5ce24fab73d8e742db98e42902e544caac5e5cc8 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 16 Sep 2020 10:13:59 +0200 Subject: [PATCH] Rename size parameter to QCommonArrayOps::sizeToInsertAtBegin() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... in order to avoid a bogus compiler warning. Change-Id: I25eb435d6d57bdd5ef5c05ccacb0e6413631f6c9 Reviewed-by: Andrei Golubev Reviewed-by: Volker Hilsheimer Reviewed-by: MÃ¥rten Nordheim --- src/corelib/tools/qarraydataops.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index fe71b41d5c2..1d7e3071924 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -1277,9 +1277,9 @@ protected: // Tells how much of the given size to insert at the beginning of the // container. This is insert-specific helper function - qsizetype sizeToInsertAtBegin(const T *const where, qsizetype size) + qsizetype sizeToInsertAtBegin(const T *const where, qsizetype maxSize) { - Q_ASSERT(size_t(size) <= this->allocatedCapacity() - this->size); + Q_ASSERT(size_t(maxSize) <= this->allocatedCapacity() - this->size); Q_ASSERT(where >= this->begin() && where <= this->end()); // in range const auto freeAtBegin = this->freeSpaceAtBegin(); @@ -1288,18 +1288,18 @@ protected: // Idea: * if enough space on both sides, try to affect less elements // * if enough space on one of the sides, use only that side // * otherwise, split between front and back (worst case) - if (freeAtBegin >= size && freeAtEnd >= size) { + if (freeAtBegin >= maxSize && freeAtEnd >= maxSize) { if (where - this->begin() < this->end() - where) { - return size; + return maxSize; } else { return 0; } - } else if (freeAtBegin >= size) { - return size; - } else if (freeAtEnd >= size) { + } else if (freeAtBegin >= maxSize) { + return maxSize; + } else if (freeAtEnd >= maxSize) { return 0; } else { - return size - freeAtEnd; + return maxSize - freeAtEnd; } }