diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-11-15 23:00:10 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-11-15 23:00:10 +0100 |
commit | 8aaf8bbcc18ca3748809fede4773b19b04135f94 (patch) | |
tree | 0a3520401608d46ec8e25b625e9182bc3fba2069 | |
parent | 05d74c53219b17ad111a64b0fe4beed5a0752857 (diff) |
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 <onepoint@starurchin.org>
-rw-r--r-- | src/cssparser.cc | 8 |
1 files changed, 4 insertions, 4 deletions
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; |