diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2012-04-04 14:11:14 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-05 01:45:10 +0200 |
commit | 98e50a18eda614caeadaeb7a05fc2f5ab4f735e7 (patch) | |
tree | 0e14d750bfb4bafe835b15e9e92f24f097eff300 /src/corelib/tools/qbytearray.cpp | |
parent | 3669ceb77968e55225fecc7f4232b5545c98a69b (diff) |
Simplify conditionals
alloc >= size is an invariant of both QString and QByteArray, unless
string data is immutable (e.g., when using fromRawData()), in which case
alloc will be 0, regardless of size, That's what needs to be checked
here.
Change-Id: Ief9e6a52a1d5ea1941d23ed3c141edfd15d2a6a7
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 2e9c1fb801..a6bb6afe57 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1433,7 +1433,7 @@ void QByteArray::resize(int size) if (d->ref.isShared() || size > int(d->alloc) || (!d->capacityReserved && size < d->size && size < int(d->alloc) >> 1)) reallocData(size, true); - if (int(d->alloc) >= size) { + if (d->alloc) { d->size = size; d->data()[size] = '\0'; } |