wasm: fix corrupt downloads

This would only ever put the first 16k into the buffer that gets read,
so this 16k would get repeated until the size of the download.

Task-number: QTBUG-74123
Change-Id: Ia53bedf6a8754d9fd83fd0ab62866cfa5af5cc1a
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Lorn Potter 2019-03-04 16:29:50 +10:00
parent ceb0e377b1
commit 7789b77458

View File

@ -265,7 +265,7 @@ qint64 QNetworkReplyWasmImpl::readData(char *data, qint64 maxlen)
Q_D(QNetworkReplyWasmImpl);
qint64 howMuch = qMin(maxlen, (d->downloadBuffer.size() - d->downloadBufferReadPosition));
memcpy(data, d->downloadBuffer.constData(), howMuch);
memcpy(data, d->downloadBuffer.constData() + d->downloadBufferReadPosition, howMuch);
d->downloadBufferReadPosition += howMuch;
return howMuch;