[PATCH] D-Bus 1.0.x Warning Fix Ups
halfline at gmail.com
Mon Dec 4 20:12:51 PST 2006
> There are a pile of warnings right now about signed/unsigned char. I've
> been reluctant to fix these because it will be a giant patch, plus I
> can't really decide how to fix them. (casts are not a good answer)
So I don't know the specifics of this, but the guidelines I tend to go by are
1) don't specify signed or unsigned when passing ascii/utf-8 strings
around, just default with char *, which may be either signed or
unsigned depending on the platform/compile flags.
2) never explicitly use signed char
3) when looking at _individual characters_ convert them to either an
unsigned char (for use with ctype functions) or gunichar/wchar_t (for
So in the ascii case "convert" does mean "cast", but in the utf-8 case
there has to be a function to specifically do the converting.
> > --- dbus/dbus-auth.c 2006-09-05 20:14:06.000000000 -0400
> > +++ dbus/dbus-auth.c.new 2006-12-03 23:46:17.000000000 -0500
> > @@ -752,6 +752,8 @@
> > const DBusString *username;
> > dbus_bool_t retval;
> > + (void)auth;
> I'm not a fan of this... I don't recall a lot of bugs in many years of C
> programming that "unused parameter" would detect, and there are lots of
> legitimate reasons to have unused parameters.
Note, gcc has __attribute__((unused)) for marking parameters as
unused, which is slightly nicer than the void cruft there, I guess.
Still, this type of thing doesn't seem that useful to care about, imo
More information about the dbus