diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-04-14 23:00:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-04-15 08:38:07 +0200 |
commit | dcd969ba5237e897c5767854df30f31fc8b4ee32 (patch) | |
tree | 168a6e91c6eb8025233085bbbb60e4ad99cf7b51 /shell | |
parent | a8383345174d91f6e722128e1d53c9a4ebc18195 (diff) |
loplugin:stringviewparam
Change-Id: Ie9dc89642c197baaf1ecfdfcd340cb6a427147ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133033
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/source/win32/SysShExec.cxx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx index d01c01f839ea..066b818abe92 100644 --- a/shell/source/win32/SysShExec.cxx +++ b/shell/source/win32/SysShExec.cxx @@ -19,6 +19,8 @@ #include <algorithm> #include <cassert> +#include <cstddef> +#include <string_view> #include <osl/diagnose.h> #include <osl/process.h> @@ -34,6 +36,7 @@ #include <o3tl/char16_t2wchar_t.hxx> #include <o3tl/runtimetooustring.hxx> #include <o3tl/safeCoInitUninit.hxx> +#include <o3tl/string_view.hxx> #include <prewin.h> #include <Shlobj.h> @@ -166,12 +169,12 @@ CSysShExec::~CSysShExec() namespace { -bool checkExtension(OUString const & extension, OUString const & denylist) { - assert(!extension.isEmpty()); - for (sal_Int32 i = 0; i != -1;) { - OUString tok = denylist.getToken(0, ';', i); - tok.startsWith(".", &tok); - if (extension.equalsIgnoreAsciiCase(tok)) { +bool checkExtension(std::u16string_view extension, std::u16string_view denylist) { + assert(!extension.empty()); + for (std::size_t i = 0; i != std::u16string_view::npos;) { + std::u16string_view tok = o3tl::getToken(denylist, ';', i); + o3tl::starts_with(tok, u'.', &tok); + if (o3tl::equalsIgnoreAsciiCase(extension, tok)) { return false; } } @@ -343,7 +346,7 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa if (!(checkExtension(ext, env) && checkExtension( ext, - ".ADE;.ADP;.APK;.APPLICATION;.APPX;.APPXBUNDLE;.BAT;.CAB;.CHM;.CLASS;" + u".ADE;.ADP;.APK;.APPLICATION;.APPX;.APPXBUNDLE;.BAT;.CAB;.CHM;.CLASS;" ".CMD;.COM;.CPL;.DLL;.DMG;.EX;.EX_;.EXE;.GADGET;.HTA;.INF;.INS;.IPA;" ".ISO;.ISP;.JAR;.JS;.JSE;.LIB;.LNK;.MDE;.MSC;.MSH;.MSH1;.MSH2;.MSHXML;" ".MSH1XML;.MSH2XML;.MSI;.MSIX;.MSIXBUNDLE;.MSP;.MST;.NSH;.PIF;.PS1;" |