[PATCH] D-Bus 1.0.x Warning Fix Ups

Havoc Pennington hp at redhat.com
Tue Dec 5 08:14:11 PST 2006


Ray Strode wrote:
>> 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
> utf-8)
> 
> 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.

The basic issue is that DBusString is used for both utf-8 strings and 
binary data. I used unsigned char for most of DBusString, but the utf-8 
strings are all plain char.

Havoc



More information about the dbus mailing list