From d53f8d6bbb8ec204dfe8be21a9c792649b8fd079 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 23 Feb 2023 15:25:03 +0100 Subject: [PATCH] QCryptographicHash: move addData(QIODevice*) to Private To be reused in QMessageAuthenticationCode. Pick-to: 6.5 Change-Id: Ie4f003ad38ce9072cf6ee52ef2d7a63438e4d7ae Reviewed-by: Thiago Macieira --- src/corelib/tools/qcryptographichash.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index cda3c9612a6..8163ddf216d 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -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(); }