summaryrefslogtreecommitdiff
path: root/i18nlangtag
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-04-12 10:50:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-04-14 07:54:28 +0200
commitbc2101646bc6e63944c42500af5a15134b9b2d17 (patch)
treeca1da50da2e3e76eef650a1ae3956c16e0a19f33 /i18nlangtag
parentad97694737c99889bc0eb21efccb83768d510361 (diff)
loplugin:stringviewparam improvements
improve the check by checking for methods that exclude using string_view, rather than checking for methods that __can__ use string_view, which leads to exposing some holes in our o3tl/string_view.hxx coverage. Change-Id: Ic9dd60441c671f502692f9cd2a1bb67301c4b960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150277 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18nlangtag')
-rw-r--r--i18nlangtag/source/isolang/isolang.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 192f979dcc0b..01b456f95a4a 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -18,6 +18,7 @@
*/
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/ustring.hxx>
#include <rtl/string.hxx>
@@ -87,7 +88,7 @@ struct IsoLanguageScriptCountryEntry
We don't have OUString::startsWithIgnoreAsciiCaseAscii()
*/
- bool startsInIgnoreAsciiCase( const OUString & rStr ) const;
+ bool startsInIgnoreAsciiCase( std::u16string_view aStr ) const;
};
struct Bcp47CountryEntry
@@ -830,9 +831,9 @@ css::lang::Locale IsoLanguageScriptCountryEntry::getLocale() const
return lang::Locale( I18NLANGTAG_QLT, OUString::createFromAscii( maCountry), getTagString());
}
-bool IsoLanguageScriptCountryEntry::startsInIgnoreAsciiCase( const OUString & rStr ) const
+bool IsoLanguageScriptCountryEntry::startsInIgnoreAsciiCase( std::u16string_view aStr ) const
{
- return rStr.matchIgnoreAsciiCaseAsciiL( maLanguageScript, strlen( maLanguageScript) );
+ return o3tl::matchIgnoreAsciiCase(aStr, std::string_view(maLanguageScript) );
}
OUString Bcp47CountryEntry::getTagString() const
@@ -1208,12 +1209,12 @@ css::lang::Locale MsLangId::Conversion::lookupFallbackLocale(
// static
-LanguageType MsLangId::Conversion::convertPrivateUseToLanguage( const OUString& rPriv )
+LanguageType MsLangId::Conversion::convertPrivateUseToLanguage( std::u16string_view rPriv )
{
for (const IsoLangOtherEntry* pPrivateEntry = aImplPrivateUseEntries;
pPrivateEntry->mnLang != LANGUAGE_DONTKNOW; ++pPrivateEntry)
{
- if ( rPriv.equalsIgnoreAsciiCaseAscii( pPrivateEntry->mpLanguage ) )
+ if ( o3tl::equalsIgnoreAsciiCase(rPriv, pPrivateEntry->mpLanguage ) )
return pPrivateEntry->mnLang;
}
return LANGUAGE_DONTKNOW;