Skip to content

Commit

Permalink
Merge pull request #4406 from Be-ing/qsizetype_int_cast
Browse files Browse the repository at this point in the history
static_cast<size_t> for QByteArray::size with std::max
  • Loading branch information
daschuer authored Oct 13, 2021
2 parents 730d057 + 1ebc690 commit 20abb64
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 20abb64

Please sign in to comment.