summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hartmann <phartmann@blackberry.com>2013-03-20 11:40:30 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-24 13:55:58 +0100
commit804a067846cd90e3ca31f985d539c8d75d654d82 (patch)
tree7ee09f022fc4477294dee8d4130b211def5167de
parent7b5ad884898c77926aeebac8281dc4d2fd27e637 (diff)
QNonContiguousByteDevice: reset() instead of seek() if possible
... because e.g. QHttpMultiPartIODevice does not implement seek at all (QTBUG-30295), which would make resetting such a device fail. Change-Id: I0a9c0f21047baa72146690bfdf638cdffab0e25f Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp
index 2bac7c761c..c0fbbaf103 100644
--- a/src/corelib/io/qnoncontiguousbytedevice.cpp
+++ b/src/corelib/io/qnoncontiguousbytedevice.cpp
@@ -388,8 +388,8 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset()
{
if (resetDisabled)
return false;
-
- if (device->seek(initialPosition)) {
+ bool reset = (initialPosition == 0) ? device->reset() : device->seek(initialPosition);
+ if (reset) {
eof = false; // assume eof is false, it will be true after a read has been attempted
return true;
}