ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] FYI: Status of gcc warnings in epan/dissectors

From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Wed, 28 Mar 2007 00:17:53 -0700
On Wed, Mar 28, 2007 at 03:04:27PM +0800, Jeff Morriss wrote:
> 
> Stephen Fisher wrote:
> > Almost all of the warnings I've fixed so far are "sign mismatches" 
> > between guint8* and (g)char* :(.  552 of the 795 remaining warnings 
> > outside of the .cnf files are this problem.
> 
> Is casting away signed and unsigned really the way to go with that?

Well, since (g)char defaults to unsigned on most platforms, it is 
usually the same as a guint8.  So it isn't really a mismatch; I think 
gcc 4.0 is warning about it for portability to platforms that don't have 
(g)char unsigned by default (which are they?).  The problem is that we 
use guint8 all over the place, but the standard C and GLib functions use 
char.  So there is a lot of going back and forth in the code.  The 
implicit "conversion" is already being done and the code works, I'm just 
making it explicit with a cast.  I'm open to other ideas if you have any 
other than getting rid of our use of guint8 :).



Steve