Skip to content

Commit

Permalink
static_cast<size_t> for QByteArray::size with std::max
Browse files Browse the repository at this point in the history
QByteArray::size returns qsizetype in Qt6, which needs to be
converted to size_t to pass to std::max.
  • Loading branch information
Be-ing committed Oct 13, 2021
1 parent 730d057 commit 1ebc690
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 1ebc690

Please sign in to comment.