From e78d9eb8d228a78f1e0626943ec5121bd9b00574 Mon Sep 17 00:00:00 2001 From: ArtSin Date: Tue, 5 Nov 2024 11:44:24 +0400 Subject: [PATCH] Fix argument types of formatting functions `cluster_legacy.c`: `slot_info_pairs` has `uint16_t` values, but they were cast to `unsigned long` and `%i` was used. `valkey-cli.c`: `node->replicas_count` is `int`, not `unsigned long`. Signed-off-by: ArtSin --- src/cluster_legacy.c | 8 ++++---- src/valkey-cli.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index 43d56b9a09..9fc8773b9e 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -5544,12 +5544,12 @@ sds representClusterNodeFlags(sds ci, uint16_t flags) { * else each slot is added separately. */ sds representSlotInfo(sds ci, uint16_t *slot_info_pairs, int slot_info_pairs_count) { for (int i = 0; i < slot_info_pairs_count; i += 2) { - unsigned long start = slot_info_pairs[i]; - unsigned long end = slot_info_pairs[i + 1]; + unsigned int start = slot_info_pairs[i]; + unsigned int end = slot_info_pairs[i + 1]; if (start == end) { - ci = sdscatfmt(ci, " %i", start); + ci = sdscatfmt(ci, " %u", start); } else { - ci = sdscatfmt(ci, " %i-%i", start, end); + ci = sdscatfmt(ci, " %u-%u", start, end); } } return ci; diff --git a/src/valkey-cli.c b/src/valkey-cli.c index b4a7fcaf91..9f055b729b 100644 --- a/src/valkey-cli.c +++ b/src/valkey-cli.c @@ -4395,7 +4395,7 @@ static sds clusterManagerNodeInfo(clusterManagerNode *node, int indent) { if (node->replicate != NULL) info = sdscatfmt(info, "\n%s replicates %S", spaces, node->replicate); else if (node->replicas_count) - info = sdscatfmt(info, "\n%s %U additional replica(s)", spaces, node->replicas_count); + info = sdscatfmt(info, "\n%s %i additional replica(s)", spaces, node->replicas_count); sdsfree(spaces); return info; }