[Libreoffice-commits] core.git: 2 commits - desktop/source include/osl sal/osl

Stephan Bergmann sbergman at redhat.com
Thu Dec 4 06:56:45 PST 2014


 desktop/source/lib/init.cxx  |    6 +-----
 include/osl/process.h        |    9 ---------
 sal/osl/all/compat.cxx       |    4 ++++
 sal/osl/unx/process_impl.cxx |   10 +---------
 sal/osl/w32/process.cxx      |   10 +---------
 5 files changed, 7 insertions(+), 32 deletions(-)

New commits:
commit 0a40d6c3abba6f005e1b7806919e5169e032f985
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 4 15:52:03 2014 +0100

    [API CHANGE] Remove osl_setCommandArgs
    
    ...it was added late in the LO 3.3 cycle apparently by error.
    
    While this is strictly speaking an incompatible change, no client code should
    ever have called this deprecated, internal functionality anyway.  An aborting
    stub is left in place for soname stability.
    
    Change-Id: Ibbc96ccf76a07a80d732a0713c95ff7b6bf1e528

diff --git a/include/osl/process.h b/include/osl/process.h
index 205e6da..712bb0b 100644
--- a/include/osl/process.h
+++ b/include/osl/process.h
@@ -366,15 +366,6 @@ SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getCommandArgCount(void);
 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getCommandArg(
         sal_uInt32 nArg, rtl_uString **strCommandArg);
 
-/** Determine whether or not the command args have already been set.
-
-    Deprecated: This function is only for internal use
-
-    @return The command args are already set, and may not be set again.
-    @since LibreOffice 4.3
-*/
-SAL_DLLPUBLIC int SAL_CALL osl_areCommandArgsSet (void);
-
 /** Set the command-line arguments as passed to the main-function of this process.
 
     Deprecated: This function is only for internal use. Passing the args from main will
diff --git a/sal/osl/all/compat.cxx b/sal/osl/all/compat.cxx
index ef44215..3f072a1 100644
--- a/sal/osl/all/compat.cxx
+++ b/sal/osl/all/compat.cxx
@@ -23,6 +23,10 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_acquireSemaphore(void *) {
     for (;;) { std::abort(); } // avoid "must return a value" warnings
 }
 
+SAL_DLLPUBLIC_EXPORT int SAL_CALL osl_areCommandArgsSet() {
+    for (;;) { std::abort(); } // avoid "must return a value" warnings
+}
+
 SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_assertFailedLine(
     char const *, sal_Int32, char const *)
 {
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx
index b5c1fe7..62f2f78 100644
--- a/sal/osl/unx/process_impl.cxx
+++ b/sal/osl/unx/process_impl.cxx
@@ -190,14 +190,6 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 nArg, rtl_uString ** strC
     return (result);
 }
 
-int SAL_CALL osl_areCommandArgsSet (void)
-{
-    pthread_mutex_lock (&(g_command_args.m_mutex));
-    int nRet = (int) (g_command_args.m_nCount > 0);
-    pthread_mutex_unlock (&(g_command_args.m_mutex));
-    return nRet;
-}
-
 /***************************************
  osl_setCommandArgs().
  **************************************/
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 0ab8580..087ee2e 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -361,15 +361,6 @@ oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCo
 
 /***************************************************************************/
 
-int SAL_CALL osl_areCommandArgsSet(void)
-{
-    osl_acquireMutex (*osl_getGlobalMutex());
-    int nRet = (int) (g_command_args.m_nCount > 0);
-    osl_releaseMutex (*osl_getGlobalMutex());
-    return nRet;
-}
-
-
 void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
 {
     assert(argc > 0);
commit 7fbfc12474b85b31c9d120898fff6e226d76d662
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 4 15:49:48 2014 +0100

    Still no need for osl_setCommandArgs
    
    (TOCTOU and all)
    
    Change-Id: I81253c8790b631117634bafa4eea65991a975ba0

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8040f54..8a7ffd53 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -693,11 +693,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
         // again (as an assert will fire), this will be the case e.g.
         // for unit tests (and possibly if UNO is being used in addition
         // to LOK in an external program).
-        if (!osl_areCommandArgsSet())
-        {
-            SAL_INFO("lok", "commandArgs not previously set");
-            osl_setCommandArgs(2, pArgs);
-        }
+        osl_setCommandArgs(2, pArgs);
         SAL_INFO("lok", "attempting to initalize UNO");
         initialize_uno(aAppURL);
         SAL_INFO("lok", "uno successfully initalized");
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx
index 7d8cc81..b5c1fe7 100644
--- a/sal/osl/unx/process_impl.cxx
+++ b/sal/osl/unx/process_impl.cxx
@@ -205,7 +205,7 @@ void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
 {
     assert(argc > 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", "args already set");
     if (g_command_args.m_nCount == 0)
     {
         rtl_uString** ppArgs = (rtl_uString**)rtl_allocateZeroMemory (argc * sizeof(rtl_uString*));
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 49259e0..0ab8580 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -374,6 +374,7 @@ void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
 {
     assert(argc > 0);
     osl_acquireMutex (*osl_getGlobalMutex());
+    SAL_WARN_IF(g_command_args.m_nCount != 0, "sal.osl", "args already set");
     if (g_command_args.m_nCount == 0)
     {
         rtl_uString** ppArgs = osl_createCommandArgs_Impl (argc, argv);


More information about the Libreoffice-commits mailing list