From a56cbd30366ac7776bcd71e2ac8d9c421ca54cc8 Mon Sep 17 00:00:00 2001 From: Hanif Ariffin Date: Thu, 17 Dec 2020 03:00:48 -0800 Subject: [PATCH] More fixes to printf format specifier. (#7909) mostly signed / unsigned mismatches. Signed-off-by: Hanif Bin Ariffin Co-authored-by: Oran Agra --- src/dict.c | 8 ++++---- src/rax.c | 2 +- src/redis-cli.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dict.c b/src/dict.c index 4736dacd5..2c59dd466 100644 --- a/src/dict.c +++ b/src/dict.c @@ -1135,10 +1135,10 @@ size_t _dictGetStatsHt(char *buf, size_t bufsize, dictht *ht, int tableid) { /* Generate human readable stats. */ l += snprintf(buf+l,bufsize-l, "Hash table %d stats (%s):\n" - " table size: %ld\n" - " number of elements: %ld\n" - " different slots: %ld\n" - " max chain length: %ld\n" + " table size: %lu\n" + " number of elements: %lu\n" + " different slots: %lu\n" + " max chain length: %lu\n" " avg chain length (counted): %.02f\n" " avg chain length (computed): %.02f\n" " Chain length distribution:\n", diff --git a/src/rax.c b/src/rax.c index 89345fe26..1ffb42287 100644 --- a/src/rax.c +++ b/src/rax.c @@ -1892,7 +1892,7 @@ void raxShow(rax *rax) { /* Used by debugnode() macro to show info about a given node. */ void raxDebugShowNode(const char *msg, raxNode *n) { if (raxDebugMsg == 0) return; - printf("%s: %p [%.*s] key:%d size:%d children:", + printf("%s: %p [%.*s] key:%u size:%u children:", msg, (void*)n, (int)n->size, (char*)n->data, n->iskey, n->size); int numcld = n->iscompr ? 1 : n->size; raxNode **cldptr = raxNodeLastChildPtr(n) - (numcld-1); diff --git a/src/redis-cli.c b/src/redis-cli.c index 4f5b0fe03..5310a1b21 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -5578,7 +5578,7 @@ static int clusterManagerCommandCreate(int argc, char **argv) { if (last > CLUSTER_MANAGER_SLOTS || i == (masters_count - 1)) last = CLUSTER_MANAGER_SLOTS - 1; if (last < first) last = first; - printf("Master[%d] -> Slots %lu - %lu\n", i, first, last); + printf("Master[%d] -> Slots %ld - %ld\n", i, first, last); master->slots_count = 0; for (j = first; j <= last; j++) { master->slots[j] = 1;