From 83f67c850449e9135b5fb20ef4459dc276a2235f Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 31 Jan 2012 17:14:22 +0000 Subject: Fix progress bar values >100% when http upload is retried MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a http upload (PUT or POST) fails, the IO device is reset and the upload is retried a second time. Now we also reset the progress counter in the wrapper class QNonContigiousByteDevice. That way the progress bar goes back to 0% and stops at 100% Previously if the 1st attempt failed at 20%, the progress values would carry on from 20% and finish at 120%. Task-number: ou1cimx1#970373 Task-number: QTBUG-23993 Change-Id: Ifc9963595113cf3001ed45f94f525e2305ad479b Reviewed-by: Markus Goetz Reviewed-by: Richard J. Moore (cherry picked from commit f5ddeeca80983ad7579e0b7ba116f0250debdfcd) Reviewed-by: Shane Kearns Reviewed-by: Pasi Pentikäinen --- src/corelib/io/qnoncontiguousbytedevice.cpp | 1 + src/corelib/io/qnoncontiguousbytedevice_p.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp index d5ce56bc09..eb44651dc9 100644 --- a/src/corelib/io/qnoncontiguousbytedevice.cpp +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -392,6 +392,7 @@ bool QNonContiguousByteDeviceIoDeviceImpl::reset() if (device->seek(initialPosition)) { eof = false; // assume eof is false, it will be true after a read has been attempted + totalAdvancements = 0; //reset the progress counter return true; } diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h index c7c94243b9..1257c99997 100644 --- a/src/corelib/io/qnoncontiguousbytedevice_p.h +++ b/src/corelib/io/qnoncontiguousbytedevice_p.h @@ -146,7 +146,7 @@ protected: qint64 currentReadBufferSize; qint64 currentReadBufferAmount; qint64 currentReadBufferPosition; - qint64 totalAdvancements; + qint64 totalAdvancements; //progress counter used for emitting the readProgress signal bool eof; qint64 initialPosition; }; -- cgit v1.2.1