Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] [PATCH]fix warnings

From: Sebastien Tandel <sebastien@xxxxxxxxx>
Date: Thu, 22 Mar 2007 01:54:19 +0100
some warning fixes

packet-http.c
    set headers.content_length = 0 before the first potential use of it.
packet-kink.c
    "ifdef kerberos" around one function declaration
packet-nbns.c
    set headers.{dgm_length|pkt_offset|error_code} = 0
packet-pflog.c
    "ifdef __GCC_WARNING_NO_USE__" around capture_pflog and
capture_old_pflog which aren't used anymore in the code.


Regards,
Sebastien Tandel
Index: epan/dissectors/packet-nbns.c
===================================================================
--- epan/dissectors/packet-nbns.c	(r�vision 21097)
+++ epan/dissectors/packet-nbns.c	(copie de travail)
@@ -1225,6 +1225,10 @@
 	header.src_ip = tvb_get_ipv4(tvb, offset+4);
 	header.src_port = tvb_get_ntohs(tvb, offset+8);
 
+	/* avoid gcc warnings */
+	header.dgm_length = 0;
+	header.pkt_offset = 0;
+	header.error_code = 0;
 	switch (header.msg_type) {
 
 	case NBDS_DIRECT_UNIQUE:
Index: epan/dissectors/packet-pflog.c
===================================================================
--- epan/dissectors/packet-pflog.c	(r�vision 21097)
+++ epan/dissectors/packet-pflog.c	(copie de travail)
@@ -78,6 +78,8 @@
 
 static gint ett_old_pflog = -1;
 
+/* defined but not used gcc warning */
+#ifdef __GCC_WARNING_NO_USE__
 static void
 capture_pflog(const guchar *pd, int offset, int len, packet_counts *ld)
 {
@@ -119,6 +121,7 @@
     break;
   }
 }
+#endif
 
 static const value_string af_vals[] = {
   { BSD_PF_INET,  "IPv4" },
@@ -317,6 +320,8 @@
 }
 
 
+/* defined but not used gcc warning */
+#ifdef __GCC_WARNING_NO_USE__
 static void
 capture_old_pflog(const guchar *pd, int offset, int len, packet_counts *ld)
 {
@@ -350,6 +355,7 @@
     break;
   }
 }
+#endif
 
 static void
 dissect_old_pflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
Index: epan/dissectors/packet-http.c
===================================================================
--- epan/dissectors/packet-http.c	(r�vision 21097)
+++ epan/dissectors/packet-http.c	(copie de travail)
@@ -629,6 +629,7 @@
 	headers.content_type = NULL;	/* content type not known yet */
 	headers.content_type_parameters = NULL;	/* content type parameters too */
 	headers.have_content_length = FALSE;	/* content length not known yet */
+	headers.content_length = 0;		/* content length set to 0 (avoid a gcc warning) */
 	headers.content_encoding = NULL; /* content encoding not known yet */
 	headers.transfer_encoding = NULL; /* transfer encoding not known yet */
 	saw_req_resp_or_header = FALSE;	/* haven't seen anything yet */
Index: epan/dissectors/packet-kink.c
===================================================================
--- epan/dissectors/packet-kink.c	(r�vision 21097)
+++ epan/dissectors/packet-kink.c	(copie de travail)
@@ -174,7 +174,9 @@
 static void dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
 static void dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
 static void dissect_payload_kink_not_defined(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree);
+#ifdef HAVE_KERBEROS
 static void dissect_decrypt_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, int payload_length);
+#endif
  
 /* This function is dissecting the kink header. */
 static void 
@@ -777,6 +779,7 @@
   }
 }
 
+#ifdef HAVE_KERBEROS
 static void
 dissect_decrypt_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, int payload_length){
   
@@ -800,6 +803,7 @@
 
   control_payload(pinfo, tvb, offset, next_payload, decrypt_kink_encrypt_tree);
 }
+#endif
 
 static void
 dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){