From 8aaf8bbcc18ca3748809fede4773b19b04135f94 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 15 Nov 2010 23:00:10 +0100 Subject: 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 --- src/cssparser.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/cssparser.cc b/src/cssparser.cc index 66bf8340..7d5e3ae3 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -447,21 +447,21 @@ void CssParser::ungetChar() /* * 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; -- cgit v1.2.3