QCryptographicHash: make Private::method const

It never changes, making it const might improve code-gen.

Change-Id: Ife8723e27ae9cf6cfcca48d58d46307003123354
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Marc Mutz 2021-07-06 07:30:58 +02:00
parent b3fbfcd373
commit bd6d706b69

View File

@ -141,7 +141,12 @@ QT_BEGIN_NAMESPACE
class QCryptographicHashPrivate class QCryptographicHashPrivate
{ {
public: public:
QCryptographicHash::Algorithm method; explicit QCryptographicHashPrivate(QCryptographicHash::Algorithm method) noexcept
: method(method)
{
}
const QCryptographicHash::Algorithm method;
union { union {
Sha1State sha1Context; Sha1State sha1Context;
#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
@ -267,9 +272,8 @@ void QCryptographicHashPrivate::sha3Finish(int bitCount, Sha3Variant sha3Variant
Constructs an object that can be used to create a cryptographic hash from data using \a method. Constructs an object that can be used to create a cryptographic hash from data using \a method.
*/ */
QCryptographicHash::QCryptographicHash(Algorithm method) QCryptographicHash::QCryptographicHash(Algorithm method)
: d(new QCryptographicHashPrivate) : d(new QCryptographicHashPrivate{method})
{ {
d->method = method;
reset(); reset();
} }