diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-11-25 23:22:13 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-11-25 23:22:13 +0100 |
commit | 2ad716f406e0fdb9b9294876c64ae92fecbf5e27 (patch) | |
tree | 200b42e3572dec1facc4b16602a4477b249d039b /sal/osl/unx | |
parent | d8266cfcd657485e1ea817376eb00c9fb2c8260f (diff) |
Revert "pyuno: set up fake command line in getComponentContext()"
This reverts commit 2386a92c1e6e8ec263edb4dc4fdcfeaa4673ce1f and its follow-ups
1acaa577b67158c060d2f57414f7aea86504a489 "sal: add special handling of argc==0
to osl_setCommandArgs()" and 01f27b5e5d428cc3c4aeabdcbbb8204494fbd435 "sal: fix
osl_setCommandArgs() on WNT."
The situation that osl_getCommandArgCount is called without a prior call to
osl_setCommandArgs should be considered as harmless and can legitimately not
only happen in the pyuno case discussed in the reverted commits, but also in
case binary UNO is bootstrapped from within a Java process, as happens in
test-javanative in ure/source/uretest/Makefile.
Change-Id: I2829db390e37dfe5daeda33a4c0659b7d35e565a
Diffstat (limited to 'sal/osl/unx')
-rw-r--r-- | sal/osl/unx/process_impl.cxx | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 56c4925a2391..3942f14d5cee 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -164,7 +164,7 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount (void) sal_uInt32 result = 0; pthread_mutex_lock (&(g_command_args.m_mutex)); - assert (g_command_args.m_nCount != 0); + SAL_WARN_IF (g_command_args.m_nCount == 0, "sal.osl", "osl_setCommandArgs() not called before calling osl_getCommandArgCount()"); if (g_command_args.m_nCount > 0) result = g_command_args.m_nCount - 1; pthread_mutex_unlock (&(g_command_args.m_mutex)); @@ -204,26 +204,13 @@ int SAL_CALL osl_areCommandArgsSet (void) **************************************/ void SAL_CALL osl_setCommandArgs (int argc, char ** argv) { - // special case for argc == 0: set up fake command line - int nArgs(argc ? argc : 1); + OSL_ASSERT(argc > 0); pthread_mutex_lock (&(g_command_args.m_mutex)); assert (g_command_args.m_nCount == 0); if (g_command_args.m_nCount == 0) { - rtl_uString** ppArgs = - (rtl_uString**)rtl_allocateZeroMemory(nArgs * sizeof(rtl_uString*)); - if (ppArgs != 0 && argc == 0) - { - // special case: set up fake command line - char const*const arg = - "this is just a fake and cheap imitation of a command line"; - rtl_string2UString(&ppArgs[0], - arg, rtl_str_getLength(arg), RTL_TEXTENCODING_ASCII_US, - OSTRING_TO_OUSTRING_CVTFLAGS); - g_command_args.m_nCount = nArgs; - g_command_args.m_ppArgs = ppArgs; - } - else if (ppArgs != 0) + rtl_uString** ppArgs = (rtl_uString**)rtl_allocateZeroMemory (argc * sizeof(rtl_uString*)); + if (ppArgs != 0) { rtl_TextEncoding encoding = osl_getThreadTextEncoding(); for (int i = 0; i < argc; i++) |