--- a/src/corelib/io/qiodevice.cpp Wed Apr 21 12:15:23 2010 +0300
+++ b/src/corelib/io/qiodevice.cpp Wed Apr 21 20:15:53 2010 +0300
@@ -785,13 +785,13 @@
do {
// Try reading from the buffer.
int lastReadChunkSize = d->buffer.read(data, maxSize);
- *d->pPos += lastReadChunkSize;
- readSoFar += lastReadChunkSize;
- // fast exit when satisfied by buffer
- if (lastReadChunkSize == maxSize && !(d->openMode & Text))
- return readSoFar;
+ if (lastReadChunkSize > 0) {
+ *d->pPos += lastReadChunkSize;
+ readSoFar += lastReadChunkSize;
+ // fast exit when satisfied by buffer
+ if (lastReadChunkSize == maxSize && !(d->openMode & Text))
+ return readSoFar;
- if (lastReadChunkSize > 0) {
data += lastReadChunkSize;
maxSize -= lastReadChunkSize;
#if defined QIODEVICE_DEBUG