[Libreoffice-commits] core.git: compilerplugins/clang helpcompiler/source

Noel Grandin noelgrandin at gmail.com
Sat Nov 14 22:46:30 PST 2015


 compilerplugins/clang/passstuffbyref.cxx |    2 +-
 helpcompiler/source/HelpCompiler.cxx     |    4 ++--
 helpcompiler/source/HelpLinker.cxx       |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 3bdd176731c351638f541a37b94094124f3c9f52
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Nov 15 07:42:02 2015 +0200

    cppcheck:stlIfStrFind
    
    "Inefficient usage of string::find() in condition; string::compare() would be faster."
    
    Change-Id: I90403b1d05eff6499c10be33068e5fd4fed30b62
    Reviewed-on: https://gerrit.libreoffice.org/19966
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 6d98dbf..673b72b3 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -103,7 +103,7 @@ bool PassStuffByRef::isFat(QualType type, std::string * name) {
     }
     *name = type.getUnqualifiedType().getCanonicalType().getAsString();
     if (*name == "class rtl::OUString" || *name == "class rtl::OString"
-        || name->find("class com::sun::star::uno::Sequence") == 0)
+        || name->compare("class com::sun::star::uno::Sequence") == 0)
     {
         return true;
     }
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index af81547..5d37091 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -335,7 +335,7 @@ void myparser::traverse( xmlNodePtr parentNode )
 
             std::string hid;
 
-            if (branch.find("hid") == 0)
+            if (branch.compare("hid") == 0)
             {
                 size_t index = branch.find('/');
                 if (index != std::string::npos)
@@ -493,7 +493,7 @@ bool HelpCompiler::compile()
 
     if ( !bExtensionMode && !fileName.empty())
     {
-        if (fileName.find("/text/") == 0)
+        if (fileName.compare("/text/") == 0)
         {
             int len = strlen("/text/");
             actMod = fileName.substr(len);
diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx
index 8b8f895..33e684a 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -400,7 +400,7 @@ void HelpLinker::link() throw(HelpProcessingException, BasicCodeTagger::TaggerEx
                 continue;
 
             std::string documentPath = streamTable.document_path;
-            if (documentPath.find("/") == 0)
+            if (documentPath.compare("/") == 0)
                 documentPath = documentPath.substr(1);
 
             std::string documentJarfile = streamTable.document_module + ".jar";


More information about the Libreoffice-commits mailing list