Skip to content

Commit

Permalink
REFAC(server): Add explicit casts to avoid conversion warnings
Browse files Browse the repository at this point in the history
Fixes #6377 (hopefully for real, this time)

(cherry picked from commit df74412)
  • Loading branch information
Krzmbrzl committed Jan 13, 2025
1 parent 5a8dde4 commit 16ee999
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/murmur/ServerUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ bool LeakyBucket::ratelimit(int tokens) {
if (static_cast< qint64 >(m_currentTokens) < drainTokens) {
m_currentTokens = 0;
} else {
m_currentTokens -= drainTokens;
m_currentTokens -= static_cast< decltype(m_currentTokens) >(drainTokens);
}

// Now that the tokens have been updated to reflect the constant drain caused by
Expand All @@ -187,7 +187,7 @@ bool LeakyBucket::ratelimit(int tokens) {

// If the bucket is not overflowed, allow message and add tokens
if (!limit) {
m_currentTokens += tokens;
m_currentTokens += static_cast< decltype(m_currentTokens) >(tokens);
}

return limit;
Expand Down

0 comments on commit 16ee999

Please sign in to comment.