[SAMBA3] tdb signed vs. unsigned char *

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Mar 26 05:59:43 GMT 2007


On Mon, Mar 26, 2007 at 12:59:44PM +1000, tridge at samba.org wrote:
>  > 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!).

But then I would prefer a _pure_ char -> unsigned char patch
without any strlen() vs strlen()+1 stuff in.

Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20070326/2bb5e32e/attachment.bin


More information about the samba-technical mailing list