summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2009-05-21 01:33:33 (GMT)
committerDavid Faure <faure@kde.org>2009-05-21 01:33:33 (GMT)
commitf645346d32468ae3ded46f42d4e4f27135526913 (patch)
tree590afb6bff714e46e2598540cef2a6659927c0bc /src/corelib
parentbc21fb2449ec80da39ee3f533f8f76b2ae726f50 (diff)
parente28412e4c2389c1765441cec02baed58a63dd29c (diff)
downloadQt-f645346d32468ae3ded46f42d4e4f27135526913.zip
Qt-f645346d32468ae3ded46f42d4e4f27135526913.tar.gz
Qt-f645346d32468ae3ded46f42d4e4f27135526913.tar.bz2
Merge branch 'master' of git://gitorious.org/qt/qt
Diffstat (limited to 'src/corelib')
-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 b6c4eb1..2ccc6ea 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -949,9 +949,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);
@@ -960,6 +960,7 @@ QByteArray QIODevice::readAll()
if (readBytes <= 0)
return tmp;
totalRead += readBytes;
+ chunkSize = qMax(qint64(4096), bytesAvailable());
}
} else {
// Read it all in one go.