From: Ruben Kerkhof Date: Sat, 8 Jul 2017 09:50:23 +0000 (+0200) Subject: chrony plugin: fix 2 build warnings X-Git-Tag: collectd-5.8.0~124 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d46c9cada2398d5508205e745c42c1cdc6efd1e9;p=collectd.git 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) ~ ^ ~~~~~~~~~~ --- 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;