]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cc: fix lexbody for negative chars
authorRuss Cox <rsc@golang.org>
Mon, 10 Jun 2013 20:13:25 +0000 (16:13 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 10 Jun 2013 20:13:25 +0000 (16:13 -0400)
The new code matches the code in cc/lex.c and the #define GETC.
This was causing problems scanning runtime·foo if the leading
· byte was returned by the buffer fill.

R=ken2
CC=golang-dev
https://golang.org/cl/10167043

src/cmd/cc/lexbody

index c5d51b8fb69bf5f349529033ad0c682a036d3682..ccc0c405d0e39b4d6b42225161ae56d4940286a5 100644 (file)
@@ -665,7 +665,7 @@ loop:
                goto pop;
        }
        fi.p = i->b + 1;
-       return i->b[0];
+       return i->b[0] & 0xff;
 
 pop:
        iostack = i->link;
@@ -678,7 +678,7 @@ pop:
        fi.c = i->c;
        if(--fi.c < 0)
                goto loop;
-       return *fi.p++;
+       return *fi.p++ & 0xff;
 }
 
 void