summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-09-16 10:13:59 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-09-16 19:20:30 +0200
commit5ce24fab73d8e742db98e42902e544caac5e5cc8 (patch)
tree8367db7f7f4b88a8c75895bc0a23ad52974779b3 /src/corelib/tools
parentbf4f6fa230e0fad691dfcad603ed9a9a8309d3f8 (diff)
Rename size parameter to QCommonArrayOps::sizeToInsertAtBegin()
... in order to avoid a bogus compiler warning. Change-Id: I25eb435d6d57bdd5ef5c05ccacb0e6413631f6c9 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qarraydataops.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index fe71b41d5c..1d7e307192 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;
}
}