QCryptographicHash: move addData(QIODevice*) to Private

To be reused in QMessageAuthenticationCode.

Pick-to: 6.5
Change-Id: Ie4f003ad38ce9072cf6ee52ef2d7a63438e4d7ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-02-23 15:25:03 +01:00
parent d2e1c0aef1
commit d53f8d6bbb

View File

@ -243,6 +243,7 @@ public:
void reset() noexcept;
void addData(QByteArrayView bytes) noexcept;
bool addData(QIODevice *dev);
void finalize() noexcept;
// when not called from the static hash() function, this function needs to be
// called with finalizeMutex held (finalize() will do that):
@ -698,6 +699,11 @@ void QCryptographicHashPrivate::addData(QByteArrayView bytes) noexcept
\since 5.0
*/
bool QCryptographicHash::addData(QIODevice *device)
{
return d->addData(device);
}
bool QCryptographicHashPrivate::addData(QIODevice *device)
{
if (!device->isReadable())
return false;
@ -709,7 +715,7 @@ bool QCryptographicHash::addData(QIODevice *device)
qint64 length;
while ((length = device->read(buffer, sizeof(buffer))) > 0)
d->addData({buffer, qsizetype(length)}); // length always <= 1024
addData({buffer, qsizetype(length)}); // length always <= 1024
return device->atEnd();
}