From d46c9cada2398d5508205e745c42c1cdc6efd1e9 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sat, 8 Jul 2017 11:50:23 +0200 Subject: [PATCH] chrony plugin: fix 2 build warnings CC src/chrony.lo src/chrony.c:355:30: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare] if (!isalnum(c) || j + 1 >= p_buf_size) ~~~~~ ^ ~~~~~~~~~~ src/chrony.c:359:9: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare] if (j < p_buf_size) ~ ^ ~~~~~~~~~~ --- src/chrony.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/chrony.c b/src/chrony.c index a5e85a8a..74dae52d 100644 --- a/src/chrony.c +++ b/src/chrony.c @@ -348,9 +348,10 @@ static char *niptoha(const tChrony_IPAddr *addr, char *p_buf, } static void nreftostr(uint32_t nrefid, char *p_buf, size_t p_buf_size) { - int i, j, c; + int i, c; + size_t j = 0; - for (i = j = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { c = ntohl(nrefid) << i * 8 >> 24; if (!isalnum(c) || j + 1 >= p_buf_size) continue; -- 2.11.0