diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-22 07:39:47 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-22 07:39:47 (GMT) |
commit | 7ffe42d376b574239480b38b8f6430339b806daa (patch) | |
tree | 837d538944ca3ab244b733938e23bd4d7694e718 /src/corelib/io | |
parent | 8afd43afdca48cccb18a9435b929c876d1c39a29 (diff) | |
parent | f9d26f0bebd5bcc32d15c4a627251c44cf78389e (diff) | |
download | Qt-7ffe42d376b574239480b38b8f6430339b806daa.zip Qt-7ffe42d376b574239480b38b8f6430339b806daa.tar.gz Qt-7ffe42d376b574239480b38b8f6430339b806daa.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 7 |
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. |