summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qiodevice.cpp4
-rw-r--r--src/corelib/tools/qbytearray.cpp7
2 files changed, 6 insertions, 5 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index e73a200fb4c..d68f33287d7 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -989,7 +989,7 @@ QByteArray QIODevice::readAll()
// Size is unknown, read incrementally.
qint64 readResult;
do {
- if (quint64(readBytes) + QIODEVICE_BUFFERSIZE > QByteArray::MaxSize) {
+ if (quint64(readBytes) + QIODEVICE_BUFFERSIZE >= QByteArray::MaxSize) {
// If resize would fail, don't read more, return what we have.
break;
}
@@ -1001,7 +1001,7 @@ QByteArray QIODevice::readAll()
} else {
// Read it all in one go.
// If resize fails, don't read anything.
- if (quint64(readBytes + theSize - d->pos) > QByteArray::MaxSize)
+ if (quint64(readBytes + theSize - d->pos) >= QByteArray::MaxSize)
return QByteArray();
result.resize(int(readBytes + theSize - d->pos));
readBytes += read(result.data() + readBytes, result.size() - readBytes);
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index da5d00311ab..36c1f429952 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.
*/
/*!