Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static_cast<size_t> for QByteArray::size with std::max #4406

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/util/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ cache_key_t cacheKeyFromMessageDigest(const QByteArray& messageDigest) {
// SP 800-107
// 5 Hash function Usage
// 5.1 Truncated Message Digest
const auto significantByteCount = math_min(
messageDigest.size(),
static_cast<int>(sizeof(cache_key_t)));
for (auto i = 0; i < significantByteCount; ++i) {
const size_t significantByteCount = math_min(
static_cast<size_t>(messageDigest.size()),
sizeof(cache_key_t));
for (size_t i = 0; i < significantByteCount; ++i) {
// Only 8 bits are relevant and we don't want the sign
// extension of a (signed) char during the conversion.
const cache_key_t nextByte =
Expand Down