summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qbytearray.cpp
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2020-10-07 15:32:57 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2020-10-08 16:52:28 +0200
commit6c7ed4c013393ce414f02fe4c9a88ebebeb3e47d (patch)
treef43c4567312b87a03e3e227f9c2a5fe565041f9b /src/corelib/text/qbytearray.cpp
parent6443c2215ee5c7d085fe84c7a271b70ea1185d3b (diff)
Make QADP capacity functions use qsizetype instead of size_t
Change types returned and accepted by capacity-related QArrayDataPointer functions to qsizetype: 1) QArrayData (underlying d-ptr) works with qsizetype 2) QArrayDataPointer::size is of type qsizetype 3) All higher level classes that use QADP (e.g. containers) cast capacity to qsizetype in their methods Additionally, fixed newly appeared warnings through qtbase Change-Id: I899408decfbf2ce9d527be7e8b7f6382875148fc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r--src/corelib/text/qbytearray.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index 1ecb19f135..459e00887d 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -1173,8 +1173,8 @@ QByteArray &QByteArray::operator=(const char *str)
} else {
const qsizetype len = qsizetype(strlen(str));
const auto capacityAtEnd = d->allocatedCapacity() - d.freeSpaceAtBegin();
- if (d->needsDetach() || size_t(len) > capacityAtEnd
- || (len < size() && size_t(len) < (capacityAtEnd >> 1)))
+ if (d->needsDetach() || len > capacityAtEnd
+ || (len < size() && len < (capacityAtEnd >> 1)))
reallocData(len, d->detachFlags());
memcpy(d.data(), str, len + 1); // include null terminator
d.size = len;