From 26d9896ec4ef656a333abd378c6558ca8a2982c8 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Thu, 12 Jan 2023 10:26:24 +0100 Subject: [PATCH] QCryptographicHash: no need to store return values just to ignore them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no benefit from storing return value from some OpenSSL calls as the only thing we do is to ignore them. There is also no difference when we would be returning earlier. Change-Id: I76c742016a2532c65ffdcd913aafc74a2d1a9623 Reviewed-by: MÃ¥rten Nordheim (cherry picked from commit a48bbbaa50860507d7b738d2095adf794eb552d5) --- src/corelib/tools/qcryptographichash.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index 1c3fea079cc..1c8ee3aaa75 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -620,8 +620,7 @@ void QCryptographicHashPrivate::addData(QByteArrayView bytes) noexcept method == QCryptographicHash::Blake2s_224) { blake2s_update(&blake2sContext, reinterpret_cast(data), length); } else if (!initializationFailed) { - const int ret = EVP_DigestUpdate(context.get(), (const unsigned char *)data, length); - Q_UNUSED(ret); + EVP_DigestUpdate(context.get(), (const unsigned char *)data, length); } #else switch (method) { @@ -755,8 +754,7 @@ void QCryptographicHashPrivate::finalize() noexcept EVP_MD_CTX_ptr copy = EVP_MD_CTX_ptr(EVP_MD_CTX_new()); EVP_MD_CTX_copy_ex(copy.get(), context.get()); tmpresult.resizeForOverwrite(EVP_MD_get_size(algorithm.get())); - const int ret = EVP_DigestFinal_ex(copy.get(), tmpresult.data(), nullptr); - Q_UNUSED(ret) + EVP_DigestFinal_ex(copy.get(), tmpresult.data(), nullptr); } #else switch (method) {