diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-05 12:07:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-06 12:09:48 +0200 |
commit | 325c571c22231978e5409902b514d2584186e0a0 (patch) | |
tree | c6d84fedf6dee52bff77b07b5d46d4800f109f5f /i18npool | |
parent | 6276e7c28ed53670fb911ec2bd97a6696583d36b (diff) |
update loplugin:stringview* for o3tl::iterateCodePoints
And change o3tl::iterateCodePoints to use sal_Int32 for its
second param, to integrate better with places where the parameter
comes from an UNO API, which cannot use std::size_t
Change-Id: I7b9dd2c9bc7f48e6c4a912f039f1b5dae7beae69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151421
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/inc/cclass_unicode.hxx | 2 | ||||
-rw-r--r-- | i18npool/source/breakiterator/breakiteratorImpl.cxx | 15 | ||||
-rw-r--r-- | i18npool/source/characterclassification/cclass_unicode.cxx | 5 |
3 files changed, 12 insertions, 10 deletions
diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx index 03c03d5bbc97..3a5f28f124ab 100644 --- a/i18npool/inc/cclass_unicode.hxx +++ b/i18npool/inc/cclass_unicode.hxx @@ -178,7 +178,7 @@ private: void setupInternational( const css::lang::Locale& rLocale ); /// Implementation of getCharacterType() for one single character - static sal_Int32 getCharType( const OUString& Text, sal_Int32 *nPos, sal_Int32 increment); + static sal_Int32 getCharType( std::u16string_view Text, sal_Int32 *nPos, sal_Int32 increment); }; diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 71d794e2c9d4..5402caa7a469 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -23,6 +23,7 @@ #include <cppuhelper/supportsservice.hxx> #include <unicode/uchar.h> #include <i18nutil/unicode.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/i18n/CharType.hpp> #include <com/sun/star/i18n/ScriptType.hpp> @@ -72,7 +73,7 @@ sal_Int32 SAL_CALL BreakIteratorImpl::previousCharacters( const OUString& Text, #define isZWSP(c) (ch == 0x200B) -static sal_Int32 skipSpace(const OUString& Text, sal_Int32 nPos, sal_Int32 len, sal_Int16 rWordType, bool bDirection) +static sal_Int32 skipSpace(std::u16string_view Text, sal_Int32 nPos, sal_Int32 len, sal_Int16 rWordType, bool bDirection) { sal_uInt32 ch=0; sal_Int32 pos=nPos; @@ -81,7 +82,7 @@ static sal_Int32 skipSpace(const OUString& Text, sal_Int32 nPos, sal_Int32 len, if (bDirection) while (nPos < len) { - ch = Text.iterateCodePoints(&pos); + ch = o3tl::iterateCodePoints(Text, &pos); if (!u_isUWhiteSpace(ch) && !isZWSP(ch)) break; nPos = pos; @@ -89,7 +90,7 @@ static sal_Int32 skipSpace(const OUString& Text, sal_Int32 nPos, sal_Int32 len, else while (nPos > 0) { - ch = Text.iterateCodePoints(&pos, -1); + ch = o3tl::iterateCodePoints(Text, &pos, -1); if (!u_isUWhiteSpace(ch) && !isZWSP(ch)) break; nPos = pos; @@ -99,7 +100,7 @@ static sal_Int32 skipSpace(const OUString& Text, sal_Int32 nPos, sal_Int32 len, if (bDirection) while (nPos < len) { - ch = Text.iterateCodePoints(&pos); + ch = o3tl::iterateCodePoints(Text, &pos); if (!u_isWhitespace(ch) && !isZWSP(ch) && (ch == 0x002E || u_isalnum(ch))) break; nPos = pos; @@ -107,7 +108,7 @@ static sal_Int32 skipSpace(const OUString& Text, sal_Int32 nPos, sal_Int32 len, else while (nPos > 0) { - ch = Text.iterateCodePoints(&pos, -1); + ch = o3tl::iterateCodePoints(Text, &pos, -1); if (!u_isWhitespace(ch) && !isZWSP(ch) && (ch == 0x002E || u_isalnum(ch))) break; nPos = pos; @@ -117,7 +118,7 @@ static sal_Int32 skipSpace(const OUString& Text, sal_Int32 nPos, sal_Int32 len, if (bDirection) while (nPos < len) { - ch = Text.iterateCodePoints(&pos); + ch = o3tl::iterateCodePoints(Text, &pos); if (!u_isUWhiteSpace(ch) && !isZWSP(ch)) break; nPos = pos; @@ -125,7 +126,7 @@ static sal_Int32 skipSpace(const OUString& Text, sal_Int32 nPos, sal_Int32 len, else while (nPos > 0) { - ch = Text.iterateCodePoints(&pos, -1); + ch = o3tl::iterateCodePoints(Text, &pos, -1); if (!u_isUWhiteSpace(ch) && !isZWSP(ch)) break; nPos = pos; diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx index f07e9f812951..e3c27e9bc0fa 100644 --- a/i18npool/source/characterclassification/cclass_unicode.cxx +++ b/i18npool/source/characterclassification/cclass_unicode.cxx @@ -27,6 +27,7 @@ #include <breakiteratorImpl.hxx> #include <transliteration_body.hxx> #include <rtl/ref.hxx> +#include <o3tl/string_view.hxx> #include <utility> using namespace ::com::sun::star; @@ -147,10 +148,10 @@ cclass_Unicode::getScript( const OUString& Text, sal_Int32 nPos ) { sal_Int32 -cclass_Unicode::getCharType( const OUString& Text, sal_Int32* nPos, sal_Int32 increment) { +cclass_Unicode::getCharType( std::u16string_view Text, sal_Int32* nPos, sal_Int32 increment) { using namespace ::com::sun::star::i18n::KCharacterType; - sal_uInt32 ch = Text.iterateCodePoints(nPos, increment); + sal_uInt32 ch = o3tl::iterateCodePoints(Text, nPos, increment); switch ( u_charType(ch) ) { // Upper case U_UPPERCASE_LETTER : |