Skip to content

Commit 06a2d65

Browse files
phartmannThe Qt Project
authored andcommitted
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 <[email protected]>
1 parent e8bc7f4 commit 06a2d65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/corelib/io/qnoncontiguousbytedevice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset()
389389
{
390390
if (resetDisabled)
391391
return false;
392-
393-
if (device->seek(initialPosition)) {
392+
bool reset = (initialPosition == 0) ? device->reset() : device->seek(initialPosition);
393+
if (reset) {
394394
eof = false; // assume eof is false, it will be true after a read has been attempted
395395
totalAdvancements = 0; //reset the progress counter
396396
if (currentReadBuffer) {

0 commit comments

Comments
 (0)