Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextServerAdvanced] Keep dynamically loaded ICU data in memory. #83827

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions modules/text_server_adv/text_server_adv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ _FORCE_INLINE_ bool is_connected_to_prev(char32_t p_chr, char32_t p_pchr) {
/*************************************************************************/

bool TextServerAdvanced::icu_data_loaded = false;
PackedByteArray TextServerAdvanced::icu_data;

bool TextServerAdvanced::_has_feature(Feature p_feature) const {
switch (p_feature) {
Expand Down Expand Up @@ -438,7 +439,7 @@ bool TextServerAdvanced::_load_support_data(const String &p_filename) {
return false;
}
uint64_t len = f->get_length();
PackedByteArray icu_data = f->get_buffer(len);
icu_data = f->get_buffer(len);

UErrorCode err = U_ZERO_ERROR;
udata_setCommonData(icu_data.ptr(), &err);
Expand Down Expand Up @@ -476,10 +477,10 @@ bool TextServerAdvanced::_save_support_data(const String &p_filename) const {
return false;
}

PackedByteArray icu_data;
icu_data.resize(U_ICUDATA_SIZE);
memcpy(icu_data.ptrw(), U_ICUDATA_ENTRY_POINT, U_ICUDATA_SIZE);
f->store_buffer(icu_data);
PackedByteArray icu_data_static;
icu_data_static.resize(U_ICUDATA_SIZE);
memcpy(icu_data_static.ptrw(), U_ICUDATA_ENTRY_POINT, U_ICUDATA_SIZE);
f->store_buffer(icu_data_static);

return true;
#else
Expand Down
1 change: 1 addition & 0 deletions modules/text_server_adv/text_server_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class TextServerAdvanced : public TextServerExtension {
// ICU support data.

static bool icu_data_loaded;
static PackedByteArray icu_data;
akien-mga marked this conversation as resolved.
Show resolved Hide resolved
mutable USet *allowed = nullptr;
mutable USpoofChecker *sc_spoof = nullptr;
mutable USpoofChecker *sc_conf = nullptr;
Expand Down