summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qdatastream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/serialization/qdatastream.cpp')
-rw-r--r--src/corelib/serialization/qdatastream.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp
index d0421f70fad..32f827c69e7 100644
--- a/src/corelib/serialization/qdatastream.cpp
+++ b/src/corelib/serialization/qdatastream.cpp
@@ -1074,13 +1074,13 @@ QDataStream &QDataStream::readBytes(char *&s, qint64 &l)
return *this;
}
- constexpr qsizetype Step = 1024 * 1024;
+ qsizetype step = 1024 * 1024;
qsizetype allocated = 0;
char *prevBuf = nullptr;
char *curBuf = nullptr;
do {
- qsizetype blockSize = qMin(Step, len - allocated);
+ qsizetype blockSize = qMin(step, len - allocated);
prevBuf = curBuf;
curBuf = new char[allocated + blockSize + 1];
if (prevBuf) {
@@ -1092,6 +1092,7 @@ QDataStream &QDataStream::readBytes(char *&s, qint64 &l)
return *this;
}
allocated += blockSize;
+ step *= 2;
} while (allocated < len);
s = curBuf;