diff options
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index da5d00311a..0ed701f4fa 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -41,6 +41,7 @@ #include "qlocale_p.h" #include "qstringalgorithms_p.h" #include "qscopedpointer.h" +#include "qbytearray_p.h" #include <qdatastream.h> #include <qmath.h> @@ -123,8 +124,8 @@ 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(alloc >= 0 && extra >= 0 && extra <= MaxAllocSize); + Q_ASSERT_X(alloc <= MaxAllocSize - extra, "qAllocMore", "Requested size is too large!"); unsigned nalloc = qNextPowerOfTwo(alloc + extra); @@ -838,15 +839,6 @@ static inline char qToLower(char c) */ /*! - \variable QByteArray::MaxSize - \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. -*/ - -/*! \enum QByteArray::Base64Option \since 5.2 @@ -1574,7 +1566,7 @@ void QByteArray::reallocData(uint alloc, Data::AllocationOptions options) d = x; } else { if (options & Data::Grow) { - if (alloc > uint(MaxAllocSize) - uint(sizeof(Data))) + if (alloc > MaxByteArraySize) qBadAlloc(); alloc = qAllocMore(alloc, sizeof(Data)); } |