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

Unified Diff: source/i18n/regexst.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/i18n/regeximp.h ('k') | source/i18n/region.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/regexst.cpp
diff --git a/source/i18n/regexst.cpp b/source/i18n/regexst.cpp
index fa61c3de401ead00bc3992f4435057cebdd6e0c2..a8cbf23f86b9f02d98c57d17044920dca9a529a9 100644
--- a/source/i18n/regexst.cpp
+++ b/source/i18n/regexst.cpp
@@ -1,7 +1,7 @@
//
// regexst.h
//
-// Copyright (C) 2004-2013, International Business Machines Corporation and others.
+// Copyright (C) 2004-2015, International Business Machines Corporation and others.
// All Rights Reserved.
//
// This file contains class RegexStaticSets
@@ -55,11 +55,6 @@ static const UChar gRuleSet_rule_char_pattern[] = {
// \ { \ } \ ^ \ $ \ | \ \ \ . ]
0x5c, 0x7b,0x5c, 0x7d, 0x5c, 0x5e, 0x5c, 0x24, 0x5c, 0x7c, 0x5c, 0x5c, 0x5c, 0x2e, 0x5d, 0};
-
-static const UChar gRuleSet_digit_char_pattern[] = {
-// [ 0 - 9 ]
- 0x5b, 0x30, 0x2d, 0x39, 0x5d, 0};
-
//
// Here are the backslash escape characters that ICU's unescape() function
// will handle.
@@ -213,23 +208,29 @@ fEmptyText(NULL)
// Sets used while parsing rules, but not referenced from the parse state table
fRuleSets[kRuleSet_rule_char-128] = UnicodeSet(UnicodeString(TRUE, gRuleSet_rule_char_pattern, -1), *status);
- fRuleSets[kRuleSet_digit_char-128] = UnicodeSet(UnicodeString(TRUE, gRuleSet_digit_char_pattern, -1), *status);
+ fRuleSets[kRuleSet_digit_char-128].add((UChar)0x30, (UChar)0x39); // [0-9]
+ fRuleSets[kRuleSet_ascii_letter-128].add((UChar)0x41, (UChar)0x5A); // [A-Z]
+ fRuleSets[kRuleSet_ascii_letter-128].add((UChar)0x61, (UChar)0x7A); // [a-z]
fRuleDigitsAlias = &fRuleSets[kRuleSet_digit_char-128];
- for (i=0; i<(int32_t)(sizeof(fRuleSets)/sizeof(fRuleSets[0])); i++) {
+ for (i=0; i<UPRV_LENGTHOF(fRuleSets); i++) {
fRuleSets[i].compact();
}
// Finally, initialize an empty string for utility purposes
fEmptyText = utext_openUChars(NULL, NULL, 0, status);
- return; // If we reached this point, everything is fine so just exit
+ if (U_SUCCESS(*status)) {
+ return;
+ }
ExitConstrDeleteAll: // Remove fPropSets and fRuleSets and return error
for (i=0; i<URX_LAST_SET; i++) {
delete fPropSets[i];
fPropSets[i] = NULL;
}
- *status = U_MEMORY_ALLOCATION_ERROR;
+ if (U_SUCCESS(*status)) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ }
}
« no previous file with comments | « source/i18n/regeximp.h ('k') | source/i18n/region.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698