[Libreoffice-commits] core.git: sal/rtl
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 20 19:21:54 UTC 2021
sal/rtl/bootstrap.cxx | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
New commits:
commit 72b9ad0bd1f355b8a1cb6ef6960ec7aaf67e4de5
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Apr 20 16:06:51 2021 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Apr 20 21:21:16 2021 +0200
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 at redhat.com>
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;
}();
More information about the Libreoffice-commits
mailing list