diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-05-03 15:10:05 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-05-04 12:53:23 +0200 |
commit | 038c1c5978c30675c5f953035a193bc76ca6ca21 (patch) | |
tree | 6532a2168a540c6691dc16291cdc5f24dbab0017 /src/corelib/text/qbytearray.cpp | |
parent | 151287fb5182b45736da6b2e2e516bb54e44219a (diff) |
QString/QByteArray::op>>: don't assume clear() makes the container isNull()
This is something we may want to change at some point, so be explicit
and assign a null container instead of relying on clear().
Add a comment that was present in the QString, but missing in the
QByteArray implementation.
Pick-to: 6.5
Task-number: QTBUG-31283
Task-number: QTBUG-60745
Change-Id: I10d82b8a0c67fff314af526c7b7e0f247c3405fd
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 1b21c98a2f..22ea718896 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -3222,8 +3222,10 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba) ba.clear(); quint32 len; in >> len; - if (len == 0xffffffff) + if (len == 0xffffffff) { // null byte-array + ba = QByteArray(); return in; + } const quint32 Step = 1024 * 1024; quint32 allocated = 0; |