From: Ruben Kerkhof Date: Fri, 7 Jul 2017 14:00:48 +0000 (+0200) Subject: snmp_agent: fix format specifiers X-Git-Tag: collectd-5.8.0~127 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f3c9335402d5853f98645ca28080600bf565f1ce;p=collectd.git snmp_agent: fix format specifiers make all-am make[1]: Entering directory '/home/ruben/src/collectd' CC src/snmp_agent_la-snmp_agent.lo In file included from ./src/daemon/common.h:33:0, from src/snmp_agent.c:31: src/snmp_agent.c: In function ‘snmp_agent_dump_data’: src/snmp_agent.c:42:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=] #define PLUGIN_NAME "snmp_agent" ^ ./src/daemon/plugin.h:400:42: note: in definition of macro ‘DEBUG’ #define DEBUG(...) plugin_log(LOG_DEBUG, __VA_ARGS__) ^~~~~~~~~~~ src/snmp_agent.c:192:13: note: in expansion of macro ‘PLUGIN_NAME’ DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str); ^~~~~~~~~~~ src/snmp_agent.c:192:35: note: format string is defined here DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str); ~^ %ld CCLD snmp_agent.la --- diff --git a/src/snmp_agent.c b/src/snmp_agent.c index d7aea2d2..0908b4eb 100644 --- a/src/snmp_agent.c +++ b/src/snmp_agent.c @@ -165,7 +165,7 @@ static void snmp_agent_dump_data(void) { DEBUG(PLUGIN_NAME ": TypeInstance: %s", dd->type_instance); for (size_t i = 0; i < dd->oids_len; i++) { snmp_agent_oid_to_string(oid_str, sizeof(oid_str), &dd->oids[i]); - DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str); + DEBUG(PLUGIN_NAME ": OID[%zu]: %s", i, oid_str); } DEBUG(PLUGIN_NAME ": Scale: %g", dd->scale); DEBUG(PLUGIN_NAME ": Shift: %g", dd->shift); @@ -189,7 +189,7 @@ static void snmp_agent_dump_data(void) { DEBUG(PLUGIN_NAME ": TypeInstance: %s", dd->type_instance); for (size_t i = 0; i < dd->oids_len; i++) { snmp_agent_oid_to_string(oid_str, sizeof(oid_str), &dd->oids[i]); - DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str); + DEBUG(PLUGIN_NAME ": OID[%zu]: %s", i, oid_str); } DEBUG(PLUGIN_NAME ": Scale: %g", dd->scale); DEBUG(PLUGIN_NAME ": Shift: %g", dd->shift);