changeset 1763:96852273c0bc

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>
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Mon, 15 Nov 2010 23:00:10 +0100
parents 433a380f83a1
children e43e68b39066
files src/cssparser.cc
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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;