summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-11-19 15:43:37 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-11-19 17:11:15 +0100
commit87e407f68876b196704e595ff841b2a01bf1bbb9 (patch)
tree582542b637628c30e166463a9a5299e2ad3fcc5a
parent72c8db4987c1df7ca2673beb1dc43cf879102251 (diff)
Use startsWith rest parameter
Change-Id: I5ec5f68c13ceb93b4e2cea83ec757b9427b8608d
-rw-r--r--desktop/source/app/cmdlineargs.cxx35
1 files changed, 14 insertions, 21 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 936844f66404..047c01b3f5e2 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -163,18 +163,11 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
{
m_bEmpty = false;
OUString oArg;
- bool bDeprecated = false;
- if (aArg.startsWith("--"))
- {
- oArg = OUString(aArg.getStr()+2, aArg.getLength()-2);
- }
- else if (aArg.startsWith("-"))
- {
- if ( aArg.getLength() > 2 ) // -h, -o, -n, -? are still valid
- bDeprecated = true;
- oArg = OUString(aArg.getStr()+1, aArg.getLength()-1);
- }
+ bool bDeprecated = !aArg.startsWith("--", &oArg)
+ && aArg.startsWith("-", &oArg) && aArg.getLength() > 2;
+ // -h, -?, -n, -o, -p are still valid
+ OUString rest;
if ( oArg == "minimized" )
{
m_minimized = true;
@@ -294,25 +287,25 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
bDeprecated = false;
}
#endif
- else if ( oArg.startsWith("infilter="))
+ else if ( oArg.startsWith("infilter=", &rest))
{
- m_infilter.push_back(oArg.copy(RTL_CONSTASCII_LENGTH("infilter=")));
+ m_infilter.push_back(rest);
}
- else if ( oArg.startsWith("accept="))
+ else if ( oArg.startsWith("accept=", &rest))
{
- m_accept.push_back(oArg.copy(RTL_CONSTASCII_LENGTH("accept=")));
+ m_accept.push_back(rest);
}
- else if ( oArg.startsWith("unaccept="))
+ else if ( oArg.startsWith("unaccept=", &rest))
{
- m_unaccept.push_back(oArg.copy(RTL_CONSTASCII_LENGTH("unaccept=")));
+ m_unaccept.push_back(rest);
}
- else if ( oArg.startsWith("language="))
+ else if ( oArg.startsWith("language=", &rest))
{
- m_language = oArg.copy(RTL_CONSTASCII_LENGTH("language="));
+ m_language = rest;
}
- else if ( oArg.startsWith("pidfile="))
+ else if ( oArg.startsWith("pidfile=", &rest))
{
- m_pidfile = oArg.copy(RTL_CONSTASCII_LENGTH("pidfile="));
+ m_pidfile = rest;
}
else if ( oArg == "writer" )
{