diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-02-01 21:22:08 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-02-16 14:29:18 +0100 |
commit | cfaed64873809b94f18f3291fa29817ee74bfedc (patch) | |
tree | 3e65b62e89f98895a05aa65edcbb0412858d2dcb /src/corelib/text/qbytearray.cpp | |
parent | 73bf1c1a9bcc2615370d6a199420da0c6f380a44 (diff) |
QByteArray/QString: add resizeForOverwrite
For these classes it's not really a new feature, but exposing
the current resize() behavior (which does uninitialized resizes)
under a proper name.
Changing the existing behavior for resize() is a behavioral
break that we can only likely afford in Qt 7.
[ChangeLog][QtCore][QString] Added resizeForOverwrite().
[ChangeLog][QtCore][QByteArray] Added resizeForOverwrite().
Change-Id: I15b3104aee2bc29d23e91d97b0e64f87612d0099
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 1eb5c5b2d2..3df77f179c 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -1897,6 +1897,21 @@ void QByteArray::resize(qsizetype newSize, char c) } /*! + \since 6.8 + + Resizes the byte array to \a size bytes. If the size of the + byte array grows, the new bytes are uninitialized. + + The behavior is identical to \c{resize(size)}. + + \sa resize() +*/ +void QByteArray::resizeForOverwrite(qsizetype size) +{ + resize(size); +} + +/*! Sets every byte in the byte array to \a ch. If \a size is different from -1 (the default), the byte array is resized to size \a size beforehand. |