svn commit: samba r19126 - in branches/SAMBA_3_0/source/lib/socket_wrapper: .

tridge at samba.org tridge at samba.org
Fri Oct 6 22:25:34 GMT 2006


Volker,

 > > I think we should change TDB_DATA to use unsigned char *
 > > so that we get the same warnings in samba 3 and 4.
 > > 
 > > But we need to fix all callers in samba3...
 > 
 > Why not change Samba4?

The problem with it being 'char *' is that it contains raw data, and
'char *' will be signed on some platforms and unsigned on others. That
means that a bug may happen on only some platforms, if someone uses
one of the bytes in a calculation. It also tends to spread, as
programmers declare a 'char *' when pulling data out of the TDB_DATA,
and that in turn changes what they declare other functions as.

Ideally we'd only use 'char *' when it really is a string. While we
commonly do put strings in a TDB_DATA, we also put a lot of non-string
data, so we should try to ensure the type has the same properties on
all platforms.

Cheers, Tridge

PS: making the sign of 'char' unspecified in the C standard was a _huge_
mistake :(


More information about the samba-technical mailing list