summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qiodevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qiodevice.cpp')
-rw-r--r--src/corelib/io/qiodevice.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 1e98473..4e14ba8 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -970,6 +970,7 @@ QByteArray QIODevice::readAll()
if (!(d->openMode & Text) && !d->buffer.isEmpty()) {
result = d->buffer.readAll();
readBytes = result.size();
+ d->pos += readBytes;
}
qint64 theSize;
@@ -985,8 +986,8 @@ QByteArray QIODevice::readAll()
} else {
// Read it all in one go.
// If resize fails, don't read anything.
- result.resize(int(theSize - d->pos));
- readBytes = read(result.data(), result.size());
+ result.resize(int(readBytes + theSize - d->pos));
+ readBytes += read(result.data() + readBytes, result.size() - readBytes);
}
if (readBytes <= 0)