[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdelibs/kjs
From: Harri Porten <porten () kde ! org>
Date: 2007-02-24 15:52:55
Message-ID: 1172332375.408737.20010.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 636886 by porten:
backported rev 636881 that ensure escaping of special chars
hmmm. null handling does not seem to work in the branch.
M +24 -6 regexp.cpp
--- branches/KDE/3.5/kdelibs/kjs/regexp.cpp #636885:636886
@@ -69,12 +69,30 @@
if (Lexer::isHexDigit(c0) && Lexer::isHexDigit(c1) &&
Lexer::isHexDigit(c2) && Lexer::isHexDigit(c3)) {
c = Lexer::convertUnicode(c0, c1, c2, c3);
- if (c.unicode() == 0) {
- // Make sure to encode 0, to avoid terminating the string
- intern += UString(nil);
- } else {
- intern += UString(&c, 1);
- }
+ switch (c.unicode()) {
+ case 0:
+ // Make sure to encode 0, to avoid terminating the string
+ fprintf(stderr, "NULL escape\n");
+ intern += UString(nil);
+ break;
+ case '^':
+ case '$':
+ case '\\':
+ case '.':
+ case '*':
+ case '+':
+ case '?':
+ case '(': case ')':
+ case '{': case '}':
+ case '[': case ']':
+ case '|':
+ // escape pattern characters have to remain escaped
+ intern.append(UString('\\'));
+ // intentional fallthrough
+ default:
+ intern += UString(&c, 1);
+ break;
+ }
i += 4;
continue;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic