0027247: Eliminate remaining compiler warnings in MFC samples and with OCCT_DEBUG
authorabv <abv@opencascade.com>
Fri, 11 Mar 2016 04:23:55 +0000 (07:23 +0300)
committerabv <abv@opencascade.com>
Sat, 12 Mar 2016 06:18:11 +0000 (09:18 +0300)
Unsafe and useless casts of handles are eliminated

samples/mfc/standard/01_Geometry/src/GeomSources.cpp
samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp
samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h
samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp
samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h
samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp
samples/mfc/standard/06_Ocaf/src/TOcaf_Commands.cxx
samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp
src/MAT2d/MAT2d_Tool2d.cxx
src/TopOpeBRepBuild/TopOpeBRepBuild_PaveSet.cxx

index b59cd3d..0c433bc 100755 (executable)
@@ -531,7 +531,7 @@ void GeomSources::gpTest7(CGeometryDoc* aDoc)
   gp_Pnt2d P2(5.5,1);                                     
   gp_Pnt2d P3(-2,2);                                      
 
-  Handle(Geom2d_TrimmedCurve) C =                         
+  Handle(Geom2d_Curve) C =                         
     GCE2d_MakeArcOfCircle (P1,P2,P3).Value();           
 
   Standard_Real FirstParameter = C->FirstParameter();
@@ -569,7 +569,7 @@ C->D1(param,P,V);                                   \n\
   AddSeparator(aDoc,Message);
   //--------------------------------------------------------------
 
-  DisplayCurve(aDoc,Handle(Geom2d_Curve)::DownCast(C));
+  DisplayCurve(aDoc,C);
   Handle(ISession_Direction) aDirection = new ISession_Direction(P,V);
   aDoc->GetISessionContext()->Display(aDirection, Standard_False);
 
@@ -844,7 +844,7 @@ void GeomSources::gpTest12(CGeometryDoc* aDoc)
 
   gp_Pnt N,Q,P(1,2,3);
   Standard_Real distance, radius = 5;
-  Handle(Geom_Circle) C = new Geom_Circle(gp::XOY(),radius);
+  Handle(Geom_Curve) C = new Geom_Circle(gp::XOY(),radius);
   GeomAPI_ProjectPointOnCurve PPC (P,C);
   N = PPC.NearestPoint();
   Standard_Integer NbResults = PPC.NbPoints();
@@ -890,7 +890,7 @@ if(NbResults>0){                                            \n\
   aString += Message2;
 
   DisplayPoint(aDoc,N,aString.ToCString(),false,0.5,0,-0.5);
-  DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(C),Quantity_NOC_YELLOW,false);
+  DisplayCurve(aDoc,C,Quantity_NOC_YELLOW,false);
 
   if(NbResults>0)
   {
@@ -1052,8 +1052,8 @@ if (ICQ.IsDone()){                                        \n\
 
  DisplaySurface(aDoc,aSurface);
 
- Handle(Geom_Ellipse) anEllips = GC_MakeEllipse(EL).Value();
- DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(anEllips),Quantity_NOC_YELLOW,false);
+ Handle(Geom_Curve) anEllips = GC_MakeEllipse(EL).Value();
+ DisplayCurve(aDoc,anEllips,Quantity_NOC_YELLOW,false);
 
  TCollection_AsciiString aString;
 
@@ -1718,7 +1718,7 @@ gp_Ax2d C2DCircleXAxis = C2DCircle->XAxis();            \n\
  Message += aC2DEntityTypeName; Message += " \n";
 
  DisplayCurve(aDoc,circ2d,4,false);
- DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(C3D),Quantity_NOC_YELLOW,false);
+ DisplayCurve(aDoc,C3D,Quantity_NOC_YELLOW,false);
  DisplayCurve(aDoc,C2D,5,false);
 
  Handle(ISession_Direction) aC3DCircleXAxisDirection = new ISession_Direction(C3DCircleXAxis.Location(),C3DCircleXAxis.Direction(),5.2);
@@ -3103,7 +3103,7 @@ void GeomSources::gpTest40(CGeometryDoc* aDoc)
   array1.SetValue(4,gp_Pnt (-5,4,-7));
   array1.SetValue(5,gp_Pnt (-3,5,-12));
 
-  Handle(Geom_BSplineCurve) SPL1 =
+  Handle(Geom_Curve) SPL1 =
   GeomAPI_PointsToBSpline(array1).Curve();
 
   GeomFill_Pipe aPipe(SPL1,1);
@@ -3126,7 +3126,7 @@ void GeomSources::gpTest40(CGeometryDoc* aDoc)
   GC_MakeSegment(gp_Pnt(1,1,1),gp_Pnt(5,5,5));
   Handle(Geom_TrimmedCurve) TC2 =
   GC_MakeSegment(gp_Pnt(1,1,0),gp_Pnt(4,5,6));
-  GeomFill_Pipe aPipe3(Handle(Geom_Curve)::DownCast(SPL1),TC1,TC2);
+  GeomFill_Pipe aPipe3(SPL1,TC1,TC2);
   aPipe3.Perform();
   Handle(Geom_Surface) aSurface3 = aPipe3.Surface();
   Standard_CString aSurfaceEntityTypeName3="Not Computed";
@@ -3667,8 +3667,8 @@ void GeomSources::gpTest46(CGeometryDoc* aDoc)
   GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type);
   Handle(Geom_BSplineSurface) aGeomSurface = aGeomFill1.Surface();
 
-  Handle(Geom_BSplineSurface) aTranslatedGeomSurface =
-    Handle(Geom_BSplineSurface)::DownCast(aGeomSurface->Copy());
+  Handle(Geom_BoundedSurface) aTranslatedGeomSurface =
+    Handle(Geom_BoundedSurface)::DownCast(aGeomSurface->Copy());
 
   Standard_Real extension = 3;
   Standard_Integer continuity = 2;
@@ -3694,8 +3694,8 @@ GeomFill_FillingStyle Type = GeomFill_StretchStyle;               \n\
 GeomFill_BSplineCurves aGeomFill1(SPL1,SPL2,Type);                \n\
 Handle(Geom_BSplineSurface) aGeomSurface = aGeomFill1.Surface();  \n\
                                                                   \n\
-Handle(Geom_BSplineSurface) aTranslatedGeomSurface =              \n\
-   Handle(Geom_BSplineSurface)::DownCast(aGeomSurface->Copy());   \n\
+Handle(Geom_BoundedSurface) aTranslatedGeomSurface =              \n\
+   Handle(Geom_BoundedSurface)::DownCast(aGeomSurface->Copy());   \n\
                                                                   \n\
 Standard_Real extension = 3;                                      \n\
 Standard_Integer continuity = 2;                                  \n\
index cd4d879..a712c3d 100755 (executable)
@@ -19,7 +19,7 @@ static char THIS_FILE[]=__FILE__;
 //////////////////////////////////////////////////////////////////////
 
 
-ISession_Curve::ISession_Curve(Handle(Geom_Curve)& aCurve)
+ISession_Curve::ISession_Curve(const Handle(Geom_Curve)& aCurve)
 :AIS_InteractiveObject(),myCurve(aCurve)
 {
 
index 0c95380..54fc440 100755 (executable)
@@ -17,7 +17,7 @@ DEFINE_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject)
 class ISession_Curve : public AIS_InteractiveObject  
 {
 public:
-  ISession_Curve(Handle(Geom_Curve)& aCurve);
+  ISession_Curve(const Handle(Geom_Curve)& aCurve);
   virtual ~ISession_Curve();
 
   DEFINE_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
index 73eb1da..8475fbc 100755 (executable)
@@ -22,7 +22,7 @@ IMPLEMENT_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject)
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-ISession_Surface::ISession_Surface(Handle(Geom_Surface)& aSurface)
+ISession_Surface::ISession_Surface(const Handle(Geom_Surface)& aSurface)
 :AIS_InteractiveObject(),mySurface(aSurface)
 {
 }
index 4cab1ba..f31a7cd 100755 (executable)
@@ -17,7 +17,7 @@ class ISession_Surface : public AIS_InteractiveObject
 {
 public:
        ISession_Surface();
-       ISession_Surface(Handle(Geom_Surface)& aSurface);
+       ISession_Surface(const Handle(Geom_Surface)& aSurface);
        virtual ~ISession_Surface();
 
 DEFINE_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject)
index 0ef62ed..5b6872d 100755 (executable)
@@ -600,7 +600,7 @@ D->CommitCommand(); \n\
                Sleep(1000);
 
                // Get the TOcafFunction_CutDriver using its Standard_GUID in the TFunction_DriverTable
-               Handle(TOcafFunction_CutDriver) myCutDriver;
+               Handle(TFunction_Driver) myCutDriver;
                if (TFunction_DriverTable::Get()->FindDriver(myDriverID, myCutDriver))
             myCutDriver->Init(LabObject);
 
@@ -643,7 +643,7 @@ TOcaf_Commands TSC(ToolLab); \n\
 TSC.ModifyBox(m_x, m_y, m_z, m_w, m_l, m_h, Name); \n\
  \n\
 //  Getting the TOcafFunction_CutDriver used to create the cut\n\
-Handle(TOcafFunction_CutDriver) myCutDriver; \n\
+Handle(TFunction_Driver) myCutDriver; \n\
 TFunction_DriverTable::Get()->FindDriver(myDriverID, myCutDriver); \n\
  \n\
 //  Recompute the cut if it must be (if an attribute was modified)\n\
index 7447a12..1f956b6 100755 (executable)
@@ -90,7 +90,7 @@ TDF_Label TOcaf_Commands::CreateBox(Standard_Real x, Standard_Real y, Standard_R
        // Initialize and execute the box driver (look at the "Execute()" code)
     Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L);
 
-       Handle(TOcafFunction_BoxDriver) myBoxDriver;
+       Handle(TFunction_Driver) myBoxDriver;
     // Find the TOcafFunction_BoxDriver in the TFunction_DriverTable using its GUID
        if(!TFunction_DriverTable::Get()->FindDriver(TOcafFunction_BoxDriver::GetID(), myBoxDriver)) return L;
        
@@ -145,7 +145,7 @@ TDF_Label TOcaf_Commands::CreateCyl(Standard_Real x, Standard_Real y, Standard_R
        // Initialize and execute the cylinder driver (look at the "Execute()" code)
     Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L);
 
-       Handle(TOcafFunction_CylDriver) myCylDriver;
+       Handle(TFunction_Driver) myCylDriver;
        // Find the TOcafFunction_CylDriver in the TFunction_DriverTable using its GUID
        if(!TFunction_DriverTable::Get()->FindDriver(TOcafFunction_CylDriver::GetID(), myCylDriver)) return L;
 
@@ -223,7 +223,7 @@ TDF_Label TOcaf_Commands::ModifyBox(Standard_Real x, Standard_Real y, Standard_R
 
        // Get the TFunction_FunctionDriver GUID used with the TFunction_Function
        Standard_GUID myDriverID=TFF->GetDriverGUID();
-       Handle(TOcafFunction_BoxDriver) myBoxDriver;
+       Handle(TFunction_Driver) myBoxDriver;
        // Find the TOcafFunction_BoxDriver in the TFunction_DriverTable using its GUID 
        TFunction_DriverTable::Get()->FindDriver(myDriverID, myBoxDriver);
        // Execute the cut if it must be (if an attribute changes)
@@ -298,7 +298,7 @@ TDF_Label TOcaf_Commands::ModifyCyl(Standard_Real x, Standard_Real y, Standard_R
 
        // Get the TFunction_FunctionDriver GUID used with the TFunction_Function
        Standard_GUID myDriverID=TFF->GetDriverGUID();
-       Handle(TOcafFunction_CylDriver) myCylDriver;
+       Handle(TFunction_Driver) myCylDriver;
        // Find the TOcafFunction_CylDriver in the TFunction_DriverTable using its GUID 
        TFunction_DriverTable::Get()->FindDriver(myDriverID, myCylDriver);
        // Execute the cut if it must be (if an attribute changes)
@@ -346,7 +346,7 @@ TDF_Label TOcaf_Commands::Cut(TDF_Label ObjectLab, TDF_Label ToolObjectLab)
        // Initialize and execute the cut driver (look at the "Execute()" code)
     Handle(TFunction_Logbook) log = TFunction_Logbook::Set(L);
 
-       Handle(TOcafFunction_CutDriver) myCutDriver;
+       Handle(TFunction_Driver) myCutDriver;
     // Find the TOcafFunction_CutDriver in the TFunction_DriverTable using its GUID 
        if(!TFunction_DriverTable::Get()->FindDriver(TOcafFunction_CutDriver::GetID(), myCutDriver)) return L;
                
index 2724bb9..d657a00 100755 (executable)
@@ -135,9 +135,9 @@ void Convert_Presentation::drawCurveAndItsBSpline(Handle(Geom_Curve) theCurve,
   
   if (WAIT_A_LITTLE) return;
 
-  Handle(Geom_BSplineCurve) aBSpline = GeomConvert::CurveToBSplineCurve(theCurve);
+  Handle(Geom_Curve) aBSpline = GeomConvert::CurveToBSplineCurve(theCurve);
 
-  drawCurve (Handle(Geom_Curve)::DownCast(aBSpline), BSplineColor);
+  drawCurve (aBSpline, BSplineColor);
 }
 
 
@@ -367,8 +367,8 @@ void Convert_Presentation::sampleRevolSurface()
   aPoles(3) = gp_Pnt(350, 150, 0);  aWeights(3) =120;
   aPoles(4) = gp_Pnt(500, 500, 0);  aWeights(4) = 1;
 
-  Handle(Geom_BezierCurve) aBezierCurve = new Geom_BezierCurve(aPoles, aWeights);
-  drawCurve(Handle(Geom_Curve)::DownCast(aBezierCurve));
+  Handle(Geom_Curve) aBezierCurve = new Geom_BezierCurve(aPoles, aWeights);
+  drawCurve(aBezierCurve);
 
   // creating a surface of revolution of the bezier curve around Y axis
   gp_Ax1 anAx(gp_Pnt(0,0,0), gp_Dir(0,1,0));
index 96e6e84..0175199 100644 (file)
@@ -1078,7 +1078,7 @@ void MAT2d_Tool2d::Dump(const Standard_Integer bisector,
   if(bisector == -1) return;
   if(bisector > theNumberOfBisectors) return;
 
-  Handle(Geom2d_Curve) thebisector = Handle(Geom2d_Curve)::DownCast(GeomBis(bisector).Value());
+  Handle(Geom2d_Curve) thebisector = GeomBis(bisector).Value();
 
   MAT2d_DrawCurve(thebisector,3);
 
index 91e8559..301ca54 100644 (file)
@@ -280,8 +280,8 @@ void  TopOpeBRepBuild_PaveSet::Prepare()
     myVerticesIt.Initialize(myVertices);
     if ( MoreLoop() ) cout<<"--- PaveSet : Prepare"<<endl;
     for (; MoreLoop(); NextLoop() ) {
-      const Handle(TopOpeBRepBuild_Pave)& PV = 
-       *((Handle(TopOpeBRepBuild_Pave)*)&(Loop()));
+      Handle(TopOpeBRepBuild_Pave) PV = 
+       Handle(TopOpeBRepBuild_Pave)::DownCast(Loop());
       const TopoDS_Vertex& v = TopoDS::Vertex(PV->Vertex());
       Standard_Real p = PV->Parameter();
       Standard_Boolean b = PV->IsShape();