Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFAC(server): Add explicit casts to avoid conversion warnings #6694

Merged
merged 2 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading