QCryptographicHash: make narrowing in addData(QIODevice*) explicit
QIODevice::read(ptr, n) returns qint64, not int. The returned values are, however, confined to the interval [-1,1024], so no harm done. Make the narrowing explicit, though. Change-Id: I5f95292ca6e05f0f402e7258e590593eff361255 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 303caa40da6cee296ffcee3ae13b88d788a2e225) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0f3c62ab2a
commit
c42a22e15e
@ -697,10 +697,10 @@ bool QCryptographicHash::addData(QIODevice *device)
|
||||
return false;
|
||||
|
||||
char buffer[1024];
|
||||
int length;
|
||||
qint64 length;
|
||||
|
||||
while ((length = device->read(buffer, sizeof(buffer))) > 0)
|
||||
d->addData({buffer, length});
|
||||
d->addData({buffer, qsizetype(length)}); // length always <= 1024
|
||||
|
||||
return device->atEnd();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user