MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / normalize

Method normalize

src/common/unicode_util.cpp:2077–2110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2075
2076
2077void UnicodeUtil::Utf16Collation::normalize(ULONG* strLen, const USHORT** str, bool forNumericSort,
2078 HalfStaticArray<USHORT, BUFFER_SMALL / 2>& buffer) const
2079{
2080 fb_assert(*strLen % sizeof(**str) == 0);
2081
2082 if (forNumericSort && !numericSort)
2083 return;
2084
2085 if (attributes & TEXTTYPE_ATTR_CASE_INSENSITIVE)
2086 {
2087 *strLen = utf16UpperCase(*strLen, *str, *strLen,
2088 buffer.getBuffer(*strLen / sizeof(USHORT)), NULL);
2089 *str = buffer.begin();
2090
2091 if (attributes & TEXTTYPE_ATTR_ACCENT_INSENSITIVE)
2092 {
2093 UTransliterator* trans = icu->getCiAiTransliterator();
2094
2095 if (trans)
2096 {
2097 const int32_t capacity = buffer.getCount();
2098 int32_t len = *strLen / sizeof(USHORT);
2099 int32_t limit = len;
2100
2101 UErrorCode errorCode = U_ZERO_ERROR;
2102 icu->utransTransUChars(trans, reinterpret_cast<UChar*>(buffer.begin()),
2103 &len, capacity, 0, &limit, &errorCode);
2104 icu->releaseCiAiTransliterator(trans);
2105
2106 *strLen = len * sizeof(USHORT);
2107 }
2108 }
2109 }
2110}
2111
2112
2113} // namespace Jrd

Callers

nothing calls this directly

Calls 5

getCiAiTransliteratorMethod · 0.80
getBufferMethod · 0.45
beginMethod · 0.45
getCountMethod · 0.45

Tested by

no test coverage detected