refactor: Use explicit types to help compiler

This commit is contained in:
Jingchen
2026-05-26 21:04:01 +01:00
committed by Ayaz Salikhov
parent 7e15621e7b
commit 9650fe8a6e
3 changed files with 6 additions and 3 deletions

View File

@@ -153,6 +153,7 @@ Checks: "-*,
readability-use-std-min-max
"
# ---
# bugprone-narrowing-conversions, # this will break a lot of code but we should enable it in the future because it can eliminate a lot of bugs
# readability-inconsistent-declaration-parameter-name, # in this codebase this check will break a lot of arg names
# readability-static-accessed-through-instance, # this check is probably unnecessary. it makes the code less readable
# ---

View File

@@ -2032,7 +2032,7 @@ PeerImp::checkTracking(std::uint32_t validationSeq)
void
PeerImp::checkTracking(std::uint32_t seq1, std::uint32_t seq2)
{
int const diff = std::max(seq1, seq2) - std::min(seq1, seq2);
std::uint32_t const diff = std::max(seq1, seq2) - std::min(seq1, seq2);
if (diff < Tuning::kConvergedLedgerLimit)
{

View File

@@ -1,14 +1,16 @@
#pragma once
#include <cstddef>
#include <cstdint>
namespace xrpl::Tuning {
/** How many ledgers off a server can be and we will
still consider it converged */
static constexpr auto kConvergedLedgerLimit = 24;
static constexpr std::uint32_t kConvergedLedgerLimit = 24;
/** How many ledgers off a server has to be before we
consider it diverged */
static constexpr auto kDivergedLedgerLimit = 128;
static constexpr std::uint32_t kDivergedLedgerLimit = 128;
/** The soft cap on the number of ledger entries in a single reply. */
static constexpr auto kSoftMaxReplyNodes = 8192;