From 97351cfe6adcb87ef9076e69312a7208029d6d1a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 20 Apr 2021 16:07:21 +0200 Subject: Simplify some code by using OUString instead of raw rtl_uString Change-Id: I0d795db2e0fc5f5a74fd8437cac46edaabd1336d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114342 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sal/rtl/cmdargs.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sal') diff --git a/sal/rtl/cmdargs.cxx b/sal/rtl/cmdargs.cxx index 8eb328258dfe..bad833077012 100644 --- a/sal/rtl/cmdargs.cxx +++ b/sal/rtl/cmdargs.cxx @@ -59,12 +59,14 @@ void init() { 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] == ':' && - rtl_ustr_indexOfChar (&(pArg->buffer[5]), '=') >= 0 ) + bool env; + { + auto const & arg = OUString::unacquired(&pArg); + env = (arg.startsWith("-") || arg.startsWith("/")) && + arg.match("env:", 1) && + arg.indexOf ('=') >= 0; + } + if (env ) { // ignore. rtl_uString_release (pArg); -- cgit