From 804a067846cd90e3ca31f985d539c8d75d654d82 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 20 Mar 2013 11:40:30 +0100 Subject: 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 Reviewed-by: Shane Kearns --- src/corelib/io/qnoncontiguousbytedevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/io') 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; } -- cgit v1.2.3