Pārlūkot izejas kodu

more generic fix for flex version

David Rose 16 gadi atpakaļ
vecāks
revīzija
3c79e6b042
1 mainītis faili ar 9 papildinājumiem un 2 dzēšanām
  1. 9 2
      panda/src/egg/lexer.lxx

+ 9 - 2
panda/src/egg/lexer.lxx

@@ -162,7 +162,7 @@ eggyywarning(ostringstream &strm) {
 // Now define a function to take input from an istream instead of a
 // Now define a function to take input from an istream instead of a
 // stdio FILE pointer.  This is flex-specific.
 // stdio FILE pointer.  This is flex-specific.
 static void
 static void
-input_chars(char *buffer, yy_size_t &result, int max_size) {
+input_chars(char *buffer, int &result, int max_size) {
   nassertv(inp != NULL);
   nassertv(inp != NULL);
   if (*inp) {
   if (*inp) {
     inp->read(buffer, max_size);
     inp->read(buffer, max_size);
@@ -193,7 +193,14 @@ input_chars(char *buffer, yy_size_t &result, int max_size) {
   Thread::consider_yield();
   Thread::consider_yield();
 }
 }
 #undef YY_INPUT
 #undef YY_INPUT
-#define YY_INPUT(buffer, result, max_size) input_chars(buffer, result, max_size)
+
+// Define this macro carefully, since different flex versions call it
+// with a different type for result.
+#define YY_INPUT(buffer, result, max_size) { \
+  int int_result; \
+  input_chars((buffer), int_result, (max_size)); \
+  (result) = int_result; \
+}
 
 
 // read_char reads and returns a single character, incrementing the
 // read_char reads and returns a single character, incrementing the
 // supplied line and column numbers as appropriate.  A convenience
 // supplied line and column numbers as appropriate.  A convenience