diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2023-03-02 19:05:16 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2023-03-17 00:41:31 +0100 |
| commit | 93cb61e305f834a25ccbe0f2b64e0f8ebb72a168 (patch) | |
| tree | 334231499546af7171d036c129d1f3fd86f77070 /src/corelib/tools/qmessageauthenticationcode.h | |
| parent | 0cab9b56e99712c6985eee5af72e53e1fb04113d (diff) | |
QMessageAuthenticationCode: port to QByteArrayView [1/3]: ctor/setKey()
The class is not used frequently enough to warrant the overhead of a
Q_WEAK_ QByteArray overload to fix the SiC Type A for users that pass
objects that implicitly convert to QByteArray. QCryptographicHash also
doesn't have it.
Also mark setKey() noexcept. Now that it takes a view instead of
an owning container, it only calls other noexcept functions.
ChangeLog will be on patch [3/3].
Task-number: QTBUG-111676
Task-number: QTBUG-111688
Change-Id: Ic2321d0d41ce8eb4d0390889f28b3fd4bd9af103
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/tools/qmessageauthenticationcode.h')
| -rw-r--r-- | src/corelib/tools/qmessageauthenticationcode.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/tools/qmessageauthenticationcode.h b/src/corelib/tools/qmessageauthenticationcode.h index 6be86823327..a753f7045fe 100644 --- a/src/corelib/tools/qmessageauthenticationcode.h +++ b/src/corelib/tools/qmessageauthenticationcode.h @@ -16,8 +16,13 @@ class QIODevice; class Q_CORE_EXPORT QMessageAuthenticationCode { public: +#if QT_CORE_REMOVED_SINCE(6, 6) explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method, - const QByteArray &key = QByteArray()); + const QByteArray &key); +#endif + explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method, + QByteArrayView key = {}); + QMessageAuthenticationCode(QMessageAuthenticationCode &&other) noexcept : d{std::exchange(other.d, nullptr)} {} ~QMessageAuthenticationCode(); @@ -28,7 +33,10 @@ public: void reset(); +#if QT_CORE_REMOVED_SINCE(6, 6) void setKey(const QByteArray &key); +#endif + void setKey(QByteArrayView key) noexcept; void addData(const char *data, qsizetype length); void addData(const QByteArray &data); |
