Skip to content

Commit

Permalink
Merge PR #6699: Backport "Merge PR #6694: REFAC(server): Add explicit…
Browse files Browse the repository at this point in the history
… casts to avoid conversion warnings"
  • Loading branch information
Krzmbrzl authored Jan 13, 2025
2 parents 255c313 + 16ee999 commit c997c88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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
2 changes: 1 addition & 1 deletion src/murmur/ServerUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class LeakyBucket {
/// (The capacity of the bucket)
unsigned int m_maxTokens;
/// The amount of tokens currently stored
/// (The amount of whater currently in the bucket)
/// (The amount of whatever currently is in the bucket)
long m_currentTokens;
/// A timer that is used to measure time intervals. It is essential
/// that this timer uses a monotonic clock (which is why QElapsedTimer is
Expand Down

0 comments on commit c997c88

Please sign in to comment.