Skip to content

Commit ab9660b

Browse files
deps: update icu to 77.1
PR-URL: #57455 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Steven R Loomis <srl295@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 8ccbfb6 commit ab9660b

File tree

145 files changed

+5231
-3324
lines changed

Some content is hidden

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

145 files changed

+5231
-3324
lines changed

deps/icu-small/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ UNICODE LICENSE V3
22

33
COPYRIGHT AND PERMISSION NOTICE
44

5-
Copyright © 2016-2024 Unicode, Inc.
5+
Copyright © 2016-2025 Unicode, Inc.
66

77
NOTICE TO USER: Carefully read the following legal agreement. BY
88
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR

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

77

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

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

+34-21
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
5959
{
6060
char fnbuff[256];
6161
char ext[4]={'\0'};
62-
CharString actualLocale;
62+
CharString actual;
6363
int32_t size;
6464
const char16_t* brkfname = nullptr;
6565
UResourceBundle brkRulesStack;
@@ -94,7 +94,7 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
9494

9595
// Use the string if we found it
9696
if (U_SUCCESS(status) && brkfname) {
97-
actualLocale.append(ures_getLocaleInternal(brkName, &status), -1, status);
97+
actual.append(ures_getLocaleInternal(brkName, &status), -1, status);
9898

9999
char16_t* extStart=u_strchr(brkfname, 0x002e);
100100
int len = 0;
@@ -123,10 +123,9 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
123123
if (U_SUCCESS(status) && result != nullptr) {
124124
U_LOCALE_BASED(locBased, *(BreakIterator*)result);
125125

126-
locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status),
127-
actualLocale.data());
128-
uprv_strncpy(result->requestLocale, loc.getName(), ULOC_FULLNAME_CAPACITY);
129-
result->requestLocale[ULOC_FULLNAME_CAPACITY-1] = 0; // always terminate
126+
locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status),
127+
actual.data(), status);
128+
LocaleBased::setLocaleID(loc.getName(), result->requestLocale, status);
130129
}
131130

132131
ures_close(b);
@@ -206,26 +205,32 @@ BreakIterator::getAvailableLocales(int32_t& count)
206205

207206
BreakIterator::BreakIterator()
208207
{
209-
*validLocale = *actualLocale = *requestLocale = 0;
210208
}
211209

212210
BreakIterator::BreakIterator(const BreakIterator &other) : UObject(other) {
213-
uprv_strncpy(actualLocale, other.actualLocale, sizeof(actualLocale));
214-
uprv_strncpy(validLocale, other.validLocale, sizeof(validLocale));
215-
uprv_strncpy(requestLocale, other.requestLocale, sizeof(requestLocale));
211+
UErrorCode status = U_ZERO_ERROR;
212+
U_LOCALE_BASED(locBased, *this);
213+
locBased.setLocaleIDs(other.validLocale, other.actualLocale, status);
214+
LocaleBased::setLocaleID(other.requestLocale, requestLocale, status);
215+
U_ASSERT(U_SUCCESS(status));
216216
}
217217

218218
BreakIterator &BreakIterator::operator =(const BreakIterator &other) {
219219
if (this != &other) {
220-
uprv_strncpy(actualLocale, other.actualLocale, sizeof(actualLocale));
221-
uprv_strncpy(validLocale, other.validLocale, sizeof(validLocale));
222-
uprv_strncpy(requestLocale, other.requestLocale, sizeof(requestLocale));
220+
UErrorCode status = U_ZERO_ERROR;
221+
U_LOCALE_BASED(locBased, *this);
222+
locBased.setLocaleIDs(other.validLocale, other.actualLocale, status);
223+
LocaleBased::setLocaleID(other.requestLocale, requestLocale, status);
224+
U_ASSERT(U_SUCCESS(status));
223225
}
224226
return *this;
225227
}
226228

227229
BreakIterator::~BreakIterator()
228230
{
231+
delete validLocale;
232+
delete actualLocale;
233+
delete requestLocale;
229234
}
230235

231236
// ------------------------------------------
@@ -394,7 +399,7 @@ BreakIterator::createInstance(const Locale& loc, int32_t kind, UErrorCode& statu
394399
// revisit this in ICU 3.0 and clean it up/fix it/remove it.
395400
if (U_SUCCESS(status) && (result != nullptr) && *actualLoc.getName() != 0) {
396401
U_LOCALE_BASED(locBased, *result);
397-
locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName());
402+
locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName(), status);
398403
}
399404
return result;
400405
}
@@ -488,6 +493,7 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
488493
}
489494

490495
if (U_FAILURE(status)) {
496+
delete result;
491497
return nullptr;
492498
}
493499

@@ -496,20 +502,25 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
496502

497503
Locale
498504
BreakIterator::getLocale(ULocDataLocaleType type, UErrorCode& status) const {
505+
if (U_FAILURE(status)) {
506+
return Locale::getRoot();
507+
}
499508
if (type == ULOC_REQUESTED_LOCALE) {
500-
return {requestLocale};
509+
return requestLocale == nullptr ?
510+
Locale::getRoot() : Locale(requestLocale->data());
501511
}
502-
U_LOCALE_BASED(locBased, *this);
503-
return locBased.getLocale(type, status);
512+
return LocaleBased::getLocale(validLocale, actualLocale, type, status);
504513
}
505514

506515
const char *
507516
BreakIterator::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
517+
if (U_FAILURE(status)) {
518+
return nullptr;
519+
}
508520
if (type == ULOC_REQUESTED_LOCALE) {
509-
return requestLocale;
521+
return requestLocale == nullptr ? "" : requestLocale->data();
510522
}
511-
U_LOCALE_BASED(locBased, *this);
512-
return locBased.getLocaleID(type, status);
523+
return LocaleBased::getLocaleID(validLocale, actualLocale, type, status);
513524
}
514525

515526

@@ -536,8 +547,10 @@ int32_t BreakIterator::getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UE
536547
}
537548

538549
BreakIterator::BreakIterator (const Locale& valid, const Locale& actual) {
550+
UErrorCode status = U_ZERO_ERROR;
539551
U_LOCALE_BASED(locBased, (*this));
540-
locBased.setLocaleIDs(valid, actual);
552+
locBased.setLocaleIDs(valid.getName(), actual.getName(), status);
553+
U_ASSERT(U_SUCCESS(status));
541554
}
542555

543556
U_NAMESPACE_END

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) {
7070
return *this;
7171
}
7272

73+
CharString &CharString::copyFrom(StringPiece s, UErrorCode &errorCode) {
74+
if (U_FAILURE(errorCode)) {
75+
return *this;
76+
}
77+
len = 0;
78+
append(s, errorCode);
79+
return *this;
80+
}
81+
7382
int32_t CharString::lastIndexOf(char c) const {
7483
for(int32_t i=len; i>0;) {
7584
if(buffer[--i]==c) {
@@ -143,7 +152,7 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error
143152
return *this;
144153
}
145154

146-
CharString &CharString::appendNumber(int32_t number, UErrorCode &status) {
155+
CharString &CharString::appendNumber(int64_t number, UErrorCode &status) {
147156
if (number < 0) {
148157
this->append('-', status);
149158
if (U_FAILURE(status)) {

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class U_COMMON_API CharString : public UMemory {
7474
* use a UErrorCode where memory allocations might be needed.
7575
*/
7676
CharString &copyFrom(const CharString &other, UErrorCode &errorCode);
77+
CharString &copyFrom(StringPiece s, UErrorCode &errorCode);
7778

7879
UBool isEmpty() const { return len==0; }
7980
int32_t length() const { return len; }
@@ -135,7 +136,7 @@ class U_COMMON_API CharString : public UMemory {
135136
}
136137
CharString &append(const char *s, int32_t sLength, UErrorCode &status);
137138

138-
CharString &appendNumber(int32_t number, UErrorCode &status);
139+
CharString &appendNumber(int64_t number, UErrorCode &status);
139140

140141
/**
141142
* Returns a writable buffer for appending and writes the buffer's capacity to

0 commit comments

Comments
 (0)