sw/source/ui/vba/vbasystem.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
New commits: commit a67450a8dd77e29f5b3d67ef035e058253675997 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Apr 20 08:12:45 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Wed Apr 20 10:09:28 2022 +0200 loplugin:stringviewparam Change-Id: I487d665875cfb182a5f30b8e6a3834960c0451e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133194 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> 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;