From kde-commits Tue Oct 19 15:47:34 2004 From: Andrew Coles Date: Tue, 19 Oct 2004 15:47:34 +0000 To: kde-commits Subject: kdelibs/khtml/xml Message-Id: <20041019154734.6988016BE2 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=109820086230295 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);