From d62ed2306899d67327bed8cac97cc0dd8992b69e Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 5 Dec 2013 23:06:13 +0100 Subject: [PATCH] + Fix compiler warnings with OCC 6.6 --- src/Mod/Part/App/ArcOfCirclePyImp.cpp | 6 +++--- src/Mod/Part/App/ArcPyImp.cpp | 10 +++++----- .../App/BRepOffsetAPI_MakePipeShellPyImp.cpp | 10 ++++++++-- src/Mod/Part/App/BSplineCurvePyImp.cpp | 12 ++++++++---- src/Mod/Part/App/BSplineSurfacePyImp.cpp | 13 +++++++------ .../Part/App/RectangularTrimmedSurfacePyImp.cpp | 8 +++++--- src/Mod/Part/App/TopoShapeCompoundPyImp.cpp | 2 +- src/Mod/Part/App/TopoShapeWirePyImp.cpp | 16 +++++++++++----- src/Mod/Raytracing/Gui/DlgSettingsRay.ui | 8 ++++---- 9 files changed, 52 insertions(+), 33 deletions(-) diff --git a/src/Mod/Part/App/ArcOfCirclePyImp.cpp b/src/Mod/Part/App/ArcOfCirclePyImp.cpp index cd5c1a74f..a77901b00 100644 --- a/src/Mod/Part/App/ArcOfCirclePyImp.cpp +++ b/src/Mod/Part/App/ArcOfCirclePyImp.cpp @@ -78,12 +78,12 @@ int ArcOfCirclePy::PyInit(PyObject* args, PyObject* kwds) { PyObject* o; double u1, u2; - int sense=1; - if (PyArg_ParseTuple(args, "O!dd|i", &(Part::CirclePy::Type), &o, &u1, &u2, &sense)) { + PyObject *sense=Py_True; + if (PyArg_ParseTuple(args, "O!dd|O!", &(Part::CirclePy::Type), &o, &u1, &u2, &PyBool_Type, &sense)) { try { Handle_Geom_Circle circle = Handle_Geom_Circle::DownCast (static_cast(o)->getGeomCirclePtr()->handle()); - GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, sense); + GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); if (!arc.IsDone()) { PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/ArcPyImp.cpp b/src/Mod/Part/App/ArcPyImp.cpp index 25ee4b377..ff7fd4cdc 100644 --- a/src/Mod/Part/App/ArcPyImp.cpp +++ b/src/Mod/Part/App/ArcPyImp.cpp @@ -61,12 +61,12 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) { PyObject* o; double u1, u2; - int sense=1; - if (PyArg_ParseTuple(args, "O!dd|i", &(Part::CirclePy::Type), &o, &u1, &u2, &sense)) { + PyObject *sense=Py_True; + if (PyArg_ParseTuple(args, "O!dd|O!", &(Part::CirclePy::Type), &o, &u1, &u2, &PyBool_Type, &sense)) { try { Handle_Geom_Circle circle = Handle_Geom_Circle::DownCast (static_cast(o)->getGeomCirclePtr()->handle()); - GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, sense); + GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); if (!arc.IsDone()) { PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(arc.Status())); return -1; @@ -108,11 +108,11 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) } PyErr_Clear(); - if (PyArg_ParseTuple(args, "O!dd|i", &(Part::EllipsePy::Type), &o, &u1, &u2, &sense)) { + if (PyArg_ParseTuple(args, "O!dd|O!", &(Part::EllipsePy::Type), &o, &u1, &u2, &PyBool_Type, &sense)) { try { Handle_Geom_Ellipse ellipse = Handle_Geom_Ellipse::DownCast (static_cast(o)->getGeomEllipsePtr()->handle()); - GC_MakeArcOfEllipse arc(ellipse->Elips(), u1, u2, sense); + GC_MakeArcOfEllipse arc(ellipse->Elips(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); if (!arc.IsDone()) { PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp index 187bec3b4..578f5be30 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp @@ -121,7 +121,11 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args) PyErr_SetString(PyExc_TypeError, "spine is not a wire"); return 0; } - this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(TopoDS::Wire(s), PyObject_IsTrue(curv), PyObject_IsTrue(keep)); + + this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode( + TopoDS::Wire(s), + PyObject_IsTrue(curv) ? Standard_True : Standard_False, + PyObject_IsTrue(keep) ? Standard_True : Standard_False); Py_Return; } @@ -133,7 +137,9 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args) ,&PyBool_Type,&keep)) return 0; const TopoDS_Shape& s = static_cast(prof)->getTopoShapePtr()->_Shape; - this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, PyObject_IsTrue(curv), PyObject_IsTrue(keep)); + this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, + PyObject_IsTrue(curv) ? Standard_True : Standard_False, + PyObject_IsTrue(keep) ? Standard_True : Standard_False); Py_Return; } diff --git a/src/Mod/Part/App/BSplineCurvePyImp.cpp b/src/Mod/Part/App/BSplineCurvePyImp.cpp index 99fa7aca0..5b45937ad 100644 --- a/src/Mod/Part/App/BSplineCurvePyImp.cpp +++ b/src/Mod/Part/App/BSplineCurvePyImp.cpp @@ -183,7 +183,7 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args) try { Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast (getGeometryPtr()->handle()); - curve->InsertKnot(U,M,tol,PyObject_IsTrue(add)); + curve->InsertKnot(U,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); @@ -223,7 +223,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args) Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast (getGeometryPtr()->handle()); - curve->InsertKnots(k,m,tol,PyObject_IsTrue(add)); + curve->InsertKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); Py_Return; } catch (Standard_Failure) { @@ -763,7 +763,8 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args) Standard_Failure::Raise("not enough points given"); } - GeomAPI_Interpolate aBSplineInterpolation(interpolationPoints, PyObject_IsTrue(periodic), tol3d); + GeomAPI_Interpolate aBSplineInterpolation(interpolationPoints, + PyObject_IsTrue(periodic) ? Standard_True : Standard_False, tol3d); if (t1 && t2) { Base::Vector3d v1 = Py::Vector(t1,false).toVector(); Base::Vector3d v2 = Py::Vector(t2,false).toVector(); @@ -991,7 +992,10 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key Standard_Failure::Raise("number of poles and sum of mults mismatch"); return(0); } - Handle_Geom_BSplineCurve spline = new Geom_BSplineCurve(occpoles,occweights,occknots,occmults,degree,PyObject_IsTrue(periodic),PyObject_IsTrue(CheckRational)); + + Handle_Geom_BSplineCurve spline = new Geom_BSplineCurve(occpoles,occweights,occknots,occmults,degree, + PyObject_IsTrue(periodic) ? Standard_True : Standard_False, + PyObject_IsTrue(CheckRational) ? Standard_True : Standard_False); if (!spline.IsNull()) { this->getGeomBSplineCurvePtr()->setHandle(spline); Py_Return; diff --git a/src/Mod/Part/App/BSplineSurfacePyImp.cpp b/src/Mod/Part/App/BSplineSurfacePyImp.cpp index c9b8ebd1b..354010dc4 100644 --- a/src/Mod/Part/App/BSplineSurfacePyImp.cpp +++ b/src/Mod/Part/App/BSplineSurfacePyImp.cpp @@ -293,7 +293,7 @@ PyObject* BSplineSurfacePy::insertUKnot(PyObject *args) try { Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast (getGeometryPtr()->handle()); - surf->InsertUKnot(U,M,tol,PyObject_IsTrue(add)); + surf->InsertUKnot(U,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); @@ -333,7 +333,7 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args) Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast (getGeometryPtr()->handle()); - surf->InsertUKnots(k,m,tol,PyObject_IsTrue(add)); + surf->InsertUKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); Py_Return; } catch (Standard_Failure) { @@ -356,7 +356,7 @@ PyObject* BSplineSurfacePy::insertVKnot(PyObject *args) try { Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast (getGeometryPtr()->handle()); - surf->InsertVKnot(V,M,tol,PyObject_IsTrue(add)); + surf->InsertVKnot(V,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); @@ -396,7 +396,7 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args) Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast (getGeometryPtr()->handle()); - surf->InsertVKnots(k,m,tol,PyObject_IsTrue(add)); + surf->InsertVKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); Py_Return; } catch (Standard_Failure) { @@ -1429,7 +1429,7 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k Standard_Integer lv = col.size(); TColgp_Array2OfPnt occpoles(1, lu, 1, lv); TColStd_Array2OfReal occweights(1, lu, 1, lv); - Standard_Boolean genweights = PyObject_Not(weights) ; //cache + Standard_Boolean genweights = PyObject_Not(weights) ? Standard_True : Standard_False; //cache Standard_Integer index1 = 0; Standard_Integer index2 = 0; for (Py::Sequence::iterator it1 = list.begin(); it1 != list.end(); ++it1) { @@ -1532,7 +1532,8 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k } Handle_Geom_BSplineSurface spline = new Geom_BSplineSurface(occpoles,occweights, occuknots,occvknots,occumults,occvmults,udegree,vdegree, - PyObject_IsTrue(uperiodic),PyObject_IsTrue(vperiodic)); + PyObject_IsTrue(uperiodic) ? Standard_True : Standard_False, + PyObject_IsTrue(vperiodic) ? Standard_True : Standard_False); if (!spline.IsNull()) { this->getGeomBSplineSurfacePtr()->setHandle(spline); Py_Return; diff --git a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp index 873a29f37..3b2874f04 100644 --- a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp +++ b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp @@ -59,7 +59,9 @@ int RectangularTrimmedSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface( Handle_Geom_Surface::DownCast(static_cast(surf)-> getGeomSurfacePtr()->handle()), - u1, u2, v1, v2, PyObject_IsTrue(usense), PyObject_IsTrue(vsense) + u1, u2, v1, v2, + PyObject_IsTrue(usense) ? Standard_True : Standard_False, + PyObject_IsTrue(vsense) ? Standard_True : Standard_False )); return 0; } @@ -69,8 +71,8 @@ int RectangularTrimmedSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/) PyObject *utrim=Py_False, *sense=Py_True; if (PyArg_ParseTuple(args, "O!ddO!|O!",&(Part::GeometrySurfacePy::Type),&surf, ¶m1,¶m2,&PyBool_Type,&utrim,&PyBool_Type,&sense)) { - Standard_Boolean UTrim = PyObject_IsTrue(utrim); - Standard_Boolean Sense = PyObject_IsTrue(sense); + Standard_Boolean UTrim = PyObject_IsTrue(utrim) ? Standard_True : Standard_False; + Standard_Boolean Sense = PyObject_IsTrue(sense) ? Standard_True : Standard_False; getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface( Handle_Geom_Surface::DownCast(static_cast(surf)-> getGeomSurfacePtr()->handle()), diff --git a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp index 7f8e3cdcd..9f5336f00 100644 --- a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp @@ -122,7 +122,7 @@ PyObject* TopoShapeCompoundPy::connectEdgesToWires(PyObject *args) for (TopExp_Explorer xp(s, TopAbs_EDGE); xp.More(); xp.Next()) hEdges->Append(xp.Current()); - ShapeAnalysis_FreeBounds::ConnectEdgesToWires(hEdges, tol, PyObject_IsTrue(shared), hWires); + ShapeAnalysis_FreeBounds::ConnectEdgesToWires(hEdges, tol, PyObject_IsTrue(shared) ? Standard_True : Standard_False, hWires); TopoDS_Compound comp; BRep_Builder builder; diff --git a/src/Mod/Part/App/TopoShapeWirePyImp.cpp b/src/Mod/Part/App/TopoShapeWirePyImp.cpp index 49e747acd..1e2b460c7 100644 --- a/src/Mod/Part/App/TopoShapeWirePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeWirePyImp.cpp @@ -242,11 +242,14 @@ PyObject* TopoShapeWirePy::makePipe(PyObject *args) PyObject* TopoShapeWirePy::makePipeShell(PyObject *args) { PyObject *obj; - int make_solid = 0; - int is_Frenet = 0; - int transition = 0; + PyObject *make_solid = Py_False; + PyObject *is_Frenet = Py_False; + PyObject *transition = Py_False; - if (PyArg_ParseTuple(args, "O|iii", &obj, &make_solid, &is_Frenet, &transition)) { + if (PyArg_ParseTuple(args, "O|O!O!O!", &obj, + &PyBool_Type, &make_solid, + &PyBool_Type, &is_Frenet, + &PyBool_Type, &transition)) { try { TopTools_ListOfShape sections; Py::Sequence list(obj); @@ -256,7 +259,10 @@ PyObject* TopoShapeWirePy::makePipeShell(PyObject *args) sections.Append(shape); } } - TopoDS_Shape shape = this->getTopoShapePtr()->makePipeShell(sections, make_solid, is_Frenet, transition); + TopoDS_Shape shape = this->getTopoShapePtr()->makePipeShell(sections, + PyObject_IsTrue(make_solid) ? Standard_True : Standard_False, + PyObject_IsTrue(is_Frenet) ? Standard_True : Standard_False, + PyObject_IsTrue(transition) ? Standard_True : Standard_False); return new TopoShapePy(new TopoShape(shape)); } catch (Standard_Failure) { diff --git a/src/Mod/Raytracing/Gui/DlgSettingsRay.ui b/src/Mod/Raytracing/Gui/DlgSettingsRay.ui index 3c92b5df6..e9b5cc8f8 100644 --- a/src/Mod/Raytracing/Gui/DlgSettingsRay.ui +++ b/src/Mod/Raytracing/Gui/DlgSettingsRay.ui @@ -13,7 +13,7 @@ Raytracing - + 9 @@ -110,7 +110,7 @@ - + @@ -240,7 +240,7 @@ Directories - + 9 @@ -248,7 +248,7 @@ 6 - + 0