summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chang <vichang@google.com>2021-02-10 16:12:56 +0000
committerVictor Chang <vichang@google.com>2021-02-10 16:17:43 +0000
commit4144a9b49bb3bd0410bfbad18b1c4c19a7a92ce4 (patch)
treed66661acd36eb05080d24dc2c18de6c6b35dc735
parente24e73a350b26d23197e955bb86d196c7bd920d3 (diff)
downloadicu-4144a9b49bb3bd0410bfbad18b1c4c19a7a92ce4.tar.gz
Expose ubrk_clone() from NDK - part 2
tools/icu4c_srcgen/libicu_export.txt is the only manual change, and other file changes are generated by the script tools/icu4c_srcgen/generate_ndk.py CTS of ubrk_clone() should be covered in CtsIcu4cTestCases. The test is TestBreakIteratorClone() located at icu4c/source/test/cintltst/cbiapts.c Bug: 177225118 Test: atest CtsIcu4cTestCases Change-Id: I71f2eb80d99dc446a105d8733a791b85fb360898
-rw-r--r--libicu/cts_headers/unicode/urename.h2
-rw-r--r--libicu/libicu.map.txt1
-rw-r--r--libicu/ndk_headers/unicode/ubrk.h13
-rw-r--r--libicu/src/shim.cpp4
-rw-r--r--tools/icu4c_srcgen/libicu_export.txt3
5 files changed, 20 insertions, 3 deletions
diff --git a/libicu/cts_headers/unicode/urename.h b/libicu/cts_headers/unicode/urename.h
index 0be0d1db7..06cb9a16c 100644
--- a/libicu/cts_headers/unicode/urename.h
+++ b/libicu/cts_headers/unicode/urename.h
@@ -482,7 +482,7 @@
#define ubiditransform_open U_ICU_ENTRY_POINT_RENAME(ubiditransform_open)
#define ubiditransform_transform U_ICU_ENTRY_POINT_RENAME(ubiditransform_transform)
#define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode)
-#define ubrk_clone U_ICU_ENTRY_POINT_RENAME(ubrk_clone)
+// #define ubrk_clone U_ICU_ENTRY_POINT_RENAME(ubrk_clone)
// #define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close)
// #define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable)
// #define ubrk_current U_ICU_ENTRY_POINT_RENAME(ubrk_current)
diff --git a/libicu/libicu.map.txt b/libicu/libicu.map.txt
index 6603317f3..e47801ed2 100644
--- a/libicu/libicu.map.txt
+++ b/libicu/libicu.map.txt
@@ -165,6 +165,7 @@ LIBICU_31 { # introduced=31
ubidi_setReorderingOptions;
ubidi_writeReordered;
ubidi_writeReverse;
+ ubrk_clone;
ubrk_close;
ubrk_countAvailable;
ubrk_current;
diff --git a/libicu/ndk_headers/unicode/ubrk.h b/libicu/ndk_headers/unicode/ubrk.h
index 3f45829ed..6d150dfc6 100644
--- a/libicu/ndk_headers/unicode/ubrk.h
+++ b/libicu/ndk_headers/unicode/ubrk.h
@@ -262,7 +262,20 @@ ubrk_open(UBreakIteratorType type,
#endif /* U_HIDE_DEPRECATED_API */
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
+/**
+ * Thread safe cloning operation.
+ * @param bi iterator to be cloned
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @return pointer to the new clone
+ * @stable ICU 69
+ */
+U_CAPI UBreakIterator * U_EXPORT2
+ubrk_clone(const UBreakIterator *bi,
+ UErrorCode *status) __INTRODUCED_IN(31);
+
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
#ifndef U_HIDE_DEPRECATED_API
diff --git a/libicu/src/shim.cpp b/libicu/src/shim.cpp
index 7a0642b4d..c64f7a986 100644
--- a/libicu/src/shim.cpp
+++ b/libicu/src/shim.cpp
@@ -167,6 +167,7 @@
#undef ubidi_setReorderingOptions
#undef ubidi_writeReordered
#undef ubidi_writeReverse
+#undef ubrk_clone
#undef ubrk_close
#undef ubrk_countAvailable
#undef ubrk_current
@@ -736,6 +737,9 @@ int32_t ubidi_writeReordered(UBiDi * pBiDi, UChar * dest, int32_t destSize, uint
int32_t ubidi_writeReverse(const UChar * src, int32_t srcLength, UChar * dest, int32_t destSize, uint16_t options, UErrorCode * pErrorCode) {
return U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse)(src, srcLength, dest, destSize, options, pErrorCode);
}
+UBreakIterator * ubrk_clone(const UBreakIterator * bi, UErrorCode * status) {
+ return U_ICU_ENTRY_POINT_RENAME(ubrk_clone)(bi, status);
+}
void ubrk_close(UBreakIterator * bi) {
U_ICU_ENTRY_POINT_RENAME(ubrk_close)(bi);
}
diff --git a/tools/icu4c_srcgen/libicu_export.txt b/tools/icu4c_srcgen/libicu_export.txt
index c084befec..c92d01e77 100644
--- a/tools/icu4c_srcgen/libicu_export.txt
+++ b/tools/icu4c_srcgen/libicu_export.txt
@@ -166,6 +166,7 @@ ubidi_setReorderingMode
ubidi_setReorderingOptions
ubidi_writeReordered
ubidi_writeReverse
+ubrk_clone
ubrk_close
ubrk_countAvailable
ubrk_current
@@ -190,8 +191,6 @@ ubrk_setUText
# ubrk_getLocaleByType
# ubrk_openBinaryRules
# ubrk_openRules
-# The API below has a deprecated argument stackBuffer, and users has other API substitutes.
-# ubrk_safeClone
uenum_close
uenum_count
uenum_next