src/corelib/io/qiodevice.cpp
branchRCL_3
changeset 14 c0432d11811c
parent 8 3f74d0d4af4c
--- 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