basctl/source/basicide/localizationmgr.cxx           |    5 +++--
 compilerplugins/clang/stringview.cxx                 |    2 +-
 compilerplugins/clang/stringviewparam.cxx            |    3 ++-
 extensions/source/propctrlr/formcomponenthandler.cxx |    6 +++---
 4 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 9f463511fb8712312c94211e34a0fbcd70069108
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Apr 11 11:18:24 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Apr 12 10:49:50 2023 +0200

    loplugin:stringview and stringviewparam, whitelist equalsAsciiL
    
    since we have a o3tl::equalsAscii that can handle that
    
    Change-Id: I0ae3b81cd5b4d97a0aef92cb6586cf365ee042b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150239
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basctl/source/basicide/localizationmgr.cxx 
b/basctl/source/basicide/localizationmgr.cxx
index 17371bed2968..ef3a1ed9ff90 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -39,6 +39,7 @@
 #include <tools/debug.hxx>
 #include <utility>
 #include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
 
 namespace basctl
 {
@@ -107,7 +108,7 @@ void LocalizationMgr::handleTranslationbar ()
 // TODO: -> export from toolkit
 
 
-static bool isLanguageDependentProperty( const OUString& aName )
+static bool isLanguageDependentProperty( std::u16string_view aName )
 {
     static struct Prop
     {
@@ -126,7 +127,7 @@ static bool isLanguageDependentProperty( const OUString& 
aName )
     };
 
     for (Prop const* pProp = vProp; pProp->sName; ++pProp)
-        if (aName.equalsAsciiL(pProp->sName, pProp->nNameLength))
+        if (o3tl::equalsAscii(aName, std::string_view(pProp->sName, 
pProp->nNameLength)))
             return true;
     return false;
 }
diff --git a/compilerplugins/clang/stringview.cxx 
b/compilerplugins/clang/stringview.cxx
index 4978c802c55b..b5d533b115cb 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -365,7 +365,7 @@ bool StringView::VisitCXXMemberCallExpr(CXXMemberCallExpr 
const* expr)
     {
         auto const dc = loplugin::DeclCheck(expr->getMethodDecl());
         if (dc.Function("toInt32") || dc.Function("toUInt32") || 
dc.Function("toInt64")
-            || dc.Function("toDouble") || dc.Function("equalsAscii")
+            || dc.Function("toDouble") || dc.Function("equalsAscii") || 
dc.Function("equalsAsciiL")
             || dc.Function("equalsIgnoreAsciiCase") || 
dc.Function("compareToIgnoreAsciiCase")
             || dc.Function("matchIgnoreAsciiCase") || dc.Function("trim")
             || dc.Function("startsWith") || dc.Function("endsWith") || 
dc.Function("match"))
diff --git a/compilerplugins/clang/stringviewparam.cxx 
b/compilerplugins/clang/stringviewparam.cxx
index eed439d0adf3..1540f03291c3 100644
--- a/compilerplugins/clang/stringviewparam.cxx
+++ b/compilerplugins/clang/stringviewparam.cxx
@@ -141,7 +141,8 @@ DeclRefExpr const* 
relevantCXXMemberCallExpr(CXXMemberCallExpr const* expr)
             || n == "indexOf" || n == "lastIndexOf" || n == "compareTo" || n 
== "match"
             || n == "trim" || n == "toInt32" || n == "toUInt32" || n == 
"toInt64" || n == "toDouble"
             || n == "equalsIgnoreAsciiCase" || n == "compareToIgnoreAsciiCase" 
|| n == "getToken"
-            || n == "copy" || n == "equalsAscii" || n == 
"matchIgnoreAsciiCase")
+            || n == "copy" || n == "equalsAscii" || n == "equalsAsciiL"
+            || n == "matchIgnoreAsciiCase")
         {
             good = true;
         }
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx 
b/extensions/source/propctrlr/formcomponenthandler.cxx
index 9385d0bdc5af..730bc2c71f8f 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -192,14 +192,14 @@ namespace pcr
 
     namespace
     {
-        bool lcl_isLanguageDependentProperty( const OUString& aName )
+        bool lcl_isLanguageDependentProperty( std::u16string_view aName )
         {
             bool bRet = false;
 
             const LanguageDependentProp* pLangDepProp = aLanguageDependentProp;
             while( pLangDepProp->pPropName != nullptr )
             {
-                if( aName.equalsAsciiL( pLangDepProp->pPropName, 
pLangDepProp->nPropNameLength ))
+                if( o3tl::equalsAscii( aName, 
std::string_view(pLangDepProp->pPropName, pLangDepProp->nPropNameLength) ))
                 {
                     bRet = true;
                     break;
@@ -210,7 +210,7 @@ namespace pcr
         }
 
         Reference< resource::XStringResourceResolver > 
lcl_getStringResourceResolverForProperty
-            ( const Reference< XPropertySet >& _xComponent, const OUString& 
_rPropertyName,
+            ( const Reference< XPropertySet >& _xComponent, 
std::u16string_view _rPropertyName,
               const Any& _rPropertyValue )
         {
             Reference< resource::XStringResourceResolver > xRet;

Reply via email to