summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-10 11:50:52 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-08-10 12:01:41 +0200
commit5ccf82642b19728e1cfe8fa11f654e90712c5757 (patch)
tree03c3faae747f03c10c76fd83aebf578de9f580fa /desktop
parent8055f402dbe6783884a51c8a78f4abcf7adda6c4 (diff)
tdf#119194: save deprecated argument early
Change-Id: I4b5001e1f71ac536ac0c3bda4b8c1955020ab40d Reviewed-on: https://gerrit.libreoffice.org/58815 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/cmdlineargs.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index bbe3bcbeb5ee..a1377168abf8 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -288,9 +288,12 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
{
m_bEmpty = false;
OUString oArg;
- bool bDeprecated = !aArg.startsWith("--", &oArg)
- && aArg.startsWith("-", &oArg) && aArg.getLength() > 2;
- // -h, -?, -n, -o, -p are still valid
+ OUString oDeprecatedArg;
+ if (!aArg.startsWith("--", &oArg) && aArg.startsWith("-", &oArg)
+ && aArg.getLength() > 2) // -h, -?, -n, -o, -p are still valid
+ {
+ oDeprecatedArg = aArg; // save here, since aArg can change later
+ }
OUString rest;
if ( oArg == "minimized" )
@@ -424,7 +427,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
*/
else if ( aArg.startsWith("-psn") )
{
- bDeprecated = false;
+ oDeprecatedArg.clear();
}
#endif
#if HAVE_FEATURE_MACOSX_SANDBOX
@@ -440,7 +443,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
*/
else if ( oArg == "Embedding" )
{
- bDeprecated = false;
+ oDeprecatedArg.clear();
}
#endif
else if ( oArg.startsWith("infilter=", &rest))
@@ -623,7 +626,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
{
m_unknown = aArg;
}
- bDeprecated = false;
+ oDeprecatedArg.clear();
}
else
{
@@ -674,9 +677,9 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
}
}
- if (bDeprecated)
+ if (!oDeprecatedArg.isEmpty())
{
- OString sArg(OUStringToOString(aArg, osl_getThreadTextEncoding()));
+ OString sArg(OUStringToOString(oDeprecatedArg, osl_getThreadTextEncoding()));
fprintf(stderr, "Warning: %s is deprecated. Use -%s instead.\n", sArg.getStr(), sArg.getStr());
}
}