BUILD: peers: adjust some printf format to silence cppcheck

In issue #1184, cppcheck complains about some inconsistent printf
formats. At least the one in peer_prepare_hellomsg() that uses "%u"
for the int "min_ver" is wrong. Let's force other types to make it
happy, though constants cannot cause trouble.
This commit is contained in:
Willy Tarreau 2022-04-12 08:28:18 +02:00
parent f0683cd510
commit 2645b34341

View File

@ -583,8 +583,8 @@ static int peer_prepare_hellomsg(char *msg, size_t size, struct peer_prep_params
peer = p->hello.peer;
min_ver = (peer->flags & PEER_F_DWNGRD) ? PEER_DWNGRD_MINOR_VER : PEER_MINOR_VER;
/* Prepare headers */
ret = snprintf(msg, size, PEER_SESSION_PROTO_NAME " %u.%u\n%s\n%s %d %d\n",
PEER_MAJOR_VER, min_ver, peer->id, localpeer, (int)getpid(), 1);
ret = snprintf(msg, size, PEER_SESSION_PROTO_NAME " %d.%d\n%s\n%s %d %d\n",
(int)PEER_MAJOR_VER, min_ver, peer->id, localpeer, (int)getpid(), (int)1);
if (ret >= size)
return 0;
@ -600,7 +600,7 @@ static int peer_prepare_status_successmsg(char *msg, size_t size, struct peer_pr
{
int ret;
ret = snprintf(msg, size, "%d\n", PEER_SESS_SC_SUCCESSCODE);
ret = snprintf(msg, size, "%d\n", (int)PEER_SESS_SC_SUCCESSCODE);
if (ret >= size)
return 0;