Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Side by Side Diff: icu52/patches/rematch.patch

Issue 224943002: icu local change part1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: function indentation changed Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « icu52/patches/regex.patch ('k') | icu52/patches/rtti.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 Index: source/i18n/rematch.cpp
2 ===================================================================
3 --- source/i18n/rematch.cpp (revision 98343)
4 +++ source/i18n/rematch.cpp (working copy)
5 @@ -5598,6 +5598,7 @@
6 const UChar *foldChars = NULL;
7 int32_t foldOffset, foldLength;
8 UChar32 c;
9 + UBool c_is_valid = FALSE;
10
11 #ifdef REGEX_SMART_BACKTRACKING
12 int32_t originalInputIdx = fp->fInputIdx;
13 @@ -5607,23 +5608,31 @@
14 foldOffset = foldLength = 0;
15
16 while (patternChars < patternEnd && success) {
17 - if(foldOffset < foldLength) {
18 - U16_NEXT_UNSAFE(foldChars, foldOffset, c);
19 - } else {
20 - U16_NEXT(inputBuf, fp->fInputIdx, fActiveLimit, c);
21 - foldLength = ucase_toFullFolding(csp, c, &foldChars , U_FOLD_CASE_DEFAULT);
22 - if(foldLength >= 0) {
23 - if(foldLength <= UCASE_MAX_STRING_LENGTH) { / / !!!: Does not correctly handle chars that fold to 0-length strings
24 - foldOffset = 0;
25 - U16_NEXT_UNSAFE(foldChars, foldOffset, c);
26 - } else {
27 - c = foldLength;
28 - foldLength = foldOffset; // to avoid readin g chars from the folding buffer
29 + if (fp->fInputIdx < fActiveLimit) { // don't read past end of string
30 + if(foldOffset < foldLength) {
31 + U16_NEXT_UNSAFE(foldChars, foldOffset, c);
32 + c_is_valid = TRUE;
33 + } else {
34 + // test pre-condition of U16_NEXT: i < length
35 + U_ASSERT(fp->fInputIdx < fActiveLimit);
36 + U16_NEXT(inputBuf, fp->fInputIdx, fActiveLimit, c);
37 + c_is_valid = TRUE;
38 + foldLength = ucase_toFullFolding(csp, c, &foldC hars, U_FOLD_CASE_DEFAULT);
39 + if(foldLength >= 0) {
40 + if(foldLength <= UCASE_MAX_STRING_LENGTH) { // !!!: Does not correctly handle chars that fold to 0-length strings
41 + foldOffset = 0;
42 + U16_NEXT_UNSAFE(foldChars, foldOffset, c);
43 + } else {
44 + c = foldLength;
45 + foldLength = foldOffset; // to avoid re ading chars from the folding buffer
46 + }
47 }
48 }
49 + } else {
50 + c_is_valid = FALSE;
51 }
52
53 - if (fp->fInputIdx <= fActiveLimit) {
54 + if (fp->fInputIdx <= fActiveLimit && c_is_valid) {
55 if (U_IS_BMP(c)) {
56 success = (*patternChars == c);
57 patternChars += 1;
58 @@ -6070,4 +6079,3 @@
59 U_NAMESPACE_END
60
61 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS
62 -
OLDNEW
« no previous file with comments | « icu52/patches/regex.patch ('k') | icu52/patches/rtti.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698