i18nutil/source/utility/unicode.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
New commits: commit ae2b0991011dd696f9840d43e35edae1e3f17c87 Author: Mike Kaganski <[email protected]> AuthorDate: Mon Oct 20 07:14:03 2025 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Oct 20 11:07:17 2025 +0200 Using static non-thread-local variables as cache is scary I think that these functions may easily be used in different threads. No idea how useful the cache is (if at all: do we call the functions repeatedly for same character often enough?); but at least it must be correct. Change-Id: Ide2f7317bed55e201cd075ca93ee617e16a2654e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192678 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx index 0f31ad040756..cef3e0c62834 100644 --- a/i18nutil/source/utility/unicode.cxx +++ b/i18nutil/source/utility/unicode.cxx @@ -69,8 +69,8 @@ unicode::getUnicodeScriptEnd( UnicodeScript type) { sal_Int16 unicode::getUnicodeType(const sal_uInt32 ch) { - static sal_uInt32 c = 0x00; - static sal_uInt32 r = 0x00; + static thread_local sal_uInt32 c = 0x00; + static thread_local sal_Int16 r = 0x00; if (ch == c) return r; else c = ch; @@ -174,8 +174,8 @@ unicode::getUnicodeType(const sal_uInt32 ch) sal_uInt8 unicode::getUnicodeDirection( const sal_Unicode ch ) { - static sal_Unicode c = 0x00; - static sal_uInt8 r = 0x00; + static thread_local sal_Unicode c = 0x00; + static thread_local sal_uInt8 r = 0x00; if (ch == c) return r; else c = ch;
