Ethereal-dev: [Ethereal-dev] Signed/Unsigned warning fixes (gryphon,lemon)
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: Tue, 24 Apr 2001 01:31:14 +0200
Hello, the attached patches remove the signed/unsigned warnings in gryphon and lemon when compiling with -W. Should I submit the lemon fixes to the original author as well? Ciao J�rg -- Joerg Mayer <jmayer@xxxxxxxxx> I found out that "pro" means "instead of" (as in proconsul). Now I know what proactive means.
Index: ethereal/plugins/gryphon/packet-gryphon.c =================================================================== RCS file: /cvsroot/ethereal/plugins/gryphon/packet-gryphon.c,v retrieving revision 1.19 diff -u -u -r1.19 packet-gryphon.c --- packet-gryphon.c 2001/01/09 06:32:08 1.19 +++ packet-gryphon.c 2001/04/23 23:21:35 @@ -90,7 +90,8 @@ proto_tree *gryphon_tree, *header_tree, *body_tree, *localTree; proto_item *ti, *header_item, *body_item, *localItem; const u_char *data, *dataend, *msgend; - int src, msglen, msgpad, dest, frmtyp, i, end_of_frame; + int msglen, msgpad, end_of_frame; + unsigned int src, dest, i, frmtyp; static const u_char *frame_type[] = {"", "Command request", "Command response", @@ -472,7 +473,8 @@ void decode_command (int dst, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - int cmd, i, padding; + int cmd, padding; + unsigned int i; proto_tree *ft; proto_item *ti; @@ -510,7 +512,8 @@ void decode_response (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - int cmd, i, j, resp; + int cmd; + unsigned int i, j, resp; proto_tree *ft; proto_item *ti; @@ -735,8 +738,7 @@ void cmd_ioctl (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - unsigned int ioctl; - int i; + unsigned int ioctl, i; ioctl = pntohl ((unsigned int *)(*data)); for (i = 0; i < SIZEOF(ioctls); i++) { @@ -802,8 +804,7 @@ void cmd_modfilt (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - unsigned char action; - int i; + unsigned char action, i; if (**data) proto_tree_add_text(pt, NullTVB, *offset, 1, "Filter handle: %hd", **data); @@ -839,7 +840,7 @@ void dfiltmode (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - int i; + unsigned int i; unsigned char mode; mode = **data; @@ -856,7 +857,7 @@ void filtmode (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - int i; + unsigned int i; unsigned char mode; mode = **data; @@ -873,7 +874,7 @@ void resp_events (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - int i; + unsigned int i; proto_tree *tree; proto_item *item; @@ -959,7 +960,8 @@ proto_tree *ft; char string[33]; int devices; - int i, j, x; + int i; + unsigned int j, x; static const value_string protocol_types[] = { {GDUMMY * 256 + GDGDMARKONE, "Dummy device driver"}, @@ -1085,7 +1087,8 @@ void resp_blm_data (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - int hours, minutes, seconds, fraction, i, x, fract; + unsigned int i; + int hours, minutes, seconds, fraction, x, fract; unsigned long timestamp; char *fields[] = { "Bus load average: %d.%02d%%", @@ -1246,7 +1249,7 @@ { unsigned char action; unsigned char dest = *((*data)-5); - int i; + unsigned int i; if (**data) proto_tree_add_text(pt, NullTVB, *offset, 1, "Response handle: %hd", **data); @@ -1572,7 +1575,8 @@ void filter_block (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt) { - int length, type, i, operator, padding; + unsigned int type, operator, i; + int length, padding; proto_tree_add_text(pt, NullTVB, *offset, 2, "Filter field starts at byte %d", pntohs ((unsigned short *)(*data))); length = pntohs ((unsigned short *)((*data)+2));
Index: ethereal/tools/lemon/lemon.c =================================================================== RCS file: /cvsroot/ethereal/tools/lemon/lemon.c,v retrieving revision 1.8 diff -u -u -r1.8 lemon.c --- lemon.c 2001/04/18 04:52:51 1.8 +++ lemon.c 2001/04/23 23:28:55 @@ -166,7 +166,7 @@ struct config *cfp; /* All configurations in this set */ int index; /* Sequencial number for this state */ struct action *ap; /* Array of actions for this state */ - int naction; /* Number of actions for this state */ + unsigned int naction; /* Number of actions for this state */ int tabstart; /* First index of the action table */ int tabdfltact; /* Default action */ }; @@ -2113,7 +2113,7 @@ struct pstate ps; FILE *fp; char *filebuf; - int filesize; + size_t filesize; int lineno; char c; char *cp, *nextcp; @@ -3040,8 +3040,8 @@ /* Loop over parser states */ for(i=0; i<lemp->nstate; i++){ - int tablesize; /* size of the hash table */ - int j,k; /* Loop counter */ + size_t tablesize; /* size of the hash table */ + unsigned int j,k; /* Loop counter */ int collide[2048]; /* The collision chain for the table */ struct action *table[2048]; /* Build the hash table here */ @@ -3125,7 +3125,7 @@ ** } */ for(i=0; i<lemp->nstate; i++){ - int tablesize; + size_t tablesize; stp = lemp->sorted[i]; tablesize = 1; while( tablesize<stp->naction ) tablesize += tablesize;
- Follow-Ups:
- Re: [Ethereal-dev] Signed/Unsigned warning fixes (gryphon,lemon)
- From: Guy Harris
- Re: [Ethereal-dev] Signed/Unsigned warning fixes (gryphon,lemon)
- From: Guy Harris
- Re: [Ethereal-dev] Signed/Unsigned warning fixes (gryphon,lemon)
- Prev by Date: Re: [Ethereal-dev] "decode as"
- Next by Date: Re: [Ethereal-dev] Signed/Unsigned warning fixes (gryphon,lemon)
- Previous by thread: Re: [Ethereal-dev] "decode as"
- Next by thread: Re: [Ethereal-dev] Signed/Unsigned warning fixes (gryphon,lemon)
- Index(es):