# HG changeset patch # User Johannes Hofmann # Date 1289858410 -3600 # Node ID 96852273c0bc3c2a47f0240533052ab03141e6b4 # Parent 433a380f83a138bcabfb1cef37230096f848a167 fix bug comment handling of CssParser The skipString() method of CssParser was eating one char too much in case of a match. This caused e.g. empty comments (/**/) to be misinterpreted. Noticed and tracked down by: Jeremy Henty diff -r 433a380f83a1 -r 96852273c0bc src/cssparser.cc --- a/src/cssparser.cc Mon Nov 15 17:08:26 2010 -0300 +++ b/src/cssparser.cc Mon Nov 15 23:00:10 2010 +0100 @@ -447,21 +447,21 @@ /* * Skip string str if it is found in the input buffer. + * If string is found leave bufptr pointing to last matched char. * If not wind back. The first char is passed as parameter c * to avoid unnecessary getChar() / ungetChar() calls. */ inline bool CssParser::skipString(int c, const char *str) { - int n = 0; + for (int n = 0; str[n]; n++) { + if (n > 0) + c = getChar(); - while (str[n]) { if (str[n] != c) { while (n--) ungetChar(); return false; } - c = getChar(); - n++; } return true;