[SAMBA3] tdb signed vs. unsigned char *

tridge at samba.org tridge at samba.org
Mon Mar 26 02:59:44 GMT 2007


Volker,

 > That's really scary stuff. Not sure I like this as a
 > 4000-liner. The alternative would be to change Samba4's
 > TDB_DATA definition to char....

I changed it from char to unsigned char quite a long time ago to
prevent bugs. It was a pretty big checkin when I changed it, and I
think Samba3 will need a similarly large checkin to fix it there.

Think of it this way - if a bug is introduced by changing TDB to use
"unsigned char" instead of "char" in Samba3, then you must already
have the bug on half the platforms Samba3 runs on. That is because on
half the platforms "char" is in fact already unsigned. So a change
from "char" to "unsigned char" never introduces a bug that isn't
already there! It may introduce large numbers of warnings though.

If tdb had originally used "signed char" then it would be a different
matter. Unfortunately I was silly enough to choose "char", and that
meant I was saying "hey, I don't care if its signed or unsigned". By
changing to "unsigned char" we're saying "ok, so that was dumb, we
_do_ care". 

The original sin was that C didn't specify the sign of char. We're
just paying the price for that (again!).

Cheers, Tridge


More information about the samba-technical mailing list