summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-05-20 12:29:10 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-05-20 12:29:10 (GMT)
commit095fe67c4a669f038ea7c14613efe5cb9453fa74 (patch)
treed5bb5d35f59d26b5992c13e36146e805c37eb27e /src/corelib/io
parent675c41f92fa72753fea364b73639fd9e0c7cc0d5 (diff)
parent3f705ded78ed54ec63ca09cc81dfb68bc2235190 (diff)
downloadQt-095fe67c4a669f038ea7c14613efe5cb9453fa74.zip
Qt-095fe67c4a669f038ea7c14613efe5cb9453fa74.tar.gz
Qt-095fe67c4a669f038ea7c14613efe5cb9453fa74.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qiodevice.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index c739054..efa4b25 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -945,9 +945,9 @@ QByteArray QIODevice::readAll()
QByteArray tmp;
if (d->isSequential() || size() == 0) {
- // Read it in chunks, bytesAvailable() is unreliable for sequential
- // devices.
- const int chunkSize = 4096;
+ // Read it in chunks. Use bytesAvailable() as an unreliable hint for
+ // sequential devices, but try to read 4K as a minimum.
+ int chunkSize = qMax(qint64(4096), bytesAvailable());
qint64 totalRead = 0;
forever {
tmp.resize(tmp.size() + chunkSize);
@@ -956,6 +956,7 @@ QByteArray QIODevice::readAll()
if (readBytes <= 0)
return tmp;
totalRead += readBytes;
+ chunkSize = qMax(qint64(4096), bytesAvailable());
}
} else {
// Read it all in one go.