diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-04-20 16:06:51 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-04-20 21:21:16 +0200 |
commit | 72b9ad0bd1f355b8a1cb6ef6960ec7aaf67e4de5 (patch) | |
tree | e2d06e05baff61666d81d8d99f0b93702ac36429 /sal | |
parent | 90cbc6c892a6b26a0fe950800d4fba0b7a0de68f (diff) |
Simplify some code by using OUString instead of raw rtl_uString
Change-Id: I62001c05436efe6a5fb6f19fb733e41837c7d9d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114341
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/bootstrap.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index a8dc87b6fd98..4f5c2f732dc1 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -161,21 +161,18 @@ static bool getFromCommandLineArgs( sal_Int32 nArgCount = osl_getCommandArgCount(); for(sal_Int32 i = 0; i < nArgCount; ++ i) { - rtl_uString *pArg = nullptr; - osl_getCommandArg( i, &pArg ); - if( (pArg->buffer[0] == '-' || pArg->buffer[0] == '/' ) && - pArg->buffer[1] == 'e' && - pArg->buffer[2] == 'n' && - pArg->buffer[3] == 'v' && - pArg->buffer[4] == ':' ) + OUString pArg; + osl_getCommandArg( i, &pArg.pData ); + if( (pArg.startsWith("-") || pArg.startsWith("/") ) && + pArg.match("env:", 1) ) { - sal_Int32 nIndex = rtl_ustr_indexOfChar( pArg->buffer, '=' ); + sal_Int32 nIndex = pArg.indexOf( '=' ); if( nIndex >= 0 ) { rtl_bootstrap_NameValue nameValue; - nameValue.sName = OUString( &(pArg->buffer[5]), nIndex - 5 ); - nameValue.sValue = OUString( &(pArg->buffer[nIndex+1]) ); + nameValue.sName = pArg.copy( 5, nIndex - 5 ); + nameValue.sValue = pArg.copy( nIndex+1 ); if( i == nArgCount-1 && nameValue.sValue.getLength() && @@ -190,7 +187,6 @@ static bool getFromCommandLineArgs( tmp.push_back( nameValue ); } } - rtl_uString_release( pArg ); }; return tmp; }(); |