[vlmc-devel] commit: vlmc.cpp: Move code, apply HACKINGS. (Rohit Yadav )

git at videolan.org git at videolan.org
Mon Oct 4 19:08:40 CEST 2010


vlmc | branch: master | Rohit Yadav <rohityadav89 at gmail.com> | Mon Oct  4 22:41:42 2010 +0530| [63473b5798c6e0851cd92e8378de5607c3f5fa78] | committer: Rohit Yadav 

vlmc.cpp: Move code, apply HACKINGS.
Previous commit, put the version() and usage() into #def blocks
controlled by :-

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=63473b5798c6e0851cd92e8378de5607c3f5fa78
---

 src/Main/vlmc.cpp |  132 ++++++++++++++++++++++++++--------------------------
 1 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/src/Main/vlmc.cpp b/src/Main/vlmc.cpp
index 16e6c17..b54ae3b 100644
--- a/src/Main/vlmc.cpp
+++ b/src/Main/vlmc.cpp
@@ -37,22 +37,42 @@ int VLMCmain( int , char** );
 
 #if defined(WITH_CRASHHANDLER) && defined(Q_OS_UNIX)
 
-# ifdef WITH_GUI
-#  include "project/GuiProjectManager.h"
-#  ifdef WITH_CRASHHANDLER_GUI
-#   include "CrashHandler.h"
-#  endif
-# else
-#  include "ProjectManager.h"
+#ifdef WITH_GUI
+    #include "project/GuiProjectManager.h"
+    #ifdef WITH_CRASHHANDLER_GUI
+        #include "CrashHandler.h"
+    #endif
+#else
+    #include "ProjectManager.h"
+#endif
+
+void
+signalHandler( int sig )
+{
+    signal( sig, SIG_DFL );
+
+    #ifdef WITH_GUI
+        GUIProjectManager::getInstance()->emergencyBackup();
+    #else
+        ProjectManager::getInstance()->emergencyBackup();
+    #endif
+
+    #ifdef WITH_CRASHHANDLER_GUI
+        CrashHandler* ch = new CrashHandler( sig );
+        ::exit( ch->exec() );
+    #else
+        ::exit( 1 );
+    #endif
+}
 #endif
 
-/** 
+/**
  * Print version text
  */
 void
 version( void )
 {
-    QTextStream out(stdout);
+    QTextStream out( stdout );
     out << "VLMC-" << PROJECT_VERSION << " '" << CODENAME << "'\n"
         << "VideoLAN Movie Creator (VLMC) is a cross-platform, non-linear\n"
         << "video editing software.\n"
@@ -61,13 +81,13 @@ version( void )
         << "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
 }
 
-/** 
+/**
  * Print usage text
  */
 void
 usage( QString const& appName )
 {
-    QTextStream out(stdout);
+    QTextStream out( stdout );
     out << "Usage: " << appName << " [options] [filename|URI]...\n"
         << "Options:\n"
         << "\t[--project|-p projectfile]\tload the given VLMC project\n"
@@ -78,81 +98,61 @@ usage( QString const& appName )
         << "\t\tVLMC project files (.vlmc)\n";
 }
 
-void
-signalHandler( int sig )
-{
-    signal( sig, SIG_DFL );
-
-#ifdef WITH_GUI
-    GUIProjectManager::getInstance()->emergencyBackup();
-#else
-    ProjectManager::getInstance()->emergencyBackup();
-#endif
-
-    #ifdef WITH_CRASHHANDLER_GUI
-        CrashHandler* ch = new CrashHandler( sig );
-        ::exit( ch->exec() );
-    #else
-        ::exit( 1 );
-    #endif
-}
-#endif
-
 int
 main( int argc, char **argv )
 {
     /* Check for command arguments */
-    for ( int i = 1; i < argc; i++ )
+    for( int i = 1; i < argc; i++ )
     {
         QString arg = argv[i];
 
-        if ( arg == "--help" || arg == "-?" )
+        if( arg == "--help" || arg == "-?" )
         {
-            usage( QString(argv[0]) );
+            ::usage( QString(argv[0]) );
             return 2;
         }
-        else if ( arg == "--version" || arg == "-v" )
+        else if( arg == "--version" || arg == "-v" )
         {
-            version();
+            ::version();
             return 2;
         }
     }
 
-#ifdef WITH_CRASHHANDLER
-    while ( true )
-    {
-        pid_t       pid = fork();
-        if ( pid < 0 )
-            qFatal("Can't fork to launch VLMC. Exiting.");
-        if ( pid == 0 )
-        {
-            signal( SIGSEGV, signalHandler );
-            signal( SIGFPE, signalHandler );
-            signal( SIGABRT, signalHandler );
-            signal( SIGILL, signalHandler );
-            return VLMCmain( argc, argv );
-        }
-        else
+    #ifdef WITH_CRASHHANDLER
+        while( true )
         {
-            int     status;
-
-            wait( &status );
-            if ( WIFEXITED(status) )
+            pid_t pid = fork();
+            if( pid < 0 )
+                qFatal("Can't fork to launch VLMC. Exiting.");
+            if( pid == 0 )
             {
-                int ret = WEXITSTATUS( status );
-                if ( ret == 2 )
-                    continue ;
-                else
-                    break ;
+                signal( SIGSEGV, signalHandler );
+                signal( SIGFPE, signalHandler );
+                signal( SIGABRT, signalHandler );
+                signal( SIGILL, signalHandler );
+                return VLMCmain( argc, argv );
             }
             else
             {
-                qCritical() << "Unhandled crash.";
-                break ;
+                int status;
+
+                wait( &status );
+                if( WIFEXITED(status) )
+                {
+                    int ret = WEXITSTATUS( status );
+                    if ( ret == 2 )
+                        continue ;
+                    else
+                        break ;
+                }
+                else
+                {
+                    qCritical() << "Unhandled crash.";
+                    break ;
+                }
             }
         }
-    }
-#else
-    return VLMCmain( argc, argv );
-#endif
+    #else
+        return VLMCmain( argc, argv );
+    #endif
 }



More information about the Vlmc-devel mailing list