diff options
-rw-r--r-- | i18npool/inc/cclass_unicode.hxx | 4 | ||||
-rw-r--r-- | i18npool/source/characterclassification/cclass_unicode_parser.cxx | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx index d962a3216585..cd77cbea275a 100644 --- a/i18npool/inc/cclass_unicode.hxx +++ b/i18npool/inc/cclass_unicode.hxx @@ -120,7 +120,7 @@ private: static const sal_Int32 pParseTokensType[]; /// If and where c occurs in pStr - static const sal_Unicode* StrChr( const sal_Unicode* pStr, sal_Unicode c ); + static const sal_Unicode* StrChr( const sal_Unicode* pStr, sal_uInt32 c ); css::uno::Reference < css::uno::XComponentContext > m_xContext; @@ -151,7 +151,7 @@ private: ParserFlags getFlagsExtended(sal_uInt32 c); /// Access parser table flags for user defined start characters. - ParserFlags getStartCharsFlags( sal_Unicode c ); + ParserFlags getStartCharsFlags( sal_uInt32 c ); /// Access parser table flags for user defined continuation characters. ParserFlags getContCharsFlags( sal_Unicode c ); diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx index 8192d7ddab16..96882a8ef3c2 100644 --- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx +++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx @@ -20,6 +20,7 @@ #include <cclass_unicode.hxx> #include <unicode/uchar.h> +#include <rtl/character.hxx> #include <rtl/math.hxx> #include <rtl/ustring.hxx> #include <com/sun/star/i18n/KParseTokens.hpp> @@ -317,13 +318,15 @@ const sal_Int32 cclass_Unicode::pParseTokensType[ nDefCnt ] = // static -const sal_Unicode* cclass_Unicode::StrChr( const sal_Unicode* pStr, sal_Unicode c ) +const sal_Unicode* cclass_Unicode::StrChr( const sal_Unicode* pStr, sal_uInt32 c ) { if ( !pStr ) return nullptr; + sal_Unicode cs[2]; + auto const n = rtl::splitSurrogates(c, cs); while ( *pStr ) { - if ( *pStr == c ) + if ( *pStr == cs[0] && (n == 1 || pStr[1] == cs[1]) ) return pStr; pStr++; } @@ -659,7 +662,7 @@ ParserFlags cclass_Unicode::getFlagsExtended(sal_uInt32 const c) } -ParserFlags cclass_Unicode::getStartCharsFlags( sal_Unicode c ) +ParserFlags cclass_Unicode::getStartCharsFlags( sal_uInt32 c ) { if ( pStart ) { |