diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-10-30 13:42:09 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-04 11:21:37 +0100 |
commit | 32a703e2779e697a9a7d75f6cbc6e555187d7fca (patch) | |
tree | ea9d56952efd13d36ae455771ace6fa144bbe568 /src/corelib/text/qbytearray.cpp | |
parent | 50ec3252ac5d61a13fab01801ef42729d6f3a7c6 (diff) |
Don't move data in QArrayDataOps::reallocate()
reallocate() should only ever call realloc(), and only be used to
create more space at the end of the data.
Change-Id: I2ac4dbc90d2afaa571bb620108d7984356712cb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 18ee2dbfb3..945a2a26fd 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -671,7 +671,7 @@ QByteArray qUncompress(const uchar* data, qsizetype nbytes) return invalidCompressedData(); } else { // grow the block - d->reallocate(d->allocatedCapacity()*2, QByteArray::Data::GrowsForward); + d->reallocate(d->allocatedCapacity()*2); if (Q_UNLIKELY(d.data() == nullptr)) return invalidCompressedData(); } @@ -1719,7 +1719,7 @@ void QByteArray::reallocData(qsizetype alloc, Data::ArrayOptions options) dd.data()[dd.size] = 0; d = dd; } else { - d->reallocate(alloc, options); + d->reallocate(alloc); } } @@ -1734,7 +1734,7 @@ void QByteArray::reallocGrowData(qsizetype n) dd.data()[dd.size] = 0; d = dd; } else { - d->reallocate(d.constAllocatedCapacity() + n, Data::GrowsForward); + d->reallocate(d.constAllocatedCapacity() + n); } } |