]> granicus.if.org Git - flex/commitdiff
Fixed bug in interactive reads where char is unsigned
authorVern Paxson <vern@ee.lbl.gov>
Thu, 9 Dec 1993 13:58:09 +0000 (13:58 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Thu, 9 Dec 1993 13:58:09 +0000 (13:58 +0000)
gen.c

diff --git a/gen.c b/gen.c
index e25160dc56379371ea8db504d4ebdfc79144a74b..11dfb504b18c5232f7e20d6235da335ff59bbe9e 100644 (file)
--- a/gen.c
+++ b/gen.c
@@ -1255,10 +1255,13 @@ void make_tables()
                        {
                        printf(
                        "\tif ( yy_current_buffer->is_interactive ) \\\n" );
+                       printf( "\t\t{ \\\n" );
+                       printf( "\t\tint c = getc( yyin ); \\\n" );
+                       printf( "\t\tresult = c == EOF ? 0 : 1; \\\n" );
+                       printf( "\t\tbuf[0] = (char) c; \\\n" );
+                       printf( "\t\t} \\\n" );
                        printf(
-"\t\tresult = ((int) (buf[0] = getc( yyin ))) == EOF ? 0 : 1; \\\n" );
-                       printf(
-"\telse if ( ((result = fread( (char *) buf, 1, max_size, yyin )) == 0)\\\n" );
+       "\telse if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \\\n" );
                        printf( "\t\t  && ferror( yyin ) ) \\\n" );
                        printf(
                "\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" );\n" );