Chromium Code Reviews

Unified Diff: source/common/ucase.cpp

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « source/common/ucase.h ('k') | source/common/ucase_props_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/ucase.cpp
diff --git a/source/common/ucase.cpp b/source/common/ucase.cpp
index b04c2d40cf0c45a1d669eda6c7ca8c1cd3f5fde1..97ded9ee2d15f6750664517cc96ca73d2c18dc55 100644
--- a/source/common/ucase.cpp
+++ b/source/common/ucase.cpp
@@ -1,3 +1,5 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
@@ -619,6 +621,18 @@ ucase_getCaseLocale(const char *locale, int32_t *locCache) {
result=UCASE_LOC_LITHUANIAN;
}
}
+ } else if(is_e(c)) {
+ /* el or ell? */
+ c=*locale++;
+ if(is_l(c)) {
+ c=*locale++;
+ if(is_l(c)) {
+ c=*locale;
+ }
+ if(is_sep(c)) {
+ result=UCASE_LOC_GREEK;
+ }
+ }
} else if(is_n(c)) {
/* nl or nld? */
c=*locale++;
@@ -801,8 +815,9 @@ U_CAPI int32_t U_EXPORT2
ucase_toFullLower(const UCaseProps *csp, UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- const char *locale, int32_t *locCache)
-{
+ const char *locale, int32_t *locCache) {
+ // The sign of the result has meaning, input must be non-negative so that it can be returned as is.
+ U_ASSERT(c >= 0);
UChar32 result=c;
uint16_t props=UTRIE2_GET16(&csp->trie, c);
if(!PROPS_HAS_EXCEPTION(props)) {
@@ -947,6 +962,8 @@ toUpperOrTitle(const UCaseProps *csp, UChar32 c,
const UChar **pString,
const char *locale, int32_t *locCache,
UBool upperNotTitle) {
+ // The sign of the result has meaning, input must be non-negative so that it can be returned as is.
+ U_ASSERT(c >= 0);
UChar32 result=c;
uint16_t props=UTRIE2_GET16(&csp->trie, c);
if(!PROPS_HAS_EXCEPTION(props)) {
@@ -1155,8 +1172,9 @@ ucase_fold(const UCaseProps *csp, UChar32 c, uint32_t options) {
U_CAPI int32_t U_EXPORT2
ucase_toFullFolding(const UCaseProps *csp, UChar32 c,
const UChar **pString,
- uint32_t options)
-{
+ uint32_t options) {
+ // The sign of the result has meaning, input must be non-negative so that it can be returned as is.
+ U_ASSERT(c >= 0);
UChar32 result=c;
uint16_t props=UTRIE2_GET16(&csp->trie, c);
if(!PROPS_HAS_EXCEPTION(props)) {
« no previous file with comments | « source/common/ucase.h ('k') | source/common/ucase_props_data.h » ('j') | no next file with comments »

Powered by Google App Engine