diff options
author | Khaled Hosny <khaled@libreoffice.org> | 2023-07-24 20:52:44 +0300 |
---|---|---|
committer | خالد حسني <khaled@libreoffice.org> | 2023-07-25 02:14:56 +0200 |
commit | 2e6e40b7453e2005d46ba7866feff2f2caa1f100 (patch) | |
tree | 37b84a12a9660b94930eeb267072f6d34f8b9adb /i18nutil | |
parent | 89229524298398ca1b5239c2a7ca798900733f5d (diff) |
i18nutil: Make unicode::getUnicodeType() take a UTF-32 code point
Still need to fix call sites to handles surrogate pairs.
Change-Id: I3ba896714fc6a90596c041148a3c9d965f60f4a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154874
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
Diffstat (limited to 'i18nutil')
-rw-r--r-- | i18nutil/source/utility/unicode.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx index dbb81a8240f1..ae7b4c512aca 100644 --- a/i18nutil/source/utility/unicode.cxx +++ b/i18nutil/source/utility/unicode.cxx @@ -67,9 +67,10 @@ unicode::getUnicodeScriptEnd( UnicodeScript type) { } sal_Int16 -unicode::getUnicodeType( const sal_Unicode ch ) { - static sal_Unicode c = 0x00; - static sal_Int16 r = 0x00; +unicode::getUnicodeType(const sal_uInt32 ch) +{ + static sal_uInt32 c = 0x00; + static sal_uInt32 r = 0x00; if (ch == c) return r; else c = ch; @@ -213,7 +214,7 @@ sal_uInt32 unicode::GetMirroredChar(sal_uInt32 nChar) { bit(UnicodeType::PARAGRAPH_SEPARATOR) #define IsType(func, mask) \ -bool func( const sal_Unicode ch) {\ +bool func( const sal_uInt32 ch) {\ return (bit(getUnicodeType(ch)) & (mask)) != 0;\ } @@ -224,7 +225,8 @@ IsType(unicode::isSpace, SPACEMASK) #define CONTROLSPACE bit(0x09)|bit(0x0a)|bit(0x0b)|bit(0x0c)|bit(0x0d)|\ bit(0x1c)|bit(0x1d)|bit(0x1e)|bit(0x1f) -bool unicode::isWhiteSpace( const sal_Unicode ch) { +bool unicode::isWhiteSpace(const sal_uInt32 ch) +{ return (ch != 0xa0 && isSpace(ch)) || (ch <= 0x1F && (bit(ch) & (CONTROLSPACE))); } |