QmlProfiler: Avoid overflowing the progress range when loading

The ProgressManager can only deal with at most (1 << 31) / 100.

Change-Id: I03c61839fa5b9dab56b99f98a63ed7ab8b340c09
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-08-31 17:52:15 +02:00
parent 0a34352473
commit 599c5a034a

View File

@@ -139,7 +139,7 @@ void QmlProfilerFileReader::setFuture(QFutureInterface<void> *future)
bool QmlProfilerFileReader::load(QIODevice *device) bool QmlProfilerFileReader::load(QIODevice *device)
{ {
if (m_future) { if (m_future) {
m_future->setProgressRange(0, qMin(device->size(), qint64(INT_MAX))); m_future->setProgressRange(0, 1000);
m_future->setProgressValue(0); m_future->setProgressValue(0);
} }
@@ -474,7 +474,7 @@ void QmlProfilerFileReader::progress(QIODevice *device)
if (!m_future) if (!m_future)
return; return;
m_future->setProgressValue(qMin(device->pos(), qint64(INT_MAX))); m_future->setProgressValue(device->pos() * 1000 / device->size());
} }
bool QmlProfilerFileReader::isCanceled() const bool QmlProfilerFileReader::isCanceled() const