Salome HOME
Merge branch 'V7_main' of salome:modules/gui.git into V7_main
[modules/gui.git] / src / CASCatch / CASCatch_CatchSignals.cxx
index ce25080a9da86c059eaeb6cfd948e15c160f0f46..c6b58c29ff07925fbb6d6d62c3c5501aff70554c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 // File   : CASCatch_CatchSignals.cxx
 // Author : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com)
-//
-#include "CASCatch_CatchSignals.hxx"
 
+#include "CASCatch_CatchSignals.hxx"
 #include "CASCatch_Failure.hxx"  
 #include "CASCatch_ErrorHandler.hxx"
+
 #include <TCollection_AsciiString.hxx>
 
 #define MAX_HANDLER_NUMBER 6
 
-
 //================================================================================
 /*! Public -
  * \brief creates a CASCatch_CatchSignals
  */
 //================================================================================ 
 CASCatch_CatchSignals::CASCatch_CatchSignals() 
-     :myIsActivated(Standard_False)
+  : myIsActivated( Standard_False )
 {
-
-  Standard_Integer i = 0;
-  for(; i<=MAX_HANDLER_NUMBER; i++)
+  for ( Standard_Integer i = 0; i <= MAX_HANDLER_NUMBER; i++ )
     mySigStates[i] = NULL;
 }
 
@@ -64,9 +61,7 @@ CASCatch_CatchSignals::CASCatch_CatchSignals()
 #include <exception.h>
 #endif
 
-//==============================
 typedef void (ACT_SIGIO_HANDLER)(void) ;
-
 ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ;
 
 typedef void (* SIG_PFV) (int);
@@ -108,7 +103,7 @@ typedef void (* SIG_PFV) (int);
  * \brief universal handler for signals
  */
 //================================================================================ 
-static void Handler(const OSD_Signals theSig, const OSD_Signals)
+static void Handler(const int theSig)
 {
   sigset_t set;
   sigemptyset(&set);
@@ -128,7 +123,7 @@ static void Handler(const OSD_Signals theSig, const OSD_Signals)
  * \brief  handler for SIGSEGV signal
  */
 //================================================================================ 
-static void SegvHandler(const OSD_Signals, const Standard_Address, const Standard_Address)
+static void SegvHandler(const int, siginfo_t*, const Standard_Address)
 {
   sigset_t set;
   sigemptyset(&set);
@@ -159,9 +154,8 @@ void CASCatch_CatchSignals::Activate()
   act.sa_handler =  (SIG_PFV) &Handler ;
   sigemptyset(&act.sa_mask) ;
 
-
-  stat = sigaction(SIGHUP,&act,(struct sigaction*)mySigStates[0]);    // ...... hangup
-  stat = sigaction(SIGFPE,&act,(struct sigaction*) mySigStates[1]);   // ...... floating point exception
+  stat = sigaction(SIGHUP,&act,(struct sigaction*)mySigStates[0]);   // ...... hangup
+  stat = sigaction(SIGFPE,&act,(struct sigaction*) mySigStates[1]);  // ...... floating point exception
   stat = sigaction(SIGINT,&act,(struct sigaction*)mySigStates[2]);   // ...... interrupt
   stat = sigaction(SIGQUIT,&act,(struct sigaction*)mySigStates[3]);  // ...... quit
   stat = sigaction(SIGBUS,&act,(struct sigaction*)mySigStates[4]);   // ...... bus error