summaryrefslogtreecommitdiff
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-04-27 10:09:19 +0200
commit06a2d65f92cf062c4906366c1835b27d91467fbc (patch)
tree090a36840043b88e16fbb22c863933ef6cb0c6a8
parente8bc7f449df5f1a94bd3d98a4f8adba6d017fa30 (diff)
downloadqt4-tools-06a2d65f92cf062c4906366c1835b27d91467fbc.tar.gz
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. (cherry picked from commit 804a067846cd90e3ca31f985d539c8d75d654d82) Change-Id: I8ba1ef76cc6e7f5ebf0b39c9a75e3aea26980b82 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 724ba22d63..72da5a8705 100644
--- a/src/corelib/io/qnoncontiguousbytedevice.cpp
+++ b/src/corelib/io/qnoncontiguousbytedevice.cpp
@@ -389,8 +389,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
totalAdvancements = 0; //reset the progress counter
if (currentReadBuffer) {