From: Aurelien Reynaud Date: Wed, 12 May 2010 09:55:05 +0000 (+0200) Subject: snmp.c: compilation fixes for AIX X-Git-Tag: collectd-4.9.3~14 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=df69fe8118215a80bb1f2e4b1a68c508abffb054;p=collectd.git snmp.c: compilation fixes for AIX The C and C++ standards allows the character type char to be signed or unsigned, depending on the platform and compiler. Most systems, including x86 GNU/Linux and Microsoft Windows, use signed char, but those based on PowerPC and ARM processors typically use unsigned char. This patch fixes a "comparison is always true" warning on AIX (powerpc) which leads the compilation to abort because of the -Werror flag. Being unsigned by default, a char is always >0. Signed-off-by: Aurelien Reynaud Signed-off-by: Florian Forster --- diff --git a/src/snmp.c b/src/snmp.c index 693cd894..8e72ce60 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -965,7 +965,7 @@ static int csnmp_strvbcopy (char *dst, /* {{{ */ for (i = 0; i < num_chars; i++) { /* Check for control characters. */ - if ((src[i] >= 0) && (src[i] < 32)) + if ((unsigned char)src[i] < 32) return (csnmp_strvbcopy_hexstring (dst, vb, dst_size)); dst[i] = src[i]; }