Sfoglia il codice sorgente

fix build warnings and errors with -DDEBUG

Dominic Chen 9 anni fa
parent
commit
21b8b30af5
2 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. 5 2
      src/docsis_encode.c
  2. 1 1
      src/docsis_snmp.c

+ 5 - 2
src/docsis_encode.c

@@ -209,6 +209,9 @@ int encode_ip_list( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr
 
 int encode_ip6( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
 {
+#ifdef DEBUG
+  char ip[INET6_ADDRSTRLEN];
+#endif /*DEBUG */
   struct in6_addr in;
   union t_val *helper; /* We only use this to cast the void* we receive to what we think it should be */
 
@@ -229,7 +232,7 @@ int encode_ip6( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
 	exit (-1);
   }
 #ifdef DEBUG
-  fprintf(stderr, "encode_ip: found %s at line %d\n",inet_ntoa(in), line);
+  fprintf(stderr, "encode_ip: found %s at line %d\n", inet_ntop(AF_INET6, &in, ip, sizeof(ip)), line);
 #endif /* DEBUG */
   memcpy ( buf, &in, sizeof(struct in6_addr));
   free(helper->strval);
@@ -683,7 +686,7 @@ unsigned int nr_found=0;
 char *cp;
 char *endptr[1];
 #ifdef DEBUG
-int i;
+unsigned int i;
 #endif
 
 union t_val *helper; /* We only use this to cast the void* we receive to what we think it should be */

+ 1 - 1
src/docsis_snmp.c

@@ -228,7 +228,7 @@ encode_vbind (char *oid_string, char oid_asntype, union t_val *value,
 				    &out_size);
       }
 #ifdef DEBUG
-      fprintf (stderr, "encoded len %ld var_len %d leftover %ud difference %d\n", len, name_len, out_size, (data_ptr - out_buffer) );
+      fprintf (stderr, "encoded len %ld var_len %zd leftover %zd difference %zd\n", len, name_len, out_size, (data_ptr - out_buffer) );
 #endif
       return data_ptr - out_buffer;
       break;