diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-04-20 08:12:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-04-20 10:09:28 +0200 |
commit | a67450a8dd77e29f5b3d67ef035e058253675997 (patch) | |
tree | f569abbdf06c8d60d7f76afaadf354b338de136c | |
parent | ed4627a868b94c05797ed30abe8d9f775ee3060f (diff) |
loplugin:stringviewparam
Change-Id: I487d665875cfb182a5f30b8e6a3834960c0451e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133194
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | sw/source/ui/vba/vbasystem.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sw/source/ui/vba/vbasystem.cxx b/sw/source/ui/vba/vbasystem.cxx index f072e5c0dba9..0d228e6d883c 100644 --- a/sw/source/ui/vba/vbasystem.cxx +++ b/sw/source/ui/vba/vbasystem.cxx @@ -25,6 +25,8 @@ #include <o3tl/char16_t2wchar_t.hxx> #ifdef _WIN32 +#include <cstddef> +#include <string_view> #if !defined WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN #endif @@ -45,13 +47,13 @@ void PrivateProfileStringListener::Initialize( const OUString& rFileName, const maKey = rKey; } #ifdef _WIN32 -static void lcl_getRegKeyInfo( const OString& sKeyInfo, HKEY& hBaseKey, OString& sSubKey ) +static void lcl_getRegKeyInfo( std::string_view sKeyInfo, HKEY& hBaseKey, OString& sSubKey ) { - sal_Int32 nBaseKeyIndex = sKeyInfo.indexOf('\\'); - if( nBaseKeyIndex > 0 ) + std::size_t nBaseKeyIndex = sKeyInfo.find('\\'); + if( nBaseKeyIndex != std::string_view::npos ) { - OString sBaseKey = sKeyInfo.copy( 0, nBaseKeyIndex ); - sSubKey = sKeyInfo.copy( nBaseKeyIndex + 1 ); + std::string_view sBaseKey = sKeyInfo.substr( 0, nBaseKeyIndex ); + sSubKey = OString(sKeyInfo.substr( nBaseKeyIndex + 1 )); if( sBaseKey == "HKEY_CURRENT_USER" ) { hBaseKey = HKEY_CURRENT_USER; |