Skip to content

Commit ee669a0

Browse files
targosgengjiawen
authored andcommitted
deps: update ICU to 69.1
Refs: https://github.com./unicode-org/icu/releases/tag/release-69-1 PR-URL: #38178 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 1d21a8d commit ee669a0

File tree

215 files changed

+5688
-2119
lines changed

Some content is hidden

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

215 files changed

+5688
-2119
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 68 source files with the following exception(s):
5-
* deps/icu-small/source/data/in/icudt68l.dat.bz2 : compressed data file
4+
It is a strict subset of ICU 69 source files with the following exception(s):
5+
* deps/icu-small/source/data/in/icudt69l.dat.bz2 : compressed data file
66

77

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

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

+17-9
Original file line numberDiff line numberDiff line change
@@ -474,31 +474,39 @@ BytesTrieBuilder::writeDeltaTo(int32_t jumpTarget) {
474474
U_ASSERT(i>=0);
475475
if(i<=BytesTrie::kMaxOneByteDelta) {
476476
return write(i);
477+
} else {
478+
char intBytes[5];
479+
return write(intBytes, internalEncodeDelta(i, intBytes));
477480
}
478-
char intBytes[5];
479-
int32_t length;
481+
}
482+
483+
int32_t
484+
BytesTrieBuilder::internalEncodeDelta(int32_t i, char intBytes[]) {
485+
U_ASSERT(i>=0);
486+
if(i<=BytesTrie::kMaxOneByteDelta) {
487+
intBytes[0]=(char)i;
488+
return 1;
489+
}
490+
int32_t length=1;
480491
if(i<=BytesTrie::kMaxTwoByteDelta) {
481492
intBytes[0]=(char)(BytesTrie::kMinTwoByteDeltaLead+(i>>8));
482-
length=1;
483493
} else {
484494
if(i<=BytesTrie::kMaxThreeByteDelta) {
485495
intBytes[0]=(char)(BytesTrie::kMinThreeByteDeltaLead+(i>>16));
486-
length=2;
487496
} else {
488497
if(i<=0xffffff) {
489498
intBytes[0]=(char)BytesTrie::kFourByteDeltaLead;
490-
length=3;
491499
} else {
492500
intBytes[0]=(char)BytesTrie::kFiveByteDeltaLead;
493501
intBytes[1]=(char)(i>>24);
494-
length=4;
502+
length=2;
495503
}
496-
intBytes[1]=(char)(i>>16);
504+
intBytes[length++]=(char)(i>>16);
497505
}
498-
intBytes[1]=(char)(i>>8);
506+
intBytes[length++]=(char)(i>>8);
499507
}
500508
intBytes[length++]=(char)i;
501-
return write(intBytes, length);
509+
return length;
502510
}
503511

504512
U_NAMESPACE_END

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

+34
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* created by: Markus W. Scherer
1515
*/
1616

17+
#include <cstdlib>
18+
1719
#include "unicode/utypes.h"
1820
#include "unicode/putil.h"
1921
#include "charstr.h"
@@ -141,6 +143,38 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error
141143
return *this;
142144
}
143145

146+
CharString &CharString::appendNumber(int32_t number, UErrorCode &status) {
147+
if (number < 0) {
148+
this->append('-', status);
149+
if (U_FAILURE(status)) {
150+
return *this;
151+
}
152+
}
153+
154+
if (number == 0) {
155+
this->append('0', status);
156+
return *this;
157+
}
158+
159+
int32_t numLen = 0;
160+
while (number != 0) {
161+
int32_t residue = number % 10;
162+
number /= 10;
163+
this->append(std::abs(residue) + '0', status);
164+
numLen++;
165+
if (U_FAILURE(status)) {
166+
return *this;
167+
}
168+
}
169+
170+
int32_t start = this->length() - numLen, end = this->length() - 1;
171+
while(start < end) {
172+
std::swap(this->data()[start++], this->data()[end--]);
173+
}
174+
175+
return *this;
176+
}
177+
144178
char *CharString::getAppendBuffer(int32_t minCapacity,
145179
int32_t desiredCapacityHint,
146180
int32_t &resultCapacity,

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

+3
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ class U_COMMON_API CharString : public UMemory {
127127
return append(s.data(), s.length(), errorCode);
128128
}
129129
CharString &append(const char *s, int32_t sLength, UErrorCode &status);
130+
131+
CharString &appendNumber(int32_t number, UErrorCode &status);
132+
130133
/**
131134
* Returns a writable buffer for appending and writes the buffer's capacity to
132135
* resultCapacity. Guarantees resultCapacity>=minCapacity if U_SUCCESS().

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

+52-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,63 @@
3131
#include <stddef.h>
3232
#include <string.h>
3333
#include "unicode/localpointer.h"
34+
#include "uassert.h"
3435

3536
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
3637
#include <stdio.h>
3738
#endif
3839

39-
40-
#define uprv_memcpy(dst, src, size) U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size)
41-
#define uprv_memmove(dst, src, size) U_STANDARD_CPP_NAMESPACE memmove(dst, src, size)
40+
// uprv_memcpy and uprv_memmove
41+
#if defined(__clang__)
42+
#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \
43+
/* Suppress warnings about addresses that will never be NULL */ \
44+
_Pragma("clang diagnostic push") \
45+
_Pragma("clang diagnostic ignored \"-Waddress\"") \
46+
U_ASSERT(dst != NULL); \
47+
U_ASSERT(src != NULL); \
48+
_Pragma("clang diagnostic pop") \
49+
U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \
50+
} UPRV_BLOCK_MACRO_END
51+
#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \
52+
/* Suppress warnings about addresses that will never be NULL */ \
53+
_Pragma("clang diagnostic push") \
54+
_Pragma("clang diagnostic ignored \"-Waddress\"") \
55+
U_ASSERT(dst != NULL); \
56+
U_ASSERT(src != NULL); \
57+
_Pragma("clang diagnostic pop") \
58+
U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \
59+
} UPRV_BLOCK_MACRO_END
60+
#elif defined(__GNUC__)
61+
#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \
62+
/* Suppress warnings about addresses that will never be NULL */ \
63+
_Pragma("GCC diagnostic push") \
64+
_Pragma("GCC diagnostic ignored \"-Waddress\"") \
65+
U_ASSERT(dst != NULL); \
66+
U_ASSERT(src != NULL); \
67+
_Pragma("GCC diagnostic pop") \
68+
U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \
69+
} UPRV_BLOCK_MACRO_END
70+
#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \
71+
/* Suppress warnings about addresses that will never be NULL */ \
72+
_Pragma("GCC diagnostic push") \
73+
_Pragma("GCC diagnostic ignored \"-Waddress\"") \
74+
U_ASSERT(dst != NULL); \
75+
U_ASSERT(src != NULL); \
76+
_Pragma("GCC diagnostic pop") \
77+
U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \
78+
} UPRV_BLOCK_MACRO_END
79+
#else
80+
#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \
81+
U_ASSERT(dst != NULL); \
82+
U_ASSERT(src != NULL); \
83+
U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \
84+
} UPRV_BLOCK_MACRO_END
85+
#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \
86+
U_ASSERT(dst != NULL); \
87+
U_ASSERT(src != NULL); \
88+
U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \
89+
} UPRV_BLOCK_MACRO_END
90+
#endif
4291

4392
/**
4493
* \def UPRV_LENGTHOF

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

+8-24
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,9 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
265265
goto foundBest;
266266
}
267267
do {
268-
int32_t wordsMatched = 1;
269268
if (words[(wordsFound + 1) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) {
270-
if (wordsMatched < 2) {
271-
// Followed by another dictionary word; mark first word as a good candidate
272-
words[wordsFound%THAI_LOOKAHEAD].markCurrent();
273-
wordsMatched = 2;
274-
}
269+
// Followed by another dictionary word; mark first word as a good candidate
270+
words[wordsFound%THAI_LOOKAHEAD].markCurrent();
275271

276272
// If we're already at the end of the range, we're done
277273
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
@@ -503,13 +499,9 @@ LaoBreakEngine::divideUpDictionaryRange( UText *text,
503499
goto foundBest;
504500
}
505501
do {
506-
int32_t wordsMatched = 1;
507502
if (words[(wordsFound + 1) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) {
508-
if (wordsMatched < 2) {
509-
// Followed by another dictionary word; mark first word as a good candidate
510-
words[wordsFound%LAO_LOOKAHEAD].markCurrent();
511-
wordsMatched = 2;
512-
}
503+
// Followed by another dictionary word; mark first word as a good candidate
504+
words[wordsFound%LAO_LOOKAHEAD].markCurrent();
513505

514506
// If we're already at the end of the range, we're done
515507
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
@@ -699,13 +691,9 @@ BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
699691
goto foundBest;
700692
}
701693
do {
702-
int32_t wordsMatched = 1;
703694
if (words[(wordsFound + 1) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) {
704-
if (wordsMatched < 2) {
705-
// Followed by another dictionary word; mark first word as a good candidate
706-
words[wordsFound%BURMESE_LOOKAHEAD].markCurrent();
707-
wordsMatched = 2;
708-
}
695+
// Followed by another dictionary word; mark first word as a good candidate
696+
words[wordsFound%BURMESE_LOOKAHEAD].markCurrent();
709697

710698
// If we're already at the end of the range, we're done
711699
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
@@ -908,13 +896,9 @@ KhmerBreakEngine::divideUpDictionaryRange( UText *text,
908896
goto foundBest;
909897
}
910898
do {
911-
int32_t wordsMatched = 1;
912899
if (words[(wordsFound + 1) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) {
913-
if (wordsMatched < 2) {
914-
// Followed by another dictionary word; mark first word as a good candidate
915-
words[wordsFound % KHMER_LOOKAHEAD].markCurrent();
916-
wordsMatched = 2;
917-
}
900+
// Followed by another dictionary word; mark first word as a good candidate
901+
words[wordsFound % KHMER_LOOKAHEAD].markCurrent();
918902

919903
// If we're already at the end of the range, we're done
920904
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {

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

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Edits &Edits::moveArray(Edits &src) U_NOEXCEPT {
8686
}
8787

8888
Edits &Edits::operator=(const Edits &other) {
89+
if (this == &other) { return *this; } // self-assignment: no-op
8990
length = other.length;
9091
delta = other.delta;
9192
numChanges = other.numChanges;

0 commit comments

Comments
 (0)