Part: Replace C cast
This commit is contained in:
committed by
Chris Hennes
parent
6dc262d44c
commit
acdfde774a
@@ -2278,7 +2278,7 @@ private:
|
||||
TopoDS_Shape* shape = new TopoDS_Shape();
|
||||
(*shape) = static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr()->getShape();
|
||||
PyObject* proxy = nullptr;
|
||||
proxy = Base::Interpreter().createSWIGPointerObj("OCC.TopoDS", "TopoDS_Shape *", (void*)shape, 1);
|
||||
proxy = Base::Interpreter().createSWIGPointerObj("OCC.TopoDS", "TopoDS_Shape *", static_cast<void*>(shape), 1);
|
||||
return Py::asObject(proxy);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -2295,7 +2295,7 @@ private:
|
||||
try {
|
||||
TopoShape* shape = new TopoShape();
|
||||
Base::Interpreter().convertSWIGPointerObj("OCC.TopoDS","TopoDS_Shape *", proxy, &ptr, 0);
|
||||
TopoDS_Shape* s = reinterpret_cast<TopoDS_Shape*>(ptr);
|
||||
TopoDS_Shape* s = static_cast<TopoDS_Shape*>(ptr);
|
||||
shape->setShape(*s);
|
||||
return Py::asObject(new TopoShapePy(shape));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ void AttachEnginePy::setMode(Py::String arg)
|
||||
{
|
||||
try {
|
||||
AttachEngine &attacher = *(this->getAttachEnginePtr());
|
||||
std::string modeName = (std::string)arg;
|
||||
std::string modeName = static_cast<std::string>(arg);
|
||||
attacher.mapMode = attacher.getModeByName(modeName);
|
||||
} ATTACHERPY_STDCATCH_ATTR;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ struct FTDC_Ctx {
|
||||
// move_cb called for start of new contour. pt is xy of contour start.
|
||||
// p points to the context where we remember what happened previously (last point, etc)
|
||||
static int move_cb(const FT_Vector* pt, void* p) {
|
||||
FTDC_Ctx* dc = (FTDC_Ctx*) p;
|
||||
FTDC_Ctx* dc = static_cast<FTDC_Ctx*>(p);
|
||||
if (!dc->Edges.empty()){
|
||||
TopoDS_Wire newwire = edgesToWire(dc->Edges);
|
||||
dc->Wires.push_back(newwire);
|
||||
@@ -232,7 +232,7 @@ static int move_cb(const FT_Vector* pt, void* p) {
|
||||
|
||||
// line_cb called for line segment in the current contour: line(LastVert -- pt)
|
||||
static int line_cb(const FT_Vector* pt, void* p) {
|
||||
FTDC_Ctx* dc = (FTDC_Ctx*) p;
|
||||
FTDC_Ctx* dc = static_cast<FTDC_Ctx*>(p);
|
||||
gp_Pnt2d v1(dc->LastVert.x, dc->LastVert.y);
|
||||
gp_Pnt2d v2(pt->x, pt->y);
|
||||
if (!v1.IsEqual(v2, Precision::Confusion())) {
|
||||
@@ -248,7 +248,7 @@ static int line_cb(const FT_Vector* pt, void* p) {
|
||||
// quad_cb called for quadratic (conic) BCurve segment in the current contour
|
||||
// (ie V-C-V in TTF fonts). BCurve(LastVert -- pt0 -- pt1)
|
||||
static int quad_cb(const FT_Vector* pt0, const FT_Vector* pt1, void* p) {
|
||||
FTDC_Ctx* dc = (FTDC_Ctx*) p;
|
||||
FTDC_Ctx* dc = static_cast<FTDC_Ctx*>(p);
|
||||
TColgp_Array1OfPnt2d Poles(1,3);
|
||||
gp_Pnt2d v1(dc->LastVert.x, dc->LastVert.y);
|
||||
gp_Pnt2d c1(pt0->x, pt0->y);
|
||||
@@ -275,7 +275,7 @@ static int quad_cb(const FT_Vector* pt0, const FT_Vector* pt1, void* p) {
|
||||
// cubic_cb called for cubic BCurve segment in the current contour (ie V-C-C-V in
|
||||
// Type 1 fonts). BCurve(LastVert -- pt0 -- pt1 -- pt2)
|
||||
static int cubic_cb(const FT_Vector* pt0, const FT_Vector* pt1, const FT_Vector* pt2, void* p) {
|
||||
FTDC_Ctx* dc = (FTDC_Ctx*) p;
|
||||
FTDC_Ctx* dc = static_cast<FTDC_Ctx*>(p);
|
||||
TColgp_Array1OfPnt2d Poles(1,4);
|
||||
gp_Pnt2d v1(dc->LastVert.x, dc->LastVert.y);
|
||||
gp_Pnt2d c1(pt0->x, pt0->y);
|
||||
|
||||
@@ -241,7 +241,7 @@ void Geometry::Restore(Base::XMLReader &reader)
|
||||
reader.readElement("GeoExtension");
|
||||
const char* TypeName = reader.getAttribute("type");
|
||||
Base::Type type = Base::Type::fromName(TypeName);
|
||||
GeometryPersistenceExtension *newE = (GeometryPersistenceExtension *)type.createInstance();
|
||||
GeometryPersistenceExtension *newE = static_cast<GeometryPersistenceExtension *>(type.createInstance());
|
||||
newE->Restore(reader);
|
||||
|
||||
extensions.push_back(std::shared_ptr<GeometryExtension>(newE));
|
||||
|
||||
@@ -192,7 +192,7 @@ void PropertyGeometryList::Restore(Base::XMLReader &reader)
|
||||
for (int i = 0; i < count; i++) {
|
||||
reader.readElement("Geometry");
|
||||
const char* TypeName = reader.getAttribute("type");
|
||||
Geometry *newG = (Geometry *)Base::Type::fromName(TypeName).createInstance();
|
||||
Geometry *newG = static_cast<Geometry *>(Base::Type::fromName(TypeName).createInstance());
|
||||
newG->Restore(reader);
|
||||
|
||||
if(reader.testStatus(Base::XMLReader::ReaderStatus::PartialRestoreInObject)) {
|
||||
|
||||
@@ -271,7 +271,7 @@ void PropertyPartShape::saveToFile(Base::Writer &writer) const
|
||||
static Base::FileInfo fi(App::Application::getTempFileName());
|
||||
|
||||
TopoDS_Shape myShape = _Shape.getShape();
|
||||
if (!BRepTools_Write(myShape,(Standard_CString)fi.filePath().c_str())) {
|
||||
if (!BRepTools_Write(myShape,static_cast<Standard_CString>(fi.filePath().c_str()))) {
|
||||
// Note: Do NOT throw an exception here because if the tmp. file could
|
||||
// not be created we should not abort.
|
||||
// We only print an error message but continue writing the next files to the
|
||||
@@ -323,7 +323,7 @@ void PropertyPartShape::loadFromFile(Base::Reader &reader)
|
||||
// If it's still empty after reading the (non-empty) file there must occurred an error.
|
||||
TopoDS_Shape shape;
|
||||
if (ulSize > 0) {
|
||||
if (!BRepTools::Read(shape, (Standard_CString)fi.filePath().c_str(), builder)) {
|
||||
if (!BRepTools::Read(shape, static_cast<Standard_CString>(fi.filePath().c_str()), builder)) {
|
||||
// Note: Do NOT throw an exception here because if the tmp. created file could
|
||||
// not be read it's NOT an indication for an invalid input stream 'reader'.
|
||||
// We only print an error message but continue reading the next files from the
|
||||
|
||||
@@ -470,7 +470,7 @@ TopAbs_ShapeEnum TopoShape::shapeType(const char *type, bool silent) {
|
||||
initShapeNameMap();
|
||||
for(size_t idx=0;idx<_ShapeNames.size();++idx) {
|
||||
if(!_ShapeNames[idx].empty() && boost::starts_with(type,_ShapeNames[idx]))
|
||||
return (TopAbs_ShapeEnum)idx;
|
||||
return static_cast<TopAbs_ShapeEnum>(idx);
|
||||
}
|
||||
}
|
||||
if(!silent) {
|
||||
@@ -817,7 +817,7 @@ void TopoShape::importBrep(const char *FileName)
|
||||
BRepTools::Read(aShape,encodeFilename(FileName).c_str(),aBuilder,pi);
|
||||
pi->EndScope();
|
||||
#else
|
||||
BRepTools::Read(aShape,(Standard_CString)FileName,aBuilder);
|
||||
BRepTools::Read(aShape,static_cast<Standard_CString>(FileName),aBuilder);
|
||||
#endif
|
||||
this->_Shape = aShape;
|
||||
}
|
||||
@@ -2184,7 +2184,7 @@ TopoDS_Shape TopoShape::makeSweep(const TopoDS_Shape& profile, double tol, int f
|
||||
if (hProfile.IsNull())
|
||||
Standard_Failure::Raise("invalid curve in profile edge");
|
||||
|
||||
GeomFill_Pipe mkSweep(hPath, hProfile, (GeomFill_Trihedron)fillMode);
|
||||
GeomFill_Pipe mkSweep(hPath, hProfile, static_cast<GeomFill_Trihedron>(fillMode));
|
||||
mkSweep.GenerateParticularCase(Standard_True);
|
||||
mkSweep.Perform(tol, Standard_False, GeomAbs_C1, BSplCLib::MaxDegree(), 1000);
|
||||
|
||||
|
||||
@@ -2542,7 +2542,7 @@ CmdPartSectionCut::CmdPartSectionCut()
|
||||
|
||||
Gui::Action* CmdPartSectionCut::createAction()
|
||||
{
|
||||
Gui::Action* pcAction = (Gui::Action*)Gui::Command::createAction();
|
||||
Gui::Action* pcAction = Gui::Command::createAction();
|
||||
#if 0
|
||||
pcAction->setCheckable(true);
|
||||
#endif
|
||||
|
||||
@@ -1417,10 +1417,8 @@ void SoBrepFaceSet::VBO::render(SoGLRenderAction * action,
|
||||
SbBool texture)
|
||||
{
|
||||
(void)texcoords; (void)texindices; (void)texture;
|
||||
const SbVec3f * coords3d = nullptr;
|
||||
SbVec3f * cur_coords3d = nullptr;
|
||||
coords3d = vertexlist->getArrayPtr3();
|
||||
cur_coords3d = ( SbVec3f *)coords3d;
|
||||
const SbVec3f * coords3d = vertexlist->getArrayPtr3();
|
||||
SbVec3f * cur_coords3d = const_cast<SbVec3f *>(coords3d);
|
||||
|
||||
const int32_t *viptr = vertexindices;
|
||||
const int32_t *viendptr = viptr + num_indices;
|
||||
@@ -1439,9 +1437,9 @@ void SoBrepFaceSet::VBO::render(SoGLRenderAction * action,
|
||||
float * vertex_array = nullptr;
|
||||
GLuint * index_array = nullptr;
|
||||
SbColor mycolor1,mycolor2,mycolor3;
|
||||
SbVec3f *mynormal1 = (SbVec3f *)currnormal;
|
||||
SbVec3f *mynormal2 = (SbVec3f *)currnormal;
|
||||
SbVec3f *mynormal3 = (SbVec3f *)currnormal;
|
||||
SbVec3f *mynormal1 = const_cast<SbVec3f *>(currnormal);
|
||||
SbVec3f *mynormal2 = const_cast<SbVec3f *>(currnormal);
|
||||
SbVec3f *mynormal3 = const_cast<SbVec3f *>(currnormal);
|
||||
int indice=0;
|
||||
uint32_t RGBA,R,G,B,A;
|
||||
float Rf,Gf,Bf,Af;
|
||||
@@ -1543,11 +1541,11 @@ void SoBrepFaceSet::VBO::render(SoGLRenderAction * action,
|
||||
if (normals) {
|
||||
if (nbind == PER_VERTEX || nbind == PER_FACE) {
|
||||
currnormal = normals++;
|
||||
mynormal1=(SbVec3f *)currnormal;
|
||||
mynormal1 = const_cast<SbVec3f *>(currnormal);
|
||||
}
|
||||
else if (nbind == PER_VERTEX_INDEXED || nbind == PER_FACE_INDEXED) {
|
||||
currnormal = &normals[*normalindices++];
|
||||
mynormal1 =(SbVec3f *) currnormal;
|
||||
mynormal1 = const_cast<SbVec3f *>(currnormal);
|
||||
}
|
||||
}
|
||||
if (mbind == PER_VERTEX)
|
||||
@@ -1558,11 +1556,11 @@ void SoBrepFaceSet::VBO::render(SoGLRenderAction * action,
|
||||
if (normals) {
|
||||
if (nbind == PER_VERTEX) {
|
||||
currnormal = normals++;
|
||||
mynormal2 = (SbVec3f *)currnormal;
|
||||
mynormal2 = const_cast<SbVec3f *>(currnormal);
|
||||
}
|
||||
else if (nbind == PER_VERTEX_INDEXED) {
|
||||
currnormal = &normals[*normalindices++];
|
||||
mynormal2 = (SbVec3f *)currnormal;
|
||||
mynormal2 = const_cast<SbVec3f *>(currnormal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1573,11 +1571,11 @@ void SoBrepFaceSet::VBO::render(SoGLRenderAction * action,
|
||||
if (normals) {
|
||||
if (nbind == PER_VERTEX) {
|
||||
currnormal = normals++;
|
||||
mynormal3 =(SbVec3f *)currnormal;
|
||||
mynormal3 =const_cast<SbVec3f *>(currnormal);
|
||||
}
|
||||
else if (nbind == PER_VERTEX_INDEXED) {
|
||||
currnormal = &normals[*normalindices++];
|
||||
mynormal3 = (SbVec3f *)currnormal;
|
||||
mynormal3 = const_cast<SbVec3f *>(currnormal);
|
||||
}
|
||||
}
|
||||
if (nbind == PER_VERTEX_INDEXED)
|
||||
|
||||
@@ -163,7 +163,7 @@ bool ViewProviderCurveNet::handleEvent(const SoEvent * const ev, Gui::View3DInve
|
||||
|
||||
// Keyboard events
|
||||
if (ev->getTypeId().isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
SoKeyboardEvent * ke = (SoKeyboardEvent *)ev;
|
||||
const SoKeyboardEvent * ke = static_cast<const SoKeyboardEvent *>(ev);
|
||||
switch (ke->getKey()) {
|
||||
case SoKeyboardEvent::LEFT_ALT:
|
||||
case SoKeyboardEvent::RIGHT_ALT:
|
||||
@@ -179,7 +179,7 @@ bool ViewProviderCurveNet::handleEvent(const SoEvent * const ev, Gui::View3DInve
|
||||
|
||||
// switching the mouse buttons
|
||||
if (ev->getTypeId().isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const SoMouseButtonEvent * const event = static_cast<const SoMouseButtonEvent *>(ev);
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user