summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2015-05-08 16:17:00 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2015-05-11 07:32:40 +0000
commitada8f1985d1f04440fca97894192748d98e47441 (patch)
tree208e0bb8e815feb809be5615e1a3fb21f18e3382 /src/corelib/tools/qbytearray.cpp
parentbf06924f3ffd22747c93a720caa501d8478dcbe6 (diff)
Check the maximum size of a QByteArray more precisely
Also document that the QByteArrray::MaxSize takes a trailing '\0' into account. Change-Id: I89e9a0d1a80a49b33efbac16ff7aa2a98f0e5670 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r--src/corelib/tools/qbytearray.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index da5d00311a..36c1f42995 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -124,7 +124,7 @@ int qFindByteArray(
int qAllocMore(int alloc, int extra) Q_DECL_NOTHROW
{
Q_ASSERT(alloc >= 0 && extra >= 0);
- Q_ASSERT_X(uint(alloc) < QByteArray::MaxSize, "qAllocMore", "Requested size is too large!");
+ Q_ASSERT_X(uint(alloc) <= QByteArray::MaxSize, "qAllocMore", "Requested size is too large!");
unsigned nalloc = qNextPowerOfTwo(alloc + extra);
@@ -842,8 +842,9 @@ static inline char qToLower(char c)
\internal
\since 5.4
- The maximum size of a QByteArray, in bytes. Also applies to a the maximum
- storage size of QString and QVector, though not the number of elements.
+ The maximum size of a QByteArray (including a '\0' terminator), in bytes.
+ Also applies to the maximum storage size of QString and QVector, though
+ not the number of elements.
*/
/*!