[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/khtml/css
From:       Maks Orlovich <maksim () kde ! org>
Date:       2009-05-17 16:42:16
Message-ID: 1242578536.863419.28186.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 969198 by orlovich:

automatically merged revision 969195:
Proper fix for what the tail padding stuff was trying to accomplish:
once we get to end of input, keep feeding flex a single buffer with nulls,
rather than let it run past the end. The original flex driver does something 
similar.

Thanks to Andrew Coles for providing a simple testcase so I could understand the issue.

 M  +12 -1     cssparser.cpp  


--- trunk/KDE/kdelibs/khtml/css/cssparser.cpp #969197:969198
@@ -2873,6 +2873,12 @@
     return start;
 }
 
+// When we reach the end of the input we switch over
+// the lexer to this alternative buffer and keep it stuck here.
+// (and as it contains nulls, flex will keep on reporting 
+//  end of buffer, and we will keep reseting the input
+//  pointer to the beginning of this).
+static unsigned short postEofBuf[2];
 
 #define YY_DECL int DOM::CSSParser::lex()
 #define yyconst const
@@ -2892,7 +2898,12 @@
 #define INITIAL 0
 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 #define YY_START ((yy_start - 1) / 2)
-#define yyterminate() yyTok = END; return yyTok
+#define yyterminate()\
+    do { \
+        if (yy_act == YY_END_OF_BUFFER) \
+            yy_c_buf_p = postEofBuf; \
+        yyTok = END; return yyTok; \
+     } while (0)
 #define YY_FATAL_ERROR(a) qFatal(a)
 #define BEGIN yy_start = 1 + 2 *
 #define COMMENT 1
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic