diff options
| author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-11-07 17:06:18 +0100 |
|---|---|---|
| committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-11-08 03:11:55 +0100 |
| commit | c5a51926d618470a90430eb4b2988fc437434797 (patch) | |
| tree | 677f206978b192a3eb07dfef52af25fdc8c3e4e8 /src/corelib/tools/qarraydata.cpp | |
| parent | 0b0118ef28f4482a87cf9901667e6934ab49670c (diff) | |
Revert "Refine {QString, QBA}::reallocData() logic"
This reverts commit 504972f838761f79a170c22225add496e7e5af6a.
Introduced realloc failures in qdoc.
Task-number: QTBUG-88258
Change-Id: I953e8d3933085022c75068af357ec9a44ab7e984
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qarraydata.cpp')
| -rw-r--r-- | src/corelib/tools/qarraydata.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index e73dc358106..2bf3e9bacc2 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -233,13 +233,10 @@ QArrayData::reallocateUnaligned(QArrayData *data, void *dataPointer, { Q_ASSERT(!data || !data->isShared()); - const qsizetype headerSize = sizeof(QArrayData); + qsizetype headerSize = sizeof(QArrayData); qsizetype allocSize = calculateBlockSize(capacity, objectSize, headerSize, option); - const qptrdiff offset = dataPointer - ? reinterpret_cast<char *>(dataPointer) - reinterpret_cast<char *>(data) - : headerSize; + qptrdiff offset = dataPointer ? reinterpret_cast<char *>(dataPointer) - reinterpret_cast<char *>(data) : headerSize; Q_ASSERT(offset > 0); - Q_ASSERT(offset <= allocSize); // == when all free space is at the beginning allocSize = reserveExtraBytes(allocSize); if (Q_UNLIKELY(allocSize < 0)) // handle overflow. cannot reallocate reliably @@ -247,7 +244,7 @@ QArrayData::reallocateUnaligned(QArrayData *data, void *dataPointer, QArrayData *header = static_cast<QArrayData *>(::realloc(data, size_t(allocSize))); if (header) { - header->alloc = capacity; + header->alloc = uint(capacity); dataPointer = reinterpret_cast<char *>(header) + offset; } else { dataPointer = nullptr; |
