[Libreoffice-commits] .: basic/source desktop/inc desktop/source svx/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Dec 10 08:34:46 PST 2010


 basic/source/app/app.cxx                         |    3 -
 basic/source/app/app.hxx                         |    2 
 desktop/inc/app.hxx                              |    2 
 desktop/source/app/app.cxx                       |   52 +++++++----------------
 desktop/source/app/sofficemain.cxx               |    6 --
 desktop/source/deployment/gui/dp_gui_service.cxx |    5 +-
 svx/source/gengal/gengal.cxx                     |    7 +--
 7 files changed, 31 insertions(+), 46 deletions(-)

New commits:
commit 3efa4300a5ab4b98e288f2108bdda93d997d897d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 10 16:12:01 2010 +0000

    propogate exit code out to main

diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index a507064..8577dbb 100644
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -228,7 +228,7 @@ static void ReplaceStringHookProc( UniString& rStr )
     }
 }
 
-void BasicApp::Main( )
+int BasicApp::Main( )
 {
 #ifdef DBG_UTIL
 //  Install filter for OSLAsserts
@@ -336,6 +336,7 @@ void BasicApp::Main( )
         InfoBox( NULL, String::CreateFromAscii( "unknown Exception not caught" ) ).Execute();
         throw;
     }
+    return EXIT_SUCCESS;
 }
 
 void BasicApp::LoadIniFile()
diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx
index 48a348a..d866418 100644
--- a/basic/source/app/app.hxx
+++ b/basic/source/app/app.hxx
@@ -58,7 +58,7 @@ public:
 //	MenuBar*	pMainMenu;			// Hauptmenue
     Accelerator*	pMainAccel;		// Acceleratoren
 
-    void  Main( );
+    int Main( );
 
     void  LoadIniFile();
     void  SetFocus();
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index c601727..ee30123 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -84,7 +84,7 @@ class Desktop : public Application
 
                                 Desktop();
                                 ~Desktop();
-        virtual void			Main( );
+        virtual int			Main( );
         virtual void			Init();
         virtual void			InitFinished();
         virtual void			DeInit();
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index deccfe5..ff74aee 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1511,7 +1511,7 @@ namespace {
     }
 }
 
-void Desktop::Main()
+int Desktop::Main()
 {
     RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::Main" );
 
@@ -1523,12 +1523,12 @@ void Desktop::Main()
     if ( eError != BE_OK )
     {
         HandleBootstrapErrors( eError );
-        return;
+        return EXIT_FAILURE;
     }
 
     BootstrapStatus eStatus = GetBootstrapStatus();
     if (eStatus == BS_TERMINATE) {
-        return;
+        return EXIT_FAILURE;
     }
 
     // Detect desktop environment - need to do this as early as possible
@@ -1561,7 +1561,7 @@ void Desktop::Main()
                 HandleBootstrapErrors( BE_USERINSTALL_NOWRITEACCESS );
             else
                 HandleBootstrapErrors( BE_USERINSTALL_FAILED );
-            return;
+            return EXIT_FAILURE;
         }
         // refresh path information
         utl::Bootstrap::reloadData();
@@ -1588,7 +1588,7 @@ void Desktop::Main()
 #ifndef UNX
         if ( pCmdLineArgs->IsHelp() ) {
             displayCmdlineHelp();
-            return;
+            return EXIT_SUCCESS;
         }
 #endif
 
@@ -1598,7 +1598,7 @@ void Desktop::Main()
         m_pLockfile = new Lockfile;
         if ( !pCmdLineArgs->IsInvisible() && !pCmdLineArgs->IsNoLockcheck() && !m_pLockfile->check( Lockfile_execWarning )) {
             // Lockfile exists, and user clicked 'no'
-            return;
+            return EXIT_FAILURE;
         }
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main <- Lockfile" );
 
@@ -1610,16 +1610,18 @@ void Desktop::Main()
 
             if( !InitAccessBridge( true, bQuitApp ) )
                 if( bQuitApp )
-                    return;
+                    return EXIT_FAILURE;
         }
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "} GetEnableATToolSupport" );
 
         // terminate if requested...
-        if( pCmdLineArgs->IsTerminateAfterInit() ) return;
+        if( pCmdLineArgs->IsTerminateAfterInit() )
+            return EXIT_SUCCESS;
 
 
         //  Read the common configuration items for optimization purpose
-        if ( !InitializeConfiguration() ) return;
+        if ( !InitializeConfiguration() )
+            return EXIT_FAILURE;
 
         SetSplashScreenProgress(30);
 
@@ -1668,7 +1670,7 @@ void Desktop::Main()
         OUString aTitleString( aTitle );
         bCheckOk = CheckInstallation( aTitleString );
         if ( !bCheckOk )
-            return;
+            return EXIT_FAILURE;
         else
             aTitle = aTitleString;
 
@@ -1725,7 +1727,7 @@ void Desktop::Main()
         SynchronizeExtensionRepositories();
         bool bAbort = CheckExtensionDependencies();
         if ( bAbort )
-            return;
+            return EXIT_FAILURE;
 
         Migration::migrateSettingsIfNecessary();
 
@@ -1823,22 +1825,13 @@ void Desktop::Main()
         com::sun::star::uno::Exception te;
         wte.TargetException >>= te;
         FatalError( MakeStartupConfigAccessErrorMessage(wte.Message + te.Message) );
-        return;
+        return EXIT_FAILURE;
     }
     catch ( com::sun::star::uno::Exception& e )
     {
         FatalError( MakeStartupErrorMessage(e.Message) );
-        return;
+        return EXIT_FAILURE;
     }
-    /*
-    catch ( ... )
-    {
-        FatalError( MakeStartupErrorMessage(
-            OUString(RTL_CONSTASCII_USTRINGPARAM(
-            "Unknown error during startup (Office wrapper service).\nInstallation could be damaged."))));
-        return;
-    }
-    */
     SetSplashScreenProgress(55);
 
     SvtFontSubstConfig().Apply();
@@ -1880,17 +1873,8 @@ void Desktop::Main()
         catch ( com::sun::star::uno::Exception& e )
         {
             FatalError( MakeStartupErrorMessage(e.Message) );
-            return;
+            return EXIT_FAILURE;
         }
-        /*
-        catch ( ... )
-        {
-            FatalError( MakeStartupErrorMessage(
-                OUString(RTL_CONSTASCII_USTRINGPARAM(
-                "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged."))));
-            return;
-        }
-        */
 
         // Post user event to startup first application component window
         // We have to send this OpenClients message short before execute() to
@@ -1982,9 +1966,9 @@ void Desktop::Main()
         if ( m_rSplashScreen.is() )
             m_rSplashScreen->reset();
 
-        // wouldn't the solution be more clean if SalMain returns the exit code to the system?
-        _exit( ExitHelper::E_NORMAL_RESTART );
+        return ExitHelper::E_NORMAL_RESTART;
     }
+    return EXIT_SUCCESS;
 }
 
 IMPL_LINK( Desktop, ImplInitFilterHdl, ConvertData*, pData )
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index b7d190c..3d4a803 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -34,7 +34,7 @@
 #include <rtl/logfile.hxx>
 #include <tools/extendapplicationenvironment.hxx>
 
-BOOL SVMain();
+int SVMain();
 
 // -=-= main() -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
@@ -47,9 +47,7 @@ extern "C" int soffice_main()
     desktop::Desktop aDesktop;
     // This string is used during initialization of the Gtk+ VCL module
     aDesktop.SetAppName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("soffice")) );
-    SVMain();
-
-    return 0;
+    return SVMain();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index a01b8b3..dce92cb 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -66,7 +66,7 @@ public:
     virtual ~MyApp();
 
     // Application
-    virtual void Main();
+    virtual int Main();
 };
 
 //______________________________________________________________________________
@@ -80,8 +80,9 @@ MyApp::MyApp()
 }
 
 //______________________________________________________________________________
-void MyApp::Main()
+int MyApp::Main()
 {
+    return EXIT_SUCCESS;
 }
 
 //##############################################################################
diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx
index d319914..edef15c 100644
--- a/svx/source/gengal/gengal.cxx
+++ b/svx/source/gengal/gengal.cxx
@@ -80,7 +80,7 @@ typedef ::std::list<rtl::OUString> FileNameList;
 class GalApp : public Application
 {
 public:
-    virtual void Main();
+    virtual int Main();
 
 protected:
     Reference<XMultiServiceFactory> xMSF;
@@ -275,7 +275,7 @@ void GalApp::InitUCB()
         fprintf( stderr, "Failed to init content broker\n" );
 }
 
-void GalApp::Main()
+int GalApp::Main()
 {
     bool bHelp = false;
     rtl::OUString aPath, aDestDir;
@@ -310,10 +310,11 @@ void GalApp::Main()
     if( bHelp )
     {
         PrintHelp();
-        return;
+        return EXIT_SUCCESS;
     }
 
     createTheme( aName, aPath, aDestDir, nNumFrom, aFiles );
+    return EXIT_SUCCESS;
 }
 
 GalApp aGalApp;


More information about the Libreoffice-commits mailing list