diff options
author | axis <qt-info@nokia.com> | 2009-05-20 11:44:05 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-05-20 11:44:05 (GMT) |
commit | 91e041fcff000024e619de5d7561ce141cb99d99 (patch) | |
tree | 0fc7285a4a1634f6a74499c324d00b6aef181974 /src/corelib/io/qiodevice.cpp | |
parent | d68629e4cfb94776b8ef02cd01cf0b02bf430db8 (diff) | |
parent | 25f86fbab2e7d23832b0bb8ae8530289258e2aa5 (diff) | |
download | Qt-91e041fcff000024e619de5d7561ce141cb99d99.zip Qt-91e041fcff000024e619de5d7561ce141cb99d99.tar.gz Qt-91e041fcff000024e619de5d7561ce141cb99d99.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
tests/auto/network-settings.h
tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
tests/auto/qiodevice/tst_qiodevice.cpp
tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp
tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
tests/auto/qsslsocket/tst_qsslsocket.cpp
Diffstat (limited to 'src/corelib/io/qiodevice.cpp')
-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 fe3ceff..3816803 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. |