[Libreoffice-commits] core.git: 5 commits - desktop/source vcl/source

Tor Lillqvist tml at collabora.com
Sat Mar 28 16:58:24 PDT 2015


 desktop/source/app/cmdlineargs.cxx     |   37 ------
 desktop/source/app/officeipcthread.cxx |  184 ++++++++++++++++++---------------
 desktop/source/app/officeipcthread.hxx |    2 
 desktop/source/lib/init.cxx            |    3 
 vcl/source/control/button.cxx          |    1 
 5 files changed, 106 insertions(+), 121 deletions(-)

New commits:
commit 5215ae54437d2cdc017e49b5b518c4e6a8fb2d50
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sun Mar 29 00:56:36 2015 +0200

    Bin superfluous empty lines
    
    Change-Id: I5bf8ef05aa0a1da972963ae44f04a0042c7b1162

diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index e776ed1..dd77aaf 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -42,7 +42,6 @@ using namespace com::sun::star::lang;
 using namespace com::sun::star::uri;
 using namespace com::sun::star::uno;
 
-
 namespace desktop
 {
 
@@ -128,8 +127,6 @@ CommandLineArgs::CommandLineArgs( Supplier& supplier )
     ParseCommandLine_Impl( supplier );
 }
 
-
-
 void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
 {
     m_cwdUrl = supplier.getCwdUrl();
@@ -630,40 +627,12 @@ void CommandLineArgs::InitParamValues()
     m_textcat = false;
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 bool CommandLineArgs::HasModuleParam() const
 {
     return m_writer || m_calc || m_draw || m_impress || m_global || m_math
         || m_web || m_base;
 }
 
-
-
-
 std::vector< OUString > CommandLineArgs::GetOpenList() const
 {
     return translateExternalUris(m_openlist);
@@ -699,9 +668,6 @@ std::vector< OUString > CommandLineArgs::GetPrintToList() const
     return translateExternalUris(m_printtolist);
 }
 
-
-
-
 std::vector< OUString > CommandLineArgs::GetConversionList() const
 {
     return translateExternalUris(m_conversionlist);
@@ -712,9 +678,6 @@ OUString CommandLineArgs::GetConversionOut() const
     return translateExternalUris(m_conversionout);
 }
 
-
-
-
 } // namespace desktop
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5c2f5facca97d70926194048877ba31b23906ef4
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sun Mar 29 00:14:09 2015 +0200

    This SAL_WARN is hit every time Writer is opened it can't be that important
    
    Change-Id: I89922b2b3e7415275e7d91c037733537bc45e336

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 5b9c8c2..37c78ae 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2197,7 +2197,6 @@ std::vector< RadioButton* > RadioButton::GetRadioButtonGroup(bool bIncludeThis)
     }
 
     //old-school
-    SAL_WARN("vcl.control", "No new-style group set on radiobutton <" << GetHelpId() << "> using old-style digging around");
 
     // go back to first in group;
     vcl::Window* pFirst = const_cast<RadioButton*>(this);
commit d61c7573d7345a3b57a9e71740ff8f50ee40116e
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Mar 28 23:37:02 2015 +0200

    Add a comment
    
    Change-Id: Ic9da4b8cb28f0789cefa8cf1eb3073424f6ea552

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e137cb1..bdab485 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -890,6 +890,9 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
         Application::EnableHeadlessMode(true);
         Application::EnableConsoleOnly();
 
+        // This is horrible crack. I really would want to go back to simply just call
+        // InitVCL() here. The OfficeIPCThread thing is just horrible.
+
         // We could use InitVCL() here -- and used to before using soffice_main,
         // however that now deals with the initialisation for us (and it's not
         // possible to try to set up VCL twice.
commit 8c100755ba5c2a097b3d12c60fde6d3b1f1f606c
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Mar 28 23:31:57 2015 +0200

    Don't use any IPC pipe when in console-only mode or in a LOKit-based program
    
    There is by definition no reason to do any IPC in those cases. Each program
    running LO code in such a mode is independent from any other.
    
    Do as before for Android, though, I don't have the patience now to check
    whether we actually need the pipe on Android for some reason.
    
    Change-Id: If0f54bf51e58b13c0c0b8f0bf6882bbef067960d

diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 5d405e1..aec9b3c 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -456,106 +456,126 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
 
     rtl::Reference< OfficeIPCThread > pThread(new OfficeIPCThread);
 
-    // The name of the named pipe is created with the hashcode of the user installation directory (without /user). We have to retrieve
-    // this information from a unotools implementation.
-    ::utl::Bootstrap::PathStatus aLocateResult = ::utl::Bootstrap::locateUserInstallation( aUserInstallPath );
-    if ( aLocateResult == ::utl::Bootstrap::PATH_EXISTS || aLocateResult == ::utl::Bootstrap::PATH_VALID)
-        aDummy = aUserInstallPath;
-    else
-    {
-        return IPC_STATUS_BOOTSTRAP_ERROR;
-    }
-
-    // Try to  determine if we are the first office or not! This should prevent multiple
-    // access to the user directory !
-    // First we try to create our pipe if this fails we try to connect. We have to do this
-    // in a loop because the other office can crash or shutdown between createPipe
-    // and connectPipe!!
+    PipeMode nPipeMode = PIPEMODE_DONTKNOW;
 
-    OUString            aIniName;
+#ifndef ANDROID // On Android it might be that we still for some reason need the pipe?
 
-    osl_getExecutableFile( &aIniName.pData );
+    // When console-only (which includes in LibreOfficeKit-based programs) we want to be totally
+    // independent from any other LibreOffice instance or LOKit-using program. Certainly no need for
+    // any IPC pipes by definition, as we don't have any reason to do any IPC. Why we even call this
+    // EnableOfficeIPCThread function from LibreOfficeKit's lo_initialize() I am not completely
+    // sure, but that code, and this, is such horrible crack that I don't want to change it too much.
 
-    sal_uInt32     lastIndex = aIniName.lastIndexOf('/');
-    if ( lastIndex > 0 )
+    if (Application::IsConsoleOnly())
     {
-        aIniName    = aIniName.copy( 0, lastIndex+1 );
-        aIniName    += "perftune";
-#if defined(WNT)
-        aIniName    += ".ini";
-#else
-        aIniName    += "rc";
-#endif
+        // Setting nPipeMode to PIPEMODE_CREATED causes the trivial path to be taken below, starting
+        // the listeing thread. (Which will immediately finish, see the execute() function, but what
+        // the heck...)
+        nPipeMode = PIPEMODE_CREATED;
     }
+    else
+#endif
+    {
+        // The name of the named pipe is created with the hashcode of the user installation directory (without /user). We have to retrieve
+        // this information from a unotools implementation.
+        ::utl::Bootstrap::PathStatus aLocateResult = ::utl::Bootstrap::locateUserInstallation( aUserInstallPath );
+        if ( aLocateResult == ::utl::Bootstrap::PATH_EXISTS || aLocateResult == ::utl::Bootstrap::PATH_VALID)
+            aDummy = aUserInstallPath;
+        else
+        {
+            return IPC_STATUS_BOOTSTRAP_ERROR;
+        }
 
-    ::rtl::Bootstrap aPerfTuneIniFile( aIniName );
-
-    OUString aDefault( "0" );
-    OUString aPreloadData;
+        // Try to  determine if we are the first office or not! This should prevent multiple
+        // access to the user directory !
+        // First we try to create our pipe if this fails we try to connect. We have to do this
+        // in a loop because the other office can crash or shutdown between createPipe
+        // and connectPipe!!
 
-    aPerfTuneIniFile.getFrom( OUString( "FastPipeCommunication" ), aPreloadData, aDefault );
+        OUString            aIniName;
 
+        osl_getExecutableFile( &aIniName.pData );
 
-    OUString aUserInstallPathHashCode;
+        sal_uInt32     lastIndex = aIniName.lastIndexOf('/');
+        if ( lastIndex > 0 )
+        {
+            aIniName    = aIniName.copy( 0, lastIndex+1 );
+            aIniName    += "perftune";
+    #if defined(WNT)
+            aIniName    += ".ini";
+    #else
+            aIniName    += "rc";
+    #endif
+        }
 
-    if ( aPreloadData == "1" )
-    {
-        sal_Char    szBuffer[32];
-        sprintf( szBuffer, "%d", LIBO_VERSION_MAJOR * 10000 + LIBO_VERSION_MINOR * 100 + LIBO_VERSION_MICRO * 1 );
-        aUserInstallPathHashCode = OUString( szBuffer, strlen(szBuffer), osl_getThreadTextEncoding() );
-    }
-    else
-        aUserInstallPathHashCode = CreateMD5FromString( aDummy );
+        ::rtl::Bootstrap aPerfTuneIniFile( aIniName );
 
+        OUString aDefault( "0" );
+        OUString aPreloadData;
 
-    // Check result to create a hash code from the user install path
-    if ( aUserInstallPathHashCode.isEmpty() )
-        return IPC_STATUS_BOOTSTRAP_ERROR; // Something completely broken, we cannot create a valid hash code!
+        aPerfTuneIniFile.getFrom( OUString( "FastPipeCommunication" ), aPreloadData, aDefault );
 
-    OUString aPipeIdent( "SingleOfficeIPC_" + aUserInstallPathHashCode );
 
-    PipeMode nPipeMode = PIPEMODE_DONTKNOW;
-    do
-    {
-        osl::Security &rSecurity = Security::get();
+        OUString aUserInstallPathHashCode;
 
-        // Try to create pipe
-        if ( pThread->maPipe.create( aPipeIdent.getStr(), osl_Pipe_CREATE, rSecurity ))
+        if ( aPreloadData == "1" )
         {
-            // Pipe created
-            nPipeMode = PIPEMODE_CREATED;
+            sal_Char    szBuffer[32];
+            sprintf( szBuffer, "%d", LIBO_VERSION_MAJOR * 10000 + LIBO_VERSION_MINOR * 100 + LIBO_VERSION_MICRO * 1 );
+            aUserInstallPathHashCode = OUString( szBuffer, strlen(szBuffer), osl_getThreadTextEncoding() );
         }
-        else if( pThread->maPipe.create( aPipeIdent.getStr(), osl_Pipe_OPEN, rSecurity )) // Creation not successful, now we try to connect
+        else
+            aUserInstallPathHashCode = CreateMD5FromString( aDummy );
+
+
+        // Check result to create a hash code from the user install path
+        if ( aUserInstallPathHashCode.isEmpty() )
+            return IPC_STATUS_BOOTSTRAP_ERROR; // Something completely broken, we cannot create a valid hash code!
+
+        OUString aPipeIdent( "SingleOfficeIPC_" + aUserInstallPathHashCode );
+
+        do
         {
-            osl::StreamPipe aStreamPipe(pThread->maPipe.getHandle());
-            if (readStringFromPipe(aStreamPipe) == SEND_ARGUMENTS)
+            osl::Security &rSecurity = Security::get();
+
+            // Try to create pipe
+            if ( pThread->maPipe.create( aPipeIdent.getStr(), osl_Pipe_CREATE, rSecurity ))
+            {
+                // Pipe created
+                nPipeMode = PIPEMODE_CREATED;
+            }
+            else if( pThread->maPipe.create( aPipeIdent.getStr(), osl_Pipe_OPEN, rSecurity )) // Creation not successful, now we try to connect
             {
-                // Pipe connected to first office
-                nPipeMode = PIPEMODE_CONNECTED;
+                osl::StreamPipe aStreamPipe(pThread->maPipe.getHandle());
+                if (readStringFromPipe(aStreamPipe) == SEND_ARGUMENTS)
+                {
+                    // Pipe connected to first office
+                    nPipeMode = PIPEMODE_CONNECTED;
+                }
+                else
+                {
+                    // Pipe connection failed (other office exited or crashed)
+                    TimeValue tval;
+                    tval.Seconds = 0;
+                    tval.Nanosec = 500000000;
+                    salhelper::Thread::wait( tval );
+                }
             }
             else
             {
-                // Pipe connection failed (other office exited or crashed)
-                TimeValue tval;
-                tval.Seconds = 0;
-                tval.Nanosec = 500000000;
-                salhelper::Thread::wait( tval );
+                oslPipeError eReason = pThread->maPipe.getError();
+                if ((eReason == osl_Pipe_E_ConnectionRefused) || (eReason == osl_Pipe_E_invalidError))
+                    return IPC_STATUS_PIPE_ERROR;
+
+                // Wait for second office to be ready
+                TimeValue aTimeValue;
+                aTimeValue.Seconds = 0;
+                aTimeValue.Nanosec = 10000000; // 10ms
+                salhelper::Thread::wait( aTimeValue );
             }
-        }
-        else
-        {
-            oslPipeError eReason = pThread->maPipe.getError();
-            if ((eReason == osl_Pipe_E_ConnectionRefused) || (eReason == osl_Pipe_E_invalidError))
-                return IPC_STATUS_PIPE_ERROR;
-
-            // Wait for second office to be ready
-            TimeValue aTimeValue;
-            aTimeValue.Seconds = 0;
-            aTimeValue.Nanosec = 10000000; // 10ms
-            salhelper::Thread::wait( aTimeValue );
-        }
 
-    } while ( nPipeMode == PIPEMODE_DONTKNOW );
+        } while ( nPipeMode == PIPEMODE_DONTKNOW );
+    }
 
     if ( nPipeMode == PIPEMODE_CREATED )
     {
@@ -684,6 +704,12 @@ bool OfficeIPCThread::IsEnabled()
 void OfficeIPCThread::execute()
 {
 #if HAVE_FEATURE_DESKTOP || defined(ANDROID)
+
+#ifndef ANDROID
+    if (Application::IsConsoleOnly())
+        return;
+#endif
+
     do
     {
         osl::StreamPipe aStreamPipe;
commit 2b9cef0286d1361441c9350135a9874d4a3ba34c
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Mar 28 22:37:43 2015 +0200

    Bin pointless static const members used only in one place
    
    Change-Id: I5cf39093e01dfd381624975f3267a2f7349ed8e5

diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index d3ce4d8..5d405e1 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -51,10 +51,6 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::frame;
 
-
-const char  *OfficeIPCThread::sc_aShowSequence = "-tofront";
-const int OfficeIPCThread::sc_nShSeqLength = 5;
-
 namespace {
 
 #if HAVE_FEATURE_DESKTOP || defined(ANDROID)
@@ -922,7 +918,7 @@ void OfficeIPCThread::execute()
                     delete pRequest;
                     pRequest = NULL;
                 }
-                if (aArguments.equalsL(sc_aShowSequence, sc_nShSeqLength) ||
+                if (aArguments.equalsL(RTL_CONSTASCII_STRINGPARAM("-tofront")) ||
                     aCmdLineArgs->IsEmpty())
                 {
                     // no document was sent, just bring Office to front
diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx
index 3f81d40..e81f57a 100644
--- a/desktop/source/app/officeipcthread.hxx
+++ b/desktop/source/app/officeipcthread.hxx
@@ -87,8 +87,6 @@ class OfficeIPCThread : public salhelper::Thread
     ::osl::Condition cReady;
 
     static ::osl::Mutex&        GetMutex();
-    static const char *sc_aShowSequence;
-    static const int sc_nShSeqLength;
 
     OfficeIPCThread();
 


More information about the Libreoffice-commits mailing list