Skip to content

Commit ebd8b44

Browse files
deps: update icu to 78.1
1 parent 24bebd0 commit ebd8b44

File tree

239 files changed

+17667
-11400
lines changed

Some content is hidden

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

239 files changed

+17667
-11400
lines changed

deps/icu-small/LICENSE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,3 +540,29 @@ publicity pertaining to distribution of the software without specific,
540540
written prior permission. M.I.T. makes no representations about the
541541
suitability of this software for any purpose. It is provided "as is"
542542
without express or implied warranty.
543+
544+
----------------------------------------------------------------------
545+
546+
File: sorttable.js (only for ICU4J)
547+
548+
The MIT Licence, for code from kryogenix.org
549+
550+
Code downloaded from the Browser Experiments section of kryogenix.org is
551+
licenced under the so-called MIT licence. The licence is below.
552+
553+
Copyright (c) 1997-date Stuart Langridge
554+
555+
Permission is hereby granted, free of charge, to any person obtaining a
556+
copy of this software and associated documentation files (the "Software"),
557+
to deal in the Software without restriction, including without limitation
558+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
559+
and/or sell copies of the Software, and to permit persons to whom the
560+
Software is furnished to do so, subject to the following conditions:
561+
562+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
563+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
564+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
565+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
566+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
567+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
568+
SOFTWARE.

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

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

77

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

deps/icu-small/source/common/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ cc_library(
6464
"umutex.cpp",
6565
"sharedobject.cpp",
6666
"utrace.cpp",
67+
"fixedstring.cpp",
6768
],
6869
deps = [
6970
":headers",

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

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,9 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
121121

122122
// If there is a result, set the valid locale and actual locale, and the kind
123123
if (U_SUCCESS(status) && result != nullptr) {
124-
U_LOCALE_BASED(locBased, *(BreakIterator*)result);
125-
126-
locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status),
127-
actual.data(), status);
128-
LocaleBased::setLocaleID(loc.getName(), result->requestLocale, status);
124+
result->actualLocale = Locale(actual.data());
125+
result->validLocale = Locale(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status));
126+
result->requestLocale = loc;
129127
}
130128

131129
ures_close(b);
@@ -204,33 +202,28 @@ BreakIterator::getAvailableLocales(int32_t& count)
204202
//-------------------------------------------
205203

206204
BreakIterator::BreakIterator()
205+
: actualLocale(Locale::getRoot()), validLocale(Locale::getRoot()), requestLocale(Locale::getRoot())
207206
{
208207
}
209208

210-
BreakIterator::BreakIterator(const BreakIterator &other) : UObject(other) {
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));
209+
BreakIterator::BreakIterator(const BreakIterator &other)
210+
: UObject(other),
211+
actualLocale(other.actualLocale),
212+
validLocale(other.validLocale),
213+
requestLocale(other.requestLocale) {
216214
}
217215

218216
BreakIterator &BreakIterator::operator =(const BreakIterator &other) {
219217
if (this != &other) {
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));
218+
actualLocale = other.actualLocale;
219+
validLocale = other.validLocale;
220+
requestLocale = other.requestLocale;
225221
}
226222
return *this;
227223
}
228224

229225
BreakIterator::~BreakIterator()
230226
{
231-
delete validLocale;
232-
delete actualLocale;
233-
delete requestLocale;
234227
}
235228

236229
// ------------------------------------------
@@ -398,8 +391,8 @@ BreakIterator::createInstance(const Locale& loc, int32_t kind, UErrorCode& statu
398391
// THIS LONG is a sign of bad code -- so the action item is to
399392
// revisit this in ICU 3.0 and clean it up/fix it/remove it.
400393
if (U_SUCCESS(status) && (result != nullptr) && *actualLoc.getName() != 0) {
401-
U_LOCALE_BASED(locBased, *result);
402-
locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName(), status);
394+
result->actualLocale = actualLoc;
395+
result->validLocale = actualLoc;
403396
}
404397
return result;
405398
}
@@ -506,8 +499,7 @@ BreakIterator::getLocale(ULocDataLocaleType type, UErrorCode& status) const {
506499
return Locale::getRoot();
507500
}
508501
if (type == ULOC_REQUESTED_LOCALE) {
509-
return requestLocale == nullptr ?
510-
Locale::getRoot() : Locale(requestLocale->data());
502+
return requestLocale;
511503
}
512504
return LocaleBased::getLocale(validLocale, actualLocale, type, status);
513505
}
@@ -518,7 +510,7 @@ BreakIterator::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
518510
return nullptr;
519511
}
520512
if (type == ULOC_REQUESTED_LOCALE) {
521-
return requestLocale == nullptr ? "" : requestLocale->data();
513+
return requestLocale.getName();
522514
}
523515
return LocaleBased::getLocaleID(validLocale, actualLocale, type, status);
524516
}
@@ -546,11 +538,8 @@ int32_t BreakIterator::getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UE
546538
return 1;
547539
}
548540

549-
BreakIterator::BreakIterator (const Locale& valid, const Locale& actual) {
550-
UErrorCode status = U_ZERO_ERROR;
551-
U_LOCALE_BASED(locBased, (*this));
552-
locBased.setLocaleIDs(valid.getName(), actual.getName(), status);
553-
U_ASSERT(U_SUCCESS(status));
541+
BreakIterator::BreakIterator(const Locale& valid, const Locale& actual)
542+
: actualLocale(actual), validLocale(valid), requestLocale(Locale::getRoot()) {
554543
}
555544

556545
U_NAMESPACE_END

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

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121

2222
U_NAMESPACE_BEGIN
2323

24-
// Windows needs us to DLL-export the MaybeStackArray template specialization,
25-
// but MacOS X cannot handle it. Same as in digitlst.h.
26-
#if !U_PLATFORM_IS_DARWIN_BASED
27-
template class U_COMMON_API MaybeStackArray<char, 40>;
28-
#endif
29-
3024
/**
3125
* ICU-internal char * string class.
3226
* This class does not assume or enforce any particular character encoding.
@@ -38,56 +32,56 @@ template class U_COMMON_API MaybeStackArray<char, 40>;
3832
* For example:
3933
* cs.data()[5]='a'; // no need for setCharAt(5, 'a')
4034
*/
41-
class U_COMMON_API CharString : public UMemory {
35+
class U_COMMON_API_CLASS CharString : public UMemory {
4236
public:
43-
CharString() : len(0) { buffer[0]=0; }
44-
CharString(StringPiece s, UErrorCode &errorCode) : len(0) {
37+
U_COMMON_API CharString() : len(0) { buffer[0]=0; }
38+
U_COMMON_API CharString(StringPiece s, UErrorCode &errorCode) : len(0) {
4539
buffer[0]=0;
4640
append(s, errorCode);
4741
}
48-
CharString(const CharString &s, UErrorCode &errorCode) : len(0) {
42+
U_COMMON_API CharString(const CharString &s, UErrorCode &errorCode) : len(0) {
4943
buffer[0]=0;
5044
append(s, errorCode);
5145
}
52-
CharString(const char *s, int32_t sLength, UErrorCode &errorCode) : len(0) {
46+
U_COMMON_API CharString(const char *s, int32_t sLength, UErrorCode &errorCode) : len(0) {
5347
buffer[0]=0;
5448
append(s, sLength, errorCode);
5549
}
56-
~CharString() {}
50+
U_COMMON_API ~CharString() {}
5751

5852
/**
5953
* Move constructor; might leave src in an undefined state.
6054
* This string will have the same contents and state that the source string had.
6155
*/
62-
CharString(CharString &&src) noexcept;
56+
U_COMMON_API CharString(CharString &&src) noexcept;
6357
/**
6458
* Move assignment operator; might leave src in an undefined state.
6559
* This string will have the same contents and state that the source string had.
6660
* The behavior is undefined if *this and src are the same object.
6761
*/
68-
CharString &operator=(CharString &&src) noexcept;
62+
U_COMMON_API CharString &operator=(CharString &&src) noexcept;
6963

7064
/**
7165
* Replaces this string's contents with the other string's contents.
7266
* CharString does not support the standard copy constructor nor
7367
* the assignment operator, to make copies explicit and to
7468
* use a UErrorCode where memory allocations might be needed.
7569
*/
76-
CharString &copyFrom(const CharString &other, UErrorCode &errorCode);
77-
CharString &copyFrom(StringPiece s, UErrorCode &errorCode);
70+
U_COMMON_API CharString &copyFrom(const CharString &other, UErrorCode &errorCode);
71+
U_COMMON_API CharString &copyFrom(StringPiece s, UErrorCode &errorCode);
7872

79-
UBool isEmpty() const { return len==0; }
80-
int32_t length() const { return len; }
81-
char operator[](int32_t index) const { return buffer[index]; }
82-
StringPiece toStringPiece() const { return StringPiece(buffer.getAlias(), len); }
73+
U_COMMON_API UBool isEmpty() const { return len==0; }
74+
U_COMMON_API int32_t length() const { return len; }
75+
U_COMMON_API char operator[](int32_t index) const { return buffer[index]; }
76+
U_COMMON_API StringPiece toStringPiece() const { return StringPiece(buffer.getAlias(), len); }
8377

84-
const char *data() const { return buffer.getAlias(); }
85-
char *data() { return buffer.getAlias(); }
78+
U_COMMON_API const char *data() const { return buffer.getAlias(); }
79+
U_COMMON_API char *data() { return buffer.getAlias(); }
8680
/**
8781
* Allocates length()+1 chars and copies the NUL-terminated data().
8882
* The caller must uprv_free() the result.
8983
*/
90-
char *cloneData(UErrorCode &errorCode) const;
84+
U_COMMON_API char *cloneData(UErrorCode &errorCode) const;
9185
/**
9286
* Copies the contents of the string into dest.
9387
* Checks if there is enough space in dest, extracts the entire string if possible,
@@ -103,40 +97,40 @@ class U_COMMON_API CharString : public UMemory {
10397
* @param errorCode ICU error code.
10498
* @return length()
10599
*/
106-
int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const;
100+
U_COMMON_API int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const;
107101

108-
bool operator==(const CharString& other) const {
102+
U_COMMON_API bool operator==(const CharString& other) const {
109103
return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0);
110104
}
111-
bool operator!=(const CharString& other) const {
105+
U_COMMON_API bool operator!=(const CharString& other) const {
112106
return !operator==(other);
113107
}
114108

115-
bool operator==(StringPiece other) const {
109+
U_COMMON_API bool operator==(StringPiece other) const {
116110
return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0);
117111
}
118-
bool operator!=(StringPiece other) const {
112+
U_COMMON_API bool operator!=(StringPiece other) const {
119113
return !operator==(other);
120114
}
121115

122116
/** @return last index of c, or -1 if c is not in this string */
123-
int32_t lastIndexOf(char c) const;
117+
U_COMMON_API int32_t lastIndexOf(char c) const;
124118

125-
bool contains(StringPiece s) const;
119+
U_COMMON_API bool contains(StringPiece s) const;
126120

127-
CharString &clear() { len=0; buffer[0]=0; return *this; }
128-
CharString &truncate(int32_t newLength);
121+
U_COMMON_API CharString &clear() { len=0; buffer[0]=0; return *this; }
122+
U_COMMON_API CharString &truncate(int32_t newLength);
129123

130-
CharString &append(char c, UErrorCode &errorCode);
131-
CharString &append(StringPiece s, UErrorCode &errorCode) {
124+
U_COMMON_API CharString &append(char c, UErrorCode &errorCode);
125+
U_COMMON_API CharString &append(StringPiece s, UErrorCode &errorCode) {
132126
return append(s.data(), s.length(), errorCode);
133127
}
134-
CharString &append(const CharString &s, UErrorCode &errorCode) {
128+
U_COMMON_API CharString &append(const CharString &s, UErrorCode &errorCode) {
135129
return append(s.data(), s.length(), errorCode);
136130
}
137-
CharString &append(const char *s, int32_t sLength, UErrorCode &status);
131+
U_COMMON_API CharString &append(const char *s, int32_t sLength, UErrorCode &status);
138132

139-
CharString &appendNumber(int64_t number, UErrorCode &status);
133+
U_COMMON_API CharString &appendNumber(int64_t number, UErrorCode &status);
140134

141135
/**
142136
* Returns a writable buffer for appending and writes the buffer's capacity to
@@ -158,26 +152,28 @@ class U_COMMON_API CharString : public UMemory {
158152
* @param errorCode in/out error code
159153
* @return a buffer with resultCapacity>=min_capacity
160154
*/
161-
char *getAppendBuffer(int32_t minCapacity,
162-
int32_t desiredCapacityHint,
163-
int32_t &resultCapacity,
164-
UErrorCode &errorCode);
155+
U_COMMON_API char *getAppendBuffer(int32_t minCapacity,
156+
int32_t desiredCapacityHint,
157+
int32_t &resultCapacity,
158+
UErrorCode &errorCode);
165159

166-
CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode);
167-
CharString &appendInvariantChars(const char16_t* uchars, int32_t ucharsLen, UErrorCode& errorCode);
160+
U_COMMON_API CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode);
161+
U_COMMON_API CharString &appendInvariantChars(const char16_t* uchars,
162+
int32_t ucharsLen,
163+
UErrorCode& errorCode);
168164

169165
/**
170166
* Appends a filename/path part, e.g., a directory name.
171167
* First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary.
172168
* Does nothing if s is empty.
173169
*/
174-
CharString &appendPathPart(StringPiece s, UErrorCode &errorCode);
170+
U_COMMON_API CharString &appendPathPart(StringPiece s, UErrorCode &errorCode);
175171

176172
/**
177173
* Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty
178174
* and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR.
179175
*/
180-
CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode);
176+
U_COMMON_API CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode);
181177

182178
private:
183179
MaybeStackArray<char, 40> buffer;

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,7 @@ class MaybeStackArray {
334334
// No heap allocation. Use only on the stack.
335335
static void* U_EXPORT2 operator new(size_t) noexcept = delete;
336336
static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
337-
#if U_HAVE_PLACEMENT_NEW
338337
static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
339-
#endif
340338

341339
/**
342340
* Default constructor initializes with internal T[stackCapacity] buffer.
@@ -570,9 +568,7 @@ class MaybeStackHeaderAndArray {
570568
// No heap allocation. Use only on the stack.
571569
static void* U_EXPORT2 operator new(size_t) noexcept = delete;
572570
static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
573-
#if U_HAVE_PLACEMENT_NEW
574571
static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
575-
#endif
576572

577573
/**
578574
* Default constructor initializes with internal H+T[stackCapacity] buffer.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343

4444
U_NAMESPACE_BEGIN
4545

46-
class U_COMMON_API CStr : public UMemory {
46+
class U_COMMON_API_CLASS CStr : public UMemory {
4747
public:
48-
CStr(const UnicodeString &in);
49-
~CStr();
50-
const char * operator ()() const;
48+
U_COMMON_API CStr(const UnicodeString &in);
49+
U_COMMON_API ~CStr();
50+
U_COMMON_API const char * operator ()() const;
5151

5252
private:
5353
CharString s;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// © 2025 and later: Unicode, Inc. and others.
2+
// License & terms of use: https://www.unicode.org/copyright.html
3+
4+
#include "fixedstring.h"
5+
6+
#include "unicode/unistr.h"
7+
#include "unicode/utypes.h"
8+
9+
U_NAMESPACE_BEGIN
10+
11+
U_EXPORT void copyInvariantChars(const UnicodeString& src, FixedString& dst, UErrorCode& status) {
12+
if (U_FAILURE(status)) {
13+
return;
14+
}
15+
16+
if (src.isEmpty()) {
17+
dst.clear();
18+
return;
19+
}
20+
21+
int32_t length = src.length();
22+
if (!dst.reserve(length + 1)) {
23+
status = U_MEMORY_ALLOCATION_ERROR;
24+
return;
25+
}
26+
src.extract(0, length, dst.getAlias(), length + 1, US_INV);
27+
}
28+
29+
U_NAMESPACE_END

0 commit comments

Comments
 (0)