From 16ee9997310aadd4402b6fed5b60cc396e983222 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Sat, 11 Jan 2025 20:09:40 +0100 Subject: [PATCH] REFAC(server): Add explicit casts to avoid conversion warnings Fixes #6377 (hopefully for real, this time) (cherry picked from commit df74412eb8efefcc0786511e2846f6a48344cc12) --- src/murmur/ServerUser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/murmur/ServerUser.cpp b/src/murmur/ServerUser.cpp index d5d2c5ababf..25061b48d3a 100644 --- a/src/murmur/ServerUser.cpp +++ b/src/murmur/ServerUser.cpp @@ -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 @@ -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;