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 <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-03-02 10:02:41 +01:00
parent 76c63936d3
commit 590172ccc5

View File

@ -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);