summaryrefslogtreecommitdiffstats
path: root/thirdparty/icu4c/common/uniset_props.cpp
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-10-29 19:25:49 -0500
committerThaddeus Crews <repiteo@outlook.com>2024-10-29 19:25:49 -0500
commit49cf7996e16b0e9b7b2b77e94085d18de21ece1b (patch)
tree07cf2a09367618d1eefb5b2e49b1b600bcaaba44 /thirdparty/icu4c/common/uniset_props.cpp
parent05a4620e88fc454e844f69e87a6eb444426c2a6e (diff)
parente698870caa3dff7234f0a4433b1751834b9e7811 (diff)
downloadredot-engine-49cf7996e16b0e9b7b2b77e94085d18de21ece1b.tar.gz
Merge pull request #98496 from bruvzg/icu761
Update ICU to 76.1
Diffstat (limited to 'thirdparty/icu4c/common/uniset_props.cpp')
-rw-r--r--thirdparty/icu4c/common/uniset_props.cpp47
1 files changed, 25 insertions, 22 deletions
diff --git a/thirdparty/icu4c/common/uniset_props.cpp b/thirdparty/icu4c/common/uniset_props.cpp
index e6f880c9f2..532b17f506 100644
--- a/thirdparty/icu4c/common/uniset_props.cpp
+++ b/thirdparty/icu4c/common/uniset_props.cpp
@@ -47,14 +47,17 @@
U_NAMESPACE_USE
+namespace {
+
// Special property set IDs
-static const char ANY[] = "ANY"; // [\u0000-\U0010FFFF]
-static const char ASCII[] = "ASCII"; // [\u0000-\u007F]
-static const char ASSIGNED[] = "Assigned"; // [:^Cn:]
+constexpr char ANY[] = "ANY"; // [\u0000-\U0010FFFF]
+constexpr char ASCII[] = "ASCII"; // [\u0000-\u007F]
+constexpr char ASSIGNED[] = "Assigned"; // [:^Cn:]
// Unicode name property alias
-#define NAME_PROP "na"
-#define NAME_PROP_LENGTH 2
+constexpr char16_t NAME_PROP[] = u"na";
+
+} // namespace
// Cached sets ------------------------------------------------------------- ***
@@ -83,7 +86,7 @@ namespace {
// Cache some sets for other services -------------------------------------- ***
void U_CALLCONV createUni32Set(UErrorCode &errorCode) {
U_ASSERT(uni32Singleton == nullptr);
- uni32Singleton = new UnicodeSet(UNICODE_STRING_SIMPLE("[:age=3.2:]"), errorCode);
+ uni32Singleton = new UnicodeSet(UnicodeString(u"[:age=3.2:]"), errorCode);
if(uni32Singleton==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
} else {
@@ -209,7 +212,7 @@ UnicodeSet::applyPatternIgnoreSpace(const UnicodeString& pattern,
*/
UBool UnicodeSet::resemblesPattern(const UnicodeString& pattern, int32_t pos) {
return ((pos+1) < pattern.length() &&
- pattern.charAt(pos) == (char16_t)91/*[*/) ||
+ pattern.charAt(pos) == static_cast<char16_t>(91)/*[*/) ||
resemblesPropertyPattern(pattern, pos);
}
@@ -471,7 +474,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
case u'-':
if (op == 0) {
if (lastItem != 0) {
- op = (char16_t) c;
+ op = static_cast<char16_t>(c);
continue;
} else {
// Treat final trailing '-' as a literal
@@ -490,7 +493,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
return;
case u'&':
if (lastItem == 2 && op == 0) {
- op = (char16_t) c;
+ op = static_cast<char16_t>(c);
continue;
}
// syntaxError(chars, "'&' not after set");
@@ -561,7 +564,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
}
add(U_ETHER);
usePat = true;
- patLocal.append((char16_t) SymbolTable::SYMBOL_REF);
+ patLocal.append(static_cast<char16_t>(SymbolTable::SYMBOL_REF));
patLocal.append(u']');
mode = 2;
continue;
@@ -658,11 +661,11 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
namespace {
UBool numericValueFilter(UChar32 ch, void* context) {
- return u_getNumericValue(ch) == *(double*)context;
+ return u_getNumericValue(ch) == *static_cast<double*>(context);
}
UBool generalCategoryMaskFilter(UChar32 ch, void* context) {
- int32_t value = *(int32_t*)context;
+ int32_t value = *static_cast<int32_t*>(context);
return (U_GET_GC_MASK((UChar32) ch) & value) != 0;
}
@@ -670,7 +673,7 @@ UBool versionFilter(UChar32 ch, void* context) {
static const UVersionInfo none = { 0, 0, 0, 0 };
UVersionInfo v;
u_charAge(ch, v);
- UVersionInfo* version = (UVersionInfo*)context;
+ UVersionInfo* version = static_cast<UVersionInfo*>(context);
return uprv_memcmp(&v, &none, sizeof(v)) > 0 && uprv_memcmp(&v, version, sizeof(v)) <= 0;
}
@@ -680,16 +683,16 @@ typedef struct {
} IntPropertyContext;
UBool intPropertyFilter(UChar32 ch, void* context) {
- IntPropertyContext* c = (IntPropertyContext*)context;
- return u_getIntPropertyValue((UChar32) ch, c->prop) == c->value;
+ IntPropertyContext* c = static_cast<IntPropertyContext*>(context);
+ return u_getIntPropertyValue(ch, c->prop) == c->value;
}
UBool scriptExtensionsFilter(UChar32 ch, void* context) {
- return uscript_hasScript(ch, *(UScriptCode*)context);
+ return uscript_hasScript(ch, *static_cast<UScriptCode*>(context));
}
UBool idTypeFilter(UChar32 ch, void* context) {
- return u_hasIDType(ch, *(UIdentifierType*)context);
+ return u_hasIDType(ch, *static_cast<UIdentifierType*>(context));
}
} // namespace
@@ -738,7 +741,7 @@ void UnicodeSet::applyFilter(UnicodeSet::Filter filter,
}
}
if (startHasProperty >= 0) {
- add((UChar32)startHasProperty, (UChar32)0x10FFFF);
+ add(startHasProperty, static_cast<UChar32>(0x10FFFF));
}
if (isBogus() && U_SUCCESS(status)) {
// We likely ran out of memory. AHHH!
@@ -784,11 +787,11 @@ UnicodeSet::applyIntPropertyValue(UProperty prop, int32_t value, UErrorCode& ec)
applyFilter(generalCategoryMaskFilter, &value, inclusions, ec);
} else if (prop == UCHAR_SCRIPT_EXTENSIONS) {
const UnicodeSet* inclusions = CharacterProperties::getInclusionsForProperty(prop, ec);
- UScriptCode script = (UScriptCode)value;
+ UScriptCode script = static_cast<UScriptCode>(value);
applyFilter(scriptExtensionsFilter, &script, inclusions, ec);
} else if (prop == UCHAR_IDENTIFIER_TYPE) {
const UnicodeSet* inclusions = CharacterProperties::getInclusionsForProperty(prop, ec);
- UIdentifierType idType = (UIdentifierType)value;
+ UIdentifierType idType = static_cast<UIdentifierType>(value);
applyFilter(idTypeFilter, &idType, inclusions, ec);
} else if (0 <= prop && prop < UCHAR_BINARY_LIMIT) {
if (value == 0 || value == 1) {
@@ -862,7 +865,7 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
// We catch NaN here because comparing it with both 0 and 255 will be false
// (as are all comparisons with NaN).
if (*end != 0 || !(0 <= val && val <= 255) ||
- (v = (int32_t)val) != val) {
+ (v = static_cast<int32_t>(val)) != val) {
// non-integral value or outside 0..255, or trailing junk
FAIL(ec);
}
@@ -1105,7 +1108,7 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern,
// support args of (UProperty, char*) then we can remove
// NAME_PROP and make this a little more efficient.
valueName = propName;
- propName = UnicodeString(NAME_PROP, NAME_PROP_LENGTH, US_INV);
+ propName = NAME_PROP;
}
}