Skip to content

Commit f3821cd

Browse files
targosnodejs-github-bot
authored andcommitted
deps: update ICU to 68.1
Refs: https://github.com/unicode-org/icu/releases/tag/release-68-1 PR-URL: nodejs#36187 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
1 parent 62a5626 commit f3821cd

File tree

419 files changed

+12539
-5755
lines changed

Some content is hidden

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

419 files changed

+12539
-5755
lines changed

Diff for: LICENSE

+3-3
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ The externally maintained libraries used by Node.js are:
418418
# Copyright (c) 2013 International Business Machines Corporation
419419
# and others. All Rights Reserved.
420420
#
421-
# Project: http://code.google.com/p/lao-dictionary/
422-
# Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
423-
# License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
421+
# Project: https://github.com/veer66/lao-dictionary
422+
# Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt
423+
# License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt
424424
# (copied below)
425425
#
426426
# This file is derived from the above dictionary, with slight

Diff for: deps/icu-small/LICENSE

+3-3
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ property of their respective owners.
284284
# Copyright (c) 2013 International Business Machines Corporation
285285
# and others. All Rights Reserved.
286286
#
287-
# Project: http://code.google.com/p/lao-dictionary/
288-
# Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
289-
# License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
287+
# Project: https://github.com/veer66/lao-dictionary
288+
# Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt
289+
# License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt
290290
# (copied below)
291291
#
292292
# This file is derived from the above dictionary, with slight

Diff for: 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 67 source files with the following exception(s):
5-
* deps/icu-small/source/data/in/icudt67l.dat.bz2 : compressed data file
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
66

77

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

Diff for: deps/icu-small/source/.clang-format

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# © 2020 and later: Unicode, Inc. and others.
2+
# License & terms of use: http://www.unicode.org/copyright.html
3+
4+
---
5+
Language: Cpp
6+
BasedOnStyle: LLVM
7+
IndentWidth: 4
8+
ColumnLimit: 105
9+
AllowShortBlocksOnASingleLine: false
10+
AllowShortIfStatementsOnASingleLine: true
11+
...

Diff for: deps/icu-small/source/common/bmpset.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class BMPSet : public UMemory {
101101
*/
102102
UBool latin1Contains[0x100];
103103

104-
/* TRUE if contains(U+FFFD). */
104+
/* true if contains(U+FFFD). */
105105
UBool containsFFFD;
106106

107107
/*

Diff for: deps/icu-small/source/common/brkeng.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class LanguageBreakEngine : public UMemory {
5454
* a particular kind of break.</p>
5555
*
5656
* @param c A character which begins a run that the engine might handle
57-
* @return TRUE if this engine handles the particular character and break
57+
* @return true if this engine handles the particular character and break
5858
* type.
5959
*/
6060
virtual UBool handles(UChar32 c) const = 0;
@@ -171,7 +171,7 @@ class UnhandledEngine : public LanguageBreakEngine {
171171
* a particular kind of break.</p>
172172
*
173173
* @param c A character which begins a run that the engine might handle
174-
* @return TRUE if this engine handles the particular character and break
174+
* @return true if this engine handles the particular character and break
175175
* type.
176176
*/
177177
virtual UBool handles(UChar32 c) const;

Diff for: deps/icu-small/source/common/bytesinkutil.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class U_COMMON_API ByteSinkUtil {
4545
static UBool appendUnchanged(const uint8_t *s, int32_t length,
4646
ByteSink &sink, uint32_t options, Edits *edits,
4747
UErrorCode &errorCode) {
48-
if (U_FAILURE(errorCode)) { return FALSE; }
48+
if (U_FAILURE(errorCode)) { return false; }
4949
if (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); }
50-
return TRUE;
50+
return true;
5151
}
5252

5353
static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit,

Diff for: deps/icu-small/source/common/charstr.cpp

+26-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "cmemory.h"
2121
#include "cstring.h"
2222
#include "uinvchar.h"
23+
#include "ustr_imp.h"
2324

2425
U_NAMESPACE_BEGIN
2526

@@ -46,6 +47,19 @@ char *CharString::cloneData(UErrorCode &errorCode) const {
4647
return p;
4748
}
4849

50+
int32_t CharString::extract(char *dest, int32_t capacity, UErrorCode &errorCode) const {
51+
if (U_FAILURE(errorCode)) { return len; }
52+
if (capacity < 0 || (capacity > 0 && dest == nullptr)) {
53+
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
54+
return len;
55+
}
56+
const char *src = buffer.getAlias();
57+
if (0 < len && len <= capacity && src != dest) {
58+
uprv_memcpy(dest, src, len);
59+
}
60+
return u_terminateChars(dest, capacity, len, &errorCode);
61+
}
62+
4963
CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) {
5064
if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) {
5165
len=s.len;
@@ -197,7 +211,7 @@ CharString &CharString::appendPathPart(StringPiece s, UErrorCode &errorCode) {
197211
}
198212
char c;
199213
if(len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) {
200-
append(U_FILE_SEP_CHAR, errorCode);
214+
append(getDirSepChar(), errorCode);
201215
}
202216
append(s, errorCode);
203217
return *this;
@@ -207,9 +221,19 @@ CharString &CharString::ensureEndsWithFileSeparator(UErrorCode &errorCode) {
207221
char c;
208222
if(U_SUCCESS(errorCode) && len>0 &&
209223
(c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) {
210-
append(U_FILE_SEP_CHAR, errorCode);
224+
append(getDirSepChar(), errorCode);
211225
}
212226
return *this;
213227
}
214228

229+
char CharString::getDirSepChar() const {
230+
char dirSepChar = U_FILE_SEP_CHAR;
231+
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
232+
// We may need to return a different directory separator when building for Cygwin or MSYS2.
233+
if(len>0 && !uprv_strchr(data(), U_FILE_SEP_CHAR) && uprv_strchr(data(), U_FILE_ALT_SEP_CHAR))
234+
dirSepChar = U_FILE_ALT_SEP_CHAR;
235+
#endif
236+
return dirSepChar;
237+
}
238+
215239
U_NAMESPACE_END

Diff for: deps/icu-small/source/common/charstr.h

+24-2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ class U_COMMON_API CharString : public UMemory {
8787
* The caller must uprv_free() the result.
8888
*/
8989
char *cloneData(UErrorCode &errorCode) const;
90+
/**
91+
* Copies the contents of the string into dest.
92+
* Checks if there is enough space in dest, extracts the entire string if possible,
93+
* and NUL-terminates dest if possible.
94+
*
95+
* If the string fits into dest but cannot be NUL-terminated (length()==capacity),
96+
* then the error code is set to U_STRING_NOT_TERMINATED_WARNING.
97+
* If the string itself does not fit into dest (length()>capacity),
98+
* then the error code is set to U_BUFFER_OVERFLOW_ERROR.
99+
*
100+
* @param dest Destination string buffer.
101+
* @param capacity Size of the dest buffer (number of chars).
102+
* @param errorCode ICU error code.
103+
* @return length()
104+
*/
105+
int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const;
90106

91107
bool operator==(StringPiece other) const {
92108
return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0);
@@ -141,13 +157,13 @@ class U_COMMON_API CharString : public UMemory {
141157

142158
/**
143159
* Appends a filename/path part, e.g., a directory name.
144-
* First appends a U_FILE_SEP_CHAR if necessary.
160+
* First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary.
145161
* Does nothing if s is empty.
146162
*/
147163
CharString &appendPathPart(StringPiece s, UErrorCode &errorCode);
148164

149165
/**
150-
* Appends a U_FILE_SEP_CHAR if this string is not empty
166+
* Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty
151167
* and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR.
152168
*/
153169
CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode);
@@ -160,6 +176,12 @@ class U_COMMON_API CharString : public UMemory {
160176

161177
CharString(const CharString &other); // forbid copying of this class
162178
CharString &operator=(const CharString &other); // forbid copying of this class
179+
180+
/**
181+
* Returns U_FILE_ALT_SEP_CHAR if found in string, and U_FILE_SEP_CHAR is not found.
182+
* Otherwise returns U_FILE_SEP_CHAR.
183+
*/
184+
char getDirSepChar() const;
163185
};
164186

165187
U_NAMESPACE_END

Diff for: deps/icu-small/source/common/charstrmap.h

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// © 2020 and later: Unicode, Inc. and others.
2+
// License & terms of use: http://www.unicode.org/copyright.html
3+
4+
// charstrmap.h
5+
// created: 2020sep01 Frank Yung-Fong Tang
6+
7+
#ifndef __CHARSTRMAP_H__
8+
#define __CHARSTRMAP_H__
9+
10+
#include <utility>
11+
#include "unicode/utypes.h"
12+
#include "unicode/uobject.h"
13+
#include "uhash.h"
14+
15+
U_NAMESPACE_BEGIN
16+
17+
/**
18+
* Map of const char * keys & values.
19+
* Stores pointers as is: Does not own/copy/adopt/release strings.
20+
*/
21+
class CharStringMap final : public UMemory {
22+
public:
23+
/** Constructs an unusable non-map. */
24+
CharStringMap() : map(nullptr) {}
25+
CharStringMap(int32_t size, UErrorCode &errorCode) {
26+
map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars,
27+
size, &errorCode);
28+
}
29+
CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) {
30+
other.map = nullptr;
31+
}
32+
CharStringMap(const CharStringMap &other) = delete;
33+
~CharStringMap() {
34+
uhash_close(map);
35+
}
36+
37+
CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT {
38+
map = other.map;
39+
other.map = nullptr;
40+
return *this;
41+
}
42+
CharStringMap &operator=(const CharStringMap &other) = delete;
43+
44+
const char *get(const char *key) const { return static_cast<const char *>(uhash_get(map, key)); }
45+
void put(const char *key, const char *value, UErrorCode &errorCode) {
46+
uhash_put(map, const_cast<char *>(key), const_cast<char *>(value), &errorCode);
47+
}
48+
49+
private:
50+
UHashtable *map;
51+
};
52+
53+
U_NAMESPACE_END
54+
55+
#endif // __CHARSTRMAP_H__

0 commit comments

Comments
 (0)