Ethereal-dev: [Ethereal-dev] more signed/unsigned fixes /packet-a..i

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Fri, 27 Apr 2001 02:55:52 +0200
Some more "fixes". I left out afs and dns as I'm wondering about the
"right" way to handle the problem of the MACRO. Would making the offset
argument to the dissector functions into unsigend be an option/OK?

  Ciao
         Jörg

-- 
Joerg Mayer                                          <jmayer@xxxxxxxxx>
I found out that "pro" means "instead of" (as in proconsul). Now I know
what proactive means.
Changelog: <jmayer@xxxxxxxxx>
   - fix some signed/unsigned warnings in
     atalk, bxxp, dcerpc, giop, icmpv6 and icq

Index: ethereal/packet-atalk.c
===================================================================
RCS file: /cvsroot/ethereal/packet-atalk.c,v
retrieving revision 1.53
diff -u -u -r1.53 packet-atalk.c
--- packet-atalk.c	2001/04/23 04:29:53	1.53
+++ packet-atalk.c	2001/04/27 00:28:05
@@ -296,7 +296,7 @@
   int offset = 0;
   guint8 info;
   guint op, count;
-  int i;
+  unsigned int i;
 
   if (check_col(pinfo->fd, COL_PROTOCOL))
     col_set_str(pinfo->fd, COL_PROTOCOL, "NBP");
Index: ethereal/packet-bxxp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-bxxp.c,v
retrieving revision 1.17
diff -u -u -r1.17 packet-bxxp.c
--- packet-bxxp.c	2001/04/23 04:10:49	1.17
+++ packet-bxxp.c	2001/04/27 00:28:07
@@ -98,7 +98,7 @@
 static int ett_header = -1;
 static int ett_trailer = -1;
 
-static int tcp_port = 0;
+static unsigned int tcp_port = 0;
 
 /* Get the state of the more flag ... */
 
@@ -146,7 +146,7 @@
 GMemChunk  *bxxp_packet_infos = NULL;
 
 /* Hash Functions */
-gint
+static gint
 bxxp_equal(gconstpointer v, gconstpointer w)
 {
   struct bxxp_request_key *v1 = (struct bxxp_request_key *)v;
@@ -212,7 +212,7 @@
  * BXXP routines
  */
 
-int bxxp_get_more(char more)
+static int bxxp_get_more(char more)
 {
 
   if (more == '.')
@@ -229,7 +229,7 @@
  *  -1 -> Proto violation
  */
 
-int
+static int
 dissect_bxxp_more(tvbuff_t *tvb, int offset, frame_data *fd, 
 		  proto_tree *tree)
 {
@@ -273,7 +273,7 @@
 
 }
 
-void dissect_bxxp_status(tvbuff_t *tvb, int offset, frame_data *fd,
+static void dissect_bxxp_status(tvbuff_t *tvb, int offset, frame_data *fd,
 			 proto_tree *tree)
 {
 
@@ -307,9 +307,9 @@
 
 }
 
-int num_len(tvbuff_t *tvb, int offset)
+static int num_len(tvbuff_t *tvb, int offset)
 {
-  int i = 0;
+  unsigned int i = 0;
 
   while (isdigit(tvb_get_guint8(tvb, offset + i))) i++;
 
@@ -324,7 +324,7 @@
  * However, we depend on the variable bxxp_strict_term
  */ 
 
-int 
+static int 
 check_term(tvbuff_t *tvb, int offset, proto_tree *tree)
 {
 
@@ -376,7 +376,7 @@
 }
 
 /* Get the header length, up to CRLF or CR or LF */
-int header_len(tvbuff_t *tvb, int offset)
+static int header_len(tvbuff_t *tvb, int offset)
 {
   int i = 0;
   guint8 sc;
@@ -404,7 +404,7 @@
   }
 }
 
-int
+static int
 dissect_bxxp_mime_header(tvbuff_t *tvb, int offset, 
 			 struct bxxp_proto_data *frame_data,
 			 proto_tree *tree)
@@ -454,11 +454,12 @@
 
 }
 
-int
+static int
 dissect_bxxp_int(tvbuff_t *tvb, int offset, frame_data *fd,
 		    proto_tree *tree, int hf, int *val, int *hfa[])
 {
-  int ival, ind = 0, i = num_len(tvb, offset);
+  int ival, ind = 0;
+  unsigned int i = num_len(tvb, offset);
   guint8 int_buff[100];
 
   memset(int_buff, '\0', sizeof(int_buff));
@@ -484,7 +485,7 @@
 
 }
 
-void
+static void
 set_mime_hdr_flags(int more, struct bxxp_request_val *request_val, 
 		   struct bxxp_proto_data *frame_data)
 {
@@ -538,7 +539,7 @@
  * A return value > 0 is the count of bytes we consumed ...
  */
 
-int
+static int
 dissect_bxxp_tree(tvbuff_t *tvb, int offset, packet_info *pinfo, 
 		  proto_tree *tree, struct bxxp_request_val *request_val, 
 		  struct bxxp_proto_data *frame_data)
Index: ethereal/packet-dcerpc.c
===================================================================
RCS file: /cvsroot/ethereal/packet-dcerpc.c,v
retrieving revision 1.3
diff -u -u -r1.3 packet-dcerpc.c
--- packet-dcerpc.c	2001/04/19 23:39:27	1.3
+++ packet-dcerpc.c	2001/04/27 00:28:07
@@ -161,7 +161,7 @@
 void
 dcerpc_tvb_get_uuid (tvbuff_t *tvb, gint offset, char *drep, e_uuid_t *uuid)
 {
-    int i;
+    unsigned int i;
     uuid->Data1 = dcerpc_tvb_get_ntohl (tvb, offset, drep);
     uuid->Data2 = dcerpc_tvb_get_ntohs (tvb, offset+4, drep);
     uuid->Data3 = dcerpc_tvb_get_ntohs (tvb, offset+6, drep);
Index: ethereal/packet-giop.c
===================================================================
RCS file: /cvsroot/ethereal/packet-giop.c,v
retrieving revision 1.31
diff -u -u -r1.31 packet-giop.c
--- packet-giop.c	2001/02/26 22:19:12	1.31
+++ packet-giop.c	2001/04/27 00:28:08
@@ -259,7 +259,7 @@
 static void
 printable_string (gchar *in, guint32 len)
 {
-  int i = 0;
+  guint32 i = 0;
 
   for(i=0; i < len; i++)
   {
@@ -554,7 +554,7 @@
   proto_tree *reply_tree = NULL;
   proto_item *tf;
 
-  int i;
+  guint32 i;
 
   big_endian = is_big_endian (header);
 
@@ -685,7 +685,7 @@
   guint32 reply_status;
   proto_tree *reply_tree = NULL;
   proto_item *tf;
-  int i;
+  guint32 i;
 
   if (tree)
     {
@@ -827,7 +827,7 @@
   gchar *reserved = NULL;
   proto_tree *request_tree = NULL;
   proto_item *tf;
-  int i;
+  guint32 i;
 
 
   if (tree)
Index: ethereal/packet-icmpv6.c
===================================================================
RCS file: /cvsroot/ethereal/packet-icmpv6.c,v
retrieving revision 1.41
diff -u -u -r1.41 packet-icmpv6.c
--- packet-icmpv6.c	2001/04/23 17:51:33	1.41
+++ packet-icmpv6.c	2001/04/27 00:28:09
@@ -365,6 +365,7 @@
 	proto_item *tf;
     struct icmp6_nodeinfo icmp6_nodeinfo, *ni;
     int off;
+    unsigned int j;
     int i, n, l, p;
     guint16 flags;
     char dname[MAXDNAME];
@@ -562,21 +563,21 @@
 	    field_tree = proto_item_add_subtree(tf, ett_nodeinfo_nodedns);
 	    /* XXXX - clean this up when packet-dns.c has been tvbuffified */
 	    tvb_compat(tvb, &pd, &top_level_offset);
-	    i = offset + sizeof (*ni) + sizeof(guint32);
-	    while (i < tvb_length(tvb)) {
-		l = get_dns_name(pd, top_level_offset + i,
+	    j = offset + sizeof (*ni) + sizeof(guint32);
+	    while (j < tvb_length(tvb)) {
+		l = get_dns_name(pd, top_level_offset + j,
 		   top_level_offset + offset + sizeof (*ni) + sizeof(guint32),
 		   dname,sizeof(dname));
-		if (tvb_bytes_exist(tvb, top_level_offset + i + l, 1) &&
-		    tvb_get_guint8(tvb, top_level_offset + i + l) == 0) {
+		if (tvb_bytes_exist(tvb, top_level_offset + j + l, 1) &&
+		    tvb_get_guint8(tvb, top_level_offset + j + l) == 0) {
 		    l++;
-		    proto_tree_add_text(field_tree, tvb, i, l,
+		    proto_tree_add_text(field_tree, tvb, j, l,
 			"DNS label: %s (truncated)", dname);
 		} else {
-		    proto_tree_add_text(field_tree, tvb, i, l,
+		    proto_tree_add_text(field_tree, tvb, j, l,
 			"DNS label: %s", dname);
 		}
-		i += l;
+		j += l;
 	    }
 	    off = tvb_length_remaining(tvb, offset);
 	    break;
@@ -630,7 +631,8 @@
     struct icmp6_router_renum icmp6_router_renum, *rr;
     struct rr_pco_match rr_pco_match, *match;
     struct rr_pco_use rr_pco_use, *use;
-    int flagoff, off, l;
+    int flagoff, off;
+    unsigned int l;
     guint8 flags;
 
     rr = &icmp6_router_renum;
Index: ethereal/packet-icq.c
===================================================================
RCS file: /cvsroot/ethereal/packet-icq.c,v
retrieving revision 1.28
diff -u -u -r1.28 packet-icq.c
--- packet-icq.c	2001/03/27 02:01:31	1.28
+++ packet-icq.c	2001/04/27 00:28:11
@@ -555,7 +555,7 @@
     guint16 msgType;
     gint sep_offset;
     int sz;            /* Size of the current element */
-    int n;
+    unsigned int n;
     static char* url_field_descr[] = {
 	"Description",
 	"URL",
@@ -1967,7 +1967,7 @@
     if (changeCol && check_col(pinfo->fd, COL_INFO))
 	col_add_fstr(pinfo->fd, COL_INFO, "ICQv5 %s", findServerCmd(cmd));
 
-    if (pktsize == -1)
+    if (pktsize == (guint32)-1)
 	pktsize = tvb_reported_length(tvb);
     
     if (tree) {