idlc/inc/idlc.hxx | 2 +- idlc/source/astscope.cxx | 6 ++++-- idlc/source/idlccompile.cxx | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-)
New commits: commit 4706eb93350b2613b1fe6b98afa1243415c40577 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Sep 22 22:19:43 2021 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Sep 23 07:27:14 2021 +0200 Extend loplugin:stringviewparam to starts/endsWith: idlc Change-Id: Ib9c97576746b6acfddeacec658a2ae994aa28516 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122497 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/idlc/inc/idlc.hxx b/idlc/inc/idlc.hxx index 8995ead72de4..1be11b1457da 100644 --- a/idlc/inc/idlc.hxx +++ b/idlc/inc/idlc.hxx @@ -147,7 +147,7 @@ void removeIfExists(std::string_view pathname); bool copyFile(const OString* source, const OString& target); // a null source means stdin -bool isFileUrl(const OString& fileName); +bool isFileUrl(std::string_view fileName); OString convertToAbsoluteSystemPath(const OString& fileName); OString convertToFileUrl(const OString& fileName); diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx index d4c0f954367c..ca6214129c87 100644 --- a/idlc/source/astscope.cxx +++ b/idlc/source/astscope.cxx @@ -20,17 +20,19 @@ #include <sal/config.h> #include <algorithm> +#include <string_view> #include <astscope.hxx> #include <astbasetype.hxx> #include <astinterface.hxx> #include <errorhandler.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> -static bool isGlobal(const OString& scopedName) +static bool isGlobal(std::string_view scopedName) { - return scopedName.isEmpty() || scopedName.startsWith(":"); + return scopedName.empty() || o3tl::starts_with(scopedName, ":"); } AstScope::AstScope(NodeType nodeType) diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 1902d63e0cad..6db9a615d316 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -22,6 +22,7 @@ #include <rtl/ustring.hxx> #include <rtl/strbuf.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <osl/process.h> #include <osl/diagnose.h> #include <osl/thread.h> @@ -52,9 +53,9 @@ extern int yydebug; static char tmpFilePattern[512]; -bool isFileUrl(const OString& fileName) +bool isFileUrl(std::string_view fileName) { - return fileName.startsWith("file://"); + return o3tl::starts_with(fileName, "file://"); } OString convertToAbsoluteSystemPath(const OString& fileName)