[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - compilerplugins/clang helpcompiler/source

Jan Holesovsky kendy at collabora.com
Tue Dec 8 03:24:26 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 858613fb2fb554c57081f54aea6a0e2782b79aaa
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Dec 8 12:07:49 2015 +0100

    tdf#96042: 'std::string::find("something") == 0' means "startsWith()".
    
    This should fix a regression from 3bdd176731c351638f541a37b94094124f3c9f52,
    apparently the cppcheck's advice is misleading.
    
    Change-Id: I427ecaa1eb3c9841cb6112997b9b51feda4583d0

diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 673b72b3..f2e66f7 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->compare("class com::sun::star::uno::Sequence") == 0)
+        || name->compare(0, 35, "class com::sun::star::uno::Sequence") == 0)
     {
         return true;
     }
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index 85a82d0..6d821e4 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -334,7 +334,7 @@ void myparser::traverse( xmlNodePtr parentNode )
 
             std::string hid;
 
-            if (branch.compare("hid") == 0)
+            if (branch.compare(0, 3, "hid") != 0)
             {
                 size_t index = branch.find('/');
                 if (index != std::string::npos)
@@ -492,7 +492,7 @@ bool HelpCompiler::compile()
 
     if ( !bExtensionMode && !fileName.empty())
     {
-        if (fileName.compare("/text/") == 0)
+        if (fileName.compare(0, 6, "/text/") == 0)
         {
             int len = strlen("/text/");
             actMod = fileName.substr(len);
diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx
index 7d4cfe5..13b840d 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -397,7 +397,7 @@ void HelpLinker::link() throw(HelpProcessingException, BasicCodeTagger::TaggerEx
                 continue;
 
             std::string documentPath = streamTable.document_path;
-            if (documentPath.compare("/") == 0)
+            if (documentPath.compare(0, 1, "/") == 0)
                 documentPath = documentPath.substr(1);
 
             std::string documentJarfile = streamTable.document_module + ".jar";


More information about the Libreoffice-commits mailing list