1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025621: CAST analysis - Avoid constructors not supplying an initial value for all non-static data members

The constructors of classes from following files have been fixed to ensure that all non-static fields are initialized:

    Adaptor2d_Line2d.cxx
    Adaptor3d_IsoCurve.cxx
    Adaptor3d_OffsetCurve.cxx
    AdvApp2Var_ApproxAFunc2Var.cxx
    AIS_Dimension.cxx
    AIS_InteractiveContext.cxx
    Aspect_DisplayConnection.cxx
    BiTgte_CurveOnEdge.cxx
    BiTgte_CurveOnVertex.cxx
    BRepAdaptor_CompCurve.cxx
    BRepMesh_Circle.hxx
    BRepMesh_Delaun.cxx
    BRepToIGES_BREntity.cxx
    ChFi2d_AnaFilletAlgo.cxx
    ChFi2d_ChamferAPI.cxx
    ChFi2d_FilletAlgo.cxx
    ChFi2d_FilletAlgo.hxx
    Extrema_ExtPExtS.cxx
    Font_FTFont.cxx
    GccEnt_QualifiedCirc.cxx
    Geom2dAdaptor_Curve.cxx
    IGESData_IGESEntity.cxx
    IGESData_DefSwitch.cxx
    IGESToBRep_CurveAndSurface.cxx
    LDOM_XmlReader.cxx
    math_TrigonometricFunctionRoots.cxx
    NCollection_ListNode.hxx
    ProjLib_CompProjectedCurve.cxx
    ProjLib_ComputeApproxOnPolarSurface.cxx
    Select3D_Box2d.hxx
    Select3D_PointData.hxx
This commit is contained in:
azn
2014-12-25 10:00:13 +03:00
committed by abv
parent 460f4f693a
commit cbff1e5531
30 changed files with 713 additions and 400 deletions

View File

@@ -80,8 +80,25 @@ static Standard_Boolean IsEqual(const gp_Pnt2d& p1, const gp_Pnt2d& p2)
// An empty constructor.
// Use the method Init() to initialize the class.
ChFi2d_AnaFilletAlgo::ChFi2d_AnaFilletAlgo()
: segment1(Standard_False),
x11(0.0),
y11(0.0),
x12(0.0),
y12(0.0),
xc1(0.0),
yc1(0.0),
radius1(0.0),
cw1(Standard_False),
segment2(Standard_False),
x21(0.0),
y21(0.0),
x22(0.0),
y22(0.0),
xc2(0.0),
yc2(0.0),
radius2(0.0),
cw2(Standard_False)
{
}
// An constructor.
@@ -89,7 +106,26 @@ ChFi2d_AnaFilletAlgo::ChFi2d_AnaFilletAlgo()
// - segment
// - arc of circle.
ChFi2d_AnaFilletAlgo::ChFi2d_AnaFilletAlgo(const TopoDS_Wire& theWire,
const gp_Pln& thePlane)
const gp_Pln& thePlane)
: plane(thePlane),
segment1(Standard_False),
x11(0.0),
y11(0.0),
x12(0.0),
y12(0.0),
xc1(0.0),
yc1(0.0),
radius1(0.0),
cw1(Standard_False),
segment2(Standard_False),
x21(0.0),
y21(0.0),
x22(0.0),
y22(0.0),
xc2(0.0),
yc2(0.0),
radius2(0.0),
cw2(Standard_False)
{
Init(theWire, thePlane);
}
@@ -101,6 +137,25 @@ ChFi2d_AnaFilletAlgo::ChFi2d_AnaFilletAlgo(const TopoDS_Wire& theWire,
ChFi2d_AnaFilletAlgo::ChFi2d_AnaFilletAlgo(const TopoDS_Edge& theEdge1,
const TopoDS_Edge& theEdge2,
const gp_Pln& thePlane)
: plane(thePlane),
segment1(Standard_False),
x11(0.0),
y11(0.0),
x12(0.0),
y12(0.0),
xc1(0.0),
yc1(0.0),
radius1(0.0),
cw1(Standard_False),
segment2(Standard_False),
x21(0.0),
y21(0.0),
x22(0.0),
y22(0.0),
xc2(0.0),
yc2(0.0),
radius2(0.0),
cw2(Standard_False)
{
// Make a wire consisting of two edges.
Init(theEdge1, theEdge2, thePlane);

View File

@@ -23,32 +23,38 @@
// An empty constructor.
ChFi2d_ChamferAPI::ChFi2d_ChamferAPI()
: myStart1(0.0),
myEnd1 (0.0),
myStart2(0.0),
myEnd2 (0.0),
myCommonStart1(Standard_False),
myCommonStart2(Standard_False)
{
}
// A constructor accepting a wire consisting of two linear edges.
ChFi2d_ChamferAPI::ChFi2d_ChamferAPI(const TopoDS_Wire& theWire) :
myStart1(0.),
myEnd1(0.),
myStart2(0.),
myEnd2(0.),
myCommonStart1(Standard_False),
myCommonStart2(Standard_False)
ChFi2d_ChamferAPI::ChFi2d_ChamferAPI(const TopoDS_Wire& theWire)
: myStart1(0.0),
myEnd1 (0.0),
myStart2(0.0),
myEnd2 (0.0),
myCommonStart1(Standard_False),
myCommonStart2(Standard_False)
{
Init(theWire);
}
// A constructor accepting two linear edges.
ChFi2d_ChamferAPI::ChFi2d_ChamferAPI(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2) :
myStart1(0.),
myEnd1(0.),
myStart2(0.),
myEnd2(0.),
myCommonStart1(Standard_False),
myCommonStart2(Standard_False)
ChFi2d_ChamferAPI::ChFi2d_ChamferAPI(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2)
: myEdge1(theEdge1),
myEdge2(theEdge2),
myStart1(0.0),
myEnd1 (0.0),
myStart2(0.0),
myEnd2 (0.0),
myCommonStart1(Standard_False),
myCommonStart2(Standard_False)
{
Init(theEdge1, theEdge2);
}
// Initializes the class by a wire consisting of two libear edges.

View File

@@ -35,11 +35,26 @@
#include <BRepAdaptor_Curve.hxx>
ChFi2d_FilletAlgo::ChFi2d_FilletAlgo()
: myStart1(0.0),
myEnd1 (0.0),
myStart2(0.0),
myEnd2 (0.0),
myRadius(0.0),
myStartSide (Standard_False),
myEdgesExchnged(Standard_False),
myDegreeOfRecursion(0)
{
}
ChFi2d_FilletAlgo::ChFi2d_FilletAlgo(const TopoDS_Wire& theWire, const gp_Pln& thePlane)
ChFi2d_FilletAlgo::ChFi2d_FilletAlgo(const TopoDS_Wire& theWire, const gp_Pln& thePlane)
: myStart1(0.0),
myEnd1 (0.0),
myStart2(0.0),
myEnd2 (0.0),
myRadius(0.0),
myStartSide (Standard_False),
myEdgesExchnged(Standard_False),
myDegreeOfRecursion(0)
{
Init(theWire, thePlane);
}
@@ -47,6 +62,16 @@ ChFi2d_FilletAlgo::ChFi2d_FilletAlgo(const TopoDS_Wire& theWire, const gp_Pln& t
ChFi2d_FilletAlgo::ChFi2d_FilletAlgo(const TopoDS_Edge& theEdge1,
const TopoDS_Edge& theEdge2,
const gp_Pln& thePlane)
: myEdge1(theEdge1),
myEdge2(theEdge2),
myStart1(0.0),
myEnd1 (0.0),
myStart2(0.0),
myEnd2 (0.0),
myRadius(0.0),
myStartSide (Standard_False),
myEdgesExchnged(Standard_False),
myDegreeOfRecursion(0)
{
Init(theEdge1, theEdge2, thePlane);
}
@@ -615,6 +640,12 @@ TopoDS_Edge ChFi2d_FilletAlgo::Result(const gp_Pnt& thePoint, TopoDS_Edge& theEd
return aResult;
}
FilletPoint::FilletPoint(const Standard_Real theParam)
: myParam (theParam),
myParam2(0.0)
{
}
void FilletPoint::appendValue(Standard_Real theValue, Standard_Boolean theValid)
{
Standard_Integer a;

View File

@@ -145,27 +145,32 @@ class FilletPoint
{
public:
//! Creates a point on a first curve by parameter on this curve.
FilletPoint(Standard_Real theParam) : myParam2(0.)
{myParam = theParam;}
FilletPoint(const Standard_Real theParam);
//! Changes the point position by changing point parameter on the first curve.
void setParam(Standard_Real theParam) {myParam = theParam;}
//! Returns the point parameter on the first curve.
Standard_Real getParam() const {return myParam;}
//! Returns number of found values of function in this point.
Standard_Integer getNBValues() {return myV.Length();}
//! Returns value of function in this point.
Standard_Real getValue(int theIndex) {return myV.Value(theIndex);}
//! Returns derivatives of function in this point.
Standard_Real getDiff(int theIndex) {return myD.Value(theIndex);}
//! Returns true if function is valid (rediuses vectors of fillet do not intersect any curve).
Standard_Boolean isValid(int theIndex) {return (Standard_Boolean)myValid.Value(theIndex);}
//! Returns the index of the nearest value
int getNear(int theIndex) {return myNear.Value(theIndex);}
//! Defines the parameter of the projected point on the second curve.
void setParam2(const Standard_Real theParam2) {myParam2 = theParam2;}
//! Returns the parameter of the projected point on the second curve.
Standard_Real getParam2() { return myParam2 ; }
@@ -179,14 +184,17 @@ public:
//! Computes difference between this point and the given. Stores difference in myD.
Standard_Boolean calculateDiff(FilletPoint*);
//! Filters out the values and leaves the most optimal one.
void FilterPoints(FilletPoint*);
//! Returns a pointer to created copy of the point
//! warning: this is not the full copy! Copies only: myParam, myV, myD, myValid
FilletPoint* Copy();
FilletPoint* Copy();
//! Returns the index of the solution or zero if there is no solution
Standard_Integer hasSolution(Standard_Real theRadius);
//! For debug only
Standard_Real LowerValue()
{