Ethereal-dev: [Ethereal-dev] Signed/unsigned fixes

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

From: Jörg Mayer <jmayer@xxxxxxxxx>
Date: Sun, 17 Jun 2001 19:21:02 +0200
Hello,

the attached patch fixes some signed/unsigned warnings. One thing I stumbled
upon was the use of the register keyword in print.c. Does it really make
sense?

  Ciao
         J�rg
-- 
J�rg Mayer <jmayer@xxxxxxxxx>
Signature fault, brain dumped
Changelog: <jmayer@xxxxxxxxx>
	Some signed/unsigned warning fixes in:
	- packet-afs.c
	- packet-clnp.c
	- packet-dns.c
	- packet-giop.c
	- prefs.c
	- print.c
	- capture.c

Index: ethereal/packet-afs.c
===================================================================
RCS file: /cvsroot/ethereal/packet-afs.c,v
retrieving revision 1.31
diff -u -u -r1.31 packet-afs.c
--- packet-afs.c	2001/05/27 05:00:17	1.31
+++ packet-afs.c	2001/06/17 13:08:46
@@ -427,7 +427,7 @@
 dissect_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
 {
 	int old_offset;
-	guint32 bytes;
+	gint32 bytes;
 	int i, n, pos, neg, acl;
 	char user[128]; /* Be sure to adjust sscanf()s below if length is changed... */
 
Index: ethereal/packet-clnp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-clnp.c,v
retrieving revision 1.31
diff -u -u -r1.31 packet-clnp.c
--- packet-clnp.c	2001/06/08 07:44:36	1.31
+++ packet-clnp.c	2001/06/17 13:08:48
@@ -1583,7 +1583,7 @@
   int         offset;
   u_char      src_len, dst_len, nsel, opt_len = 0;
   const guint8     *dst_addr, *src_addr;
-  guint       len;
+  gint        len;
   guint       next_length;
   proto_tree *discpdu_tree;
   address     save_dl_src;
Index: ethereal/packet-dns.c
===================================================================
RCS file: /cvsroot/ethereal/packet-dns.c,v
retrieving revision 1.66
diff -u -u -r1.66 packet-dns.c
--- packet-dns.c	2001/04/23 18:05:18	1.66
+++ packet-dns.c	2001/06/17 17:04:58
@@ -435,7 +435,7 @@
   int len = -1;
   int chars_processed = 0;
   int data_size = pi.len - dns_data_offset;
-  u_int component_len;
+  int component_len;
 
   maxname--;	/* reserve space for the trailing '\0' */
   for (;;) {
Index: ethereal/packet-giop.c
===================================================================
RCS file: /cvsroot/ethereal/packet-giop.c,v
retrieving revision 1.32
diff -u -u -r1.32 packet-giop.c
--- packet-giop.c	2001/04/27 01:27:36	1.32
+++ packet-giop.c	2001/06/17 17:04:59
@@ -99,7 +99,7 @@
 static const guint GIOP_MAJOR =  1;
 static const guint GIOP_MINOR =  2;
 
-static const guint GIOP_HEADER_SIZE = 12;
+static const gint GIOP_HEADER_SIZE = 12;
 
 static const int KeyAddr       = 0;
 static const int ProfileAddr   = 1;
@@ -198,7 +198,7 @@
 }
 ReplyStatusType;
 
-const static value_string reply_status_types[] = { 
+static const value_string reply_status_types[] = { 
    { NO_EXCEPTION, "No Exception" } ,
    { USER_EXCEPTION, "User Exception" } ,
    { SYSTEM_EXCEPTION, "System Exception" } ,
Index: ethereal/prefs.c
===================================================================
RCS file: /cvsroot/ethereal/prefs.c,v
retrieving revision 1.52
diff -u -u -r1.52 prefs.c
--- prefs.c	2001/06/04 08:07:34	1.52
+++ prefs.c	2001/06/17 17:05:01
@@ -889,7 +889,7 @@
 {
   static char string[N_NAME_RESOLVE_OPT+1];
   char *p;
-  int i;
+  unsigned int i;
   gboolean all_opts_set = TRUE;
 
   if (name_resolve == PREFS_RESOLV_NONE)
@@ -911,7 +911,7 @@
 string_to_name_resolve(char *string, guint32 *name_resolve)
 {
   char c;
-  int i;
+  unsigned int i;
 
   *name_resolve = 0;
   while ((c = *string++) != '\0') {
Index: ethereal/print.c
===================================================================
RCS file: /cvsroot/ethereal/print.c,v
retrieving revision 1.35
diff -u -u -r1.35 print.c
--- print.c	2001/06/08 10:07:55	1.35
+++ print.c	2001/06/17 17:05:01
@@ -249,7 +249,7 @@
 void print_hex_data_text(FILE *fh, register const u_char *cp,
 		register u_int length, char_enc encoding)
 {
-        register int ad, i, j, k;
+        register unsigned int ad, i, j, k;
         u_char c;
         u_char line[80];
 	static u_char binhex[16] = {
@@ -362,7 +362,7 @@
 void print_hex_data_ps(FILE *fh, register const u_char *cp,
 		register u_int length, char_enc encoding)
 {
-        register int ad, i, j, k;
+        register unsigned int ad, i, j, k;
         u_char c;
         u_char line[60];
 	static u_char binhex[16] = {
Index: ethereal/capture.c
===================================================================
RCS file: /cvsroot/ethereal/capture.c,v
retrieving revision 1.152
diff -u -u -r1.152 capture.c
--- capture.c	2001/06/15 01:36:46	1.152
+++ capture.c	2001/06/17 17:05:04
@@ -1208,7 +1208,8 @@
   bpf_u_int32 netnum, netmask;
   struct bpf_program fcode;
   time_t      upd_time, cur_time;
-  int         err, inpkts, i;
+  int         err, inpkts;
+  unsigned int i;
   static const char capstart_msg = SP_CAPSTART;
   char        errmsg[4096+1];
 #ifndef _WIN32