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>
This commit is contained in:
Peter Hartmann 2013-03-20 11:40:30 +01:00 committed by The Qt Project
parent 7b5ad88489
commit 804a067846

View File

@ -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;
}