Skip to content

Commit c997c88

Browse files
authored
Merge PR #6699: Backport "Merge PR #6694: REFAC(server): Add explicit casts to avoid conversion warnings"
2 parents 255c313 + 16ee999 commit c997c88

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/murmur/ServerUser.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ bool LeakyBucket::ratelimit(int tokens) {
176176
if (static_cast< qint64 >(m_currentTokens) < drainTokens) {
177177
m_currentTokens = 0;
178178
} else {
179-
m_currentTokens -= drainTokens;
179+
m_currentTokens -= static_cast< decltype(m_currentTokens) >(drainTokens);
180180
}
181181

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

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

193193
return limit;

src/murmur/ServerUser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class LeakyBucket {
8585
/// (The capacity of the bucket)
8686
unsigned int m_maxTokens;
8787
/// The amount of tokens currently stored
88-
/// (The amount of whater currently in the bucket)
88+
/// (The amount of whatever currently is in the bucket)
8989
long m_currentTokens;
9090
/// A timer that is used to measure time intervals. It is essential
9191
/// that this timer uses a monotonic clock (which is why QElapsedTimer is

0 commit comments

Comments
 (0)