Merge pull request #97648 from twrightsman/fix-icu-load

Fix ICU support data loading
This commit is contained in:
Rémi Verschelde 2024-10-01 17:31:35 +02:00
commit c73a18adbd
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -442,6 +442,8 @@ bool TextServerAdvanced::_load_support_data(const String &p_filename) {
} }
#else #else
if (!icu_data_loaded) { if (!icu_data_loaded) {
UErrorCode err = U_ZERO_ERROR;
#ifdef ICU_DATA_NAME
String filename = (p_filename.is_empty()) ? String("res://") + _MKSTR(ICU_DATA_NAME) : p_filename; String filename = (p_filename.is_empty()) ? String("res://") + _MKSTR(ICU_DATA_NAME) : p_filename;
Ref<FileAccess> f = FileAccess::open(filename, FileAccess::READ); Ref<FileAccess> f = FileAccess::open(filename, FileAccess::READ);
@ -451,13 +453,13 @@ bool TextServerAdvanced::_load_support_data(const String &p_filename) {
uint64_t len = f->get_length(); uint64_t len = f->get_length();
icu_data = f->get_buffer(len); icu_data = f->get_buffer(len);
UErrorCode err = U_ZERO_ERROR;
udata_setCommonData(icu_data.ptr(), &err); udata_setCommonData(icu_data.ptr(), &err);
if (U_FAILURE(err)) { if (U_FAILURE(err)) {
ERR_FAIL_V_MSG(false, u_errorName(err)); ERR_FAIL_V_MSG(false, u_errorName(err));
} }
err = U_ZERO_ERROR; err = U_ZERO_ERROR;
#endif
u_init(&err); u_init(&err);
if (U_FAILURE(err)) { if (U_FAILURE(err)) {
ERR_FAIL_V_MSG(false, u_errorName(err)); ERR_FAIL_V_MSG(false, u_errorName(err));