diff options
author | Martin Smith <msmith@trolltech.com> | 2010-01-05 12:27:33 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2010-01-05 12:27:33 (GMT) |
commit | 2f42f8eee39d03a84a24da8b1d047f8e58079a26 (patch) | |
tree | 1bce31e1052080511f53bd5c44a4e983135e22f1 /src | |
parent | 94c2fce09c34b629a6fcb5a9576c4646a1ac24a8 (diff) | |
parent | d03475b69aa552a490e32fb2b7ad4dfaeacecf93 (diff) | |
download | Qt-2f42f8eee39d03a84a24da8b1d047f8e58079a26.zip Qt-2f42f8eee39d03a84a24da8b1d047f8e58079a26.tar.gz Qt-2f42f8eee39d03a84a24da8b1d047f8e58079a26.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 0e5a2de..8dcccb4 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -965,7 +965,15 @@ QByteArray QIODevice::readAll() QByteArray result; qint64 readBytes = 0; - if (d->isSequential() || (readBytes = size()) == 0) { + + // flush internal read buffer + if (!(d->openMode & Text) && !d->buffer.isEmpty()) { + result = d->buffer.readAll(); + readBytes = result.size(); + } + + qint64 theSize; + if (d->isSequential() || (theSize = size()) == 0) { // Size is unknown, read incrementally. qint64 readResult; do { @@ -977,7 +985,7 @@ QByteArray QIODevice::readAll() } else { // Read it all in one go. // If resize fails, don't read anything. - result.resize(int(readBytes - d->pos)); + result.resize(int(theSize - d->pos)); readBytes = read(result.data(), result.size()); } |