Skip to content

Commit 331f0b3

Browse files
targoscodebytere
authored andcommitted
deps: update to ICU 67.1
Refs: https://github.com/unicode-org/icu/releases/tag/release-67-1 PR-URL: #33324 Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Steven R Loomis <[email protected]>
1 parent d292633 commit 331f0b3

File tree

172 files changed

+6388
-3448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+6388
-3448
lines changed

deps/icu-small/README-FULL-ICU.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ICU sources - auto generated by shrink-icu-src.py
22

33
This directory contains the ICU subset used by --with-intl=full-icu
4-
It is a strict subset of ICU 66 source files with the following exception(s):
5-
* deps/icu-small/source/data/in/icudt66l.dat.bz2 : compressed data file
4+
It is a strict subset of ICU 67 source files with the following exception(s):
5+
* deps/icu-small/source/data/in/icudt67l.dat.bz2 : compressed data file
66

77

88
To rebuild this directory, see ../../tools/icu/README.md

deps/icu-small/source/common/brkiter.cpp

+27-8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "uresimp.h"
3939
#include "uassert.h"
4040
#include "ubrkimpl.h"
41+
#include "utracimp.h"
4142
#include "charstr.h"
4243

4344
// *****************************************************************************
@@ -412,28 +413,41 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
412413
BreakIterator *result = NULL;
413414
switch (kind) {
414415
case UBRK_CHARACTER:
415-
result = BreakIterator::buildInstance(loc, "grapheme", status);
416+
{
417+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_CHARACTER);
418+
result = BreakIterator::buildInstance(loc, "grapheme", status);
419+
UTRACE_EXIT_STATUS(status);
420+
}
416421
break;
417422
case UBRK_WORD:
418-
result = BreakIterator::buildInstance(loc, "word", status);
423+
{
424+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_WORD);
425+
result = BreakIterator::buildInstance(loc, "word", status);
426+
UTRACE_EXIT_STATUS(status);
427+
}
419428
break;
420429
case UBRK_LINE:
421-
uprv_strcpy(lbType, "line");
422430
{
431+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_LINE);
432+
uprv_strcpy(lbType, "line");
423433
char lbKeyValue[kKeyValueLenMax] = {0};
424434
UErrorCode kvStatus = U_ZERO_ERROR;
425435
int32_t kLen = loc.getKeywordValue("lb", lbKeyValue, kKeyValueLenMax, kvStatus);
426436
if (U_SUCCESS(kvStatus) && kLen > 0 && (uprv_strcmp(lbKeyValue,"strict")==0 || uprv_strcmp(lbKeyValue,"normal")==0 || uprv_strcmp(lbKeyValue,"loose")==0)) {
427437
uprv_strcat(lbType, "_");
428438
uprv_strcat(lbType, lbKeyValue);
429439
}
440+
result = BreakIterator::buildInstance(loc, lbType, status);
441+
442+
UTRACE_DATA1(UTRACE_INFO, "lb=%s", lbKeyValue);
443+
UTRACE_EXIT_STATUS(status);
430444
}
431-
result = BreakIterator::buildInstance(loc, lbType, status);
432445
break;
433446
case UBRK_SENTENCE:
434-
result = BreakIterator::buildInstance(loc, "sentence", status);
435-
#if !UCONFIG_NO_FILTERED_BREAK_ITERATION
436447
{
448+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_SENTENCE);
449+
result = BreakIterator::buildInstance(loc, "sentence", status);
450+
#if !UCONFIG_NO_FILTERED_BREAK_ITERATION
437451
char ssKeyValue[kKeyValueLenMax] = {0};
438452
UErrorCode kvStatus = U_ZERO_ERROR;
439453
int32_t kLen = loc.getKeywordValue("ss", ssKeyValue, kKeyValueLenMax, kvStatus);
@@ -444,11 +458,16 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
444458
delete fbiBuilder;
445459
}
446460
}
447-
}
448461
#endif
462+
UTRACE_EXIT_STATUS(status);
463+
}
449464
break;
450465
case UBRK_TITLE:
451-
result = BreakIterator::buildInstance(loc, "title", status);
466+
{
467+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_TITLE);
468+
result = BreakIterator::buildInstance(loc, "title", status);
469+
UTRACE_EXIT_STATUS(status);
470+
}
452471
break;
453472
default:
454473
status = U_ILLEGAL_ARGUMENT_ERROR;

deps/icu-small/source/common/cmemory.h

+102-18
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t le
274274
*
275275
* WARNING: MaybeStackArray only works with primitive (plain-old data) types.
276276
* It does NOT know how to call a destructor! If you work with classes with
277-
* destructors, consider LocalArray in localpointer.h or MemoryPool.
277+
* destructors, consider:
278+
*
279+
* - LocalArray in localpointer.h if you know the length ahead of time
280+
* - MaybeStackVector if you know the length at runtime
278281
*/
279282
template<typename T, int32_t stackCapacity>
280283
class MaybeStackArray {
@@ -684,26 +687,26 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t l
684687
template<typename T, int32_t stackCapacity = 8>
685688
class MemoryPool : public UMemory {
686689
public:
687-
MemoryPool() : count(0), pool() {}
690+
MemoryPool() : fCount(0), fPool() {}
688691

689692
~MemoryPool() {
690-
for (int32_t i = 0; i < count; ++i) {
691-
delete pool[i];
693+
for (int32_t i = 0; i < fCount; ++i) {
694+
delete fPool[i];
692695
}
693696
}
694697

695698
MemoryPool(const MemoryPool&) = delete;
696699
MemoryPool& operator=(const MemoryPool&) = delete;
697700

698-
MemoryPool(MemoryPool&& other) U_NOEXCEPT : count(other.count),
699-
pool(std::move(other.pool)) {
700-
other.count = 0;
701+
MemoryPool(MemoryPool&& other) U_NOEXCEPT : fCount(other.fCount),
702+
fPool(std::move(other.fPool)) {
703+
other.fCount = 0;
701704
}
702705

703706
MemoryPool& operator=(MemoryPool&& other) U_NOEXCEPT {
704-
count = other.count;
705-
pool = std::move(other.pool);
706-
other.count = 0;
707+
fCount = other.fCount;
708+
fPool = std::move(other.fPool);
709+
other.fCount = 0;
707710
return *this;
708711
}
709712

@@ -716,20 +719,101 @@ class MemoryPool : public UMemory {
716719
*/
717720
template<typename... Args>
718721
T* create(Args&&... args) {
719-
int32_t capacity = pool.getCapacity();
720-
if (count == capacity &&
721-
pool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity,
722-
capacity) == nullptr) {
722+
int32_t capacity = fPool.getCapacity();
723+
if (fCount == capacity &&
724+
fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity,
725+
capacity) == nullptr) {
723726
return nullptr;
724727
}
725-
return pool[count++] = new T(std::forward<Args>(args)...);
728+
return fPool[fCount++] = new T(std::forward<Args>(args)...);
726729
}
727730

728-
private:
729-
int32_t count;
730-
MaybeStackArray<T*, stackCapacity> pool;
731+
/**
732+
* @return Number of elements that have been allocated.
733+
*/
734+
int32_t count() const {
735+
return fCount;
736+
}
737+
738+
protected:
739+
int32_t fCount;
740+
MaybeStackArray<T*, stackCapacity> fPool;
741+
};
742+
743+
/**
744+
* An internal Vector-like implementation based on MemoryPool.
745+
*
746+
* Heap-allocates each element and stores pointers.
747+
*
748+
* To append an item to the vector, use emplaceBack.
749+
*
750+
* MaybeStackVector<MyType> vector;
751+
* MyType* element = vector.emplaceBack();
752+
* if (!element) {
753+
* status = U_MEMORY_ALLOCATION_ERROR;
754+
* }
755+
* // do stuff with element
756+
*
757+
* To loop over the vector, use a for loop with indices:
758+
*
759+
* for (int32_t i = 0; i < vector.length(); i++) {
760+
* MyType* element = vector[i];
761+
* }
762+
*/
763+
template<typename T, int32_t stackCapacity = 8>
764+
class MaybeStackVector : protected MemoryPool<T, stackCapacity> {
765+
public:
766+
using MemoryPool<T, stackCapacity>::MemoryPool;
767+
using MemoryPool<T, stackCapacity>::operator=;
768+
769+
template<typename... Args>
770+
T* emplaceBack(Args&&... args) {
771+
return this->create(args...);
772+
}
773+
774+
int32_t length() const {
775+
return this->fCount;
776+
}
777+
778+
T** getAlias() {
779+
return this->fPool.getAlias();
780+
}
781+
782+
/**
783+
* Array item access (read-only).
784+
* No index bounds check.
785+
* @param i array index
786+
* @return reference to the array item
787+
*/
788+
const T* operator[](ptrdiff_t i) const {
789+
return this->fPool[i];
790+
}
791+
792+
/**
793+
* Array item access (writable).
794+
* No index bounds check.
795+
* @param i array index
796+
* @return reference to the array item
797+
*/
798+
T* operator[](ptrdiff_t i) {
799+
return this->fPool[i];
800+
}
801+
802+
/**
803+
* Append all the items from another MaybeStackVector to this one.
804+
*/
805+
void appendAll(const MaybeStackVector& other, UErrorCode& status) {
806+
for (int32_t i = 0; i < other.fCount; i++) {
807+
T* item = emplaceBack(*other[i]);
808+
if (!item) {
809+
status = U_MEMORY_ALLOCATION_ERROR;
810+
return;
811+
}
812+
}
813+
}
731814
};
732815

816+
733817
U_NAMESPACE_END
734818

735819
#endif /* __cplusplus */

deps/icu-small/source/common/cstring.h

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
U_CAPI UBool U_EXPORT2
5353
uprv_isASCIILetter(char c);
5454

55+
// NOTE: For u_asciiToUpper that takes a UChar, see ustr_imp.h
56+
5557
U_CAPI char U_EXPORT2
5658
uprv_toupper(char c);
5759

deps/icu-small/source/common/dictbe.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "unicode/uniset.h"
1919
#include "unicode/chariter.h"
2020
#include "unicode/ubrk.h"
21+
#include "utracimp.h"
2122
#include "uvectr32.h"
2223
#include "uvector.h"
2324
#include "uassert.h"
@@ -194,6 +195,8 @@ ThaiBreakEngine::ThaiBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode
194195
: DictionaryBreakEngine(),
195196
fDictionary(adoptDictionary)
196197
{
198+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
199+
UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Thai");
197200
fThaiWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Thai:]&[:LineBreak=SA:]]"), status);
198201
if (U_SUCCESS(status)) {
199202
setCharacters(fThaiWordSet);
@@ -213,6 +216,7 @@ ThaiBreakEngine::ThaiBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode
213216
fEndWordSet.compact();
214217
fBeginWordSet.compact();
215218
fSuffixSet.compact();
219+
UTRACE_EXIT_STATUS(status);
216220
}
217221

218222
ThaiBreakEngine::~ThaiBreakEngine() {
@@ -436,6 +440,8 @@ LaoBreakEngine::LaoBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &s
436440
: DictionaryBreakEngine(),
437441
fDictionary(adoptDictionary)
438442
{
443+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
444+
UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Laoo");
439445
fLaoWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Laoo:]&[:LineBreak=SA:]]"), status);
440446
if (U_SUCCESS(status)) {
441447
setCharacters(fLaoWordSet);
@@ -452,6 +458,7 @@ LaoBreakEngine::LaoBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &s
452458
fMarkSet.compact();
453459
fEndWordSet.compact();
454460
fBeginWordSet.compact();
461+
UTRACE_EXIT_STATUS(status);
455462
}
456463

457464
LaoBreakEngine::~LaoBreakEngine() {
@@ -632,6 +639,8 @@ BurmeseBreakEngine::BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErro
632639
: DictionaryBreakEngine(),
633640
fDictionary(adoptDictionary)
634641
{
642+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
643+
UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Mymr");
635644
fBurmeseWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Mymr:]&[:LineBreak=SA:]]"), status);
636645
if (U_SUCCESS(status)) {
637646
setCharacters(fBurmeseWordSet);
@@ -645,6 +654,7 @@ BurmeseBreakEngine::BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErro
645654
fMarkSet.compact();
646655
fEndWordSet.compact();
647656
fBeginWordSet.compact();
657+
UTRACE_EXIT_STATUS(status);
648658
}
649659

650660
BurmeseBreakEngine::~BurmeseBreakEngine() {
@@ -825,6 +835,8 @@ KhmerBreakEngine::KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCod
825835
: DictionaryBreakEngine(),
826836
fDictionary(adoptDictionary)
827837
{
838+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
839+
UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Khmr");
828840
fKhmerWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:LineBreak=SA:]]"), status);
829841
if (U_SUCCESS(status)) {
830842
setCharacters(fKhmerWordSet);
@@ -850,6 +862,7 @@ KhmerBreakEngine::KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCod
850862
fEndWordSet.compact();
851863
fBeginWordSet.compact();
852864
// fSuffixSet.compact();
865+
UTRACE_EXIT_STATUS(status);
853866
}
854867

855868
KhmerBreakEngine::~KhmerBreakEngine() {
@@ -1045,6 +1058,8 @@ KhmerBreakEngine::divideUpDictionaryRange( UText *text,
10451058
static const uint32_t kuint32max = 0xFFFFFFFF;
10461059
CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType type, UErrorCode &status)
10471060
: DictionaryBreakEngine(), fDictionary(adoptDictionary) {
1061+
UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
1062+
UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Hani");
10481063
// Korean dictionary only includes Hangul syllables
10491064
fHangulWordSet.applyPattern(UNICODE_STRING_SIMPLE("[\\uac00-\\ud7a3]"), status);
10501065
fHanWordSet.applyPattern(UNICODE_STRING_SIMPLE("[:Han:]"), status);
@@ -1066,6 +1081,7 @@ CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType
10661081
setCharacters(cjSet);
10671082
}
10681083
}
1084+
UTRACE_EXIT_STATUS(status);
10691085
}
10701086

10711087
CjkBreakEngine::~CjkBreakEngine(){

0 commit comments

Comments
 (0)