Token.c appears to have a bug.

Wayne Davison wayned at
Tue Oct 14 10:41:56 EST 2003

On Mon, Oct 13, 2003 at 04:54:20PM -0700, jw schultz wrote:
> Having looked at that bit of code now.  I am a bit concerned about the
> use of shift operators on signed integers here.

I don't see the problem with regard to this code because we're only
looking at bits that where known to exist in the var before the shift
(i.e. no sign-extended bits have any effect).  Also, your proposed
change doesn't affect the shifting at all -- you'd have to cast the "n"
to unsigned before shifting it, not cast the result to unsigned after
shifting it.  Since the code we're calling is expecting a "char *", I
think we should leave the type of temp_byte unchanged.

> Habit also makes me shy of relying on char being 8 bits but that is
> probably overcautious.

I think a lot of things would fail in the code if "char" wasn't 8 bits.


More information about the rsync mailing list