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. Pick-to: 6.5 Change-Id: I5f95292ca6e05f0f402e7258e590593eff361255 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
d32d2137b7
commit
303caa40da
@ -696,10 +696,10 @@ bool QCryptographicHash::addData(QIODevice *device)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
int length;
|
qint64 length;
|
||||||
|
|
||||||
while ((length = device->read(buffer, sizeof(buffer))) > 0)
|
while ((length = device->read(buffer, sizeof(buffer))) > 0)
|
||||||
d->addData({buffer, length});
|
d->addData({buffer, qsizetype(length)}); // length always <= 1024
|
||||||
|
|
||||||
return device->atEnd();
|
return device->atEnd();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user