[Libreoffice-commits] core.git: desktop/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 10 10:02:06 UTC 2018
desktop/source/app/cmdlineargs.cxx | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
New commits:
commit 5ccf82642b19728e1cfe8fa11f654e90712c5757
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Aug 10 11:50:52 2018 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Aug 10 12:01:41 2018 +0200
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 at collabora.com>
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());
}
}
More information about the Libreoffice-commits
mailing list