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.
diff --git a/src/peers.c b/src/peers.c
index 5172214..413f594 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -583,8 +583,8 @@
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 @@
{
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;