diff options
-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; |