Kaydet (Commit) 3bdd1767 authored tarafından Noel Grandin's avatar Noel Grandin

cppcheck:stlIfStrFind

"Inefficient usage of string::find() in condition; string::compare() would be faster."

Change-Id: I90403b1d05eff6499c10be33068e5fd4fed30b62
Reviewed-on: https://gerrit.libreoffice.org/19966Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 7272e8df
...@@ -103,7 +103,7 @@ bool PassStuffByRef::isFat(QualType type, std::string * name) { ...@@ -103,7 +103,7 @@ bool PassStuffByRef::isFat(QualType type, std::string * name) {
} }
*name = type.getUnqualifiedType().getCanonicalType().getAsString(); *name = type.getUnqualifiedType().getCanonicalType().getAsString();
if (*name == "class rtl::OUString" || *name == "class rtl::OString" 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; return true;
} }
......
...@@ -335,7 +335,7 @@ void myparser::traverse( xmlNodePtr parentNode ) ...@@ -335,7 +335,7 @@ void myparser::traverse( xmlNodePtr parentNode )
std::string hid; std::string hid;
if (branch.find("hid") == 0) if (branch.compare("hid") == 0)
{ {
size_t index = branch.find('/'); size_t index = branch.find('/');
if (index != std::string::npos) if (index != std::string::npos)
...@@ -493,7 +493,7 @@ bool HelpCompiler::compile() ...@@ -493,7 +493,7 @@ bool HelpCompiler::compile()
if ( !bExtensionMode && !fileName.empty()) if ( !bExtensionMode && !fileName.empty())
{ {
if (fileName.find("/text/") == 0) if (fileName.compare("/text/") == 0)
{ {
int len = strlen("/text/"); int len = strlen("/text/");
actMod = fileName.substr(len); actMod = fileName.substr(len);
......
...@@ -400,7 +400,7 @@ void HelpLinker::link() throw(HelpProcessingException, BasicCodeTagger::TaggerEx ...@@ -400,7 +400,7 @@ void HelpLinker::link() throw(HelpProcessingException, BasicCodeTagger::TaggerEx
continue; continue;
std::string documentPath = streamTable.document_path; std::string documentPath = streamTable.document_path;
if (documentPath.find("/") == 0) if (documentPath.compare("/") == 0)
documentPath = documentPath.substr(1); documentPath = documentPath.substr(1);
std::string documentJarfile = streamTable.document_module + ".jar"; std::string documentJarfile = streamTable.document_module + ".jar";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment