monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] basic_io not binary transparent?


From: Nathaniel J. Smith
Subject: Re: [Monotone-devel] basic_io not binary transparent?
Date: Sat, 9 Dec 2006 13:18:53 -0800
User-agent: Mutt/1.2.5.1i

On Fri, Dec 08, 2006 at 11:24:05PM +0100, Christof Petig wrote:
> Actually the NUL byte turned out to be not the real problem, the problem
> was the 0xff byte following the NUL bytes which terminated the string.
> (int(char(0xff))==EOF on intel machines)

Ah, sign-extending is wonderful.

> Patch:
> ============================================================
> --- basic_io.hh       d8c0da1addf5ce3ebda40f4508db86375620343a
> +++ basic_io.hh       2d6d4c0e33715ae8addbf0467dc535edbd88f683
> @@ -78,7 +78,7 @@ namespace basic_io
>      inline void peek()
>      {
>        if (LIKELY(curr != in.end()))
> -     lookahead = *curr;
> +     lookahead = *curr & 0xff;

Using:
  lookahead = widen<int,char>(*curr);
is better (I guess maybe with a comment?  this is exactly the sort of
situation widen<> is designed for, though), and this patch appears to
use tabs instead of spaces for indentation, but yeah, fine to commit.

-- Nathaniel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]