From 3d0c34cfd35e99a2e09e6a3f035bade907987aa64d3b59b98a7b746b3389524a Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 25 May 2023 20:10:44 +0000 Subject: [PATCH] Accepting request 1089033 from home:gmbr3:Active - Add icu-UCHAR-uint16t.patch: fixes builds where UCHAR_TYPE is re-defined such as libqt5-qtwebengine OBS-URL: https://build.opensuse.org/request/show/1089033 OBS-URL: https://build.opensuse.org/package/show/X11:common:Factory/icu?expand=0&rev=166 --- icu-UCHAR-uint16t.patch | 117 ++++++++++++++++++++++++++++++++++++++++ icu.changes | 6 +++ icu.spec | 1 + 3 files changed, 124 insertions(+) create mode 100644 icu-UCHAR-uint16t.patch diff --git a/icu-UCHAR-uint16t.patch b/icu-UCHAR-uint16t.patch new file mode 100644 index 0000000..852e758 --- /dev/null +++ b/icu-UCHAR-uint16t.patch @@ -0,0 +1,117 @@ +From 4fd9d6ce9a951e66e727b296138f22cd05479de1 Mon Sep 17 00:00:00 2001 +From: Fredrik Roubert +Date: Tue, 18 Apr 2023 23:39:28 +0200 +Subject: [PATCH] ICU-22356 Use ConstChar16Ptr to safely cast from UChar* to + char16_t*. + +This is necessary for this header file to be usable by clients that +define UCHAR_TYPE as a type not compatible with char16_t, eg. uint16_t. +--- + icu4c/source/common/unicode/ures.h | 9 +++++---- + icu4c/source/test/intltest/Makefile.in | 2 +- + icu4c/source/test/intltest/intltest.vcxproj | 1 + + icu4c/source/test/intltest/intltest.vcxproj.filters | 3 +++ + icu4c/source/test/intltest/uchar_type_build_test.cpp | 7 +++++++ + 5 files changed, 17 insertions(+), 5 deletions(-) + create mode 100644 icu4c/source/test/intltest/uchar_type_build_test.cpp + +diff --git a/icu4c/source/common/unicode/ures.h b/icu4c/source/common/unicode/ures.h +index cc25b6e49cd..babc01d426a 100644 +--- icu4c/source/common/unicode/ures.h ++++ icu4c/source/common/unicode/ures.h +@@ -25,6 +25,7 @@ + #ifndef URES_H + #define URES_H + ++#include "unicode/char16ptr.h" + #include "unicode/utypes.h" + #include "unicode/uloc.h" + +@@ -812,7 +813,7 @@ inline UnicodeString + ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; +- const char16_t *r = ures_getString(resB, &len, status); ++ const char16_t *r = ConstChar16Ptr(ures_getString(resB, &len, status)); + if(U_SUCCESS(*status)) { + result.setTo(true, r, len); + } else { +@@ -837,7 +838,7 @@ inline UnicodeString + ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; +- const char16_t* r = ures_getNextString(resB, &len, key, status); ++ const char16_t* r = ConstChar16Ptr(ures_getNextString(resB, &len, key, status)); + if(U_SUCCESS(*status)) { + result.setTo(true, r, len); + } else { +@@ -859,7 +860,7 @@ inline UnicodeString + ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; +- const char16_t* r = ures_getStringByIndex(resB, indexS, &len, status); ++ const char16_t* r = ConstChar16Ptr(ures_getStringByIndex(resB, indexS, &len, status)); + if(U_SUCCESS(*status)) { + result.setTo(true, r, len); + } else { +@@ -882,7 +883,7 @@ inline UnicodeString + ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; +- const char16_t* r = ures_getStringByKey(resB, key, &len, status); ++ const char16_t* r = ConstChar16Ptr(ures_getStringByKey(resB, key, &len, status)); + if(U_SUCCESS(*status)) { + result.setTo(true, r, len); + } else { +diff --git a/icu4c/source/test/intltest/Makefile.in b/icu4c/source/test/intltest/Makefile.in +index 8007d3c1880..f57f8d995f4 100644 +--- icu4c/source/test/intltest/Makefile.in ++++ icu4c/source/test/intltest/Makefile.in +@@ -70,7 +70,7 @@ numbertest_parse.o numbertest_doubleconversion.o numbertest_skeletons.o \ + static_unisets_test.o numfmtdatadriventest.o numbertest_range.o erarulestest.o \ + formattedvaluetest.o formatted_string_builder_test.o numbertest_permutation.o \ + units_data_test.o units_router_test.o units_test.o displayoptions_test.o \ +-numbertest_simple.o ++numbertest_simple.o uchar_type_build_test.o + + DEPS = $(OBJECTS:.o=.d) + +diff --git a/icu4c/source/test/intltest/intltest.vcxproj b/icu4c/source/test/intltest/intltest.vcxproj +index 0985ba1e808..71ce1254038 100644 +--- icu4c/source/test/intltest/intltest.vcxproj ++++ icu4c/source/test/intltest/intltest.vcxproj +@@ -291,6 +291,7 @@ + + + ++ + + + +diff --git a/icu4c/source/test/intltest/intltest.vcxproj.filters b/icu4c/source/test/intltest/intltest.vcxproj.filters +index ffe9bc1467d..5d8777c5aaf 100644 +--- icu4c/source/test/intltest/intltest.vcxproj.filters ++++ icu4c/source/test/intltest/intltest.vcxproj.filters +@@ -568,6 +568,9 @@ + + formatting + ++ ++ configuration ++ + + + +diff --git a/icu4c/source/test/intltest/uchar_type_build_test.cpp b/icu4c/source/test/intltest/uchar_type_build_test.cpp +new file mode 100644 +index 00000000000..ca9335441a3 +--- /dev/null ++++ icu4c/source/test/intltest/uchar_type_build_test.cpp +@@ -0,0 +1,7 @@ ++// © 2023 and later: Unicode, Inc. and others. ++// License & terms of use: http://www.unicode.org/copyright.html#License ++ ++// ICU-22356 Test that client code can be built with UCHAR_TYPE redefined. ++#undef UCHAR_TYPE ++#define UCHAR_TYPE uint16_t ++#include "unicode/ures.h" diff --git a/icu.changes b/icu.changes index 380ee59..84aef09 100644 --- a/icu.changes +++ b/icu.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu May 25 12:52:50 UTC 2023 - Callum Farmer + +- Add icu-UCHAR-uint16t.patch: fixes builds where UCHAR_TYPE is + re-defined such as libqt5-qtwebengine + ------------------------------------------------------------------- Thu Apr 13 23:05:00 UTC 2023 - Jan Engelhardt diff --git a/icu.spec b/icu.spec index 6849589..d53072b 100644 --- a/icu.spec +++ b/icu.spec @@ -43,6 +43,7 @@ Patch6: icu-error-reporting.diff Patch7: icu-avoid-x87-excess-precision.diff Patch8: locale.diff Patch9: nan-undefined-conversion.patch +Patch10: icu-UCHAR-uint16t.patch BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: pkg-config