compilerplugins/clang/stringviewparam.cxx                      |    2 -
 connectivity/source/drivers/postgresql/pq_databasemetadata.cxx |   16 
+++++-----
 include/svtools/ctrltool.hxx                                   |    2 -
 lotuswordpro/source/filter/benlist.cxx                         |    4 +-
 lotuswordpro/source/filter/first.hxx                           |    2 -
 scripting/source/provider/BrowseNodeFactoryImpl.cxx            |    4 +-
 svtools/source/control/ctrltool.cxx                            |    8 ++---
 xmloff/source/chart/MultiPropertySetHandler.hxx                |    4 +-
 8 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit c898611bd56a2ea090b2eb46f4d7bd4dd57594a7
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sat Apr 2 13:41:56 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Apr 2 16:55:36 2022 +0200

    loplugin:stringviewparam convert methods using compareTo
    
    which converts to compare
    
    Change-Id: If03c790ea113a7caedbe89f926b29055c9ec1e76
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132455
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/stringviewparam.cxx 
b/compilerplugins/clang/stringviewparam.cxx
index f0d09fe333d9..0ca41f2aeb1e 100644
--- a/compilerplugins/clang/stringviewparam.cxx
+++ b/compilerplugins/clang/stringviewparam.cxx
@@ -138,7 +138,7 @@ DeclRefExpr const* 
relevantCXXMemberCallExpr(CXXMemberCallExpr const* expr)
     {
         auto const n = i->getName();
         if (n == "endsWith" || n == "isEmpty" || n == "startsWith" || n == 
"subView"
-            || n == "indexOf" || n == "lastIndexOf")
+            || n == "indexOf" || n == "lastIndexOf" || n == "compareTo")
         {
             good = true;
         }
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx 
b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index c3280e07bf15..e14831a99b79 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -1185,30 +1185,30 @@ css::uno::Reference< XResultSet > 
DatabaseMetaData::getTables(
 namespace
 {
     // sort no schema first, then "public", then normal schemas, then internal 
schemas
-    int compare_schema(const OUString &nsA, std::u16string_view nsB)
+    int compare_schema(std::u16string_view nsA, std::u16string_view nsB)
     {
-        if (nsA.isEmpty())
+        if (nsA.empty())
         {
             return nsB.empty() ? 0 : -1;
         }
         else if (nsB.empty())
         {
-            assert(!nsA.isEmpty());
+            assert(!nsA.empty());
             return 1;
         }
-        else if(nsA == "public")
+        else if(nsA == u"public")
         {
             return (nsB == u"public") ? 0 : -1;
         }
         else if(nsB == u"public")
         {
-            assert(nsA != "public");
+            assert(nsA != u"public");
             return 1;
         }
-        else if(nsA.startsWith("pg_"))
+        else if(o3tl::starts_with(nsA, u"pg_"))
         {
             if(o3tl::starts_with(nsB, u"pg_"))
-                return nsA.compareTo(nsB);
+                return nsA.compare(nsB);
             else
                 return 1;
         }
@@ -1218,7 +1218,7 @@ namespace
         }
         else
         {
-            return nsA.compareTo(nsB);
+            return nsA.compare(nsB);
         }
     }
 
diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx
index 4ec07814a14e..dc15f2637253 100644
--- a/include/svtools/ctrltool.hxx
+++ b/include/svtools/ctrltool.hxx
@@ -148,7 +148,7 @@ private:
     VclPtr<OutputDevice>    mpDev2;
     std::vector<std::unique_ptr<ImplFontListNameInfo>> m_Entries;
 
-    SVT_DLLPRIVATE ImplFontListNameInfo*    ImplFind( const OUString& 
rSearchName, sal_uInt32* pIndex ) const;
+    SVT_DLLPRIVATE ImplFontListNameInfo*    ImplFind( std::u16string_view 
rSearchName, sal_uInt32* pIndex ) const;
     SVT_DLLPRIVATE ImplFontListNameInfo*    ImplFindByName( const OUString& 
rStr ) const;
     SVT_DLLPRIVATE void                     ImplInsertFonts(OutputDevice* 
pDev, bool bInsertData);
 
diff --git a/lotuswordpro/source/filter/benlist.cxx 
b/lotuswordpro/source/filter/benlist.cxx
index 8757cce41ce8..1972254fe98b 100644
--- a/lotuswordpro/source/filter/benlist.cxx
+++ b/lotuswordpro/source/filter/benlist.cxx
@@ -56,7 +56,7 @@
 #include "first.hxx"
 namespace OpenStormBento
 {
-CBenNamedObject* FindNamedObject(CUtList* pList, const OString& rName, 
CUtListElmt** ppPrev)
+CBenNamedObject* FindNamedObject(CUtList* pList, std::string_view rName, 
CUtListElmt** ppPrev)
 {
     CUtListElmt& rTerminating = pList->GetTerminating();
     for (CUtListElmt* pCurr = pList->GetLast(); pCurr != &rTerminating; pCurr 
= pCurr->GetPrev())
@@ -64,7 +64,7 @@ CBenNamedObject* FindNamedObject(CUtList* pList, const 
OString& rName, CUtListEl
         CBenNamedObjectListElmt* pCurrNamedObjectListElmt
             = static_cast<CBenNamedObjectListElmt*>(pCurr);
 
-        sal_Int32 Comp = 
rName.compareTo(pCurrNamedObjectListElmt->GetNamedObject()->GetName());
+        sal_Int32 Comp = 
rName.compare(pCurrNamedObjectListElmt->GetNamedObject()->GetName());
 
         if (Comp == 0)
             return pCurrNamedObjectListElmt->GetNamedObject();
diff --git a/lotuswordpro/source/filter/first.hxx 
b/lotuswordpro/source/filter/first.hxx
index 9acf487ed380..78b6181ff09a 100644
--- a/lotuswordpro/source/filter/first.hxx
+++ b/lotuswordpro/source/filter/first.hxx
@@ -64,7 +64,7 @@ namespace OpenStormBento
 // String constants
 extern const char gsBenMagicBytes[];
 
-CBenNamedObject* FindNamedObject(CUtList* pList, const OString& rName, 
CUtListElmt** ppPrev);
+CBenNamedObject* FindNamedObject(CUtList* pList, std::string_view rName, 
CUtListElmt** ppPrev);
 
 CBenIDListElmt* FindID(CUtList* pList, BenObjectID ObjectID, CUtListElmt** 
ppPrev);
 } // end namespace
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index b18db2bbce31..23eb2f203630 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -143,9 +143,9 @@ public:
 
 struct alphaSort
 {
-    bool operator()( const OUString& a, std::u16string_view b )
+    bool operator()( std::u16string_view a, std::u16string_view b )
     {
-        return a.compareTo( b ) < 0;
+        return a.compare( b ) < 0;
     }
 };
 class LocationBrowseNode :
diff --git a/svtools/source/control/ctrltool.cxx 
b/svtools/source/control/ctrltool.cxx
index 90f912746cde..d061c2773e3f 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -166,7 +166,7 @@ static OUString ImplMakeSearchStringFromName(const 
OUString& rStr)
     return ImplMakeSearchString(rStr.getToken( 0, ';' ));
 }
 
-ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, 
sal_uInt32* pIndex) const
+ImplFontListNameInfo* FontList::ImplFind(std::u16string_view rSearchName, 
sal_uInt32* pIndex) const
 {
     // Append if there is no entry in the list or if the entry is larger
     // then the last one. We only compare to the last entry as the list of VCL
@@ -181,7 +181,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& 
rSearchName, sal_uInt32
     else
     {
         const ImplFontListNameInfo* pCmpData = m_Entries.back().get();
-        sal_Int32 nComp = rSearchName.compareTo( pCmpData->maSearchName );
+        sal_Int32 nComp = rSearchName.compare( pCmpData->maSearchName );
         if (nComp > 0)
         {
             if ( pIndex )
@@ -203,7 +203,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& 
rSearchName, sal_uInt32
     {
         nMid = (nLow + nHigh) / 2;
         pCompareData = m_Entries[nMid].get();
-        sal_Int32 nComp = rSearchName.compareTo(pCompareData->maSearchName);
+        sal_Int32 nComp = rSearchName.compare(pCompareData->maSearchName);
         if (nComp < 0)
         {
             if ( !nMid )
@@ -225,7 +225,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& 
rSearchName, sal_uInt32
 
     if ( pIndex )
     {
-        sal_Int32 nComp = rSearchName.compareTo(pCompareData->maSearchName);
+        sal_Int32 nComp = rSearchName.compare(pCompareData->maSearchName);
         if (nComp > 0)
             *pIndex = (nMid+1);
         else
diff --git a/xmloff/source/chart/MultiPropertySetHandler.hxx 
b/xmloff/source/chart/MultiPropertySetHandler.hxx
index d742faf50463..d47b942f0fe0 100644
--- a/xmloff/source/chart/MultiPropertySetHandler.hxx
+++ b/xmloff/source/chart/MultiPropertySetHandler.hxx
@@ -94,9 +94,9 @@ class   OUStringComparison
 {
 public:
     /// Compare two strings.  Returns true if the first is before the second.
-    bool    operator()  (const OUString & a, std::u16string_view b) const
+    bool    operator()  (std::u16string_view a, std::u16string_view b) const
     {
-        return (a.compareTo (b) < 0);
+        return (a.compare (b) < 0);
     }
 };
 

Reply via email to