From 5a8dde4ad4968576560236e350c70cf426bf8cc7 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Sat, 11 Jan 2025 20:09:30 +0100 Subject: [PATCH 1/2] DOCS: Fixed typo (cherry picked from commit 30b9cba49e82f5a506218c9ad647fe35a567c466) --- src/murmur/ServerUser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/murmur/ServerUser.h b/src/murmur/ServerUser.h index e91f4c879f3..767c570f5b5 100644 --- a/src/murmur/ServerUser.h +++ b/src/murmur/ServerUser.h @@ -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 From 16ee9997310aadd4402b6fed5b60cc396e983222 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Sat, 11 Jan 2025 20:09:40 +0100 Subject: [PATCH 2/2] 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;