Todd C. Miller:

> On Thu, 30 Sep 2021 21:37:06 +0200, Christian Weisgerber wrote:
> 
> > Unfortunately that also affects the parsebuf/pushback_buffer complex
> > used in some parser.y files.
> 
> That would require a few extra casts but it is straightforward.

E.g. like this?

Index: bin/chio/parse.y
===================================================================
RCS file: /cvs/src/bin/chio/parse.y,v
retrieving revision 1.23
diff -u -p -r1.23 parse.y
--- bin/chio/parse.y    15 Oct 2020 19:42:56 -0000      1.23
+++ bin/chio/parse.y    30 Sep 2021 20:13:12 -0000
@@ -179,9 +179,9 @@ lookup(char *s)
 
 #define MAXPUSHBACK    128
 
-u_char *parsebuf;
+char   *parsebuf;
 int     parseindex;
-u_char  pushback_buffer[MAXPUSHBACK];
+char    pushback_buffer[MAXPUSHBACK];
 int     pushback_index = 0;
 
 int
@@ -192,7 +192,7 @@ lgetc(int quotec)
        if (parsebuf) {
                /* Read character from the parsebuffer instead of input. */
                if (parseindex >= 0) {
-                       c = parsebuf[parseindex++];
+                       c = (unsigned char)parsebuf[parseindex++];
                        if (c != '\0')
                                return (c);
                        parsebuf = NULL;
@@ -201,7 +201,7 @@ lgetc(int quotec)
        }
 
        if (pushback_index)
-               return (pushback_buffer[--pushback_index]);
+               return ((unsigned char)pushback_buffer[--pushback_index]);
 
        if (quotec) {
                if ((c = getc(file->stream)) == EOF) {
@@ -243,7 +243,7 @@ lungetc(int c)
                        return (c);
        }
        if (pushback_index < MAXPUSHBACK-1)
-               return (pushback_buffer[pushback_index++] = c);
+               return (unsigned char)(pushback_buffer[pushback_index++] = c);
        else
                return (EOF);
 }
@@ -272,8 +272,8 @@ findeol(void)
 int
 yylex(void)
 {
-       u_char   buf[8096];
-       u_char  *p;
+       char     buf[8096];
+       char    *p;
        int      quotec, next, c;
        int      token;
 
@@ -353,8 +353,8 @@ yylex(void)
                } else {
 nodigits:
                        while (p > buf + 1)
-                               lungetc(*--p);
-                       c = *--p;
+                               lungetc((unsigned char)*--p);
+                       c = (unsigned char)*--p;
                        if (c == '-')
                                return (c);
                }

-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to