flex/flex-max_size.patch

38 lines
1.5 KiB
Diff
Raw Normal View History

commit 3946924ed5e77420c453bf841603c7278766093a
Author: rlar <rlar>
Date: Sun Feb 28 15:20:31 2016 +0100
generated code, `max_size' seems to be of type `int', fix casts accordingly
diff --git a/src/gen.c b/src/gen.c
index 21b27ae..d31aab3 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -1875,7 +1875,7 @@ void make_tables (void)
if (!C_plus_plus) {
if (use_read) {
outn ("\terrno=0; \\");
- outn ("\twhile ( (result = (int) read( fileno(yyin), buf, max_size )) < 0 ) \\");
+ outn ("\twhile ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \\");
outn ("\t{ \\");
outn ("\t\tif( errno != EINTR) \\");
outn ("\t\t{ \\");
@@ -1891,7 +1891,7 @@ void make_tables (void)
outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\");
outn ("\t\t{ \\");
outn ("\t\tint c = '*'; \\");
- outn ("\t\tsize_t n; \\");
+ outn ("\t\tint n; \\");
outn ("\t\tfor ( n = 0; n < max_size && \\");
outn ("\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\");
outn ("\t\t\tbuf[n] = (char) c; \\");
@@ -1904,7 +1904,7 @@ void make_tables (void)
outn ("\telse \\");
outn ("\t\t{ \\");
outn ("\t\terrno=0; \\");
- outn ("\t\twhile ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \\");
+ outn ("\t\twhile ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \\");
outn ("\t\t\t{ \\");
outn ("\t\t\tif( errno != EINTR) \\");
outn ("\t\t\t\t{ \\");