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

List:       kde-commits
Subject:    kdelibs/khtml/xml
From:       Andrew Coles <andrew_coles () yahoo ! co ! uk>
Date:       2004-10-19 15:47:34
Message-ID: 20041019154734.6988016BE2 () office ! kde ! org
[Download RAW message or body]

CVS commit by coles: 



Fixed a mistake I put in there earlier, sorry about that....


  M +5 -10     dom_stringimpl.cpp   1.53


--- kdelibs/khtml/xml/dom_stringimpl.cpp  #1.52:1.53
@@ -159,6 +159,5 @@ DOMStringImpl *DOMStringImpl::substring(
 static Length parseLength(const QChar *s, unsigned int l)
 {
-
-    const QChar* last = &(s[l-1]);
+    const QChar* last = s+l-1;
     if (l && *last == QChar('%')) {
         // CSS allows one decimal after the point, like
@@ -165,9 +164,7 @@ static Length parseLength(const QChar *s
         //  42.2%, but not 42.22%
         // we ignore the non-integer part for speed/space reasons
-
         int i = QConstString(s, l).string().findRev('.');
-        if ( i >= 0 && i < (int)l-1 ) {
+        if ( i >= 0 && i < (int)l-1 )
             l = i + 1;
-        }
 
         bool ok;
@@ -178,13 +175,12 @@ static Length parseLength(const QChar *s
 
         // in case of weird constructs like 5*%
-        last-=sizeof(QChar);
+        last--;
         l--;
     }
 
-    if (l == 0) { // if the string passed is just a single % character this prevents \
accessing invalid memory +    if (l == 0)
         return Length(0, Variable);
-    }
 
-    if ( *last == QChar('*')) {
+    if ( *last == '*') {
         if(last == s)
             return Length(1, Relative);


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

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