From 590172ccc55bdcca91a311cbbc10e18e7dc06623 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 2 Mar 2023 10:02:41 +0100 Subject: [PATCH] QMessageAuthenticationCode: port Private::setKey() to QByteArrayView The only change is the signature of the function. Also mark it as noexcept. It calls all functions in-contract and doesn't allocate memory. Task-number: QTBUG-111676 Pick-to: 6.5 Change-Id: I505c1f51da704fd46e538a68d6d8703f7cdefbc8 Reviewed-by: Thiago Macieira --- src/corelib/tools/qcryptographichash.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index 095d1910a64..2d7f6664ecd 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -1156,7 +1156,7 @@ public: QCryptographicHashPrivate messageHash; const QCryptographicHash::Algorithm method; - void setKey(const QByteArray &k); + void setKey(QByteArrayView k) noexcept; void initMessageHash(); void finalize(); @@ -1175,7 +1175,7 @@ public: This function assumes it can use messageHash (i.e. it's in its initial state (reset() has been called)). */ -void QMessageAuthenticationCodePrivate::setKey(const QByteArray &newKey) +void QMessageAuthenticationCodePrivate::setKey(QByteArrayView newKey) noexcept { const int blockSize = qt_hash_block_size(method);