[PATCH] ext/snmp warning fixes

php.internals

Joe Orton

22 years ago
4.3/ext/snmp/snmp.c: In function `php_snmp_getvalue': 4.3/ext/snmp/snmp.c:282: warning: unsigned int format, long int arg (arg 4) 4.3/ext/snmp/snmp.c:288: warning: int format, long int arg (arg 4) 4.3/ext/snmp/snmp.c: In function `netsnmp_session_gen_auth_key': 4.3/ext/snmp/snmp.c:804: warning: initialization discards qualifiers from pointer target type 4.3/ext/snmp/snmp.c: In function `netsnmp_session_gen_sec_key': 4.3/ext/snmp/snmp.c:833: warning: initialization discards qualifiers from pointer target type 4.3/ext/snmp/snmp.c: In function `php_snmpv3': 4.3/ext/snmp/snmp.c:909: warning: char format, pointer arg (arg 4) The qualifier warnings require some oid * -> const oid * changes which I'd guess would break with older SNMP libraries, so I've not included those fixes. --- ext/snmp/snmp.c 23 Sep 2003 18:26:10 -0000 1.70.2.12 +++ ext/snmp/snmp.c 13 Oct 2003 10:59:11 -0000 @@ -279,13 +279,13 @@ /* ASN_UNSIGNED is the same as ASN_GAUGE */ case ASN_TIMETICKS: /* 0x43, snmp_impl.h */ case ASN_UINTEGER: /* 0x47, snmp_impl.h */ - snprintf(buf, sizeof(buf)-1, "%u", *vars->val.integer); + snprintf(buf, sizeof(buf)-1, "%lu", *vars->val.integer); buf[sizeof(buf)-1]=0; ZVAL_STRING(val, buf, 1); break; case ASN_INTEGER: /* 0x02, asn1.h */ - snprintf(buf, sizeof(buf)-1, "%d", *vars->val.integer); + snprintf(buf, sizeof(buf)-1, "%ld", *vars->val.integer); buf[sizeof(buf)-1]=0; ZVAL_STRING(val, buf, 1); break; @@ -906,7 +906,7 @@ /* Setting the security level. */ convert_to_string_ex(a3); if (netsnmp_session_set_sec_level(&session, Z_STRVAL_PP(a3) TSRMLS_CC)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid security level: %s", a3); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid security level: %s", Z_STRVAL_PP(a3)); RETURN_FALSE; }