From 478f9f18c06504f96d842a9e47cfd459f731c92b Mon Sep 17 00:00:00 2001 From: jijinbei Date: Sun, 19 Apr 2026 07:17:26 +0900 Subject: [PATCH 1/3] Coding - Replace C-style casts with C++ cast operators Applies clang-tidy 20.1.8 google-readability-casting across all buildable modules (FoundationClasses, ModelingData, ModelingAlgorithms, Visualization, DataExchange, ApplicationFramework, Draw). 751 files changed; clang-tidy replaced C-style casts with static_cast / reinterpret_cast / const_cast or removed unnecessary ones. Four manual corrections were needed where the tool's default choice did not compile: - OSD_SharedLibrary.cxx: dlsym() returns void*, converting to function pointer requires reinterpret_cast, not static_cast. - TopLoc_Location.lxx: casts to `const void**` from const member address dropped a qualifier; rewrote as `const void* const*`. - TopOpeBRep_sort.cxx: qsort callback casts from `const void*` needed `const BOA_t*` to preserve const. - XCAFDoc_ShapeTool.cxx: casts to `void**` from const handle address dropped qualifiers; rewrote as `void* const*`. - IntCurveSurface_InterUtils.pxx: tool emitted an extra closing parenthesis in two `(double)iU`-style casts; removed. Excluded: src/Deprecated/, Khronos headers (OpenGl_glext.h, OpenGl_khrplatform.h). Verified by full Release build (Linux, GCC 15.2, Ninja, -O3 -DNDEBUG) across all seven modules. 0 errors. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../BinMDataXtd_ConstraintDriver.cxx | 4 +- .../BinMDataXtd_GeometryDriver.cxx | 4 +- .../BinMNaming/BinMNaming_NamingDriver.cxx | 6 +- .../BinLDrivers_DocumentRetrievalDriver.cxx | 6 +- .../BinLDrivers_DocumentSection.cxx | 6 +- .../TKBinL/BinMDF/BinMDF_ADriver.lxx | 2 +- .../BinMDataStd_ByteArrayDriver.cxx | 2 +- .../BinMDataStd_ExtStringArrayDriver.cxx | 2 +- .../BinMDataStd_IntPackedMapDriver.cxx | 2 +- .../BinMDataStd_IntegerArrayDriver.cxx | 2 +- .../BinMDataStd_NamedDataDriver.cxx | 4 +- .../BinMDataStd_RealArrayDriver.cxx | 2 +- .../BinMFunction_GraphNodeDriver.cxx | 4 +- .../TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx | 106 ++--- .../TKBinL/BinObjMgt/BinObjMgt_Persistent.lxx | 26 +- .../TKBinL/BinObjMgt/BinObjMgt_Position.cxx | 2 +- .../BinTObjDrivers_IntSparseArrayDriver.cxx | 4 +- .../BinTObjDrivers_ObjectDriver.cxx | 2 +- .../TKCAF/TDataXtd/TDataXtd_Presentation.cxx | 2 +- .../TKCAF/TNaming/TNaming.cxx | 4 +- .../TKCAF/TNaming/TNaming_Naming.cxx | 2 +- .../TKCAF/TNaming/TNaming_Tool.cxx | 4 +- .../TKCDF/CDF/CDF_Application.cxx | 12 +- .../TKCDF/LDOM/LDOMBasicString.cxx | 30 +- .../TKCDF/LDOM/LDOMBasicString.hxx | 2 +- .../TKCDF/LDOM/LDOMParser.cxx | 10 +- .../TKCDF/LDOM/LDOMString.cxx | 4 +- .../TKCDF/LDOM/LDOM_BasicAttribute.cxx | 2 +- .../TKCDF/LDOM/LDOM_BasicElement.cxx | 36 +- .../TKCDF/LDOM/LDOM_BasicNode.cxx | 2 +- .../TKCDF/LDOM/LDOM_CharReference.cxx | 22 +- .../TKCDF/LDOM/LDOM_CharacterData.cxx | 2 +- .../TKCDF/LDOM/LDOM_Document.cxx | 6 +- .../TKCDF/LDOM/LDOM_Element.cxx | 8 +- .../TKCDF/LDOM/LDOM_MemManager.cxx | 26 +- .../TKCDF/LDOM/LDOM_Node.cxx | 8 +- .../TKCDF/LDOM/LDOM_Node.hxx | 2 +- .../TKCDF/LDOM/LDOM_OSStream.cxx | 2 +- .../TKCDF/LDOM/LDOM_XmlReader.cxx | 36 +- .../TKCDF/LDOM/LDOM_XmlWriter.cxx | 12 +- .../TKCDF/PCDM/PCDM_ReadWriter.cxx | 2 +- .../TKCDF/PCDM/PCDM_ReaderFilter.cxx | 8 +- .../TKCDF/PCDM/PCDM_StorageDriver.cxx | 6 +- .../TKLCAF/TDF/TDF_LabelNode.hxx | 2 +- .../TKLCAF/TDF/TDF_Tool.cxx | 4 +- .../TKLCAF/TDataStd/TDataStd_TreeNode.cxx | 6 +- .../TKLCAF/TFunction/TFunction_Iterator.cxx | 4 +- .../StdPersistent/StdPersistent_PPrsStd.cxx | 2 +- .../TKStd/StdStorage/StdStorage.cxx | 2 +- .../StdStorage_BacketOfPersistent.cxx | 4 +- .../StdStorage_BacketOfPersistent.hxx | 4 +- .../TKTObj/TObj/TObj_Persistence.cxx | 2 +- .../TKTObj/TObj/TObj_SequenceIterator.cxx | 2 +- .../TKTObj/TObj/TObj_TIntSparseArray.cxx | 2 +- .../TPrsStd/TPrsStd_AISPresentation.cxx | 2 +- .../XmlMDataXtd_PresentationDriver.cxx | 2 +- .../XmlMNaming_NamedShapeDriver.cxx | 6 +- .../XmlMNaming/XmlMNaming_NamingDriver.cxx | 4 +- .../TKXml/XmlMNaming/XmlMNaming_Shape1.cxx | 2 +- .../TKXmlL/XmlLDrivers/XmlLDrivers.cxx | 4 +- .../TKXmlL/XmlMDF/XmlMDF_ADriver.cxx | 2 +- .../XmlMDataStd_BooleanArrayDriver.cxx | 2 +- .../XmlMDataStd_ByteArrayDriver.cxx | 2 +- .../XmlMDataStd_NamedDataDriver.cxx | 4 +- .../XmlMDataStd_RealArrayDriver.cxx | 2 +- .../XmlMDataStd_RealListDriver.cxx | 2 +- .../XmlMDataStd_UAttributeDriver.cxx | 2 +- .../XmlMFunction_FunctionDriver.cxx | 2 +- .../XmlMFunction_GraphNodeDriver.cxx | 4 +- .../TKXmlL/XmlObjMgt/XmlObjMgt.cxx | 18 +- .../TKXmlL/XmlObjMgt/XmlObjMgt_GP.cxx | 10 +- .../XmlTObjDrivers_IntSparseArrayDriver.cxx | 2 +- .../BinMXCAFDoc_AssemblyItemRefDriver.cxx | 6 +- .../BinMXCAFDoc/BinMXCAFDoc_DimTolDriver.cxx | 2 +- .../BinMXCAFDoc_LocationDriver.cxx | 6 +- .../BinMXCAFDoc_VisMaterialDriver.cxx | 8 +- .../TKDE/DE/DE_ShapeFixConfigurationNode.cxx | 392 +++++++++--------- .../DEBREP/DEBREP_ConfigurationNode.cxx | 10 +- .../DEXCAF/DEXCAF_ConfigurationNode.cxx | 6 +- .../DEIGES/DEIGES_ConfigurationNode.cxx | 34 +- .../TKDEIGES/DEIGES/DEIGES_Parameters.cxx | 16 +- .../TKDEIGES/DEIGES/DEIGES_Provider.cxx | 20 +- .../IGESCAFControl/IGESCAFControl_Writer.cxx | 2 +- .../IGESData/IGESData_BasicEditor.cxx | 8 +- .../IGESData/IGESData_GlobalSection.cxx | 26 +- .../IGESData/IGESData_IGESReaderData.cxx | 2 +- .../TKDEIGES/IGESData/IGESData_IGESWriter.cxx | 12 +- .../IGESData/IGESData_ParamReader.cxx | 2 +- .../IGESGraph_LineFontDefPattern.cxx | 2 +- .../IGESGraph/IGESGraph_ToolTextFontDef.cxx | 2 +- .../TKDEIGES/IGESSelect/IGESSelect_Dumper.cxx | 4 +- .../IGESSelect/IGESSelect_IGESTypeForm.cxx | 4 +- .../IGESSelect/IGESSelect_SignColor.cxx | 12 +- .../IGESSelect/IGESSelect_SignLevelNumber.cxx | 4 +- .../IGESSelect/IGESSelect_SignStatus.cxx | 2 +- .../IGESSelect/IGESSelect_WorkLibrary.cxx | 2 +- .../TKDEIGES/IGESToBRep/IGESToBRep_Reader.cxx | 2 +- .../TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx | 8 +- .../TKDEOBJ/RWObj/RWObj_CafReader.cxx | 4 +- .../TKDEOBJ/RWObj/RWObj_CafWriter.cxx | 4 +- .../TKDEOBJ/RWObj/RWObj_MtlReader.cxx | 6 +- .../TKDEOBJ/RWObj/RWObj_ObjMaterialMap.cxx | 2 +- .../TKDEOBJ/RWObj/RWObj_Reader.cxx | 18 +- .../TKDEOBJ/RWObj/RWObj_Reader.hxx | 6 +- .../TKDEOBJ/RWObj/RWObj_Tools.hxx | 8 +- .../TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx | 10 +- .../TKDEPLY/RWPly/RWPly_CafWriter.cxx | 12 +- .../TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx | 12 +- .../DESTEP/DESTEP_ConfigurationNode.cxx | 65 ++- .../TKDESTEP/DESTEP/DESTEP_Parameters.cxx | 36 +- .../STEPCAFControl_GDTProperty.cxx | 4 +- .../STEPCAFControl/STEPCAFControl_Reader.cxx | 20 +- .../STEPConstruct_AP203Context.cxx | 2 +- .../STEPConstruct_RenderingProperties.cxx | 2 +- .../StepAP209/StepAP209_Construct.cxx | 2 +- .../TKDESTEP/StepData/StepData_Field.cxx | 10 +- .../TKDESTEP/StepData/StepData_StepDumper.cxx | 2 +- .../StepData/StepData_StepReaderData.cxx | 8 +- .../TKDESTEP/StepData/StepData_StepWriter.cxx | 10 +- .../StepData/StepData_UndefinedEntity.cxx | 2 +- ...Tol_SimpleDatumReferenceModifierMember.cxx | 2 +- .../StepElement_CurveElementFreedom.cxx | 2 +- .../StepElement_CurveElementPurpose.cxx | 2 +- .../StepElement/StepElement_ElementAspect.cxx | 4 +- .../StepElement_MeasureOrUnspecifiedValue.cxx | 2 +- .../StepElement_SurfaceElementPurpose.cxx | 2 +- .../StepElement_VolumeElementPurpose.cxx | 2 +- .../StepFEA/StepFEA_DegreeOfFreedom.cxx | 2 +- .../TKDESTEP/StepFile/StepFile_ReadData.cxx | 10 +- .../TKDESTEP/StepToGeom/StepToGeom.cxx | 4 +- .../StepVisual/StepVisual_MarkerMember.cxx | 2 +- .../StepVisual/StepVisual_NullStyleMember.cxx | 2 +- .../TKDESTL/DESTL/DESTL_ConfigurationNode.cxx | 2 +- src/DataExchange/TKDESTL/RWStl/RWStl.cxx | 2 +- .../TKDESTL/RWStl/RWStl_Reader.cxx | 12 +- .../DEVRML/DEVRML_ConfigurationNode.cxx | 16 +- .../VrmlConverter_DeflectionCurve.cxx | 2 +- .../TKDEVRML/VrmlData/VrmlData_Geometry.cxx | 4 +- .../VrmlData/VrmlData_IndexedFaceSet.cxx | 6 +- .../VrmlData/VrmlData_IndexedLineSet.cxx | 2 +- .../TKDEVRML/VrmlData/VrmlData_Node.cxx | 4 +- .../TKDEVRML/VrmlData/VrmlData_Scene.cxx | 8 +- .../VrmlData/VrmlData_UnknownNode.hxx | 2 +- .../TKXCAF/XCAFDoc/XCAFDoc_Color.cxx | 2 +- .../TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx | 6 +- .../TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx | 12 +- .../TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx | 14 +- .../TKXCAF/XCAFDoc/XCAFDoc_NoteBinData.cxx | 4 +- .../TKXCAF/XCAFDoc/XCAFDoc_ShapeTool.cxx | 8 +- .../TKXCAF/XCAFDoc/XCAFDoc_View.cxx | 2 +- .../IFGraph/IFGraph_SubPartsIterator.cxx | 2 +- .../IFSelect/IFSelect_DispPerSignature.cxx | 2 +- .../TKXSBase/IFSelect/IFSelect_Editor.cxx | 8 +- .../IFSelect/IFSelect_ModifReorder.cxx | 2 +- .../TKXSBase/IFSelect/IFSelect_SignType.cxx | 2 +- .../TKXSBase/IFSelect/IFSelect_Signature.cxx | 2 +- .../IFSelect/IFSelect_WorkSession.cxx | 2 +- .../Interface/Interface_FileParameter.cxx | 2 +- .../Interface/Interface_FloatWriter.cxx | 4 +- .../Interface/Interface_InterfaceModel.cxx | 2 +- .../Interface/Interface_LineBuffer.cxx | 2 +- .../TKXSBase/Interface/Interface_MSG.cxx | 8 +- .../TKXSBase/Interface/Interface_ParamSet.cxx | 8 +- .../TKXSBase/Interface/Interface_STAT.cxx | 4 +- .../TKXSBase/Interface/Interface_SignType.cxx | 2 +- .../Interface/Interface_TypedValue.cxx | 4 +- .../Interface/Interface_UndefinedContent.cxx | 8 +- .../TKXSBase/MoniTool/MoniTool_CaseData.cxx | 2 +- .../TKXSBase/Transfer/Transfer_Binder.cxx | 2 +- .../TKXSBase/TransferBRep/TransferBRep.cxx | 2 +- .../XSControl/XSControl_FuncShape.cxx | 8 +- .../XSControl/XSControl_TransferReader.cxx | 2 +- .../TKXSBase/XSControl/XSControl_Utils.cxx | 12 +- .../XSControl/XSControl_WorkSession.cxx | 2 +- .../XmlMXCAFDoc/XmlMXCAFDoc_ColorDriver.cxx | 4 +- .../XmlMXCAFDoc_NoteBinDataDriver.cxx | 2 +- .../XmlMXCAFDoc_VisMaterialDriver.cxx | 16 +- .../TKMath/BSplCLib/BSplCLib.cxx | 8 +- .../TKMath/BSplCLib/BSplCLib_2.cxx | 8 +- .../BSplCLib/BSplCLib_CurveComputation.pxx | 22 +- .../TKMath/BSplSLib/BSplSLib.cxx | 60 +-- .../TKMath/BSplSLib/BSplSLib_Cache.cxx | 2 +- .../Convert/Convert_CompPolynomialToPoles.cxx | 4 +- .../Convert/Convert_ConeToBSplineSurface.cxx | 4 +- .../Convert/Convert_ConicToBSplineCurve.cxx | 2 +- .../Convert_CylinderToBSplineSurface.cxx | 4 +- .../Convert/Convert_GridPolynomialToPoles.cxx | 4 +- .../Convert_SphereToBSplineSurface.cxx | 12 +- .../Convert/Convert_TorusToBSplineSurface.cxx | 12 +- src/FoundationClasses/TKMath/PLib/PLib.cxx | 10 +- .../TKMath/Poly/Poly_ArrayOfNodes.hxx | 14 +- .../TKMath/Poly/Poly_ArrayOfUVNodes.hxx | 14 +- .../TKMath/Poly/Poly_Connect.cxx | 2 +- .../TKMath/Poly/Poly_MakeLoops.cxx | 2 +- .../TKMath/Poly/Poly_MergeNodesTool.cxx | 10 +- .../TKMath/Poly/Poly_MergeNodesTool.hxx | 8 +- .../TKMath/Poly/Poly_Triangulation.cxx | 2 +- .../TKMath/Poly/Poly_Triangulation.hxx | 2 +- .../TKMath/TopLoc/TopLoc_Location.lxx | 4 +- .../TopLoc/TopLoc_SListNodeOfItemLocation.lxx | 4 +- src/FoundationClasses/TKMath/gp/gp_Trsf.cxx | 2 +- .../TKMath/math/math_BFGS.cxx | 2 +- .../TKMath/math/math_FRPR.cxx | 2 +- .../TKMath/math/math_FunctionAllRoots.cxx | 12 +- .../TKMath/math/math_FunctionSetRoot.cxx | 2 +- .../TKMath/math/math_GlobOptMin.cxx | 2 +- .../TKMath/math/math_NewtonMinimum.cxx | 2 +- .../TKMath/math/math_Powell.cxx | 2 +- .../TKernel/FSD/FSD_Base64.cxx | 20 +- .../TKernel/FSD/FSD_BinaryFile.cxx | 46 +- .../TKernel/FSD/FSD_File.cxx | 20 +- .../TKernel/Message/Message_AlertExtended.cxx | 2 +- .../TKernel/Message/Message_Algorithm.cxx | 2 +- .../Message/Message_AttributeMeter.cxx | 4 +- .../Message/Message_CompositeAlerts.cxx | 2 +- .../TKernel/Message/Message_ExecStatus.hxx | 12 +- .../TKernel/Message/Message_Msg.cxx | 8 +- .../TKernel/Message/Message_MsgFile.cxx | 4 +- .../Message/Message_PrinterOStream.cxx | 4 +- .../Message/Message_PrinterOStream.hxx | 2 +- .../TKernel/Message/Message_ProgressScope.hxx | 4 +- .../TKernel/Message/Message_Report.cxx | 8 +- .../NCollection/NCollection_AccAllocator.cxx | 2 +- .../NCollection/NCollection_AccAllocator.hxx | 4 +- .../NCollection/NCollection_AliasedArray.hxx | 4 +- .../NCollection/NCollection_BaseList.hxx | 2 +- .../NCollection/NCollection_BaseMap.cxx | 8 +- .../NCollection_BasePointerVector.cxx | 4 +- .../NCollection/NCollection_Buffer.hxx | 2 +- .../NCollection/NCollection_CellFilter.hxx | 4 +- .../NCollection/NCollection_OccAllocator.hxx | 2 +- .../NCollection/NCollection_PackedMap.hxx | 4 +- .../NCollection_SparseArrayBase.cxx | 6 +- .../NCollection_SparseArrayBase.hxx | 26 +- .../NCollection/NCollection_UBTreeFiller.hxx | 2 +- .../NCollection/NCollection_UtfIterator.hxx | 2 +- .../NCollection/NCollection_UtfIterator.lxx | 18 +- .../NCollection/NCollection_UtfString.hxx | 4 +- .../TKernel/NCollection/NCollection_Vec3.hxx | 2 +- .../TKernel/OSD/OSD_Chronometer.cxx | 4 +- .../TKernel/OSD/OSD_Directory.cxx | 2 +- .../TKernel/OSD/OSD_DirectoryIterator.cxx | 12 +- .../TKernel/OSD/OSD_Disk.cxx | 4 +- .../TKernel/OSD/OSD_Environment.cxx | 4 +- .../TKernel/OSD/OSD_Error.cxx | 2 +- .../TKernel/OSD/OSD_File.cxx | 18 +- .../TKernel/OSD/OSD_FileIterator.cxx | 16 +- .../TKernel/OSD/OSD_FileNode.cxx | 16 +- .../TKernel/OSD/OSD_FileSystem.cxx | 4 +- .../TKernel/OSD/OSD_Host.cxx | 8 +- .../TKernel/OSD/OSD_LocalFileSystem.cxx | 4 +- .../TKernel/OSD/OSD_MemInfo.cxx | 32 +- .../TKernel/OSD/OSD_MemInfo.hxx | 2 +- .../TKernel/OSD/OSD_OpenFile.cxx | 2 +- .../TKernel/OSD/OSD_Parallel.cxx | 2 +- .../TKernel/OSD/OSD_Path.cxx | 14 +- .../TKernel/OSD/OSD_Process.cxx | 2 +- .../TKernel/OSD/OSD_SharedLibrary.cxx | 6 +- .../TKernel/OSD/OSD_Thread.cxx | 4 +- .../TKernel/OSD/OSD_Timer.cxx | 2 +- .../TKernel/OSD/OSD_signal.cxx | 2 +- .../TKernel/Quantity/Quantity_Color.cxx | 48 +-- .../TKernel/Quantity/Quantity_Color.hxx | 6 +- .../TKernel/Quantity/Quantity_ColorRGBA.cxx | 2 +- .../TKernel/Quantity/Quantity_ColorRGBA.hxx | 6 +- .../TKernel/Resource/Resource_Manager.cxx | 2 +- .../TKernel/Resource/Resource_Unicode.cxx | 120 +++--- .../TKernel/Standard/Standard.cxx | 2 +- .../Standard/Standard_CLocaleSentry.cxx | 2 +- .../TKernel/Standard/Standard_Character.hxx | 22 +- .../TKernel/Standard/Standard_Dump.cxx | 10 +- .../Standard/Standard_ErrorHandler.cxx | 12 +- .../Standard/Standard_ExtCharacter.hxx | 4 +- .../TKernel/Standard/Standard_Failure.cxx | 4 +- .../TKernel/Standard/Standard_GUID.cxx | 32 +- .../TKernel/Standard/Standard_HashUtils.lxx | 4 +- .../TKernel/Standard/Standard_MMgrOpt.cxx | 41 +- .../Standard/Standard_ReadLineBuffer.hxx | 2 +- .../TKernel/Standard/Standard_StackTrace.cxx | 4 +- .../TKernel/Standard/Standard_Strtod.cxx | 62 +-- .../TKernel/Storage/Storage_BaseDriver.cxx | 2 +- .../Storage/Storage_BucketOfPersistent.hxx | 4 +- .../TKernel/Storage/Storage_Schema.cxx | 8 +- .../TCollection/TCollection_AsciiString.cxx | 12 +- .../TCollection_ExtendedString.cxx | 6 +- .../TCollection_HExtendedString.cxx | 2 +- .../TKernel/Units/Units_Measurement.cxx | 4 +- .../TKernel/Units/Units_Token.cxx | 2 +- .../TKernel/Units/Units_Token.lxx | 14 +- .../TKernel/Units/Units_UnitsDictionary.cxx | 6 +- .../TKBO/BOPAlgo/BOPAlgo_BOP.cxx | 2 +- .../TKBO/BOPAlgo/BOPAlgo_Builder.cxx | 2 +- .../TKBO/BOPAlgo/BOPAlgo_BuilderSolid.cxx | 2 +- .../TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx | 4 +- .../TKBO/BOPAlgo/BOPAlgo_MakerVolume.cxx | 2 +- .../TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx | 8 +- .../TKBO/BOPAlgo/BOPAlgo_Section.cxx | 2 +- .../TKBO/BOPAlgo/BOPAlgo_ShellSplitter.cxx | 2 +- .../TKBO/BOPAlgo/BOPAlgo_Tools.cxx | 2 +- .../TKBO/BOPAlgo/BOPAlgo_WireSplitter.cxx | 2 +- .../TKBO/BOPDS/BOPDS_Curve.lxx | 2 +- .../TKBO/BOPDS/BOPDS_Iterator.cxx | 6 +- .../TKBO/BOPDS/BOPDS_SubIterator.cxx | 4 +- .../TKBO/BOPDS/BOPDS_SubIterator.hxx | 4 +- .../TKBO/BOPTools/BOPTools_AlgoTools.cxx | 2 +- .../BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx | 2 +- .../IntTools/IntTools_BeanFaceIntersector.cxx | 16 +- .../TKBO/IntTools/IntTools_Context.cxx | 22 +- .../IntTools/IntTools_CurveRangeSample.cxx | 6 +- .../TKBO/IntTools/IntTools_EdgeEdge.cxx | 4 +- .../TKBO/IntTools/IntTools_EdgeFace.cxx | 4 +- .../TKBO/IntTools/IntTools_FClass2d.cxx | 2 +- .../TKBO/IntTools/IntTools_FaceFace.cxx | 12 +- .../TKBO/IntTools/IntTools_Tools.cxx | 2 +- .../TKBO/IntTools/IntTools_TopolTool.cxx | 14 +- .../TKBO/IntTools/IntTools_WLineTool.cxx | 4 +- .../TKBool/BRepAlgo/BRepAlgo.cxx | 4 +- .../TKBool/BRepFill/BRepFill_Draft.cxx | 2 +- .../TopOpeBRep_FaceEdgeIntersector.cxx | 2 +- .../TopOpeBRep/TopOpeBRep_FacesFiller.cxx | 2 +- .../TopOpeBRep_FacesIntersector.cxx | 12 +- .../TopOpeBRep/TopOpeBRep_LineInter.cxx | 4 +- .../TopOpeBRep/TopOpeBRep_VPointInter.cxx | 2 +- .../TopOpeBRep_VPointInterIterator.cxx | 2 +- .../TopOpeBRep/TopOpeBRep_WPointInter.cxx | 2 +- .../TopOpeBRep_WPointInterIterator.cxx | 2 +- .../TKBool/TopOpeBRep/TopOpeBRep_sort.cxx | 8 +- .../TopOpeBRepBuild_Builder1_1.cxx | 4 +- .../TopOpeBRepBuild_BuilderON2d.cxx | 2 +- .../TopOpeBRepBuild_CorrectFace2d.cxx | 12 +- .../TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx | 2 +- .../TopOpeBRepBuild_GridFF.cxx | 2 +- .../TopOpeBRepBuild_Griddump.cxx | 2 +- .../TopOpeBRepBuild_HBuilder.cxx | 4 +- .../TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx | 4 +- .../TopOpeBRepBuild_fctwes.cxx | 4 +- .../TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx | 8 +- .../TopOpeBRepBuild_kpkole.cxx | 2 +- .../TopOpeBRepBuild/TopOpeBRepBuild_on.cxx | 12 +- .../TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx | 4 +- .../TopOpeBRepDS/TopOpeBRepDS_Check.cxx | 4 +- .../TopOpeBRepDS_CurveExplorer.cxx | 2 +- .../TopOpeBRepDS_DataStructure.cxx | 2 +- .../TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx | 8 +- .../TKBool/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx | 2 +- .../TopOpeBRepDS/TopOpeBRepDS_Marker.cxx | 2 +- .../TopOpeBRepDS_PointExplorer.cxx | 2 +- .../TopOpeBRepDS_SurfaceExplorer.cxx | 2 +- .../TKBool/TopOpeBRepDS/TopOpeBRepDS_TKI.cxx | 8 +- .../TopOpeBRepDS/TopOpeBRepDS_connex.cxx | 20 +- .../TopOpeBRepDS/TopOpeBRepDS_samdom.cxx | 14 +- .../TopOpeBRepTool/TopOpeBRepTool_2d.cxx | 2 +- .../TopOpeBRepTool/TopOpeBRepTool_BoxSort.cxx | 2 +- .../TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx | 2 +- .../TopOpeBRepTool_CurveTool.cxx | 12 +- .../TopOpeBRepTool_RegularizeW.cxx | 2 +- .../TopOpeBRepTool_ShapeClassifier.cxx | 4 +- .../TopOpeBRepTool_SolidClassifier.cxx | 6 +- .../TKExpress/ExprIntrp/lex.ExprIntrp.c | 6 +- .../TKFeat/BRepFeat/BRepFeat.cxx | 12 +- .../TKFeat/BRepFeat/BRepFeat_Form.cxx | 2 +- .../BRepFeat/BRepFeat_MakeCylindricalHole.cxx | 2 +- .../TKFeat/BRepFeat/BRepFeat_RibSlot.cxx | 2 +- .../TKFeat/BRepFeat/BRepFeat_SplitShape.cxx | 2 +- .../TKFeat/LocOpe/LocOpe_CSIntersector.cxx | 34 +- .../BRepBlend/BRepBlend_AppFuncRoot.cxx | 32 +- .../BRepBlend/BRepBlend_HCurve2dTool.cxx | 2 +- .../BRepBlend/BRepBlend_HCurveTool.cxx | 2 +- .../BRepFilletAPI_MakeFillet.cxx | 2 +- .../TKFillet/BlendFunc/BlendFunc.cxx | 6 +- .../BlendFunc/BlendFunc_CSCircular.cxx | 2 +- .../BlendFunc/BlendFunc_CSConstRad.cxx | 2 +- .../TKFillet/BlendFunc/BlendFunc_ConstRad.cxx | 8 +- .../TKFillet/BlendFunc/BlendFunc_EvolRad.cxx | 8 +- .../TKFillet/BlendFunc/BlendFunc_Ruled.cxx | 2 +- .../TKFillet/ChFi3d/ChFi3d_Builder.cxx | 2 +- .../TKFillet/ChFi3d/ChFi3d_Builder_6.cxx | 2 +- .../TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx | 4 +- .../TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx | 4 +- .../TKFillet/ChFi3d/ChFi3d_ChBuilder.cxx | 2 +- .../TKFillet/ChFi3d/ChFi3d_FilBuilder.cxx | 4 +- .../TKFillet/ChFiDS/ChFiDS_Spine.cxx | 20 +- .../TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx | 2 +- .../ApproxInt/ApproxInt_MultiLine.gxx | 30 +- .../TKGeomAlgo/FairCurve/FairCurve_Batten.cxx | 2 +- .../TKGeomAlgo/FairCurve/FairCurve_Energy.cxx | 4 +- .../FairCurve/FairCurve_MinimalVariation.cxx | 6 +- .../GccAna/GccAna_Circ2dTanOnRad_4.cxx | 2 +- .../TKGeomAlgo/GccAna/GccAna_Lin2d2Tan.cxx | 2 +- .../Geom2dAPI/Geom2dAPI_Interpolate.cxx | 8 +- .../Geom2dAPI/Geom2dAPI_PointsToBSpline.cxx | 2 +- .../Geom2dGcc/Geom2dGcc_Circ2d3Tan.cxx | 2 +- .../Geom2dHatch/Geom2dHatch_Intersector.cxx | 2 +- .../Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx | 2 +- ...ntersectorOfTheIntConicCurveOfGInter_0.cxx | 6 +- .../GeomAPI/GeomAPI_Interpolate.cxx | 8 +- .../GeomAPI_PointsToBSplineSurface.cxx | 8 +- .../TKGeomAlgo/GeomFill/GeomFill.cxx | 18 +- .../GeomFill/GeomFill_BezierCurves.cxx | 2 +- .../GeomFill/GeomFill_CircularBlendFunc.cxx | 16 +- .../GeomFill/GeomFill_CorrectedFrenet.cxx | 2 +- .../GeomFill/GeomFill_Generator.cxx | 2 +- .../GeomFill/GeomFill_GuideTrihedronPlan.cxx | 4 +- .../GeomFill/GeomFill_LocFunction.cxx | 6 +- .../GeomFill/GeomFill_LocationDraft.cxx | 2 +- .../GeomFill/GeomFill_LocationGuide.cxx | 6 +- .../GeomFill/GeomFill_NSections.cxx | 4 +- .../GeomFill_QuasiAngularConvertor.cxx | 12 +- .../GeomFill_SweepSectionGenerator.cxx | 4 +- .../TKGeomAlgo/GeomInt/GeomInt_IntSS_1.cxx | 8 +- .../GeomInt/GeomInt_LineConstructor.cxx | 12 +- .../TKGeomAlgo/GeomInt/GeomInt_LineTool.cxx | 8 +- .../GeomPlate/GeomPlate_BuildPlateSurface.cxx | 18 +- .../GeomPlate/GeomPlate_PlateG0Criterion.cxx | 6 +- .../GeomPlate/GeomPlate_PlateG1Criterion.cxx | 6 +- .../IntCurve_ExactIntersectionPoint.gxx | 16 +- ...ve_MyImpParToolOfIntImpConicParConic_0.cxx | 6 +- .../IntCurve/IntCurve_Polygon2dGen.gxx | 2 +- .../IntCurveSurface_InterUtils.pxx | 12 +- .../IntCurveSurface_TheHCurveTool.cxx | 4 +- .../TKGeomAlgo/IntImp/IntImp_ZerImpFunc.lxx | 4 +- .../TKGeomAlgo/IntImp/IntImp_ZerParFunc.lxx | 4 +- .../IntPatch/IntPatch_ALineToWLine.cxx | 4 +- .../IntPatch/IntPatch_HCurve2dTool.cxx | 2 +- .../IntPatch/IntPatch_HInterTool.cxx | 8 +- .../IntPatch/IntPatch_ImpImpIntersection.cxx | 4 +- .../IntPatch/IntPatch_ImpPrmIntersection.cxx | 12 +- .../IntPatch/IntPatch_LineConstructor.cxx | 26 +- .../TKGeomAlgo/IntPatch/IntPatch_Point.cxx | 20 +- .../IntPatch/IntPatch_Polyhedron.cxx | 28 +- .../IntPatch/IntPatch_PrmPrmIntersection.cxx | 38 +- .../IntPatch_PrmPrmIntersection_T3Bits.hxx | 6 +- .../TKGeomAlgo/IntPatch/IntPatch_RstInt.cxx | 14 +- .../TKGeomAlgo/IntPatch/IntPatch_WLine.cxx | 4 +- .../IntPatch/IntPatch_WLineTool.cxx | 8 +- .../IntPolyh/IntPolyh_MaillageAffinage.cxx | 4 +- .../TKGeomAlgo/IntPolyh/IntPolyh_Tools.cxx | 4 +- .../IntStart/IntStart_SearchInside.gxx | 4 +- .../IntStart/IntStart_SearchOnBoundaries.gxx | 4 +- .../TKGeomAlgo/IntWalk/IntWalk_IWalking.gxx | 12 +- .../TKGeomAlgo/IntWalk/IntWalk_PWalking.cxx | 10 +- .../TKGeomAlgo/Intf/Intf_TangentZone.cxx | 16 +- .../TKGeomAlgo/Intf/Intf_Tool.cxx | 18 +- .../TKGeomAlgo/Law/Law_BSpline.cxx | 6 +- .../TKGeomAlgo/Law/Law_Interpolate.cxx | 8 +- .../TKGeomAlgo/NLPlate/NLPlate_NLPlate.cxx | 2 +- .../TKGeomAlgo/Plate/Plate_Plate.cxx | 32 +- .../TKGeomAlgo/Plate/Plate_Plate.lxx | 8 +- .../Plate/Plate_SampledCurveConstraint.cxx | 2 +- .../TopTrans/TopTrans_SurfaceTransition.cxx | 4 +- .../TKHLR/Contap/Contap_ArcFunction.cxx | 2 +- .../TKHLR/Contap/Contap_Contour.cxx | 10 +- .../TKHLR/Contap/Contap_HContTool.cxx | 6 +- .../TKHLR/Contap/Contap_HCurve2dTool.cxx | 2 +- .../TKHLR/Contap/Contap_SurfFunction.cxx | 2 +- .../TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.cxx | 16 +- .../TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.lxx | 4 +- .../TKHLR/HLRAlgo/HLRAlgo_EdgesBlock.hxx | 4 +- .../TKHLR/HLRAlgo/HLRAlgo_PolyAlgo.cxx | 50 +-- .../TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx | 2 +- .../TKHLR/HLRAlgo/HLRAlgo_WiresBlock.hxx | 2 +- .../TKHLR/HLRBRep/HLRBRep_BCurveTool.cxx | 2 +- .../TKHLR/HLRBRep/HLRBRep_BSurfaceTool.cxx | 4 +- .../TKHLR/HLRBRep/HLRBRep_Curve.cxx | 42 +- .../TKHLR/HLRBRep/HLRBRep_CurveTool.cxx | 20 +- .../TKHLR/HLRBRep/HLRBRep_CurveTool.lxx | 46 +- .../TKHLR/HLRBRep/HLRBRep_Data.cxx | 264 ++++++------ .../TKHLR/HLRBRep/HLRBRep_EdgeData.cxx | 6 +- .../TKHLR/HLRBRep/HLRBRep_EdgeFaceTool.cxx | 14 +- .../TKHLR/HLRBRep/HLRBRep_FaceData.cxx | 2 +- .../TKHLR/HLRBRep/HLRBRep_FaceData.lxx | 84 ++-- .../TKHLR/HLRBRep/HLRBRep_Intersector.cxx | 16 +- ...ntersectorOfTheIntConicCurveOfCInter_0.cxx | 6 +- .../TKHLR/HLRBRep/HLRBRep_SLPropsATool.lxx | 8 +- .../TKHLR/HLRBRep/HLRBRep_ShapeToHLR.cxx | 8 +- .../TKHLR/HLRBRep/HLRBRep_Surface.cxx | 2 +- .../TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx | 4 +- .../HLRTopoBRep/HLRTopoBRep_DSFiller.cxx | 8 +- .../HLRTopoBRep/HLRTopoBRep_FaceIsoLiner.cxx | 4 +- .../TKHLR/Intrv/Intrv_Interval.cxx | 12 +- .../TKHLR/Intrv/Intrv_Interval.lxx | 8 +- .../HelixGeom/HelixGeom_BuilderHelix.cxx | 2 +- .../BRepMesh/BRepMesh_ConeRangeSplitter.cxx | 4 +- .../BRepMesh_CylinderRangeSplitter.cxx | 2 +- .../BRepMesh_DataStructureOfDelaun.cxx | 10 +- .../BRepMesh_DataStructureOfDelaun.hxx | 2 +- .../BRepMesh_DelabellaBaseMeshAlgo.cxx | 8 +- .../TKMesh/BRepMesh/BRepMesh_GeomTool.cxx | 32 +- .../TKMesh/BRepMesh/BRepMesh_MeshTool.cxx | 2 +- .../BRepMesh/BRepMesh_SphereRangeSplitter.hxx | 2 +- .../BRepMesh/BRepMesh_TorusRangeSplitter.cxx | 12 +- .../TKMesh/BRepMesh/delabella.cpp | 50 +-- .../BRepOffset/BRepOffset_Inter2d.cxx | 2 +- .../TKOffset/BRepOffset/BRepOffset_Tool.cxx | 8 +- .../BRepOffsetAPI_MakePipeShell.cxx | 2 +- .../BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx | 2 +- .../BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx | 6 +- .../ShapeAnalysis/ShapeAnalysis_Curve.cxx | 6 +- .../ShapeBuild/ShapeBuild_Edge.cxx | 2 +- .../ShapeConstruct/ShapeConstruct.cxx | 2 +- .../ShapeConstruct_ProjectCurveOnSurface.cxx | 2 +- .../ShapeFix/ShapeFix_ComposeShell.cxx | 6 +- .../ShapeFix/ShapeFix_FixSmallSolid.cxx | 2 +- .../ShapeProcess/ShapeProcess_Context.cxx | 4 +- .../ShapeProcess_ShapeContext.cxx | 6 +- .../ShapeProcessAPI_ApplySequence.cxx | 4 +- .../ShapeUpgrade_FixSmallBezierCurves.cxx | 4 +- .../ShapeUpgrade_RemoveLocations.cxx | 4 +- .../ShapeUpgrade_RemoveLocations.lxx | 2 +- .../ShapeUpgrade_SplitSurfaceAngle.cxx | 2 +- .../ShapeUpgrade_SplitSurfaceArea.cxx | 6 +- .../BRepBuilderAPI_FastSewing.hxx | 2 +- .../BRepBuilderAPI_MakeShape.cxx | 2 +- .../BRepBuilderAPI_MakeShapeOnMesh.cxx | 2 +- .../BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx | 2 +- .../BRepCheck/BRepCheck_Analyzer.cxx | 4 +- .../TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx | 4 +- .../TKTopAlgo/BRepCheck/BRepCheck_Shell.cxx | 12 +- .../BRepClass3d/BRepClass3d_SolidExplorer.cxx | 12 +- .../BRepExtrema_DistShapeShape.cxx | 22 +- .../BRepExtrema_ProximityDistTool.cxx | 6 +- .../BRepExtrema_ProximityValueTool.cxx | 6 +- .../BRepGProp/BRepGProp_EdgeTool.cxx | 4 +- .../BRepGProp/BRepGProp_VinertGK.cxx | 2 +- .../TKTopAlgo/BRepLib/BRepLib.cxx | 4 +- .../TKTopAlgo/BRepLib/BRepLib_MakeShape.cxx | 2 +- .../BRepLib/BRepLib_PointCloudShape.cxx | 2 +- .../BRepTopAdaptor_FClass2d.cxx | 2 +- .../BRepTopAdaptor_TopolTool.cxx | 12 +- .../TKTopAlgo/Bisector/Bisector_BisecCC.cxx | 2 +- .../TKTopAlgo/Bisector/Bisector_PolyBis.cxx | 2 +- .../IntCurvesFace_Intersector.cxx | 2 +- .../TKTopAlgo/MAT/MAT_Arc.cxx | 8 +- .../TKTopAlgo/MAT/MAT_BasicElt.cxx | 4 +- .../TKTopAlgo/MAT/MAT_Node.cxx | 6 +- src/ModelingData/TKBRep/BRep/BRep_Tool.cxx | 2 +- .../BRepAdaptor/BRepAdaptor_CompCurve.cxx | 2 +- .../TKBRep/BRepTools/BRepTools.cxx | 2 +- .../TKBRep/BRepTools/BRepTools_Debug.cxx | 6 +- .../BRepTools/BRepTools_GTrsfModification.cxx | 2 +- src/ModelingData/TKBRep/BinTools/BinTools.cxx | 14 +- .../TKBRep/BinTools/BinTools_Curve2dSet.cxx | 28 +- .../TKBRep/BinTools/BinTools_CurveSet.cxx | 28 +- .../TKBRep/BinTools/BinTools_IStream.cxx | 24 +- .../TKBRep/BinTools/BinTools_LocationSet.cxx | 6 +- .../TKBRep/BinTools/BinTools_OStream.cxx | 44 +- .../TKBRep/BinTools/BinTools_ShapeReader.cxx | 4 +- .../TKBRep/BinTools/BinTools_ShapeSet.cxx | 56 +-- .../TKBRep/BinTools/BinTools_ShapeWriter.cxx | 34 +- .../TKBRep/BinTools/BinTools_SurfaceSet.cxx | 40 +- src/ModelingData/TKBRep/TopoDS/TopoDS.hxx | 16 +- .../TKBRep/TopoDS/TopoDS_Builder.cxx | 24 +- .../TKG2d/Adaptor2d/Adaptor2d_OffsetCurve.cxx | 4 +- .../Geom2dEval/Geom2dEval_AHTBezierCurve.cxx | 10 +- .../Adaptor3d/Adaptor3d_HSurfaceTool.cxx | 4 +- .../TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx | 4 +- .../AdvApprox/AdvApprox_ApproxAFunction.cxx | 16 +- .../AdvApprox/AdvApprox_SimpleApprox.cxx | 12 +- .../TKG3d/Geom/Geom_BSplineCurve_1.cxx | 2 +- .../TKG3d/Geom/Geom_OsculatingSurface.cxx | 40 +- .../GeomEval/GeomEval_AHTBezierCurve.cxx | 10 +- .../GeomEval/GeomEval_AHTBezierSurface.cxx | 8 +- .../GeomEval/GeomEval_TBezierSurface.cxx | 6 +- src/ModelingData/TKG3d/TopAbs/TopAbs.cxx | 2 +- .../AdvApp2Var/AdvApp2Var_ApproxAFunc2Var.cxx | 2 +- .../AdvApp2Var/AdvApp2Var_ApproxF2var.cxx | 2 +- .../AdvApp2Var/AdvApp2Var_Context.cxx | 12 +- .../AdvApp2Var/AdvApp2Var_Data_Main.pxx | 4 +- .../AdvApp2Var/AdvApp2Var_Data_Mlgdrtl.pxx | 2 +- .../AdvApp2Var/AdvApp2Var_Data_Mmapgs0.pxx | 2 +- .../AdvApp2Var/AdvApp2Var_Data_Mmapgs1.pxx | 2 +- .../AdvApp2Var/AdvApp2Var_Data_Mmapgs2.pxx | 2 +- .../AdvApp2Var/AdvApp2Var_Data_Mmapgss.pxx | 2 +- .../AdvApp2Var/AdvApp2Var_Data_Mmcmcnp.pxx | 2 +- .../AdvApp2Var/AdvApp2Var_Data_Mmjcobi.pxx | 2 +- .../TKGeomBase/AdvApp2Var/AdvApp2Var_Iso.cxx | 16 +- .../AdvApp2Var/AdvApp2Var_MathBase.cxx | 24 +- .../AdvApp2Var/AdvApp2Var_Patch.cxx | 88 ++-- .../AdvApp2Var/AdvApp2Var_SysBase.cxx | 8 +- .../TKGeomBase/AppDef/AppDef_Variational.cxx | 22 +- .../TKGeomBase/AppParCurves/AppParCurves.cxx | 2 +- .../AppParCurves/AppParCurves_LeastSquare.gxx | 2 +- .../Approx/Approx_BSplComputeLine.gxx | 6 +- .../TKGeomBase/Approx/Approx_ComputeLine.gxx | 4 +- .../Approx/Approx_SameParameter.cxx | 6 +- .../TKGeomBase/CPnts/CPnts_AbscissaPoint.cxx | 4 +- .../CPnts/CPnts_UniformDeflection.cxx | 8 +- .../TKGeomBase/Extrema/Extrema_ExtCS.cxx | 2 +- .../TKGeomBase/Extrema/Extrema_GFuncExtCC.hxx | 2 +- .../GCPnts/GCPnts_QuasiUniformDeflection.cxx | 4 +- .../GCPnts/GCPnts_TangentialDeflection.cxx | 2 +- .../GCPnts/GCPnts_UniformAbscissa.cxx | 2 +- .../GCPnts/GCPnts_UniformDeflection.cxx | 4 +- .../TKGeomBase/GeomConvert/GeomConvert_1.cxx | 2 +- .../TKGeomBase/GeomLib/GeomLib.cxx | 12 +- .../TKGeomBase/GeomTools/GeomTools_Debug.cxx | 2 +- .../ProjLib/ProjLib_CompProjectedCurve.cxx | 6 +- .../ProjLib/ProjLib_ComputeApprox.cxx | 4 +- .../ProjLib_ComputeApproxOnPolarSurface.cxx | 40 +- .../ProjLib/ProjLib_ProjectedCurve.cxx | 2 +- .../TKMeshVS/MeshVS/MeshVS_Buffer.hxx | 6 +- .../TKMeshVS/MeshVS/MeshVS_DataSource3D.cxx | 4 +- .../MeshVS_ElementalColorPrsBuilder.cxx | 12 +- .../TKMeshVS/MeshVS/MeshVS_MeshPrsBuilder.cxx | 12 +- .../MeshVS/MeshVS_NodalColorPrsBuilder.cxx | 10 +- .../TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx | 16 +- .../TKMeshVS/MeshVS/MeshVS_Tool.cxx | 44 +- .../TKMeshVS/MeshVS/MeshVS_TwoColors.cxx | 36 +- .../MeshVS/MeshVS_VectorPrsBuilder.cxx | 6 +- .../TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx | 38 +- .../OpenGl/OpenGl_AspectsTextureSet.cxx | 2 +- .../OpenGl/OpenGl_BackgroundArray.cxx | 32 +- .../TKOpenGl/OpenGl/OpenGl_Buffer.cxx | 24 +- .../TKOpenGl/OpenGl/OpenGl_Buffer.hxx | 2 +- .../TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx | 12 +- .../TKOpenGl/OpenGl/OpenGl_CappingAlgo.cxx | 2 +- .../OpenGl/OpenGl_CappingPlaneResource.cxx | 10 +- .../TKOpenGl/OpenGl/OpenGl_Context.cxx | 86 ++-- .../TKOpenGl/OpenGl/OpenGl_Context.hxx | 2 +- .../TKOpenGl/OpenGl/OpenGl_Flipper.cxx | 24 +- .../TKOpenGl/OpenGl/OpenGl_Font.cxx | 22 +- .../TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx | 30 +- .../TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx | 36 +- .../TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx | 6 +- .../OpenGl/OpenGl_GraduatedTrihedron.cxx | 28 +- .../TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx | 6 +- .../TKOpenGl/OpenGl/OpenGl_Group.hxx | 2 +- .../TKOpenGl/OpenGl/OpenGl_HaltonSampler.hxx | 4 +- .../TKOpenGl/OpenGl/OpenGl_LayerList.cxx | 6 +- .../TKOpenGl/OpenGl/OpenGl_LineAttributes.cxx | 8 +- .../TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx | 16 +- .../TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx | 8 +- .../TKOpenGl/OpenGl/OpenGl_SceneGeometry.cxx | 4 +- .../TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx | 16 +- .../TKOpenGl/OpenGl/OpenGl_ShaderManager.hxx | 10 +- .../TKOpenGl/OpenGl/OpenGl_ShaderObject.cxx | 6 +- .../TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx | 28 +- .../TKOpenGl/OpenGl/OpenGl_Structure.cxx | 14 +- .../TKOpenGl/OpenGl/OpenGl_Text.cxx | 16 +- .../TKOpenGl/OpenGl/OpenGl_Texture.cxx | 28 +- .../OpenGl/OpenGl_TextureSetPairIterator.hxx | 2 +- .../TKOpenGl/OpenGl/OpenGl_TileSampler.cxx | 38 +- .../TKOpenGl/OpenGl/OpenGl_TileSampler.hxx | 10 +- .../TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx | 6 +- .../TKOpenGl/OpenGl/OpenGl_View.cxx | 56 +-- .../TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx | 42 +- .../TKOpenGl/OpenGl/OpenGl_Window.cxx | 16 +- .../TKOpenGl/OpenGl/OpenGl_Workspace.cxx | 2 +- .../TKService/Aspect/Aspect_CircularGrid.cxx | 10 +- .../Aspect/Aspect_DisplayConnection.cxx | 8 +- .../Aspect/Aspect_DisplayConnection.hxx | 12 +- .../TKService/Aspect/Aspect_NeutralWindow.hxx | 2 +- .../Aspect/Aspect_RectangularGrid.cxx | 8 +- .../Aspect/Aspect_WindowInputListener.cxx | 4 +- .../TKService/Font/Font_FTFont.cxx | 52 +-- .../TKService/Font/Font_FontMgr.cxx | 22 +- .../TKService/Font/Font_SystemFont.cxx | 12 +- .../TKService/Font/Font_TextFormatter.cxx | 6 +- .../TKService/Font/Font_TextFormatter.hxx | 4 +- .../Graphic3d/Graphic3d_ArrayOfPrimitives.cxx | 4 +- .../Graphic3d/Graphic3d_ArrayOfPrimitives.hxx | 92 ++-- .../Graphic3d/Graphic3d_AspectFillArea3d.cxx | 2 +- .../Graphic3d/Graphic3d_AspectLine3d.cxx | 2 +- .../Graphic3d/Graphic3d_AspectLine3d.hxx | 2 +- .../Graphic3d/Graphic3d_AspectMarker3d.cxx | 2 +- .../Graphic3d/Graphic3d_AspectMarker3d.hxx | 2 +- .../Graphic3d/Graphic3d_AspectText3d.hxx | 2 +- .../TKService/Graphic3d/Graphic3d_Aspects.hxx | 6 +- .../Graphic3d/Graphic3d_AttribBuffer.cxx | 10 +- .../TKService/Graphic3d/Graphic3d_BSDF.cxx | 2 +- .../TKService/Graphic3d/Graphic3d_Buffer.hxx | 14 +- .../TKService/Graphic3d/Graphic3d_CView.cxx | 12 +- .../TKService/Graphic3d/Graphic3d_Camera.cxx | 14 +- .../Graphic3d/Graphic3d_ClipPlane.hxx | 2 +- .../Graphic3d/Graphic3d_CubeMapPacked.cxx | 2 +- .../Graphic3d/Graphic3d_CubeMapSeparate.cxx | 2 +- .../Graphic3d/Graphic3d_FrameStats.cxx | 52 +-- .../Graphic3d/Graphic3d_FrameStatsData.cxx | 2 +- .../TKService/Graphic3d/Graphic3d_Group.cxx | 30 +- .../Graphic3d/Graphic3d_HatchStyle.cxx | 2 +- .../Graphic3d/Graphic3d_IndexBuffer.hxx | 10 +- .../TKService/Graphic3d/Graphic3d_Layer.cxx | 4 +- .../Graphic3d/Graphic3d_MarkerImage.cxx | 50 +-- .../Graphic3d/Graphic3d_MaterialAspect.cxx | 4 +- .../Graphic3d/Graphic3d_MediaTexture.cxx | 2 +- .../Graphic3d_MutableIndexBuffer.hxx | 2 +- .../Graphic3d/Graphic3d_PBRMaterial.cxx | 16 +- .../Graphic3d/Graphic3d_PBRMaterial.hxx | 2 +- .../Graphic3d/Graphic3d_ShaderObject.cxx | 6 +- .../Graphic3d/Graphic3d_Structure.cxx | 12 +- .../Graphic3d/Graphic3d_Structure.hxx | 2 +- .../Graphic3d/Graphic3d_Texture3D.cxx | 2 +- .../Graphic3d/Graphic3d_TextureSetBits.hxx | 10 +- .../Graphic3d/Graphic3d_TransformPers.hxx | 22 +- .../TKService/Graphic3d/Graphic3d_Vertex.hxx | 6 +- .../TKService/Image/Image_AlienPixMap.cxx | 4 +- .../TKService/Image/Image_DDSParser.cxx | 18 +- .../TKService/Image/Image_Diff.cxx | 44 +- .../TKService/Image/Image_Diff.hxx | 6 +- .../TKService/Image/Image_PixMap.cxx | 94 ++--- .../TKService/Image/Image_PixMap.hxx | 10 +- .../TKService/Image/Image_PixMapData.hxx | 36 +- .../TKService/Image/Image_Texture.cxx | 18 +- .../TKService/Media/Media_FormatContext.cxx | 36 +- .../TKService/Media/Media_PlayerContext.cxx | 6 +- .../TKService/Media/Media_PlayerContext.hxx | 2 +- .../TKService/WNT/WNT_HIDSpaceMouse.cxx | 6 +- .../TKService/Wasm/Wasm_Window.cxx | 2 +- src/Visualization/TKService/Xw/Xw_Window.cxx | 62 +-- src/Visualization/TKV3d/AIS/AIS_Circle.cxx | 4 +- .../TKV3d/AIS/AIS_ColorScale.cxx | 42 +- .../TKV3d/AIS/AIS_ColoredShape.cxx | 6 +- .../TKV3d/AIS/AIS_ExclusionFilter.cxx | 20 +- .../TKV3d/AIS/AIS_InteractiveContext.cxx | 4 +- .../TKV3d/AIS/AIS_InteractiveContext.hxx | 2 +- .../TKV3d/AIS/AIS_LightSource.cxx | 4 +- src/Visualization/TKV3d/AIS/AIS_Line.cxx | 4 +- .../TKV3d/AIS/AIS_Manipulator.cxx | 4 +- .../TKV3d/AIS/AIS_MediaPlayer.cxx | 14 +- src/Visualization/TKV3d/AIS/AIS_Plane.cxx | 4 +- .../TKV3d/AIS/AIS_PointCloud.cxx | 2 +- .../TKV3d/AIS/AIS_RubberBand.cxx | 20 +- src/Visualization/TKV3d/AIS/AIS_Shape.cxx | 12 +- src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx | 10 +- .../TKV3d/AIS/AIS_TexturedShape.cxx | 4 +- .../TKV3d/AIS/AIS_Triangulation.cxx | 8 +- src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx | 30 +- .../TKV3d/AIS/AIS_ViewController.cxx | 128 +++--- src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx | 46 +- .../TKV3d/DsgPrs/DsgPrs_AnglePresentation.cxx | 18 +- .../DsgPrs_EllipseRadiusPresentation.cxx | 4 +- .../DsgPrs_EqualDistancePresentation.cxx | 4 +- .../DsgPrs_FilletRadiusPresentation.cxx | 2 +- .../DsgPrs/DsgPrs_IdenticPresentation.cxx | 6 +- .../DsgPrs/DsgPrs_LengthPresentation.cxx | 8 +- .../DsgPrs/DsgPrs_MidPointPresentation.cxx | 4 +- .../DsgPrs/DsgPrs_SymmetricPresentation.cxx | 16 +- .../TKV3d/Prs3d/Prs3d_DatumAspect.cxx | 4 +- .../TKV3d/Prs3d/Prs3d_Drawer.hxx | 2 +- .../TKV3d/Prs3d/Prs3d_ShadingAspect.cxx | 8 +- src/Visualization/TKV3d/Prs3d/Prs3d_Text.cxx | 4 +- .../TKV3d/PrsDim/PrsDim_AngleDimension.cxx | 2 +- .../TKV3d/PrsDim/PrsDim_Dimension.cxx | 6 +- .../TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx | 6 +- .../TKV3d/PrsMgr/PrsMgr_PresentableObject.hxx | 2 +- .../Select3D/Select3D_BVHIndexBuffer.hxx | 12 +- .../Select3D_SensitivePrimitiveArray.cxx | 10 +- .../Select3D/Select3D_SensitiveSegment.cxx | 2 +- .../TKV3d/Select3D/Select3D_SensitiveSet.cxx | 2 +- .../Select3D/Select3D_SensitiveTriangle.cxx | 2 +- .../SelectBasics/SelectBasics_PickResult.hxx | 2 +- .../SelectMgr_SelectingVolumeManager.cxx | 4 +- .../SelectMgr_SelectionImageFiller.cxx | 16 +- .../SelectMgr_SelectionImageFiller.hxx | 6 +- .../SelectMgr/SelectMgr_ViewerSelector.cxx | 2 +- .../TKV3d/StdPrs/StdPrs_BRepFont.cxx | 6 +- .../TKV3d/StdPrs/StdPrs_BRepFont.hxx | 16 +- .../TKV3d/StdPrs/StdPrs_Curve.cxx | 2 +- .../TKV3d/StdPrs/StdPrs_DeflectionCurve.cxx | 2 +- .../TKV3d/StdPrs/StdPrs_Plane.cxx | 10 +- .../TKV3d/V3d/V3d_CircularGrid.cxx | 8 +- src/Visualization/TKV3d/V3d/V3d_Plane.cxx | 2 +- src/Visualization/TKV3d/V3d/V3d_View.cxx | 30 +- 763 files changed, 3934 insertions(+), 3942 deletions(-) diff --git a/src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_ConstraintDriver.cxx b/src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_ConstraintDriver.cxx index 641b4f6276a..d17cd2b3e0a 100644 --- a/src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_ConstraintDriver.cxx +++ b/src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_ConstraintDriver.cxx @@ -110,7 +110,7 @@ bool BinMDataXtd_ConstraintDriver::Paste(const BinObjMgt_Persistent& theSo int aType; if (!(theSource >> aType)) return false; - aC->SetType((TDataXtd_ConstraintEnum)aType); + aC->SetType(static_cast(aType)); // flags int flags; @@ -165,7 +165,7 @@ void BinMDataXtd_ConstraintDriver::Paste( theTarget << aNb; // constraint type - theTarget << (int)aC->GetType(); + theTarget << static_cast(aC->GetType()); // flags int flags = 0; diff --git a/src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_GeometryDriver.cxx b/src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_GeometryDriver.cxx index fb27ec3c7fa..3c17be5a94d 100644 --- a/src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_GeometryDriver.cxx +++ b/src/ApplicationFramework/TKBin/BinMDataXtd/BinMDataXtd_GeometryDriver.cxx @@ -50,7 +50,7 @@ bool BinMDataXtd_GeometryDriver::Paste(const BinObjMgt_Persistent& theSour int aType; bool ok = theSource >> aType; if (ok) - aT->SetType((TDataXtd_GeometryEnum)aType); + aT->SetType(static_cast(aType)); return ok; } @@ -63,5 +63,5 @@ void BinMDataXtd_GeometryDriver::Paste( NCollection_IndexedMap>&) const { occ::handle aG = occ::down_cast(theSource); - theTarget << (int)aG->GetType(); + theTarget << static_cast(aG->GetType()); } diff --git a/src/ApplicationFramework/TKBin/BinMNaming/BinMNaming_NamingDriver.cxx b/src/ApplicationFramework/TKBin/BinMNaming/BinMNaming_NamingDriver.cxx index 91ec5683e21..b58ca593f86 100644 --- a/src/ApplicationFramework/TKBin/BinMNaming/BinMNaming_NamingDriver.cxx +++ b/src/ApplicationFramework/TKBin/BinMNaming/BinMNaming_NamingDriver.cxx @@ -347,7 +347,7 @@ bool BinMNaming_NamingDriver::Paste(const BinObjMgt_Persistent& theSource, TopAbs_Orientation OrientationToApply(TopAbs_FORWARD); if (ok) { - OrientationToApply = (TopAbs_Orientation)anIndx; + OrientationToApply = static_cast(anIndx); aName.Orientation(OrientationToApply); #ifdef OCCT_DEBUG std::cout << "NamingDriver:: Retrieved Orientation = " << OrientationToApply @@ -415,7 +415,7 @@ void BinMNaming_NamingDriver::Paste( anArray.SetValue(i, anIndx); } - theTarget.PutIntArray((BinObjMgt_PInteger)&anArray.Value(1), aNbArgs); // keep Array + theTarget.PutIntArray(const_cast(&anArray.Value(1)), aNbArgs); // keep Array } // 4. keep StopNS @@ -440,5 +440,5 @@ void BinMNaming_NamingDriver::Paste( theTarget << entry; // 7. keep Orientation - theTarget << (int)aName.Orientation(); + theTarget << static_cast(aName.Orientation()); } diff --git a/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx b/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx index 97f1c0c45d5..d4f769eadca 100644 --- a/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx +++ b/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx @@ -264,7 +264,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read(Standard_IStream& BinLDrivers_DocumentSection& aCurSection = anIterS.ChangeValue(); if (!aCurSection.IsPostRead()) { - theIStream.seekg((std::streampos)aCurSection.Offset()); + theIStream.seekg(std::streampos(aCurSection.Offset())); if (aCurSection.Name().IsEqual(SHAPESECTION_POS)) { ReadShapeSection(aCurSection, theIStream, false, aPS.Next()); @@ -314,7 +314,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read(Standard_IStream& if (aShapeSectionPos) { aDocumentPos = theIStream.tellg(); - theIStream.seekg((std::streampos)aShapeSectionPos); + theIStream.seekg(std::streampos(aShapeSectionPos)); CheckShapeSection(aShapeSectionPos, theIStream); // Read Shapes @@ -388,7 +388,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read(Standard_IStream& BinLDrivers_DocumentSection& aCurSection = aSectIter.ChangeValue(); if (aCurSection.IsPostRead()) { - theIStream.seekg((std::streampos)aCurSection.Offset()); + theIStream.seekg(std::streampos(aCurSection.Offset())); ReadSection(aCurSection, theDoc, theIStream); } } diff --git a/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentSection.cxx b/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentSection.cxx index 2c4d48096b2..310b73f9d32 100644 --- a/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentSection.cxx +++ b/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentSection.cxx @@ -105,7 +105,7 @@ void BinLDrivers_DocumentSection::WriteTOC(Standard_OStream& theStream #ifdef DO_INVERSE aBufSz[0] = InverseInt((int)aBufSize); #else - aBufSz[0] = (int)aBufSize; + aBufSz[0] = static_cast(aBufSize); #endif theStream.write(&aBuf[0], aBufSize + sizeof(int)); @@ -147,7 +147,7 @@ void BinLDrivers_DocumentSection::Write(Standard_OStream& theStream, "BinLDrivers_DocumentSection::Write : file size is too big, needs int64."); // Old documents stored file position as 4-bytes values. - int32_t aValInt[3] = {int32_t(myValue[0]), int32_t(myValue[1]), int32_t(myIsPostRead ? 1 : 0)}; + int32_t aValInt[3] = {static_cast(myValue[0]), static_cast(myValue[1]), static_cast(myIsPostRead ? 1 : 0)}; #ifdef DO_INVERSE aValInt[0] = InverseInt(aValInt[0]); aValInt[1] = InverseInt(aValInt[1]); @@ -157,7 +157,7 @@ void BinLDrivers_DocumentSection::Write(Standard_OStream& theStream, } else { - uint64_t aVal[3] = {myValue[0], myValue[1], uint64_t(myIsPostRead ? 1 : 0)}; + uint64_t aVal[3] = {myValue[0], myValue[1], static_cast(myIsPostRead ? 1 : 0)}; #ifdef DO_INVERSE aVal[0] = InverseUint64(aVal[0]); aVal[1] = InverseUint64(aVal[1]); diff --git a/src/ApplicationFramework/TKBinL/BinMDF/BinMDF_ADriver.lxx b/src/ApplicationFramework/TKBinL/BinMDF/BinMDF_ADriver.lxx index 34c2877f959..d52132dbbab 100644 --- a/src/ApplicationFramework/TKBinL/BinMDF/BinMDF_ADriver.lxx +++ b/src/ApplicationFramework/TKBinL/BinMDF/BinMDF_ADriver.lxx @@ -20,6 +20,6 @@ inline const TCollection_AsciiString& BinMDF_ADriver::TypeName() const { if (myTypeName.Length() == 0) - (TCollection_AsciiString&)myTypeName += SourceType()->Name(); + const_cast(myTypeName) += SourceType()->Name(); return myTypeName; } diff --git a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_ByteArrayDriver.cxx b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_ByteArrayDriver.cxx index 46e62d989d0..cf9b1979933 100644 --- a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_ByteArrayDriver.cxx +++ b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_ByteArrayDriver.cxx @@ -108,7 +108,7 @@ void BinMDataStd_ByteArrayDriver::Paste( } uint8_t* aPtr = &aSourceArray(lower); theTarget.PutByteArray(aPtr, bytes->Length()); - theTarget << (uint8_t)(anAtt->GetDelta() ? 1 : 0); + theTarget << static_cast(anAtt->GetDelta() ? 1 : 0); // process user defined guid if (anAtt->ID() != TDataStd_ByteArray::GetID()) diff --git a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cxx b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cxx index 7f7adfb8211..8dbb3487bf0 100644 --- a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cxx +++ b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_ExtStringArrayDriver.cxx @@ -112,7 +112,7 @@ void BinMDataStd_ExtStringArrayDriver::Paste( for (int i = aFirstInd; i <= aLastInd; i++) theTarget << anAtt->Value(i); - theTarget << (uint8_t)(anAtt->GetDelta() ? 1 : 0); + theTarget << static_cast(anAtt->GetDelta() ? 1 : 0); // process user defined guid if (anAtt->ID() != TDataStd_ExtStringArray::GetID()) diff --git a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_IntPackedMapDriver.cxx b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_IntPackedMapDriver.cxx index 826be6a193a..01afe7356da 100644 --- a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_IntPackedMapDriver.cxx +++ b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_IntPackedMapDriver.cxx @@ -123,5 +123,5 @@ void BinMDataStd_IntPackedMapDriver::Paste( for (; anIt.More(); anIt.Next()) Target << anIt.Key(); } - Target << (uint8_t)(anAtt->GetDelta() ? 1 : 0); + Target << static_cast(anAtt->GetDelta() ? 1 : 0); } diff --git a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_IntegerArrayDriver.cxx b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_IntegerArrayDriver.cxx index 4519447accf..b8e6413de48 100644 --- a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_IntegerArrayDriver.cxx +++ b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_IntegerArrayDriver.cxx @@ -100,7 +100,7 @@ void BinMDataStd_IntegerArrayDriver::Paste( theTarget << aFirstInd << aLastInd; int* aPtr = const_cast(&aSourceArray(aFirstInd)); theTarget.PutIntArray(aPtr, aLength); - theTarget << (uint8_t)(anAtt->GetDelta() ? 1 : 0); + theTarget << static_cast(anAtt->GetDelta() ? 1 : 0); // process user defined guid if (anAtt->ID() != TDataStd_IntegerArray::GetID()) diff --git a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_NamedDataDriver.cxx b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_NamedDataDriver.cxx index 5f339d43a85..bbce03a50fc 100644 --- a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_NamedDataDriver.cxx +++ b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_NamedDataDriver.cxx @@ -121,7 +121,7 @@ bool BinMDataStd_NamedDataDriver::Paste(const BinObjMgt_Persistent& theSou uint8_t aValue; if (!(theSource >> aKey >> aValue)) return false; - aBytes.Bind(aKey, (uint8_t)aValue); + aBytes.Bind(aKey, aValue); } T->ChangeBytes(aBytes); } @@ -260,7 +260,7 @@ void BinMDataStd_NamedDataDriver::Paste( NCollection_DataMap::Iterator itr(S->GetBytesContainer()); for (; itr.More(); itr.Next()) { - theTarget << itr.Key() << (uint8_t)itr.Value(); + theTarget << itr.Key() << static_cast(itr.Value()); } } else diff --git a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_RealArrayDriver.cxx b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_RealArrayDriver.cxx index c00d88d1fe2..ee1135a1697 100644 --- a/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_RealArrayDriver.cxx +++ b/src/ApplicationFramework/TKBinL/BinMDataStd/BinMDataStd_RealArrayDriver.cxx @@ -96,7 +96,7 @@ void BinMDataStd_RealArrayDriver::Paste( theTarget << aFirstInd << aLastInd; double* aPtr = const_cast(&aSourceArray(aFirstInd)); theTarget.PutRealArray(aPtr, aLength); - theTarget << (uint8_t)(anAtt->GetDelta() ? 1 : 0); + theTarget << static_cast(anAtt->GetDelta() ? 1 : 0); // process user defined guid if (anAtt->ID() != TDataStd_RealArray::GetID()) theTarget << anAtt->ID(); diff --git a/src/ApplicationFramework/TKBinL/BinMFunction/BinMFunction_GraphNodeDriver.cxx b/src/ApplicationFramework/TKBinL/BinMFunction/BinMFunction_GraphNodeDriver.cxx index fe3366df77a..52ad8f3ee91 100644 --- a/src/ApplicationFramework/TKBinL/BinMFunction/BinMFunction_GraphNodeDriver.cxx +++ b/src/ApplicationFramework/TKBinL/BinMFunction/BinMFunction_GraphNodeDriver.cxx @@ -59,7 +59,7 @@ bool BinMFunction_GraphNodeDriver::Paste(const BinObjMgt_Persistent& theSo return false; // Execution status - GN->SetStatus((TFunction_ExecutionStatus)intStatus); + GN->SetStatus(static_cast(intStatus)); // Previous functions if (nb_previous) @@ -101,7 +101,7 @@ void BinMFunction_GraphNodeDriver::Paste( occ::handle GN = occ::down_cast(theSource); // Execution status - theTarget << (int)GN->GetStatus(); + theTarget << static_cast(GN->GetStatus()); // Number of previous functions theTarget << GN->GetPrevious().Extent(); // Number of next functions diff --git a/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx b/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx index 029b6ed5ae2..70a3072e232 100644 --- a/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx +++ b/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx @@ -62,7 +62,7 @@ void BinObjMgt_Persistent::Init() void* aPiece = Standard::Allocate(BP_PIECESIZE); myData.Append(aPiece); } - int* aData = (int*)myData(1); + int* aData = static_cast(myData(1)); aData[0] = 0; // Type Id aData[1] = 0; // Object Id aData[2] = 0; // Data length @@ -88,7 +88,7 @@ Standard_OStream& BinObjMgt_Persistent::Write(Standard_OStream& theOS, const boo return theOS; } int nbWritten = 0; - int* aData = (int*)myData(1); + int* aData = static_cast(myData(1)); // update data length aData[2] = mySize - BP_HEADSIZE; if (theDirectStream) @@ -101,7 +101,7 @@ Standard_OStream& BinObjMgt_Persistent::Write(Standard_OStream& theOS, const boo for (int i = 1; theOS && nbWritten < mySize && i <= myData.Length(); i++) { int nbToWrite = std::min(mySize - nbWritten, BP_PIECESIZE); - theOS.write((char*)myData(i), nbToWrite); + theOS.write(static_cast(myData(i)), nbToWrite); nbWritten += nbToWrite; } myIndex = 1; @@ -125,20 +125,20 @@ Standard_IStream& BinObjMgt_Persistent::Read(Standard_IStream& theIS) mySize = BP_HEADSIZE; myIsError = false; - int* aData = (int*)myData(1); + int* aData = static_cast(myData(1)); aData[0] = 0; // Type Id aData[1] = 0; // Object Id aData[2] = 0; // Data length // read TypeId - theIS.read((char*)&aData[0], BP_INTSIZE); + theIS.read(reinterpret_cast(&aData[0]), BP_INTSIZE); #ifdef DO_INVERSE aData[0] = InverseInt(aData[0]); #endif if (theIS && aData[0] > 0) { // read Id and Length - theIS.read((char*)&aData[1], 2 * BP_INTSIZE); + theIS.read(reinterpret_cast(&aData[1]), 2 * BP_INTSIZE); #ifdef DO_INVERSE aData[1] = InverseInt(aData[1]); aData[2] = InverseInt(aData[2]); @@ -160,7 +160,7 @@ Standard_IStream& BinObjMgt_Persistent::Read(Standard_IStream& theIS) myData.Append(aPiece); } int nbToRead = std::min(mySize - nbRead, BP_PIECESIZE); - char* ptr = (char*)myData(i); + char* ptr = static_cast(myData(i)); if (i == 1) { // 1st piece: reduce the number of bytes by header size @@ -210,7 +210,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutCharacter(const char theValue) { alignOffset(1); prepareForPut(1); - char* aData = (char*)myData(myIndex) + myOffset; + char* aData = static_cast(myData(myIndex)) + myOffset; *aData = theValue; myOffset++; return *this; @@ -222,7 +222,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutByte(const uint8_t theValue) { alignOffset(1); prepareForPut(1); - uint8_t* aData = (uint8_t*)myData(myIndex) + myOffset; + uint8_t* aData = static_cast(myData(myIndex)) + myOffset; *aData = theValue; myOffset++; return *this; @@ -234,7 +234,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutExtCharacter(const char16_t theVa { alignOffset(BP_EXTCHARSIZE, true); prepareForPut(BP_EXTCHARSIZE); - char16_t* aData = (char16_t*)((char*)myData(myIndex) + myOffset); + char16_t* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); #ifdef DO_INVERSE *aData = InverseExtChar(theValue); #else @@ -250,7 +250,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutInteger(const int theValue) { alignOffset(BP_INTSIZE, true); prepareForPut(BP_INTSIZE); - int* aData = (int*)((char*)myData(myIndex) + myOffset); + int* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); #ifdef DO_INVERSE *aData = InverseInt(theValue); #else @@ -281,7 +281,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutReal(const double theValue) else { // the value fits in the current piece => put it quickly - double* aData = (double*)((char*)myData(myIndex) + myOffset); + double* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); #ifdef DO_INVERSE *aData = InverseReal(theValue); #else @@ -298,7 +298,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutShortReal(const float theValue) { alignOffset(BP_INTSIZE, true); prepareForPut(BP_SHORTREALSIZE); - float* aData = (float*)((char*)myData(myIndex) + myOffset); + float* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); #ifdef DO_INVERSE *aData = InverseShortReal(theValue); #else @@ -316,7 +316,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutShortReal(const float theValue) BinObjMgt_Persistent& BinObjMgt_Persistent::PutCString(const char* const theValue) { alignOffset(1); - int aSize = (int)(strlen(theValue) + 1); + int aSize = static_cast(strlen(theValue) + 1); prepareForPut(aSize); putArray((void*)theValue, aSize); return *this; @@ -365,7 +365,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutLabel(const TDF_Label& theValue) alignOffset(BP_INTSIZE, true); int aLen = (theValue.IsNull() ? 0 : theValue.Depth() + 1); prepareForPut((aLen + 1) * BP_INTSIZE); - int* aData = (int*)((char*)myData(myIndex) + myOffset); + int* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); // store nb of tags #ifdef DO_INVERSE *aData++ = InverseInt(aLen); @@ -384,7 +384,7 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutLabel(const TDF_Label& theValue) { myOffset = 0; myIndex++; - aData = (int*)((char*)myData(myIndex) + myOffset); + aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); } #ifdef DO_INVERSE *aData++ = InverseInt(itTag.Value()); @@ -405,9 +405,9 @@ BinObjMgt_Persistent& BinObjMgt_Persistent::PutGUID(const Standard_GUID& theValu prepareForPut(BP_UUIDSIZE); const Standard_UUID aStandardUUID = theValue.ToUUID(); BinObjMgt_UUID anUUID; - anUUID.Data1 = (unsigned int)aStandardUUID.Data1; - anUUID.Data2 = (unsigned short)aStandardUUID.Data2; - anUUID.Data3 = (unsigned short)aStandardUUID.Data3; + anUUID.Data1 = static_cast(aStandardUUID.Data1); + anUUID.Data2 = static_cast(aStandardUUID.Data2); + anUUID.Data3 = static_cast(aStandardUUID.Data3); anUUID.Data4[0] = aStandardUUID.Data4[0]; anUUID.Data4[1] = aStandardUUID.Data4[1]; anUUID.Data4[2] = aStandardUUID.Data4[2]; @@ -548,9 +548,9 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetCharacter(char& theValue) c alignOffset(1); if (noMoreData(1)) return *this; - char* aData = (char*)myData(myIndex) + myOffset; + char* aData = static_cast(myData(myIndex)) + myOffset; theValue = *aData; - ((BinObjMgt_Persistent*)this)->myOffset++; + (const_cast(this))->myOffset++; return *this; } @@ -561,9 +561,9 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetByte(uint8_t& theValue) con alignOffset(1); if (noMoreData(1)) return *this; - uint8_t* aData = (uint8_t*)myData(myIndex) + myOffset; + uint8_t* aData = static_cast(myData(myIndex)) + myOffset; theValue = *aData; - ((BinObjMgt_Persistent*)this)->myOffset++; + (const_cast(this))->myOffset++; return *this; } @@ -574,13 +574,13 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetExtCharacter(char16_t& theV alignOffset(BP_EXTCHARSIZE); if (noMoreData(BP_EXTCHARSIZE)) return *this; - char16_t* aData = (char16_t*)((char*)myData(myIndex) + myOffset); + char16_t* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); #ifdef DO_INVERSE theValue = InverseExtChar(*aData); #else theValue = *aData; #endif - ((BinObjMgt_Persistent*)this)->myOffset += BP_EXTCHARSIZE; + (const_cast(this))->myOffset += BP_EXTCHARSIZE; return *this; } @@ -591,13 +591,13 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetInteger(int& theValue) cons alignOffset(BP_INTSIZE); if (noMoreData(BP_INTSIZE)) return *this; - int* aData = (int*)((char*)myData(myIndex) + myOffset); + int* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); #ifdef DO_INVERSE theValue = InverseInt(*aData); #else theValue = *aData; #endif - ((BinObjMgt_Persistent*)this)->myOffset += BP_INTSIZE; + (const_cast(this))->myOffset += BP_INTSIZE; return *this; } @@ -617,9 +617,9 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetReal(double& theValue) cons else { // the value fits in the current piece => get it quickly - double* aData = (double*)((char*)myData(myIndex) + myOffset); + double* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); theValue = *aData; - ((BinObjMgt_Persistent*)this)->myOffset += BP_REALSIZE; + (const_cast(this))->myOffset += BP_REALSIZE; } #ifdef DO_INVERSE theValue = InverseReal(theValue); @@ -634,13 +634,13 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetShortReal(float& theValue) alignOffset(BP_INTSIZE); if (noMoreData(BP_SHORTREALSIZE)) return *this; - float* aData = (float*)((char*)myData(myIndex) + myOffset); + float* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); #ifdef DO_INVERSE theValue = InverseShortReal(*aData); #else theValue = *aData; #endif - ((BinObjMgt_Persistent*)this)->myOffset += BP_SHORTREALSIZE; + (const_cast(this))->myOffset += BP_SHORTREALSIZE; return *this; } @@ -652,8 +652,8 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetAsciiString( alignOffset(BP_INTSIZE); int aStartIndex = myIndex; int aStartOffset = myOffset; - BinObjMgt_Persistent* me = (BinObjMgt_Persistent*)this; - char* aData = (char*)myData(myIndex) + myOffset; + BinObjMgt_Persistent* me = const_cast(this); + char* aData = static_cast(myData(myIndex)) + myOffset; // count the string length while (!noMoreData(1) && *aData++) @@ -662,7 +662,7 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetAsciiString( if (myOffset >= BP_PIECESIZE) { me->myOffset = 0; - aData = (char*)myData(++me->myIndex); + aData = static_cast(myData(++me->myIndex)); } } if (IsError()) @@ -686,7 +686,7 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetAsciiString( me->myIndex = aStartIndex; me->myOffset = aStartOffset; getArray(aString, aSize); - theValue = (char*)aString; + theValue = static_cast(aString); Standard::Free(aString); } @@ -701,8 +701,8 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetExtendedString( alignOffset(BP_INTSIZE); int aStartIndex = myIndex; int aStartOffset = myOffset; - BinObjMgt_Persistent* me = (BinObjMgt_Persistent*)this; - char16_t* aData = (char16_t*)((char*)myData(myIndex) + myOffset); + BinObjMgt_Persistent* me = const_cast(this); + char16_t* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); // count the string length while (!noMoreData(1) && *aData++) @@ -711,7 +711,7 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetExtendedString( if (myOffset >= BP_PIECESIZE) { me->myOffset = 0; - aData = (char16_t*)myData(++me->myIndex); + aData = static_cast(myData(++me->myIndex)); } } if (IsError()) @@ -735,7 +735,7 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetExtendedString( me->myIndex = aStartIndex; me->myOffset = aStartOffset; getArray(aString, aSize); - theValue = (char16_t*)aString; + theValue = static_cast(aString); Standard::Free(aString); } #ifdef DO_INVERSE @@ -756,9 +756,9 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetLabel(const occ::handle(this); // retrieve nb of tags - int* aData = (int*)((char*)myData(myIndex) + myOffset); + int* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); int aLen = *aData++; #ifdef DO_INVERSE aLen = InverseInt(aLen); @@ -777,7 +777,7 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetLabel(const occ::handlemyOffset = 0; me->myIndex++; - aData = (int*)((char*)myData(myIndex) + myOffset); + aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); } #ifdef DO_INVERSE aTagList.Append(InverseInt(*aData++)); @@ -950,7 +950,7 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetShortRealArray( void BinObjMgt_Persistent::putArray(void* const theArray, const int theSize) { - char* aPtr = (char*)theArray; + char* aPtr = static_cast(theArray); int aLen = theSize; while (aLen > 0) { @@ -960,7 +960,7 @@ void BinObjMgt_Persistent::putArray(void* const theArray, const int theSize) myOffset = 0; } int aLenInPiece = std::min(aLen, BP_PIECESIZE - myOffset); - char* aData = (char*)myData(myIndex) + myOffset; + char* aData = static_cast(myData(myIndex)) + myOffset; memcpy(aData, aPtr, aLenInPiece); aLen -= aLenInPiece; aPtr += aLenInPiece; @@ -975,9 +975,9 @@ void BinObjMgt_Persistent::putArray(void* const theArray, const int theSize) void BinObjMgt_Persistent::getArray(void* const theArray, const int theSize) const { - char* aPtr = (char*)theArray; + char* aPtr = static_cast(theArray); int aLen = theSize; - BinObjMgt_Persistent* me = (BinObjMgt_Persistent*)this; + BinObjMgt_Persistent* me = const_cast(this); while (aLen > 0) { if (myOffset >= BP_PIECESIZE) @@ -986,7 +986,7 @@ void BinObjMgt_Persistent::getArray(void* const theArray, const int theSize) con me->myOffset = 0; } int aLenInPiece = std::min(aLen, BP_PIECESIZE - myOffset); - char* aData = (char*)myData(myIndex) + myOffset; + char* aData = static_cast(myData(myIndex)) + myOffset; memcpy(aPtr, aData, aLenInPiece); aLen -= aLenInPiece; aPtr += aLenInPiece; @@ -1009,7 +1009,7 @@ void BinObjMgt_Persistent::inverseExtCharData(const int theIndex, while (aLen > 0) { int aLenInPiece = std::min(aLen, BP_PIECESIZE - anOffset); - char16_t* aData = (char16_t*)((char*)myData(anIndex) + anOffset); + char16_t* aData = reinterpret_cast(static_cast(myData(anIndex)) + anOffset); for (int i = 0; i < aLenInPiece / BP_EXTCHARSIZE; i++) aData[i] = FSD_BinaryFile::InverseExtChar(aData[i]); aLen -= aLenInPiece; @@ -1037,7 +1037,7 @@ void BinObjMgt_Persistent::inverseIntData(const int theIndex, while (aLen > 0) { int aLenInPiece = std::min(aLen, BP_PIECESIZE - anOffset); - int* aData = (int*)((char*)myData(anIndex) + anOffset); + int* aData = reinterpret_cast(static_cast(myData(anIndex)) + anOffset); for (int i = 0; i < aLenInPiece / BP_INTSIZE; i++) aData[i] = FSD_BinaryFile::InverseInt(aData[i]); aLen -= aLenInPiece; @@ -1073,13 +1073,13 @@ void BinObjMgt_Persistent::inverseRealData(const int theIndex, { int aLenInPiece = std::min(aLen, BP_PIECESIZE - anOffset); - aWrapUnion.aRealData = (double*)((char*)myData(anIndex) + anOffset); + aWrapUnion.aRealData = reinterpret_cast(static_cast(myData(anIndex)) + anOffset); if (aPrevPtr) { int aTmp; - aTmp = FSD_BinaryFile::InverseInt(*(int*)aPrevPtr); - *(int*)aPrevPtr = FSD_BinaryFile::InverseInt(*aWrapUnion.aIntData); + aTmp = FSD_BinaryFile::InverseInt(*static_cast(aPrevPtr)); + *static_cast(aPrevPtr) = FSD_BinaryFile::InverseInt(*aWrapUnion.aIntData); *aWrapUnion.aIntData = aTmp; aWrapUnion.aIntData++; aPrevPtr = nullptr; @@ -1113,7 +1113,7 @@ void BinObjMgt_Persistent::inverseShortRealData(const int theIndex, while (aLen > 0) { int aLenInPiece = std::min(aLen, BP_PIECESIZE - anOffset); - float* aData = (float*)((char*)myData(anIndex) + anOffset); + float* aData = reinterpret_cast(static_cast(myData(anIndex)) + anOffset); for (int i = 0; i < aLenInPiece / BP_INTSIZE; i++) aData[i] = FSD_BinaryFile::InverseShortReal(aData[i]); aLen -= aLenInPiece; diff --git a/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.lxx b/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.lxx index 46018fb5176..c8cebf840ff 100644 --- a/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.lxx +++ b/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.lxx @@ -20,7 +20,7 @@ inline void BinObjMgt_Persistent::SetId(const int theId) { - ((int*)myData(1))[1] = theId; + (static_cast(myData(1)))[1] = theId; } //======================================================================= @@ -30,7 +30,7 @@ inline void BinObjMgt_Persistent::SetId(const int theId) inline void BinObjMgt_Persistent::SetTypeId(const int theTypeId) { - ((int*)myData(1))[0] = theTypeId; + (static_cast(myData(1)))[0] = theTypeId; myStreamStart.Nullify(); } @@ -38,7 +38,7 @@ inline void BinObjMgt_Persistent::SetTypeId(const int theTypeId) inline int BinObjMgt_Persistent::Id() const { - return ((int*)myData(1))[1]; + return (static_cast(myData(1)))[1]; } //======================================================================= @@ -48,7 +48,7 @@ inline int BinObjMgt_Persistent::Id() const inline int BinObjMgt_Persistent::TypeId() const { - return ((int*)myData(1))[0]; + return (static_cast(myData(1)))[0]; } //================================================================================================= @@ -91,9 +91,9 @@ inline int BinObjMgt_Persistent::Position() const inline bool BinObjMgt_Persistent::SetPosition(const int thePos) const { - ((BinObjMgt_Persistent*)this)->myIndex = thePos / BP_PIECESIZE + 1; - ((BinObjMgt_Persistent*)this)->myOffset = thePos % BP_PIECESIZE; - ((BinObjMgt_Persistent*)this)->myIsError = thePos > mySize || thePos < BP_HEADSIZE; + (const_cast(this))->myIndex = thePos / BP_PIECESIZE + 1; + (const_cast(this))->myOffset = thePos % BP_PIECESIZE; + (const_cast(this))->myIsError = thePos > mySize || thePos < BP_HEADSIZE; return !myIsError; } @@ -143,15 +143,15 @@ inline void BinObjMgt_Persistent::alignOffset(const int theSize, const bool toCl if (anOffset > myOffset) { if (toClear && anOffset <= BP_PIECESIZE) - memset(((char*)myData(myIndex)) + myOffset, 0, anOffset - myOffset); - ((BinObjMgt_Persistent*)this)->myOffset = anOffset; + memset((static_cast(myData(myIndex))) + myOffset, 0, anOffset - myOffset); + (const_cast(this))->myOffset = anOffset; } // ensure there is a room for at least one item in the current piece if (myOffset >= BP_PIECESIZE) { - ((BinObjMgt_Persistent*)this)->myIndex++; - ((BinObjMgt_Persistent*)this)->myOffset = 0; + (const_cast(this))->myIndex++; + (const_cast(this))->myOffset = 0; } } @@ -183,7 +183,7 @@ inline int BinObjMgt_Persistent::prepareForPut(const int theSize) inline bool BinObjMgt_Persistent::noMoreData(const int theSize) const { - ((BinObjMgt_Persistent*)this)->myIsError = Position() + theSize > mySize; + (const_cast(this))->myIsError = Position() + theSize > mySize; return myIsError; } @@ -191,7 +191,7 @@ inline bool BinObjMgt_Persistent::noMoreData(const int theSize) const inline BinObjMgt_Persistent& BinObjMgt_Persistent::PutBoolean(const bool theValue) { - return PutInteger((int)theValue); + return PutInteger(static_cast(theValue)); } //================================================================================================= diff --git a/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Position.cxx b/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Position.cxx index bfa84a93b08..60475fcd346 100644 --- a/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Position.cxx +++ b/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Position.cxx @@ -27,7 +27,7 @@ BinObjMgt_Position::BinObjMgt_Position(Standard_OStream& theStream) void BinObjMgt_Position::StoreSize(Standard_OStream& theStream) { - mySize = uint64_t(theStream.tellp() - myPosition); + mySize = static_cast(theStream.tellp() - myPosition); } //================================================================================================= diff --git a/src/ApplicationFramework/TKBinTObj/BinTObjDrivers/BinTObjDrivers_IntSparseArrayDriver.cxx b/src/ApplicationFramework/TKBinTObj/BinTObjDrivers/BinTObjDrivers_IntSparseArrayDriver.cxx index 53bc5309a53..89bf4ca3fba 100644 --- a/src/ApplicationFramework/TKBinTObj/BinTObjDrivers/BinTObjDrivers_IntSparseArrayDriver.cxx +++ b/src/ApplicationFramework/TKBinTObj/BinTObjDrivers/BinTObjDrivers_IntSparseArrayDriver.cxx @@ -88,8 +88,8 @@ void BinTObjDrivers_IntSparseArrayDriver::Paste( continue; // store ID and value - theTarget << (int)anIt.Index() << aValue; + theTarget << static_cast(anIt.Index()) << aValue; } // zero indicates end of the entities - theTarget << (int)0; + theTarget << 0; } diff --git a/src/ApplicationFramework/TKBinTObj/BinTObjDrivers/BinTObjDrivers_ObjectDriver.cxx b/src/ApplicationFramework/TKBinTObj/BinTObjDrivers/BinTObjDrivers_ObjectDriver.cxx index d92bc928f54..608dd3d8260 100644 --- a/src/ApplicationFramework/TKBinTObj/BinTObjDrivers/BinTObjDrivers_ObjectDriver.cxx +++ b/src/ApplicationFramework/TKBinTObj/BinTObjDrivers/BinTObjDrivers_ObjectDriver.cxx @@ -54,7 +54,7 @@ bool BinTObjDrivers_ObjectDriver::Paste(const BinObjMgt_Persistent& theSou if (!(theSource >> anID)) return false; occ::handle anObject; - if ((unsigned)anID > 0xffff) + if (static_cast(anID) > 0xffff) { // if we are here it means that the type was stored as an ascii string, // so rewind theSource and reget diff --git a/src/ApplicationFramework/TKCAF/TDataXtd/TDataXtd_Presentation.cxx b/src/ApplicationFramework/TKCAF/TDataXtd/TDataXtd_Presentation.cxx index 6e5e8b499f0..e38d3f39428 100644 --- a/src/ApplicationFramework/TKCAF/TDataXtd/TDataXtd_Presentation.cxx +++ b/src/ApplicationFramework/TKCAF/TDataXtd/TDataXtd_Presentation.cxx @@ -152,7 +152,7 @@ Quantity_NameOfColor TDataXtd_Presentation::getColorNameFromOldEnum(int theOld) { return Quantity_NOC_WHITE; } - return (Quantity_NameOfColor)aNew; + return static_cast(aNew); } //================================================================================================= diff --git a/src/ApplicationFramework/TKCAF/TNaming/TNaming.cxx b/src/ApplicationFramework/TKCAF/TNaming/TNaming.cxx index c433796c8e7..1bb1aab541d 100644 --- a/src/ApplicationFramework/TKCAF/TNaming/TNaming.cxx +++ b/src/ApplicationFramework/TKCAF/TNaming/TNaming.cxx @@ -731,9 +731,9 @@ static void BuildMapIn(const TopoDS_Shape& Context, TopAbs_ShapeEnum aType; if ((Context.ShapeType() == TopAbs_SOLID || Context.ShapeType() == TopAbs_FACE) && (StopType - Context.ShapeType()) != 1) - aType = (TopAbs_ShapeEnum)(Context.ShapeType() + 2); + aType = static_cast(Context.ShapeType() + 2); else - aType = (TopAbs_ShapeEnum)(Context.ShapeType() + 1); + aType = static_cast(Context.ShapeType() + 1); for (TopExp_Explorer exp(Context, aType); exp.More(); exp.Next()) { #ifdef OCCT_DEBUG diff --git a/src/ApplicationFramework/TKCAF/TNaming/TNaming_Naming.cxx b/src/ApplicationFramework/TKCAF/TNaming/TNaming_Naming.cxx index 9a7f1826cb1..7465144c081 100644 --- a/src/ApplicationFramework/TKCAF/TNaming/TNaming_Naming.cxx +++ b/src/ApplicationFramework/TKCAF/TNaming/TNaming_Naming.cxx @@ -507,7 +507,7 @@ static bool TestSolution(const TNaming_Scope& MDF, NCollection_Map::Iterator aMapIter(aView); for (; aMapIter.More(); aMapIter.Next()) { - TopAbs_ShapeEnum aCurType = (TopAbs_ShapeEnum)aMapIter.Key(); + TopAbs_ShapeEnum aCurType = static_cast(aMapIter.Key()); for (TopExp_Explorer exp(Res, aCurType); exp.More(); exp.Next()) { if (MS.Contains(exp.Current())) diff --git a/src/ApplicationFramework/TKCAF/TNaming/TNaming_Tool.cxx b/src/ApplicationFramework/TKCAF/TNaming/TNaming_Tool.cxx index 2e548c8f34c..251a848a976 100644 --- a/src/ApplicationFramework/TKCAF/TNaming/TNaming_Tool.cxx +++ b/src/ApplicationFramework/TKCAF/TNaming/TNaming_Tool.cxx @@ -606,7 +606,7 @@ void TNaming_Tool::FindShape(const NCollection_Map& Valid, // Looking for sub shapes of the result shape NCollection_Map subShapes; - TopExp_Explorer anExpl(Arg->Get(), (TopAbs_ShapeEnum)((int)(aNaming->GetName().ShapeType()) + 1)); + TopExp_Explorer anExpl(Arg->Get(), static_cast(static_cast(aNaming->GetName().ShapeType()) + 1)); for (; anExpl.More(); anExpl.Next()) subShapes.Add(anExpl.Current()); #ifdef OCCT_DEBUG @@ -677,7 +677,7 @@ void TNaming_Tool::FindShape(const NCollection_Map& Valid, const TopoDS_Shape& possibleResult = explC.Current(); NCollection_Map subShapesOfResult; for (explSubC.Init(possibleResult, - (TopAbs_ShapeEnum)((int)(aNaming->GetName().ShapeType()) + 1)); + static_cast(static_cast(aNaming->GetName().ShapeType()) + 1)); explSubC.More(); explSubC.Next()) { diff --git a/src/ApplicationFramework/TKCDF/CDF/CDF_Application.cxx b/src/ApplicationFramework/TKCDF/CDF/CDF_Application.cxx index b733adbf7c4..1e3b2ad649b 100644 --- a/src/ApplicationFramework/TKCDF/CDF/CDF_Application.cxx +++ b/src/ApplicationFramework/TKCDF/CDF/CDF_Application.cxx @@ -250,14 +250,14 @@ occ::handle CDF_Application::Retrieve(const occ::handlePath() << "; not found." - << (char)0 << std::endl; + << static_cast(0) << std::endl; break; case PCDM_RS_PermissionDenied: aMsg << "Could not find the referenced document: " << aMetaData->Path() - << "; permission denied. " << (char)0 << std::endl; + << "; permission denied. " << static_cast(0) << std::endl; break; case PCDM_RS_NoDocument: - aMsg << "Document for appending is not defined." << (char)0 << std::endl; + aMsg << "Document for appending is not defined." << static_cast(0) << std::endl; break; default: myRetrievableStatus = PCDM_RS_OK; @@ -278,7 +278,7 @@ occ::handle CDF_Application::Retrieve(const occ::handleFileName(), aFormat)) { Standard_SStream aMsg; - aMsg << "Could not determine format for the file " << aMetaData->FileName() << (char)0; + aMsg << "Could not determine format for the file " << aMetaData->FileName() << static_cast(0); throw Standard_NoSuchObject(aMsg.str().c_str()); } occ::handle theReader = ReaderFromFormat(aFormat); @@ -453,7 +453,7 @@ occ::handle CDF_Application::ReaderFromFormat( if (!UTL::Find(Resources(), aResourceName)) { Standard_SStream aMsg; - aMsg << "Could not found the item:" << aResourceName << (char)0; + aMsg << "Could not found the item:" << aResourceName << static_cast(0); myRetrievableStatus = PCDM_RS_WrongResource; throw Standard_NoSuchObject(aMsg.str().c_str()); } @@ -509,7 +509,7 @@ occ::handle CDF_Application::WriterFromFormat( { myWriters.Add(theFormat, aDriver); Standard_SStream aMsg; - aMsg << "Could not found the resource definition:" << aResourceName << (char)0; + aMsg << "Could not found the resource definition:" << aResourceName << static_cast(0); throw Standard_NoSuchObject(aMsg.str().c_str()); } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.cxx index 4cee3747a97..baf09111353 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.cxx @@ -55,7 +55,7 @@ LDOMBasicString::LDOMBasicString(const char* aValue, const occ::handle(strlen(aValue)) + 1; myVal.ptr = aDoc->Allocate(aLen); memcpy(myVal.ptr, aValue, aLen); } @@ -80,7 +80,7 @@ LDOMBasicString::LDOMBasicString(const char* aValue, myType = LDOM_AsciiDoc; myVal.ptr = aDoc->Allocate(aLen + 1); memcpy(myVal.ptr, aValue, aLen); - ((char*)myVal.ptr)[aLen] = '\0'; + (static_cast(myVal.ptr))[aLen] = '\0'; } } @@ -94,7 +94,7 @@ LDOMBasicString::LDOMBasicString(const LDOMBasicString& anOther) case LDOM_AsciiFree: if (anOther.myVal.ptr) { - size_t aLen = strlen((const char*)anOther.myVal.ptr) + 1; + size_t aLen = strlen(static_cast(anOther.myVal.ptr)) + 1; myVal.ptr = new char[aLen]; memcpy(myVal.ptr, anOther.myVal.ptr, aLen); break; @@ -118,7 +118,7 @@ LDOMBasicString::~LDOMBasicString() { if (myType == LDOM_AsciiFree) { - delete[] (char*)myVal.ptr; + delete[] static_cast(myVal.ptr); } } @@ -127,7 +127,7 @@ LDOMBasicString::~LDOMBasicString() LDOMBasicString& LDOMBasicString::operator=(const LDOM_NullPtr*) { if (myType == LDOM_AsciiFree) - delete[] (char*)myVal.ptr; + delete[] static_cast(myVal.ptr); myType = LDOM_NULL; myVal.ptr = nullptr; return *this; @@ -142,14 +142,14 @@ LDOMBasicString& LDOMBasicString::operator=(const LDOMBasicString& anOther) return *this; } if (myType == LDOM_AsciiFree) - delete[] (char*)myVal.ptr; + delete[] static_cast(myVal.ptr); myType = anOther.Type(); switch (myType) { case LDOM_AsciiFree: if (anOther.myVal.ptr) { - size_t aLen = strlen((const char*)anOther.myVal.ptr) + 1; + size_t aLen = strlen(static_cast(anOther.myVal.ptr)) + 1; myVal.ptr = new char[aLen]; memcpy(myVal.ptr, anOther.myVal.ptr, aLen); break; @@ -191,8 +191,8 @@ bool LDOMBasicString::equals(const LDOMBasicString& anOther) const case LDOM_AsciiDocClear: case LDOM_AsciiHashed: { errno = 0; - long aLongOther = strtol((const char*)anOther.myVal.ptr, nullptr, 10); - return (errno == 0 && aLongOther == long(myVal.i)); + long aLongOther = strtol(static_cast(anOther.myVal.ptr), nullptr, 10); + return (errno == 0 && aLongOther == static_cast(myVal.i)); } case LDOM_NULL: default:; @@ -203,14 +203,14 @@ bool LDOMBasicString::equals(const LDOMBasicString& anOther) const { case LDOM_Integer: { errno = 0; - long aLong = strtol((const char*)myVal.ptr, nullptr, 10); - return (errno == 0 && aLong == long(anOther.myVal.i)); + long aLong = strtol(static_cast(myVal.ptr), nullptr, 10); + return (errno == 0 && aLong == static_cast(anOther.myVal.i)); } case LDOM_AsciiFree: case LDOM_AsciiDoc: case LDOM_AsciiDocClear: case LDOM_AsciiHashed: - return (strcmp((const char*)myVal.ptr, (const char*)anOther.myVal.ptr) == 0); + return (strcmp(static_cast(myVal.ptr), static_cast(anOther.myVal.ptr)) == 0); case LDOM_NULL: default:; } @@ -274,7 +274,7 @@ LDOMBasicString::operator TCollection_ExtendedString() const buf[2] = ptr[2]; buf[3] = ptr[3]; errno = 0; - aResult[j++] = char16_t(strtol(&buf[0], nullptr, 16)); + aResult[j++] = static_cast(strtol(&buf[0], nullptr, 16)); if (errno) { delete[] aResult; @@ -306,10 +306,10 @@ bool LDOMBasicString::GetInteger(int& aResult) const case LDOM_AsciiHashed: { char* ptr; errno = 0; - long aValue = strtol((const char*)myVal.ptr, &ptr, 10); + long aValue = strtol(static_cast(myVal.ptr), &ptr, 10); if (ptr == myVal.ptr || errno == ERANGE || errno == EINVAL) return false; - aResult = int(aValue); + aResult = static_cast(aValue); break; } default: diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.hxx b/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.hxx index 0fff8da1f44..d1e0ee8dd35 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.hxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.hxx @@ -55,7 +55,7 @@ public: const char* GetString() const { - return myType == LDOM_Integer || myType == LDOM_NULL ? "" : (const char*)myVal.ptr; + return myType == LDOM_Integer || myType == LDOM_NULL ? "" : static_cast(myVal.ptr); } // Conversion to char * (only for LDOM_Ascii*) diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOMParser.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOMParser.cxx index 199f51c7d0b..3fb6842a891 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOMParser.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOMParser.cxx @@ -117,7 +117,7 @@ inline const TCollection_AsciiString& LDOMParser::GetError(TCollection_AsciiString& aData) const { - char* aStr = (char*)myCurrentData.str(); + char* aStr = const_cast(myCurrentData.str()); aData = aStr; delete[] aStr; return myError; @@ -333,7 +333,7 @@ bool LDOMParser::ParseElement(Standard_IStream& theIStream, bool& theDocStart) break; case LDOM_XmlReader::XML_END_ELEMENT: { const char* aParentName = static_cast(aParent->GetTagName()); - aTextStr = (char*)myCurrentData.str(); + aTextStr = const_cast(myCurrentData.str()); if (strcmp(aTextStr, aParentName) != 0) { myError = "Expected end tag \'"; @@ -353,7 +353,7 @@ bool LDOMParser::ParseElement(Standard_IStream& theIStream, bool& theDocStart) aLocType = LDOM_Node::TEXT_NODE; { int aTextLen; - aTextStr = LDOM_CharReference::Decode((char*)myCurrentData.str(), aTextLen); + aTextStr = LDOM_CharReference::Decode(const_cast(myCurrentData.str()), aTextLen); // try to convert to integer if (IsDigit(aTextStr[0])) { @@ -368,13 +368,13 @@ bool LDOMParser::ParseElement(Standard_IStream& theIStream, bool& theDocStart) aLocType = LDOM_Node::COMMENT_NODE; { int aTextLen; - aTextStr = LDOM_CharReference::Decode((char*)myCurrentData.str(), aTextLen); + aTextStr = LDOM_CharReference::Decode(const_cast(myCurrentData.str()), aTextLen); aTextValue = LDOMBasicString(aTextStr, aTextLen, myDocument); } goto create_text_node; case LDOM_XmlReader::XML_CDATA: aLocType = LDOM_Node::CDATA_SECTION_NODE; - aTextStr = (char*)myCurrentData.str(); + aTextStr = const_cast(myCurrentData.str()); aTextValue = LDOMBasicString(aTextStr, myCurrentData.Length(), myDocument); create_text_node: { LDOM_BasicNode& aTextNode = LDOM_BasicText::Create(aLocType, aTextValue, myDocument); diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOMString.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOMString.cxx index 1a77ad66acd..8890663c5b0 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOMString.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOMString.cxx @@ -49,8 +49,8 @@ LDOMString::LDOMString(const LDOMBasicString& anOther, const occ::handleAllocate(aLen); + int aLen = static_cast(strlen(aString) + 1); + myVal.ptr = (const_cast(myPtrDoc))->Allocate(aLen); memcpy(myVal.ptr, aString, aLen); } break; diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicAttribute.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicAttribute.cxx index 50b3871ba75..d73a1f10dd3 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicAttribute.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicAttribute.cxx @@ -39,7 +39,7 @@ LDOM_BasicAttribute& LDOM_BasicAttribute::Create(const LDOMBasicString& LDOM_BasicAttribute* aNewAtt = new (aMem) LDOM_BasicAttribute; const char* aString = theName.GetString(); - aNewAtt->myName = theDoc->HashedAllocate(aString, (int)strlen(aString), theHash); + aNewAtt->myName = theDoc->HashedAllocate(aString, static_cast(strlen(aString)), theHash); aNewAtt->myNodeType = LDOM_Node::ATTRIBUTE_NODE; return *aNewAtt; diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicElement.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicElement.cxx index 013df94086f..d97acef8af5 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicElement.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicElement.cxx @@ -172,26 +172,26 @@ const LDOM_BasicAttribute* LDOM_BasicElement::GetFirstAttribute( if (theLastCh) { aFirstAttr = theLastCh->mySibling; - aPrevNode = (const LDOM_BasicNode**)&(theLastCh->mySibling); + aPrevNode = const_cast(&(theLastCh->mySibling)); while (aFirstAttr) { if (aFirstAttr->getNodeType() == LDOM_Node::ATTRIBUTE_NODE) break; - aPrevNode = (const LDOM_BasicNode**)&(aFirstAttr->mySibling); + aPrevNode = const_cast(&(aFirstAttr->mySibling)); aFirstAttr = aFirstAttr->mySibling; } } else { aFirstAttr = myFirstChild; - aPrevNode = (const LDOM_BasicNode**)&myFirstChild; + aPrevNode = const_cast(&myFirstChild); while (aFirstAttr) { if (aFirstAttr->getNodeType() == LDOM_Node::ATTRIBUTE_NODE) break; if (!aFirstAttr->isNull()) theLastCh = aFirstAttr; - aPrevNode = (const LDOM_BasicNode**)&(aFirstAttr->mySibling); + aPrevNode = const_cast(&(aFirstAttr->mySibling)); aFirstAttr = aFirstAttr->mySibling; } } @@ -232,7 +232,7 @@ const LDOM_BasicNode* LDOM_BasicElement::AddAttribute(const LDOMBasicString& anA else { // this attribute may have already been installed - LDOM_BasicAttribute* aCurrentAttr = (LDOM_BasicAttribute*)aFirstAttr; + LDOM_BasicAttribute* aCurrentAttr = const_cast(aFirstAttr); while (aCurrentAttr) { if (aCurrentAttr->getNodeType() == LDOM_Node::ATTRIBUTE_NODE) @@ -263,7 +263,7 @@ const LDOM_BasicNode* LDOM_BasicElement::RemoveAttribute(const LDOMBasicString& { // Check attribute hash value against the current mask const char* const aNameStr = aName.GetString(); - const int aHash = LDOM_MemManager::Hash(aNameStr, (int)strlen(aNameStr)); + const int aHash = LDOM_MemManager::Hash(aNameStr, static_cast(strlen(aNameStr))); const unsigned int anAttrMaskValue = aHash & (8 * sizeof(myAttributeMask) - 1); const unsigned long anAttributeMask = (1 << anAttrMaskValue); #ifdef OCCT_DEBUG_MASK @@ -296,7 +296,7 @@ const LDOM_BasicNode* LDOM_BasicElement::RemoveAttribute(const LDOMBasicString& void LDOM_BasicElement::RemoveChild(const LDOM_BasicNode* aChild) const { const LDOM_BasicNode* aNode = myFirstChild; - const LDOM_BasicNode** aPrevNode = (const LDOM_BasicNode**)&myFirstChild; + const LDOM_BasicNode** aPrevNode = const_cast(&myFirstChild); while (aNode) { if (aNode->getNodeType() == LDOM_Node::ATTRIBUTE_NODE) @@ -304,10 +304,10 @@ void LDOM_BasicElement::RemoveChild(const LDOM_BasicNode* aChild) const if (aNode == aChild) { *aPrevNode = aNode->GetSibling(); - *(LDOM_BasicNode*)aChild = nullptr; + *const_cast(aChild) = nullptr; break; } - aPrevNode = (const LDOM_BasicNode**)&(aNode->mySibling); + aPrevNode = const_cast(&(aNode->mySibling)); aNode = aNode->GetSibling(); } // here may be the cause to throw an exception @@ -320,21 +320,21 @@ void LDOM_BasicElement::AppendChild(const LDOM_BasicNode* aChild, { if (aLastChild) { - (const LDOM_BasicNode*&)aChild->mySibling = aLastChild->mySibling; - (const LDOM_BasicNode*&)aLastChild->mySibling = aChild; + const_cast(aChild->mySibling) = aLastChild->mySibling; + const_cast(aLastChild->mySibling) = aChild; } else { const LDOM_BasicNode* aNode = myFirstChild; - const LDOM_BasicNode** aPrevNode = (const LDOM_BasicNode**)&myFirstChild; + const LDOM_BasicNode** aPrevNode = const_cast(&myFirstChild); while (aNode) { if (aNode->getNodeType() == LDOM_Node::ATTRIBUTE_NODE) { - (const LDOM_BasicNode*&)aChild->mySibling = aNode; + const_cast(aChild->mySibling) = aNode; break; } - aPrevNode = (const LDOM_BasicNode**)&(aNode->mySibling); + aPrevNode = const_cast(&(aNode->mySibling)); aNode = aNode->mySibling; } *aPrevNode = aChild; @@ -413,7 +413,7 @@ void LDOM_BasicElement::ReplaceElement(const LDOM_BasicElement& anOth const LDOM_BasicElement& aBNodeElem = *(const LDOM_BasicElement*)aBNode; const char* aTagString = aBNodeElem.GetTagName(); LDOM_BasicElement& aNewBNodeElem = - LDOM_BasicElement::Create(aTagString, (int)strlen(aTagString), aDocument); + LDOM_BasicElement::Create(aTagString, static_cast(strlen(aTagString)), aDocument); aNewBNodeElem.ReplaceElement(aBNodeElem, aDocument); // reccur aNewBNode = &aNewBNodeElem; break; @@ -433,15 +433,15 @@ void LDOM_BasicElement::ReplaceElement(const LDOM_BasicElement& anOth continue; } if (GetFirstChild()) - (const LDOM_BasicNode*&)aLastChild->mySibling = aNewBNode; + const_cast(aLastChild->mySibling) = aNewBNode; else (const LDOM_BasicNode*&)myFirstChild = aNewBNode; - (const LDOM_BasicNode*&)aLastChild = aNewBNode; + const_cast(aLastChild) = aNewBNode; } // Loop on attributes (in the end of the list of children) loop_attr: - LDOM_BasicNode* aLastAttr = (LDOM_BasicNode*)aLastChild; + LDOM_BasicNode* aLastAttr = const_cast(aLastChild); for (; aBNode != nullptr; aBNode = aBNode->GetSibling()) { int aHash; diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicNode.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicNode.cxx index 2a76b6431cc..2c915800ff9 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicNode.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicNode.cxx @@ -34,7 +34,7 @@ const LDOM_BasicNode* LDOM_BasicNode::GetSibling() const { while (mySibling) if (mySibling->isNull()) - (const LDOM_BasicNode*&)mySibling = mySibling->mySibling; + const_cast(mySibling) = mySibling->mySibling; else break; return mySibling; diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharReference.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharReference.cxx index 3cea1ed8ee9..284c2810880 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharReference.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharReference.cxx @@ -68,16 +68,16 @@ char* LDOM_CharReference::Decode(char* theSrc, int& theLen) // End of the loop aPtr = strchr(aSrcPtr, '\0'); if (anIncrCount == 0) - theLen = (int)(aPtr - theSrc); + theLen = static_cast(aPtr - theSrc); else { - int aByteCount = (int)(aPtr - aSrcPtr); + int aByteCount = static_cast(aPtr - aSrcPtr); memmove(aDstPtr, aSrcPtr, aByteCount + 1); - theLen = (int)(aDstPtr - theSrc) + aByteCount; + theLen = static_cast(aDstPtr - theSrc) + aByteCount; } break; } - int aByteCount = (int)(aPtr - aSrcPtr); + int aByteCount = static_cast(aPtr - aSrcPtr); if (aByteCount > 0 && aDstPtr != aSrcPtr) memmove(aDstPtr, aSrcPtr, aByteCount); aSrcPtr = aPtr; @@ -93,8 +93,8 @@ char* LDOM_CharReference::Decode(char* theSrc, int& theLen) if (aNewPtr[0] != ';' || aChar == 0 || aChar > 255UL) // Error reading an XML string return nullptr; - aDstPtr[-1] = (char)aChar; - anIncrCount += (int)(aNewPtr - aSrcPtr); + aDstPtr[-1] = static_cast(aChar); + anIncrCount += static_cast(aNewPtr - aSrcPtr); aSrcPtr = &aNewPtr[1]; } else if (IS_EQUAL(aSrcPtr + 1, "amp;")) @@ -162,12 +162,12 @@ char* LDOM_CharReference::Encode(const char* theSrc, int& theLen, const bool isA entityRef("'", 6)}; const char *endSrc, *ptrSrc = theSrc; - char* aDest = (char*)theSrc; + char* aDest = const_cast(theSrc); int aCount = 0; // Analyse if there is a non-standard character in the string for (;;) { - const unsigned int iSrc = (unsigned int)*(const unsigned char*)ptrSrc; + const unsigned int iSrc = static_cast(*reinterpret_cast(ptrSrc)); if (iSrc == 0) { endSrc = ptrSrc; @@ -180,14 +180,14 @@ char* LDOM_CharReference::Encode(const char* theSrc, int& theLen, const bool isA } // If there are such, copy the string with replacements if (!aCount) - theLen = (int)(endSrc - theSrc); + theLen = static_cast(endSrc - theSrc); else { char* ptrDest = new char[(endSrc - theSrc) + aCount * 5 + 1]; aDest = ptrDest; for (ptrSrc = theSrc; ptrSrc < endSrc; ptrSrc++) { - const unsigned int iSrc = (unsigned int)*(const unsigned char*)ptrSrc; + const unsigned int iSrc = static_cast(*reinterpret_cast(ptrSrc)); const int aCode = myTab[iSrc]; if (aCode == NORMAL_C) // normal (regular) character *ptrDest++ = *ptrSrc; @@ -205,7 +205,7 @@ char* LDOM_CharReference::Encode(const char* theSrc, int& theLen, const bool isA ptrDest += entity_ref[aCode].length; } } - theLen = (int)(ptrDest - aDest); + theLen = static_cast(ptrDest - aDest); *ptrDest = '\0'; } return aDest; diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharacterData.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharacterData.cxx index f433b0964ce..3bfeeb3b0fb 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharacterData.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharacterData.cxx @@ -52,6 +52,6 @@ void LDOM_CharacterData::setData(const LDOMString& theValue) int LDOM_CharacterData::getLength() const { if (myLength < 0) - (int&)myLength = (int)strlen(getNodeValue().GetString()); + const_cast(myLength) = static_cast(strlen(getNodeValue().GetString())); return myLength; } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Document.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Document.cxx index 830ca38d940..37033f5f819 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Document.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Document.cxx @@ -63,7 +63,7 @@ LDOM_Element LDOM_Document::getDocumentElement() const LDOM_NodeList LDOM_Document::getElementsByTagName(const LDOMString& theTagName) const { LDOM_NodeList aList(myMemManager); - LDOM_BasicElement* anElem = (LDOM_BasicElement*)myMemManager->RootElement(); + LDOM_BasicElement* anElem = const_cast(myMemManager->RootElement()); const char* aTagString = theTagName.GetString(); if (anElem) { @@ -84,7 +84,7 @@ LDOM_Document LDOM_Document::createDocument(const LDOMString& theQualifiedName) if (strlen(aString) == 0) aString = "document"; aDoc.myMemManager->myRootElement = - &LDOM_BasicElement::Create(aString, (int)strlen(aString), aDoc.myMemManager); + &LDOM_BasicElement::Create(aString, static_cast(strlen(aString)), aDoc.myMemManager); return aDoc; } @@ -94,7 +94,7 @@ LDOM_Element LDOM_Document::createElement(const LDOMString& theTagName) { const char* aTagString = theTagName.GetString(); LDOM_BasicElement& aBasicElem = - LDOM_BasicElement::Create(aTagString, (int)strlen(aTagString), myMemManager); + LDOM_BasicElement::Create(aTagString, static_cast(strlen(aTagString)), myMemManager); return LDOM_Element(aBasicElem, myMemManager); } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Element.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Element.cxx index 63543d86c1c..90d72c8ac10 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Element.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Element.cxx @@ -47,7 +47,7 @@ LDOMString LDOM_Element::getAttribute(const LDOMString& aName) const return LDOMString(); if (aSibling->getNodeType() == LDOM_Node::ATTRIBUTE_NODE) { - (const LDOM_BasicNode*&)myLastChild = aNode; + const_cast(myLastChild) = aNode; break; } aNode = aSibling; @@ -77,7 +77,7 @@ LDOM_Attr LDOM_Element::getAttributeNode(const LDOMString& aName) const return LDOM_Attr(); if (aSibling->getNodeType() == LDOM_Node::ATTRIBUTE_NODE) { - (const LDOM_BasicNode*&)myLastChild = aSibling; + const_cast(myLastChild) = aSibling; break; } aNode = aSibling; @@ -209,12 +209,12 @@ void LDOM_Element::ReplaceElement(const LDOM_Element& anOther) anElem.myTagName = anOtherElem.myTagName; anElem.myAttributeMask = anOtherElem.myAttributeMask; anElem.myFirstChild = anOtherElem.myFirstChild; - (const LDOM_BasicNode*&)myLastChild = anOther.myLastChild; + const_cast(myLastChild) = anOther.myLastChild; } else { anElem.ReplaceElement(anOtherElem, myDocument); - (const LDOM_BasicNode*&)myLastChild = nullptr; + const_cast(myLastChild) = nullptr; } } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_MemManager.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_MemManager.cxx index 551f84996f1..daa7446adb2 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_MemManager.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_MemManager.cxx @@ -68,7 +68,7 @@ void* LDOM_MemManager::MemBlock::AllocateAndCheck( const LDOM_MemManager::MemBlock*& aFirstWithoutRoom) { void* aResult = nullptr; - int aRoom = (int)(myEndBlock - myFreeSpace); + int aRoom = static_cast(myEndBlock - myFreeSpace); if (aSize <= aRoom) { aResult = myFreeSpace; @@ -115,7 +115,7 @@ LDOM_MemManager::HashTable::HashTable(/* const int aMask, */ } myMask = nKeys - 1; */ - myTable = (TableItem*)myManager.Allocate(sizeof(TableItem) * nKeys); + myTable = static_cast(myManager.Allocate(sizeof(TableItem) * nKeys)); for (m = 0; m < nKeys; m += 2) { myTable[m].str = nullptr; @@ -168,13 +168,13 @@ int LDOM_MemManager::HashTable::Hash(const char* aString, const int aLen) }; unsigned int aCRC = 0; - const unsigned char* aPtr = (const unsigned char*)aString; + const unsigned char* aPtr = reinterpret_cast(aString); for (int i = aLen; i > 0; i--) { - const unsigned int bTmp = aCRC ^ (unsigned int)(*aPtr++); + const unsigned int bTmp = aCRC ^ static_cast(*aPtr++); aCRC = ((aCRC >> 8) ^ wCRC16a[bTmp & 0x0F]) ^ wCRC16b[(bTmp >> 4) & 0x0F]; } - return int(aCRC & HASH_MASK /* myMask */); + return static_cast(aCRC & HASH_MASK /* myMask */); } //======================================================================= @@ -194,9 +194,9 @@ const char* LDOM_MemManager::HashTable::AddString(const char* theString, if (aNode->str == nullptr) { LDOM_HashValue* anAlloc = - (LDOM_HashValue*)myManager.Allocate(theLen + 1 + sizeof(LDOM_HashValue)); - anAlloc[0] = LDOM_HashValue(aHashIndex); - aNode->str = (char*)&anAlloc[1]; + static_cast(myManager.Allocate(theLen + 1 + sizeof(LDOM_HashValue))); + anAlloc[0] = static_cast(aHashIndex); + aNode->str = reinterpret_cast(&anAlloc[1]); memcpy(aNode->str, theString, theLen); aNode->str[theLen] = '\0'; aResult = aNode->str; @@ -219,12 +219,12 @@ const char* LDOM_MemManager::HashTable::AddString(const char* theString, { // Attention!!! We can make this allocation in a separate pool // improving performance - aNode->next = (TableItem*)myManager.Allocate(sizeof(TableItem)); + aNode->next = static_cast(myManager.Allocate(sizeof(TableItem))); aNode = aNode->next; LDOM_HashValue* anAlloc = - (LDOM_HashValue*)myManager.Allocate(theLen + 1 + sizeof(LDOM_HashValue)); - anAlloc[0] = LDOM_HashValue(aHashIndex); - aNode->str = (char*)&anAlloc[1]; + static_cast(myManager.Allocate(theLen + 1 + sizeof(LDOM_HashValue))); + anAlloc[0] = static_cast(aHashIndex); + aNode->str = reinterpret_cast(&anAlloc[1]); memcpy(aNode->str, theString, theLen); aNode->str[theLen] = '\0'; aResult = aNode->str; @@ -332,7 +332,7 @@ bool LDOM_MemManager::CompareStrings(const char* theString, const int theHashValue, const char* theHashedStr) { - if (((LDOM_HashValue*)theHashedStr)[-1] == LDOM_HashValue(theHashValue)) + if (((LDOM_HashValue*)theHashedStr)[-1] == static_cast(theHashValue)) if (!strcmp(theString, theHashedStr)) return true; return false; diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.cxx index bd782d7818f..65142c56174 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.cxx @@ -151,7 +151,7 @@ LDOM_Node LDOM_Node::getLastChild() const if (myLastChild == nullptr) { const LDOM_BasicElement& anElement = *(const LDOM_BasicElement*)myOrigin; - (const LDOM_BasicNode*&)myLastChild = anElement.GetLastChild(); + const_cast(myLastChild) = anElement.GetLastChild(); } return LDOM_Node(*myLastChild, myDocument); } @@ -195,7 +195,7 @@ void LDOM_Node::appendChild(const LDOM_Node& aChild) if (myLastChild) { aChild.myOrigin->SetSibling(myLastChild->mySibling); - (const LDOM_BasicNode*&)myLastChild->mySibling = aChild.myOrigin; + const_cast(myLastChild->mySibling) = aChild.myOrigin; } else { @@ -230,14 +230,14 @@ void LDOM_Node::SetValueClear() const { case ATTRIBUTE_NODE: { const LDOM_BasicAttribute& anAttr = *(const LDOM_BasicAttribute*)myOrigin; - aValue = (LDOMBasicString*)&anAttr.GetValue(); + aValue = const_cast(&anAttr.GetValue()); break; } case TEXT_NODE: case CDATA_SECTION_NODE: case COMMENT_NODE: { const LDOM_BasicText& aText = *(const LDOM_BasicText*)myOrigin; - aValue = (LDOMBasicString*)&aText.GetData(); + aValue = const_cast(&aText.GetData()); break; } default: diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.hxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.hxx index f30b97af354..2dbbfeceb69 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.hxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.hxx @@ -110,7 +110,7 @@ protected: LDOM_Node(const LDOM_BasicNode& anOrig, const occ::handle& aDoc) : myDocument(aDoc), - myOrigin((LDOM_BasicNode*)&anOrig), + myOrigin(const_cast(&anOrig)), myLastChild(nullptr) { } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_OSStream.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_OSStream.cxx index 1b1d6fbdd4c..243174298fa 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_OSStream.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_OSStream.cxx @@ -81,7 +81,7 @@ const char* LDOM_SBuffer::str() const //======================================================================= int LDOM_SBuffer::overflow(int c) { - char cc = (char)c; + char cc = static_cast(c); xsputn(&cc, 1); return c; } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlReader.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlReader.cxx index 77abfe5e398..d1e83ed5b70 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlReader.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlReader.cxx @@ -97,7 +97,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre // Check if the current file buffer is exhausted // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // There should always be some bytes available in the buffer for analysis - int aBytesRest = (int)(myEndPtr - myPtr); + int aBytesRest = static_cast(myEndPtr - myPtr); if (aBytesRest < XML_MIN_BUFFER) { if (myEOF) @@ -140,7 +140,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre { theIStream.read(&myBuffer[aBytesRest], XML_BUFFER_SIZE - aBytesRest); } - aNBytes = (size_t)theIStream.gcount(); + aNBytes = static_cast(theIStream.gcount()); if (aNBytes == 0) { @@ -312,7 +312,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre if (myPtr < myEndPtr) { myElement = - &LDOM_BasicElement::Create(aStartData, (int)(myPtr - aStartData), myDocument); + &LDOM_BasicElement::Create(aStartData, static_cast(myPtr - aStartData), myDocument); myLastChild = nullptr; aState = STATE_ATTRIBUTE_NAME; aStartData = nullptr; @@ -331,7 +331,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre [[fallthrough]]; default: // Limitation: we do not treat '&' as special character - aPtr = (const char*)memchr(myPtr, '<', myEndPtr - myPtr); + aPtr = static_cast(memchr(myPtr, '<', myEndPtr - myPtr)); if (aPtr) { // The end of text field reached @@ -349,7 +349,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre // Checking the characters in STATE_HEADER, seek for "?>" sequence // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ case STATE_HEADER: - aPtr = (const char*)memchr(aStartData, '?', (myEndPtr - 1) - aStartData); + aPtr = static_cast(memchr(aStartData, '?', (myEndPtr - 1) - aStartData)); if (aPtr) { // The end of XML declaration found @@ -393,7 +393,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre state_doctype_markup: case STATE_DOCTYPE_MARKUP: - aPtr = (const char*)memchr(aStartData, ']', (myEndPtr - 1) - aStartData); + aPtr = static_cast(memchr(aStartData, ']', (myEndPtr - 1) - aStartData)); if (aPtr) { // The end of DOCTYPE declaration found @@ -417,7 +417,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre aPtr = aStartData; for (;;) { - aPtr = (const char*)memchr(aPtr, '-', (myEndPtr - 2) - aPtr); + aPtr = static_cast(memchr(aPtr, '-', (myEndPtr - 2) - aPtr)); if (aPtr == nullptr) break; if (aPtr[1] != '-') @@ -441,7 +441,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre // Checking the characters in STATE_TEXT, seek for "<" // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ case STATE_TEXT: - aPtr = (const char*)memchr(aStartData, '<', myEndPtr - aStartData); + aPtr = static_cast(memchr(aStartData, '<', myEndPtr - aStartData)); if (aPtr) { // The end of text field reached @@ -459,7 +459,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre aPtr = aStartData; for (;;) { - aPtr = (const char*)memchr(aPtr, ']', (myEndPtr - 1) - aStartData); + aPtr = static_cast(memchr(aPtr, ']', (myEndPtr - 1) - aStartData)); if (aPtr == nullptr) break; if (aPtr[1] != ']') @@ -486,7 +486,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre } { theData.rdbuf()->sputn(aStartData, aNameEnd - aStartData); - char* aDataString = (char*)theData.str(); + char* aDataString = const_cast(theData.str()); myElement = &LDOM_BasicElement::Create(aDataString, theData.Length(), myDocument); theData.Clear(); myLastChild = nullptr; @@ -548,12 +548,12 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre else { if (theData.Length() == 0) - anAttrName = LDOMBasicString(myPtr, (int)(aNameEnd - myPtr), myDocument); + anAttrName = LDOMBasicString(myPtr, static_cast(aNameEnd - myPtr), myDocument); else { theData.rdbuf()->sputn(myPtr, aNameEnd - myPtr); attr_name: - char* aDataString = (char*)theData.str(); + char* aDataString = const_cast(theData.str()); theData.Clear(); anAttrName = LDOMBasicString(aDataString, myDocument); delete[] aDataString; @@ -608,19 +608,19 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre } // Limitation: we do not take into account that '<' and '&' // are not allowed in attribute values - aPtr = (const char*)memchr(aStartData, anAttDelimiter, myEndPtr - aStartData); + aPtr = static_cast(memchr(aStartData, anAttDelimiter, myEndPtr - aStartData)); if (aPtr) { - (char&)aPtr[0] = '\0'; + const_cast(aPtr[0]) = '\0'; anAttDelimiter = '\0'; - char* aDataString = (char*)aStartData; + char* aDataString = const_cast(aStartData); const char* ePtr = aPtr; // Append the end of the string to previously taken data if (theData.Length() > 0) { theData.rdbuf()->sputn(aStartData, aPtr - aStartData); - aDataString = (char*)theData.str(); + aDataString = const_cast(theData.str()); ePtr = strchr(aDataString, '\0'); } @@ -656,7 +656,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre // Checking the characters in STATE_ELEMENT_END, seek for ">" // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ case STATE_ELEMENT_END: - aPtr = (const char*)memchr(aStartData, '>', myEndPtr - aStartData); + aPtr = static_cast(memchr(aStartData, '>', myEndPtr - aStartData)); if (aPtr) { // The end of the end-element markup @@ -751,7 +751,7 @@ bool LDOM_XmlReader::getInteger(LDOMBasicString& theValue, const char* theStart, long aResult = strtol(theStart, &ptr, 10); if (ptr == theEnd && errno == 0) { - theValue = int(aResult); + theValue = static_cast(aResult); return false; } } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlWriter.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlWriter.cxx index e618a1b14d2..e88fa9dd13a 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlWriter.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlWriter.cxx @@ -315,7 +315,7 @@ void LDOM_XmlWriter::Write(Standard_OStream& theOStream, const LDOM_Node& theNod } default: #ifndef _MSC_VER - std::cerr << "Unrecognized node type = " << (long)theNode.getNodeType() << std::endl + std::cerr << "Unrecognized node type = " << static_cast(theNode.getNodeType()) << std::endl #endif ; } @@ -408,7 +408,7 @@ void LDOM_XmlWriter::WriteAttribute(Standard_OStream& theOStream, const LDOM_Nod int anIntValue; aValueStr.GetInteger(anIntValue); - aLength = (int)(20 + strlen(aName)); + aLength = static_cast(20 + strlen(aName)); if (aLength > myABufferLen) { delete[] myABuffer; @@ -424,7 +424,7 @@ void LDOM_XmlWriter::WriteAttribute(Standard_OStream& theOStream, const LDOM_Nod chDoubleQuote, anIntValue, chDoubleQuote); - aLength = (int)strlen(myABuffer); + aLength = static_cast(strlen(myABuffer)); } else // String attribute value { @@ -432,13 +432,13 @@ void LDOM_XmlWriter::WriteAttribute(Standard_OStream& theOStream, const LDOM_Nod const char* aValue = aValueStr.GetString(); if (aValueStr.Type() == LDOMBasicString::LDOM_AsciiDocClear) { - encStr = (char*)aValue; - aLength = (int)(4 + strlen(aValue) + strlen(aName)); + encStr = const_cast(aValue); + aLength = static_cast(4 + strlen(aValue) + strlen(aName)); } else { encStr = LDOM_CharReference::Encode(aValue, aLength, true); - aLength += (int)(4 + strlen(aName)); + aLength += static_cast(4 + strlen(aName)); } if (aLength > myABufferLen) diff --git a/src/ApplicationFramework/TKCDF/PCDM/PCDM_ReadWriter.cxx b/src/ApplicationFramework/TKCDF/PCDM/PCDM_ReadWriter.cxx index 02962fa61ce..5fe2f60dcb8 100644 --- a/src/ApplicationFramework/TKCDF/PCDM/PCDM_ReadWriter.cxx +++ b/src/ApplicationFramework/TKCDF/PCDM/PCDM_ReadWriter.cxx @@ -62,7 +62,7 @@ void PCDM_ReadWriter::Open(const occ::handle& aDriver, default: break; } - aMsg << (char)0; + aMsg << static_cast(0); throw Standard_Failure(aMsg.str().c_str()); } } diff --git a/src/ApplicationFramework/TKCDF/PCDM/PCDM_ReaderFilter.cxx b/src/ApplicationFramework/TKCDF/PCDM/PCDM_ReaderFilter.cxx index 8bfa5589652..cb1dd50d113 100644 --- a/src/ApplicationFramework/TKCDF/PCDM/PCDM_ReaderFilter.cxx +++ b/src/ApplicationFramework/TKCDF/PCDM/PCDM_ReaderFilter.cxx @@ -116,7 +116,7 @@ void PCDM_ReaderFilter::StartIteration() int aTag = aTagStr.IntegerValue(); if (aMap->IsBound(aTag)) { - aMap = (TagTree*)aMap->Find(aTag); + aMap = static_cast(aMap->Find(aTag)); } else { @@ -133,7 +133,7 @@ void PCDM_ReaderFilter::StartIteration() void PCDM_ReaderFilter::Up() { if (myCurrentDepth == 0) - myCurrent = (TagTree*)myCurrent->Find(-1); + myCurrent = static_cast(myCurrent->Find(-1)); else myCurrentDepth--; } @@ -143,7 +143,7 @@ void PCDM_ReaderFilter::Down(const int& theTag) if (myCurrentDepth == 0) { if (myCurrent->IsBound(theTag)) - myCurrent = (TagTree*)myCurrent->Find(theTag); + myCurrent = static_cast(myCurrent->Find(theTag)); else ++myCurrentDepth; } @@ -165,7 +165,7 @@ void PCDM_ReaderFilter::ClearSubTree(void* const theMap) { if (theMap) { - TagTree* aMap = (TagTree*)theMap; + TagTree* aMap = static_cast(theMap); for (TagTree::Iterator aTagIter(*aMap); aTagIter.More(); aTagIter.Next()) if (aTagIter.Key() != -1) ClearSubTree(aTagIter.Value()); diff --git a/src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx b/src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx index 230c608e03e..d03ee8e570a 100644 --- a/src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx +++ b/src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx @@ -54,7 +54,7 @@ void PCDM_StorageDriver::Write(const occ::handle& aDocument, } catch (Standard_Failure const& anException) { - aMsg << anException << (char)0; + aMsg << anException << static_cast(0); Failure = true; } } @@ -65,7 +65,7 @@ void PCDM_StorageDriver::Write(const occ::handle& aDocument, if (thePersistentDocuments.IsEmpty()) { aMsg << "the storage driver: " << DynamicType()->Name() << "returned no documents to store" - << (char)0; + << static_cast(0); throw PCDM_DriverError(aMsg.str().c_str()); } @@ -116,7 +116,7 @@ occ::handle PCDM_StorageDriver::Make(const occ::handle voidDocument; Standard_SStream aMsg; - aMsg << "No Make method were implemented in this Driver" << DynamicType()->Name() << (char)0; + aMsg << "No Make method were implemented in this Driver" << DynamicType()->Name() << static_cast(0); throw Standard_NotImplemented(aMsg.str().c_str()); } diff --git a/src/ApplicationFramework/TKLCAF/TDF/TDF_LabelNode.hxx b/src/ApplicationFramework/TKLCAF/TDF/TDF_LabelNode.hxx index 1ac6bd57ea0..cc830315e59 100644 --- a/src/ApplicationFramework/TKLCAF/TDF/TDF_LabelNode.hxx +++ b/src/ApplicationFramework/TKLCAF/TDF/TDF_LabelNode.hxx @@ -33,7 +33,7 @@ class TDF_Data; enum { - TDF_LabelNodeImportMsk = (int)0x80000000, // Because the sign bit (HP). + TDF_LabelNodeImportMsk = static_cast(0x80000000), // Because the sign bit (HP). TDF_LabelNodeAttModMsk = 0x40000000, TDF_LabelNodeMayModMsk = 0x20000000, TDF_LabelNodeFlagsMsk = (TDF_LabelNodeImportMsk | TDF_LabelNodeAttModMsk | TDF_LabelNodeMayModMsk) diff --git a/src/ApplicationFramework/TKLCAF/TDF/TDF_Tool.cxx b/src/ApplicationFramework/TKLCAF/TDF/TDF_Tool.cxx index aa3bec6e238..e2471aa3929 100644 --- a/src/ApplicationFramework/TKLCAF/TDF/TDF_Tool.cxx +++ b/src/ApplicationFramework/TKLCAF/TDF/TDF_Tool.cxx @@ -359,8 +359,8 @@ void TDF_Tool::Entry(const TDF_Label& aLabel, TCollection_AsciiString& anEntry) { int aTag = aLab.Tag(); for (; aTag > 9; --aPtr, aTag /= 10) - *aPtr = char(aTag % 10) + '0'; - *aPtr = char(aTag) + '0'; + *aPtr = static_cast(aTag % 10) + '0'; + *aPtr = static_cast(aTag) + '0'; aPtr -= 2; } *aPtr = '0'; diff --git a/src/ApplicationFramework/TKLCAF/TDataStd/TDataStd_TreeNode.cxx b/src/ApplicationFramework/TKLCAF/TDataStd/TDataStd_TreeNode.cxx index 3746adca271..c02990ba097 100644 --- a/src/ApplicationFramework/TKLCAF/TDataStd/TDataStd_TreeNode.cxx +++ b/src/ApplicationFramework/TKLCAF/TDataStd/TDataStd_TreeNode.cxx @@ -238,7 +238,7 @@ int TDataStd_TreeNode::Depth() const { int depth = 0; - TDataStd_TreeNode* O = (TDataStd_TreeNode*)this; + TDataStd_TreeNode* O = const_cast(this); while (O->myFather != nullptr) { depth++; @@ -284,7 +284,7 @@ bool TDataStd_TreeNode::IsAscendant(const occ::handle& ofTN) bool TDataStd_TreeNode::IsDescendant(const occ::handle& ofTN) const { - TDataStd_TreeNode* O = (TDataStd_TreeNode*)this; + TDataStd_TreeNode* O = const_cast(this); while (O->myFather != nullptr) { if (O->myFather == ofTN) @@ -327,7 +327,7 @@ bool TDataStd_TreeNode::IsRoot() const occ::handle TDataStd_TreeNode::Root() const { - TDataStd_TreeNode* O = (TDataStd_TreeNode*)this; + TDataStd_TreeNode* O = const_cast(this); while (O->myFather != nullptr) { O = O->myFather; diff --git a/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Iterator.cxx b/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Iterator.cxx index 5f71bd3e2c5..753f7da3b6c 100644 --- a/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Iterator.cxx +++ b/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Iterator.cxx @@ -271,7 +271,7 @@ Standard_OStream& TFunction_Iterator::Dump(Standard_OStream& anOS) const occ::handle G; if (L.FindAttribute(TFunction_GraphNode::GetID(), G)) { - saved_status.Bind(L, (int)G->GetStatus()); + saved_status.Bind(L, static_cast(G->GetStatus())); G->SetStatus(TFunction_ES_NotExecuted); } } @@ -314,7 +314,7 @@ Standard_OStream& TFunction_Iterator::Dump(Standard_OStream& anOS) const for (; itrm.More(); itrm.Next()) { const TDF_Label& L = itrm.Key(); - TFunction_ExecutionStatus status = (TFunction_ExecutionStatus)itrm.Value(); + TFunction_ExecutionStatus status = static_cast(itrm.Value()); occ::handle G; if (L.FindAttribute(TFunction_GraphNode::GetID(), G)) diff --git a/src/ApplicationFramework/TKStd/StdPersistent/StdPersistent_PPrsStd.cxx b/src/ApplicationFramework/TKStd/StdPersistent/StdPersistent_PPrsStd.cxx index 21a09f62d5e..40fd253d1e5 100644 --- a/src/ApplicationFramework/TKStd/StdPersistent/StdPersistent_PPrsStd.cxx +++ b/src/ApplicationFramework/TKStd/StdPersistent/StdPersistent_PPrsStd.cxx @@ -25,7 +25,7 @@ void StdPersistent_PPrsStd::AISPresentation::Import( theAttribute->SetDriverGUID(Standard_GUID(aDriverGUID->String().ToExtString())); if (myColor != -1) - theAttribute->SetColor(static_cast((int)myColor)); + theAttribute->SetColor(static_cast(myColor)); else theAttribute->UnsetColor(); diff --git a/src/ApplicationFramework/TKStd/StdStorage/StdStorage.cxx b/src/ApplicationFramework/TKStd/StdStorage/StdStorage.cxx index 3a21267d9bc..c86736fdceb 100644 --- a/src/ApplicationFramework/TKStd/StdStorage/StdStorage.cxx +++ b/src/ApplicationFramework/TKStd/StdStorage/StdStorage.cxx @@ -205,7 +205,7 @@ static TCollection_AsciiString currentDate() char nowstr[SLENGTH]; time_t nowbin; struct tm* nowstruct; - if (time(&nowbin) != (time_t)-1) + if (time(&nowbin) != static_cast(-1)) { nowstruct = localtime(&nowbin); strftime(nowstr, SLENGTH, "%m/%d/%Y", nowstruct); diff --git a/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.cxx b/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.cxx index 2915ee6da6a..c1797650815 100644 --- a/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.cxx +++ b/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.cxx @@ -52,7 +52,7 @@ StdStorage_BucketOfPersistent::StdStorage_BucketOfPersistent(const int theBucket myNumberOfBucketAllocated(theBucketNumber), myBucketSize(theBucketSize) { - myBuckets = (StdStorage_Bucket**)Standard::Allocate(sizeof(StdStorage_Bucket*) * theBucketNumber); + myBuckets = static_cast(Standard::Allocate(sizeof(StdStorage_Bucket*) * theBucketNumber)); myBuckets[0] = new StdStorage_Bucket(myBucketSize); myCurrentBucket = myBuckets[0]; myLength = 0; @@ -116,7 +116,7 @@ void StdStorage_BucketOfPersistent::Append(const occ::handle myNumberOfBucketAllocated) { size_t e = sizeof(StdStorage_Bucket*) * myNumberOfBucketAllocated; - myBuckets = (StdStorage_Bucket**)Standard::Reallocate(myBuckets, e * 2); + myBuckets = static_cast(Standard::Reallocate(myBuckets, e * 2)); myNumberOfBucketAllocated *= 2; } diff --git a/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.hxx b/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.hxx index 4f8b868a120..bdb9d5928df 100644 --- a/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.hxx +++ b/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.hxx @@ -40,7 +40,7 @@ public: myCurrentSpace(-1) { mySpace = - (StdObjMgt_Persistent**)Standard::Allocate(sizeof(StdObjMgt_Persistent*) * mySpaceSize); + static_cast(Standard::Allocate(sizeof(StdObjMgt_Persistent*) * mySpaceSize)); } StdStorage_Bucket(const int theSpaceSize) @@ -49,7 +49,7 @@ public: myCurrentSpace(-1) { mySpace = - (StdObjMgt_Persistent**)Standard::Allocate(sizeof(StdObjMgt_Persistent*) * mySpaceSize); + static_cast(Standard::Allocate(sizeof(StdObjMgt_Persistent*) * mySpaceSize)); } void Clear(); diff --git a/src/ApplicationFramework/TKTObj/TObj/TObj_Persistence.cxx b/src/ApplicationFramework/TKTObj/TObj/TObj_Persistence.cxx index c02eba3a6d9..bebea0d8209 100644 --- a/src/ApplicationFramework/TKTObj/TObj/TObj_Persistence.cxx +++ b/src/ApplicationFramework/TKTObj/TObj/TObj_Persistence.cxx @@ -51,7 +51,7 @@ occ::handle TObj_Persistence::CreateNewObject(const char* const the { if (getMapOfTypes().IsBound(theType)) { - TObj_Persistence* tool = (TObj_Persistence*)getMapOfTypes().Find(theType); + TObj_Persistence* tool = static_cast(getMapOfTypes().Find(theType)); if (tool) return tool->New(theLabel); } diff --git a/src/ApplicationFramework/TKTObj/TObj/TObj_SequenceIterator.cxx b/src/ApplicationFramework/TKTObj/TObj/TObj_SequenceIterator.cxx index 2a1102a431f..70d5b66138b 100644 --- a/src/ApplicationFramework/TKTObj/TObj/TObj_SequenceIterator.cxx +++ b/src/ApplicationFramework/TKTObj/TObj/TObj_SequenceIterator.cxx @@ -49,7 +49,7 @@ bool TObj_SequenceIterator::More() const // check type if (isMore && !myType.IsNull() && !myObjects->Value(myIndex)->IsKind(myType)) { - TObj_SequenceIterator* me = (TObj_SequenceIterator*)this; + TObj_SequenceIterator* me = const_cast(this); me->Next(); return More(); } diff --git a/src/ApplicationFramework/TKTObj/TObj/TObj_TIntSparseArray.cxx b/src/ApplicationFramework/TKTObj/TObj/TObj_TIntSparseArray.cxx index ad7e8846bd9..b2f32c6fa6c 100644 --- a/src/ApplicationFramework/TKTObj/TObj/TObj_TIntSparseArray.cxx +++ b/src/ApplicationFramework/TKTObj/TObj/TObj_TIntSparseArray.cxx @@ -198,7 +198,7 @@ occ::handle TObj_TIntSparseArray::BackupCopy() const // save delta data in a copy if (!myOldMap.IsEmpty()) - aCopy->myOldMap.Exchange((NCollection_SparseArray&)myOldMap); + aCopy->myOldMap.Exchange(const_cast&>(myOldMap)); return aCopy; } diff --git a/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_AISPresentation.cxx b/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_AISPresentation.cxx index fee145b6a52..c3ace506ec8 100644 --- a/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_AISPresentation.cxx +++ b/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_AISPresentation.cxx @@ -160,7 +160,7 @@ Standard_GUID TPrsStd_AISPresentation::GetDriverGUID() const Graphic3d_NameOfMaterial TPrsStd_AISPresentation::Material() const { - return (Graphic3d_NameOfMaterial)getData()->MaterialIndex(); + return static_cast(getData()->MaterialIndex()); } //================================================================================================= diff --git a/src/ApplicationFramework/TKXml/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx b/src/ApplicationFramework/TKXml/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx index 81ff4af8af4..f4ab330befd 100644 --- a/src/ApplicationFramework/TKXml/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx +++ b/src/ApplicationFramework/TKXml/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx @@ -68,7 +68,7 @@ bool XmlMDataXtd_PresentationDriver::Paste(const XmlObjMgt_Persistent& the myMessageDriver->Send("Cannot retrieve guid string from attribute", Message_Fail); return false; } - const char* aGuidStr = (const char*)aDOMStr.GetString(); + const char* aGuidStr = aDOMStr.GetString(); aTPrs->SetDriverGUID(aGuidStr); // is displayed diff --git a/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_NamedShapeDriver.cxx b/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_NamedShapeDriver.cxx index c3a857d28b7..e99cb42689d 100644 --- a/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_NamedShapeDriver.cxx +++ b/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_NamedShapeDriver.cxx @@ -99,7 +99,7 @@ bool XmlMNaming_NamedShapeDriver::Paste(const XmlObjMgt_Persistent& theSou TopoDS_Shape anOldShape; TopoDS_Shape aNewShape; - BRepTools_ShapeSet& aShapeSet = (BRepTools_ShapeSet&)myShapeSet; + BRepTools_ShapeSet& aShapeSet = const_cast(myShapeSet); int lower = NewPShapes.Lower(); if (OldPShapes.Lower() < lower) @@ -186,7 +186,7 @@ void XmlMNaming_NamedShapeDriver::Paste(const occ::handle& theSou SItr.Next(); } - BRepTools_ShapeSet& aShapeSet = (BRepTools_ShapeSet&)myShapeSet; + BRepTools_ShapeSet& aShapeSet = const_cast(myShapeSet); XmlObjMgt_Array1 OldPShapes(1, NbShapes), NewPShapes(1, NbShapes); OldPShapes.CreateArrayElement(theTarget, ::OldsString()); @@ -373,7 +373,7 @@ void XmlMNaming_NamedShapeDriver::WriteShapeSection(XmlObjMgt_Element& theEle // aStream.rdbuf() -> freeze(0); // release the buffer anElement.appendChild(aText); // Clear the shape set to avoid appending to it on the next write - BRepTools_ShapeSet& aShapeSet = (BRepTools_ShapeSet&)myShapeSet; + BRepTools_ShapeSet& aShapeSet = const_cast(myShapeSet); aShapeSet.Clear(); if (!aPS.More()) return; diff --git a/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_NamingDriver.cxx b/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_NamingDriver.cxx index 298292432e2..c003b9fc3cf 100644 --- a/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_NamingDriver.cxx +++ b/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_NamingDriver.cxx @@ -235,7 +235,7 @@ bool XmlMNaming_NamingDriver::Paste(const XmlObjMgt_Persistent& theSource, myMessageDriver->Send(aMsgString, Message_Fail); return false; } - aNgName.Orientation((TopAbs_Orientation)aNb); + aNgName.Orientation(static_cast(aNb)); } // or. end } @@ -323,7 +323,7 @@ void XmlMNaming_NamingDriver::Paste(const occ::handle& theSource, #endif // orientation - anElem.setAttribute(::OrientString(), (int)aNgName.Orientation()); + anElem.setAttribute(::OrientString(), static_cast(aNgName.Orientation())); } //================================================================================================= diff --git a/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_Shape1.cxx b/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_Shape1.cxx index 14c27f6fe6f..d9b7495fb6c 100644 --- a/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_Shape1.cxx +++ b/src/ApplicationFramework/TKXml/XmlMNaming/XmlMNaming_Shape1.cxx @@ -70,7 +70,7 @@ XmlMNaming_Shape1::XmlMNaming_Shape1(const XmlObjMgt_Element& theEl) throw Standard_DomainError( "XmlMNaming_Shape1; orientation value without enum term equivalence"); } - const char* anIntPtr = (const char*)&aPtr[1]; + const char* anIntPtr = &aPtr[1]; if (!XmlObjMgt::GetInteger(anIntPtr, myTShapeID)) throw Standard_DomainError( "XmlMNaming_Shape1; tshape value cannot be initialised by integer"); diff --git a/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers.cxx b/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers.cxx index 4453c9e227d..50af4ac94f4 100644 --- a/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers.cxx @@ -67,7 +67,7 @@ TCollection_AsciiString XmlLDrivers::CreationDate() time_t nowbin; struct tm* nowstruct; - if (time(&nowbin) == (time_t)-1) + if (time(&nowbin) == static_cast(-1)) { #ifdef OCCT_DEBUG std::cerr << "Storage ERROR : Could not get time of day from time()" << std::endl; @@ -76,7 +76,7 @@ TCollection_AsciiString XmlLDrivers::CreationDate() nowstruct = localtime(&nowbin); - if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == (size_t)0) + if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == static_cast(0)) { #ifdef OCCT_DEBUG std::cerr << "Storage ERROR : Could not get string from strftime()" << std::endl; diff --git a/src/ApplicationFramework/TKXmlL/XmlMDF/XmlMDF_ADriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMDF/XmlMDF_ADriver.cxx index 5bd40a4b822..c43e057d4bc 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMDF/XmlMDF_ADriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMDF/XmlMDF_ADriver.cxx @@ -61,6 +61,6 @@ const TCollection_AsciiString& XmlMDF_ADriver::TypeName() const { const char* const aString = myTypeName.ToCString(); if (myTypeName.Length() == 0 || aString[myTypeName.Length() - 1] == ':') - (TCollection_AsciiString&)myTypeName += SourceType()->Name(); + const_cast(myTypeName) += SourceType()->Name(); return myTypeName; } diff --git a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_BooleanArrayDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_BooleanArrayDriver.cxx index b8f8b652bad..557d6acecb9 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_BooleanArrayDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_BooleanArrayDriver.cxx @@ -115,7 +115,7 @@ bool XmlMDataStd_BooleanArrayDriver::Paste(const XmlObjMgt_Persistent& the myMessageDriver->Send(aMessageString, Message_Warning); aValue = 0; } - arr.SetValue(i, (uint8_t)aValue); + arr.SetValue(i, static_cast(aValue)); } aBooleanArray->SetInternalArray(hArr); diff --git a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_ByteArrayDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_ByteArrayDriver.cxx index 1275d376c73..301c630d381 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_ByteArrayDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_ByteArrayDriver.cxx @@ -119,7 +119,7 @@ bool XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent& theSou myMessageDriver->Send(aMessageString, Message_Warning); aValue = 0; } - arr.SetValue(i, (uint8_t)aValue); + arr.SetValue(i, static_cast(aValue)); } aByteArray->ChangeArray(hArr); diff --git a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_NamedDataDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_NamedDataDriver.cxx index e993ee7aeab..d846e39505e 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_NamedDataDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_NamedDataDriver.cxx @@ -428,7 +428,7 @@ bool XmlMDataStd_NamedDataDriver::Paste(const XmlObjMgt_Persistent& theSou } TCollection_AsciiString aVal(aValueStr, '?'); - uint8_t aValue = (uint8_t)aVal.IntegerValue(); + uint8_t aValue = static_cast(aVal.IntegerValue()); aMap.Bind(aKey, aValue); aCurNode = aCurElement->getNextSibling(); @@ -445,7 +445,7 @@ bool XmlMDataStd_NamedDataDriver::Paste(const XmlObjMgt_Persistent& theSou } TCollection_AsciiString aVal(aValueStr, '?'); - uint8_t aValue = (uint8_t)aVal.IntegerValue(); + uint8_t aValue = static_cast(aVal.IntegerValue()); aMap.Bind(aKey, aValue); T->ChangeBytes(aMap); } diff --git a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx index d1cb234b65a..3134cffe4ff 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_RealArrayDriver.cxx @@ -105,7 +105,7 @@ bool XmlMDataStd_RealArrayDriver::Paste(const XmlObjMgt_Persistent& theSou { int anIntValue; if (aString.GetInteger(anIntValue)) - aRealArray->SetValue(aFirstInd, double(anIntValue)); + aRealArray->SetValue(aFirstInd, static_cast(anIntValue)); } else { diff --git a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_RealListDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_RealListDriver.cxx index 8d8ae56e2e5..c2e9fb4df9e 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_RealListDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_RealListDriver.cxx @@ -96,7 +96,7 @@ bool XmlMDataStd_RealListDriver::Paste(const XmlObjMgt_Persistent& theSour { int anIntValue; if (aString.GetInteger(anIntValue)) - aRealList->Append(double(anIntValue)); + aRealList->Append(static_cast(anIntValue)); } else { diff --git a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_UAttributeDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_UAttributeDriver.cxx index ecb50448d18..4e50d784e72 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_UAttributeDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMDataStd/XmlMDataStd_UAttributeDriver.cxx @@ -45,7 +45,7 @@ bool XmlMDataStd_UAttributeDriver::Paste(const XmlObjMgt_Persistent& theSo XmlObjMgt_RRelocationTable&) const { XmlObjMgt_DOMString aGuidDomStr = theSource.Element().getAttribute(::GuidString()); - const char* aGuidStr = (const char*)aGuidDomStr.GetString(); + const char* aGuidStr = aGuidDomStr.GetString(); if (aGuidStr[0] == '\0') { myMessageDriver->Send("error retrieving GUID for type TDataStd_UAttribute", Message_Fail); diff --git a/src/ApplicationFramework/TKXmlL/XmlMFunction/XmlMFunction_FunctionDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMFunction/XmlMFunction_FunctionDriver.cxx index d84a95d4430..032d47dddd4 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMFunction/XmlMFunction_FunctionDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMFunction/XmlMFunction_FunctionDriver.cxx @@ -52,7 +52,7 @@ bool XmlMFunction_FunctionDriver::Paste(const XmlObjMgt_Persistent& theSou // function GUID XmlObjMgt_DOMString aGuidDomStr = theSource.Element().getAttribute(::GuidString()); - const char* aGuidStr = (const char*)aGuidDomStr.GetString(); + const char* aGuidStr = aGuidDomStr.GetString(); if (aGuidStr[0] == '\0') { myMessageDriver->Send("error retrieving GUID for type TFunction_Function", Message_Fail); diff --git a/src/ApplicationFramework/TKXmlL/XmlMFunction/XmlMFunction_GraphNodeDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlMFunction/XmlMFunction_GraphNodeDriver.cxx index 357fb47d892..1393151ce06 100644 --- a/src/ApplicationFramework/TKXmlL/XmlMFunction/XmlMFunction_GraphNodeDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlMFunction/XmlMFunction_GraphNodeDriver.cxx @@ -152,7 +152,7 @@ bool XmlMFunction_GraphNodeDriver::Paste(const XmlObjMgt_Persistent& theSo myMessageDriver->Send(aMessageString, Message_Fail); return false; } - G->SetStatus((TFunction_ExecutionStatus)exec); + G->SetStatus(static_cast(exec)); return true; } @@ -201,5 +201,5 @@ void XmlMFunction_GraphNodeDriver::Paste(const occ::handle& theSo XmlObjMgt::SetStringValue(theTarget, aValueStr.ToCString(), true); // Execution status - theTarget.Element().setAttribute(::ExecutionStatus(), (int)G->GetStatus()); + theTarget.Element().setAttribute(::ExecutionStatus(), static_cast(G->GetStatus())); } diff --git a/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt.cxx b/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt.cxx index ce759683d50..61054e6fe40 100644 --- a/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt.cxx @@ -78,12 +78,12 @@ void SprintfExtStr(char* out, const TCollection_ExtendedString& theString) for (int j = 0, k = 3; j < 4; j++, k--) { unsigned short v = *(p + i) & mask[j]; // x000 - v = (unsigned short)(v >> (4 * k)); + v = static_cast(v >> (4 * k)); if (v < 10) v |= 0x30; else v += 87; - out[4 * i + j] = (char)v; + out[4 * i + j] = static_cast(v); } i++; len--; @@ -149,7 +149,7 @@ bool XmlObjMgt::GetTagEntryString(const XmlObjMgt_DOMString& theSource, return false; // Begin aTagEntry string - char* aTagEntry = (char*)Standard::Allocate(strlen(aSource) / 2); // quite enough to hold it + char* aTagEntry = static_cast(Standard::Allocate(strlen(aSource) / 2)); // quite enough to hold it char* aTagEntryPtr = aTagEntry + 1; *aTagEntry = '0'; aSource += aPrefixSize; @@ -171,7 +171,7 @@ bool XmlObjMgt::GetTagEntryString(const XmlObjMgt_DOMString& theSource, errno = 0; char* aPtr; long aTagValue = strtol(&aSource[1], &aPtr, 10); - int aLen = (int)(aPtr - &aSource[1]); + int aLen = static_cast(aPtr - &aSource[1]); if (aTagValue < 0 || aLen == 0 || aPtr[0] != aQuote || errno == ERANGE || errno == EINVAL) return false; aTagEntryPtr[0] = ':'; @@ -195,7 +195,7 @@ void XmlObjMgt::SetTagEntryString(XmlObjMgt_DOMString& theTarget, const TCollection_AsciiString& theTagEntry) { // Begin parsing theTagEntry - const char* aTagEntry = (const char*)theTagEntry.ToCString() + 1; + const char* aTagEntry = theTagEntry.ToCString() + 1; if (aTagEntry[-1] != '0') return; @@ -210,7 +210,7 @@ void XmlObjMgt::SetTagEntryString(XmlObjMgt_DOMString& theTarget, const size_t anElem1Size = sizeof(aRefElem1) - 1; const size_t anElem2Size = sizeof(aRefElem2) - 1; char* aTarget = - (char*)Standard::Allocate(sizeof(aRefPrefix) + aTagCount * (anElem1Size + anElem2Size + 12)); + static_cast(Standard::Allocate(sizeof(aRefPrefix) + aTagCount * (anElem1Size + anElem2Size + 12))); memcpy(aTarget, aRefPrefix, sizeof(aRefPrefix) - 1); char* aTargetPtr = aTarget + (sizeof(aRefPrefix) - 1); @@ -226,7 +226,7 @@ void XmlObjMgt::SetTagEntryString(XmlObjMgt_DOMString& theTarget, errno = 0; char* ptr; long aTagValue = strtol(aTagEntry, &ptr, 10); - int aTagSize = (int)(ptr - aTagEntry); + int aTagSize = static_cast(ptr - aTagEntry); if (aTagValue < 0 || aTagSize == 0 || errno == ERANGE || errno == EINVAL) return; // error @@ -295,7 +295,7 @@ bool XmlObjMgt::GetInteger(const char*& theString, int& theValue) long aValue = strtol(theString, &ptr, 10); if (ptr == theString || errno == ERANGE || errno == EINVAL) return false; - theValue = int(aValue); + theValue = static_cast(aValue); theString = ptr; return true; } @@ -352,7 +352,7 @@ bool XmlObjMgt::GetReal(const XmlObjMgt_DOMString& theString, double& theValue) case LDOMBasicString::LDOM_Integer: { int anIntValue; theString.GetInteger(anIntValue); - theValue = double(anIntValue); + theValue = static_cast(anIntValue); break; } default: // LDOM_Ascii* diff --git a/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt_GP.cxx b/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt_GP.cxx index 5fadbcfe52c..13cb442a409 100644 --- a/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt_GP.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt_GP.cxx @@ -64,24 +64,24 @@ bool XmlObjMgt_GP::Translate(const XmlObjMgt_DOMString& theStr, gp_Trsf& T) const char* aStr = theStr.GetString(); char* ptr; errno = 0; - double aScaleFactor = double(Strtod(aStr, &ptr)); + double aScaleFactor = (Strtod(aStr, &ptr)); if (ptr != aStr && errno != ERANGE && errno != EINVAL) { T.SetScaleFactor(aScaleFactor); aStr = ptr; - int aForm = int(strtol(aStr, &ptr, 10)); + int aForm = static_cast(strtol(aStr, &ptr, 10)); if (ptr != aStr && errno != ERANGE && errno != EINVAL) { - T.SetForm((gp_TrsfForm)aForm); + T.SetForm(static_cast(aForm)); aStr = ptr; // gp_Mat aMatr; - aStr = ::Translate(aStr, (gp_Mat&)T.HVectorialPart()); + aStr = ::Translate(aStr, const_cast(T.HVectorialPart())); if (aStr) { // gp_XYZ aTransl; - ::Translate(aStr, (gp_XYZ&)T.TranslationPart()); + ::Translate(aStr, const_cast(T.TranslationPart())); aResult = true; } } diff --git a/src/ApplicationFramework/TKXmlTObj/XmlTObjDrivers/XmlTObjDrivers_IntSparseArrayDriver.cxx b/src/ApplicationFramework/TKXmlTObj/XmlTObjDrivers/XmlTObjDrivers_IntSparseArrayDriver.cxx index defb6feaf0f..e32dc55c95e 100644 --- a/src/ApplicationFramework/TKXmlTObj/XmlTObjDrivers/XmlTObjDrivers_IntSparseArrayDriver.cxx +++ b/src/ApplicationFramework/TKXmlTObj/XmlTObjDrivers/XmlTObjDrivers_IntSparseArrayDriver.cxx @@ -93,7 +93,7 @@ void XmlTObjDrivers_IntSparseArrayDriver::Paste(const occ::handle TCollection_AsciiString anIdStr = TCollection_AsciiString(ITEM_ID) + TCollection_AsciiString(i); TCollection_AsciiString aStrIndex = TCollection_AsciiString(ITEM_VALUE) + TCollection_AsciiString(i); - theTarget.Element().setAttribute(anIdStr.ToCString(), (int)anIt.Index()); + theTarget.Element().setAttribute(anIdStr.ToCString(), static_cast(anIt.Index())); theTarget.Element().setAttribute(aStrIndex.ToCString(), anIt.Value()); i++; } diff --git a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx index 825e53ce043..c55488e6887 100644 --- a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx +++ b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx @@ -89,15 +89,15 @@ void BinMXCAFDoc_AssemblyItemRefDriver::Paste( theTarget << aThis->GetItem().ToString(); if (aThis->IsGUID()) { - theTarget << int(1); + theTarget << (1); theTarget << aThis->GetGUID(); } else if (aThis->IsSubshapeIndex()) { - theTarget << int(2); + theTarget << (2); theTarget << aThis->GetSubshapeIndex(); } else - theTarget << int(0); + theTarget << (0); } } diff --git a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_DimTolDriver.cxx b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_DimTolDriver.cxx index 326cc358fbe..792ba090b8c 100644 --- a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_DimTolDriver.cxx +++ b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_DimTolDriver.cxx @@ -97,7 +97,7 @@ void BinMXCAFDoc_DimTolDriver::Paste( { const int aLength = aLastInd - aFirstInd + 1; const NCollection_Array1& anArr = aHArr->Array1(); - double* aPtr = (double*)&anArr(aFirstInd); + double* aPtr = const_cast(&anArr(aFirstInd)); theTarget.PutRealArray(aPtr, aLength); } } diff --git a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx index 228595cb75e..9d688dc1d40 100644 --- a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx +++ b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx @@ -141,10 +141,10 @@ bool BinMXCAFDoc_LocationDriver::Translate(const BinObjMgt_Persistent& theSource int aForm; theSource >> aForm; - aTrsf.SetForm((gp_TrsfForm)aForm); + aTrsf.SetForm(static_cast(aForm)); int R, C; - gp_Mat& aMat = (gp_Mat&)aTrsf.HVectorialPart(); + gp_Mat& aMat = const_cast(aTrsf.HVectorialPart()); for (R = 1; R <= 3; R++) for (C = 1; C <= 3; C++) { @@ -155,7 +155,7 @@ bool BinMXCAFDoc_LocationDriver::Translate(const BinObjMgt_Persistent& theSource double x, y, z; theSource >> x >> y >> z; - gp_XYZ& aLoc = (gp_XYZ&)aTrsf.TranslationPart(); + gp_XYZ& aLoc = const_cast(aTrsf.TranslationPart()); aLoc.SetX(x); aLoc.SetY(y); aLoc.SetZ(z); diff --git a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx index ba6ed0c5286..796792570a1 100644 --- a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx +++ b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx @@ -161,7 +161,7 @@ static void writeTexture(BinObjMgt_Persistent& theTarget, theTarget.PutAsciiString(theImage->TextureId()); theTarget.PutBoolean(true); theTarget.PutInteger(static_cast(theImage->DataBuffer()->Size())); - theTarget.PutByteArray((uint8_t*)theImage->DataBuffer()->Data(), + theTarget.PutByteArray(const_cast(theImage->DataBuffer()->Data()), static_cast(theImage->DataBuffer()->Size())); } @@ -231,9 +231,9 @@ bool BinMXCAFDoc_VisMaterialDriver::Paste(const BinObjMgt_Persistent& theS if (aVerMaj < 1 || aVerMaj > MaterialVersionMajor) { myMessageDriver->Send( - TCollection_AsciiString("Skipping XCAFDoc_VisMaterial of unknown version ") + int(aVerMaj) - + "." + int(aVerMin) + " (supported version: " + int(MaterialVersionMajor) + "." - + int(MaterialVersionMinor) + ")"); + TCollection_AsciiString("Skipping XCAFDoc_VisMaterial of unknown version ") + static_cast(aVerMaj) + + "." + static_cast(aVerMin) + " (supported version: " + static_cast(MaterialVersionMajor) + "." + + static_cast(MaterialVersionMinor) + ")"); return false; } diff --git a/src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx b/src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx index 7aa34a1ba41..58f2cf9edae 100644 --- a/src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx +++ b/src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx @@ -55,215 +55,215 @@ bool DE_ShapeFixConfigurationNode::Load(const occ::handleRealVal("max.tolerance3d", ShapeFixParameters.MaxTolerance3d, aScope); ShapeFixParameters.MinTolerance3d = theResource->RealVal("min.tolerance3d", ShapeFixParameters.MinTolerance3d, aScope); - ShapeFixParameters.FixFreeShellMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + ShapeFixParameters.FixFreeShellMode = static_cast(theResource->IntegerVal( "free.shell", - (int)ShapeFixParameters.FixFreeShellMode, - aScope); + static_cast(ShapeFixParameters.FixFreeShellMode), + aScope)); ShapeFixParameters.FixFreeFaceMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("free.face", - (int)ShapeFixParameters.FixFreeFaceMode, - aScope); + static_cast(theResource->IntegerVal("free.face", + static_cast(ShapeFixParameters.FixFreeFaceMode), + aScope)); ShapeFixParameters.FixFreeWireMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("free.wire", - (int)ShapeFixParameters.FixFreeWireMode, - aScope); - ShapeFixParameters.FixSameParameterMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal("free.wire", + static_cast(ShapeFixParameters.FixFreeWireMode), + aScope)); + ShapeFixParameters.FixSameParameterMode = static_cast(theResource->IntegerVal( "same.parameter", - (int)ShapeFixParameters.FixSameParameterMode, - aScope); + static_cast(ShapeFixParameters.FixSameParameterMode), + aScope)); ShapeFixParameters.FixSolidMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("solid", - (int)ShapeFixParameters.FixSolidMode, - aScope); + static_cast(theResource->IntegerVal("solid", + static_cast(ShapeFixParameters.FixSolidMode), + aScope)); ShapeFixParameters.FixShellOrientationMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "shell.orientation", - (int)ShapeFixParameters.FixShellOrientationMode, - aScope); - ShapeFixParameters.CreateOpenSolidMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixShellOrientationMode), + aScope)); + ShapeFixParameters.CreateOpenSolidMode = static_cast(theResource->IntegerVal( "create.open.solid", - (int)ShapeFixParameters.CreateOpenSolidMode, - aScope); + static_cast(ShapeFixParameters.CreateOpenSolidMode), + aScope)); ShapeFixParameters.FixShellMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("shell", - (int)ShapeFixParameters.FixShellMode, - aScope); + static_cast(theResource->IntegerVal("shell", + static_cast(ShapeFixParameters.FixShellMode), + aScope)); ShapeFixParameters.FixFaceOrientationMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "face.orientation", - (int)ShapeFixParameters.FixFaceOrientationMode, - aScope); + static_cast(ShapeFixParameters.FixFaceOrientationMode), + aScope)); ShapeFixParameters.FixFaceMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("face", - (int)ShapeFixParameters.FixFaceMode, - aScope); + static_cast(theResource->IntegerVal("face", + static_cast(ShapeFixParameters.FixFaceMode), + aScope)); ShapeFixParameters.FixWireMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("wire", - (int)ShapeFixParameters.FixWireMode, - aScope); - ShapeFixParameters.FixOrientationMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal("wire", + static_cast(ShapeFixParameters.FixWireMode), + aScope)); + ShapeFixParameters.FixOrientationMode = static_cast(theResource->IntegerVal( "orientation", - (int)ShapeFixParameters.FixOrientationMode, - aScope); + static_cast(ShapeFixParameters.FixOrientationMode), + aScope)); ShapeFixParameters.FixAddNaturalBoundMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "add.natural.bound", - (int)ShapeFixParameters.FixAddNaturalBoundMode, - aScope); - ShapeFixParameters.FixMissingSeamMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixAddNaturalBoundMode), + aScope)); + ShapeFixParameters.FixMissingSeamMode = static_cast(theResource->IntegerVal( "missing.seam", - (int)ShapeFixParameters.FixMissingSeamMode, - aScope); - ShapeFixParameters.FixSmallAreaWireMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixMissingSeamMode), + aScope)); + ShapeFixParameters.FixSmallAreaWireMode = static_cast(theResource->IntegerVal( "small.area.wire", - (int)ShapeFixParameters.FixSmallAreaWireMode, - aScope); + static_cast(ShapeFixParameters.FixSmallAreaWireMode), + aScope)); ShapeFixParameters.RemoveSmallAreaFaceMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "remove.small.area.face", - (int)ShapeFixParameters.RemoveSmallAreaFaceMode, - aScope); + static_cast(ShapeFixParameters.RemoveSmallAreaFaceMode), + aScope)); ShapeFixParameters.FixIntersectingWiresMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "intersecting.wires", - (int)ShapeFixParameters.FixIntersectingWiresMode, - aScope); - ShapeFixParameters.FixLoopWiresMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixIntersectingWiresMode), + aScope)); + ShapeFixParameters.FixLoopWiresMode = static_cast(theResource->IntegerVal( "loop.wires", - (int)ShapeFixParameters.FixLoopWiresMode, - aScope); - ShapeFixParameters.FixSplitFaceMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixLoopWiresMode), + aScope)); + ShapeFixParameters.FixSplitFaceMode = static_cast(theResource->IntegerVal( "split.face", - (int)ShapeFixParameters.FixSplitFaceMode, - aScope); + static_cast(ShapeFixParameters.FixSplitFaceMode), + aScope)); ShapeFixParameters.AutoCorrectPrecisionMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "auto.correct.precision", - (int)ShapeFixParameters.AutoCorrectPrecisionMode, - aScope); - ShapeFixParameters.ModifyTopologyMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.AutoCorrectPrecisionMode), + aScope)); + ShapeFixParameters.ModifyTopologyMode = static_cast(theResource->IntegerVal( "modify.topology", - (int)ShapeFixParameters.ModifyTopologyMode, - aScope); - ShapeFixParameters.ModifyGeometryMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.ModifyTopologyMode), + aScope)); + ShapeFixParameters.ModifyGeometryMode = static_cast(theResource->IntegerVal( "modify.geometry", - (int)ShapeFixParameters.ModifyGeometryMode, - aScope); + static_cast(ShapeFixParameters.ModifyGeometryMode), + aScope)); ShapeFixParameters.ClosedWireMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("closed.wire", - (int)ShapeFixParameters.ClosedWireMode, - aScope); - ShapeFixParameters.PreferencePCurveMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal("closed.wire", + static_cast(ShapeFixParameters.ClosedWireMode), + aScope)); + ShapeFixParameters.PreferencePCurveMode = static_cast(theResource->IntegerVal( "preference.pcurve", - (int)ShapeFixParameters.PreferencePCurveMode, - aScope); + static_cast(ShapeFixParameters.PreferencePCurveMode), + aScope)); ShapeFixParameters.FixReorderMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("reorder.edges", - (int)ShapeFixParameters.FixReorderMode, - aScope); + static_cast(theResource->IntegerVal("reorder.edges", + static_cast(ShapeFixParameters.FixReorderMode), + aScope)); ShapeFixParameters.FixSmallMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("remove.small.edges", - (int)ShapeFixParameters.FixSmallMode, - aScope); - ShapeFixParameters.FixConnectedMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal("remove.small.edges", + static_cast(ShapeFixParameters.FixSmallMode), + aScope)); + ShapeFixParameters.FixConnectedMode = static_cast(theResource->IntegerVal( "connected.edges", - (int)ShapeFixParameters.FixConnectedMode, - aScope); - ShapeFixParameters.FixEdgeCurvesMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixConnectedMode), + aScope)); + ShapeFixParameters.FixEdgeCurvesMode = static_cast(theResource->IntegerVal( "edge.curves", - (int)ShapeFixParameters.FixEdgeCurvesMode, - aScope); - ShapeFixParameters.FixDegeneratedMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixEdgeCurvesMode), + aScope)); + ShapeFixParameters.FixDegeneratedMode = static_cast(theResource->IntegerVal( "add.degenerated.edges", - (int)ShapeFixParameters.FixDegeneratedMode, - aScope); + static_cast(ShapeFixParameters.FixDegeneratedMode), + aScope)); ShapeFixParameters.FixLackingMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("add.lacking.edges", - (int)ShapeFixParameters.FixLackingMode, - aScope); + static_cast(theResource->IntegerVal("add.lacking.edges", + static_cast(ShapeFixParameters.FixLackingMode), + aScope)); ShapeFixParameters.FixSelfIntersectionMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "selfintersection", - (int)ShapeFixParameters.FixSelfIntersectionMode, - aScope); + static_cast(ShapeFixParameters.FixSelfIntersectionMode), + aScope)); ShapeFixParameters.RemoveLoopMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("remove.loop", - (int)ShapeFixParameters.RemoveLoopMode, - aScope); - ShapeFixParameters.FixReversed2dMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal("remove.loop", + static_cast(ShapeFixParameters.RemoveLoopMode), + aScope)); + ShapeFixParameters.FixReversed2dMode = static_cast(theResource->IntegerVal( "reversed2d", - (int)ShapeFixParameters.FixReversed2dMode, - aScope); - ShapeFixParameters.FixRemovePCurveMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixReversed2dMode), + aScope)); + ShapeFixParameters.FixRemovePCurveMode = static_cast(theResource->IntegerVal( "remove.pcurve", - (int)ShapeFixParameters.FixRemovePCurveMode, - aScope); - ShapeFixParameters.FixRemoveCurve3dMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixRemovePCurveMode), + aScope)); + ShapeFixParameters.FixRemoveCurve3dMode = static_cast(theResource->IntegerVal( "remove.curve3d", - (int)ShapeFixParameters.FixRemoveCurve3dMode, - aScope); - ShapeFixParameters.FixAddPCurveMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixRemoveCurve3dMode), + aScope)); + ShapeFixParameters.FixAddPCurveMode = static_cast(theResource->IntegerVal( "add.pcurve", - (int)ShapeFixParameters.FixAddPCurveMode, - aScope); - ShapeFixParameters.FixAddCurve3dMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixAddPCurveMode), + aScope)); + ShapeFixParameters.FixAddCurve3dMode = static_cast(theResource->IntegerVal( "add.curve3d", - (int)ShapeFixParameters.FixAddCurve3dMode, - aScope); + static_cast(ShapeFixParameters.FixAddCurve3dMode), + aScope)); ShapeFixParameters.FixSeamMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("correct.order.in.seam", - (int)ShapeFixParameters.FixSeamMode, - aScope); + static_cast(theResource->IntegerVal("correct.order.in.seam", + static_cast(ShapeFixParameters.FixSeamMode), + aScope)); ShapeFixParameters.FixShiftedMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("shifted", - (int)ShapeFixParameters.FixShiftedMode, - aScope); + static_cast(theResource->IntegerVal("shifted", + static_cast(ShapeFixParameters.FixShiftedMode), + aScope)); ShapeFixParameters.FixEdgeSameParameterMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "edge.same.parameter", - (int)ShapeFixParameters.FixEdgeSameParameterMode, - aScope); - ShapeFixParameters.FixNotchedEdgesMode = (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(ShapeFixParameters.FixEdgeSameParameterMode), + aScope)); + ShapeFixParameters.FixNotchedEdgesMode = static_cast(theResource->IntegerVal( "notched.edges", - (int)ShapeFixParameters.FixNotchedEdgesMode, - aScope); + static_cast(ShapeFixParameters.FixNotchedEdgesMode), + aScope)); ShapeFixParameters.FixTailMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("tail", - (int)ShapeFixParameters.FixTailMode, - aScope); + static_cast(theResource->IntegerVal("tail", + static_cast(ShapeFixParameters.FixTailMode), + aScope)); ShapeFixParameters.MaxTailAngle = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("max.tail.angle", - (int)ShapeFixParameters.MaxTailAngle, - aScope); + static_cast(theResource->IntegerVal("max.tail.angle", + static_cast(ShapeFixParameters.MaxTailAngle), + aScope)); ShapeFixParameters.MaxTailWidth = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal("max.tail.width", - (int)ShapeFixParameters.MaxTailWidth, - aScope); + static_cast(theResource->IntegerVal("max.tail.width", + static_cast(ShapeFixParameters.MaxTailWidth), + aScope)); ShapeFixParameters.FixSelfIntersectingEdgeMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "selfintersecting.edge", - (int)ShapeFixParameters.FixSelfIntersectingEdgeMode, - aScope); + static_cast(ShapeFixParameters.FixSelfIntersectingEdgeMode), + aScope)); ShapeFixParameters.FixIntersectingEdgesMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "intersecting.edges", - (int)ShapeFixParameters.FixIntersectingEdgesMode, - aScope); + static_cast(ShapeFixParameters.FixIntersectingEdgesMode), + aScope)); ShapeFixParameters.FixNonAdjacentIntersectingEdgesMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "nonadjacent.intersecting.edges", - (int)ShapeFixParameters.FixNonAdjacentIntersectingEdgesMode, - aScope); + static_cast(ShapeFixParameters.FixNonAdjacentIntersectingEdgesMode), + aScope)); ShapeFixParameters.FixVertexPositionMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "vertex.position", - (int)ShapeFixParameters.FixVertexPositionMode, - aScope); + static_cast(ShapeFixParameters.FixVertexPositionMode), + aScope)); ShapeFixParameters.FixVertexToleranceMode = - (DE_ShapeFixParameters::FixMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "vertex.tolerance", - (int)ShapeFixParameters.FixVertexToleranceMode, - aScope); + static_cast(ShapeFixParameters.FixVertexToleranceMode), + aScope)); return true; } @@ -302,35 +302,35 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Defines the mode for applying fixes of ShapeFix_Shell for ShapeFix_Shape\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "free.shell :\t " + (int)ShapeFixParameters.FixFreeShellMode + "\n"; + aResult += aScope + "free.shell :\t " + static_cast(ShapeFixParameters.FixFreeShellMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying fixes of ShapeFix_Face for ShapeFix_Shape\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "free.face :\t " + (int)ShapeFixParameters.FixFreeFaceMode + "\n"; + aResult += aScope + "free.face :\t " + static_cast(ShapeFixParameters.FixFreeFaceMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying fixes of ShapeFix_Wire for ShapeFix_Shape\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "free.wire :\t " + (int)ShapeFixParameters.FixFreeWireMode + "\n"; + aResult += aScope + "free.wire :\t " + static_cast(ShapeFixParameters.FixFreeWireMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying ShapeFix::SameParameter after all fixes\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "same.parameter :\t " + (int)ShapeFixParameters.FixSameParameterMode + "\n"; + aResult += aScope + "same.parameter :\t " + static_cast(ShapeFixParameters.FixSameParameterMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying fixes of ShapeFix_Solid\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "solid :\t " + (int)ShapeFixParameters.FixSolidMode + "\n"; + aResult += aScope + "solid :\t " + static_cast(ShapeFixParameters.FixSolidMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -339,7 +339,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "shell.orientation :\t " + (int)ShapeFixParameters.FixShellOrientationMode + "\n"; + aScope + "shell.orientation :\t " + static_cast(ShapeFixParameters.FixShellOrientationMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -348,14 +348,14 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "else solids are created from closed shells only\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "create.open.solid :\t " + (int)ShapeFixParameters.CreateOpenSolidMode + "\n"; + aResult += aScope + "create.open.solid :\t " + static_cast(ShapeFixParameters.CreateOpenSolidMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying fixes of ShapeFix_Shell for ShapeFix_Solid\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "shell :\t " + (int)ShapeFixParameters.FixShellMode + "\n"; + aResult += aScope + "shell :\t " + static_cast(ShapeFixParameters.FixShellMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -364,28 +364,28 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "face.orientation :\t " + (int)ShapeFixParameters.FixFaceOrientationMode + "\n"; + aScope + "face.orientation :\t " + static_cast(ShapeFixParameters.FixFaceOrientationMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying fixes of ShapeFix_Face\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "face :\t " + (int)ShapeFixParameters.FixFaceMode + "\n"; + aResult += aScope + "face :\t " + static_cast(ShapeFixParameters.FixFaceMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying fixes of ShapeFix_Wire\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "wire :\t " + (int)ShapeFixParameters.FixWireMode + "\n"; + aResult += aScope + "wire :\t " + static_cast(ShapeFixParameters.FixWireMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying a fix for the orientation of faces in the shell\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "orientation :\t " + (int)ShapeFixParameters.FixOrientationMode + "\n"; + aResult += aScope + "orientation :\t " + static_cast(ShapeFixParameters.FixOrientationMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -394,21 +394,21 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "add.natural.bound :\t " + (int)ShapeFixParameters.FixAddNaturalBoundMode + "\n"; + aScope + "add.natural.bound :\t " + static_cast(ShapeFixParameters.FixAddNaturalBoundMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix missing seam mode (tries to insert seam is missed)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "missing.seam :\t " + (int)ShapeFixParameters.FixMissingSeamMode + "\n"; + aResult += aScope + "missing.seam :\t " + static_cast(ShapeFixParameters.FixMissingSeamMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix small area wire mode (drops small wires)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "small.area.wire :\t " + (int)ShapeFixParameters.FixSmallAreaWireMode + "\n"; + aResult += aScope + "small.area.wire :\t " + static_cast(ShapeFixParameters.FixSmallAreaWireMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -416,7 +416,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "remove.small.area.face :\t " + (int)ShapeFixParameters.RemoveSmallAreaFaceMode + "\n"; + aScope + "remove.small.area.face :\t " + static_cast(ShapeFixParameters.RemoveSmallAreaFaceMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -424,21 +424,21 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "intersecting.wires :\t " + (int)ShapeFixParameters.FixIntersectingWiresMode + "\n"; + aScope + "intersecting.wires :\t " + static_cast(ShapeFixParameters.FixIntersectingWiresMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix loop wires mode in ShapeFix_Face\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "loop.wires :\t " + (int)ShapeFixParameters.FixLoopWiresMode + "\n"; + aResult += aScope + "loop.wires :\t " + static_cast(ShapeFixParameters.FixLoopWiresMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix split face mode in ShapeFix_Face\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "split.face :\t " + (int)ShapeFixParameters.FixSplitFaceMode + "\n"; + aResult += aScope + "split.face :\t " + static_cast(ShapeFixParameters.FixSplitFaceMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -446,7 +446,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n"; aResult += aScope + "auto.correct.precision :\t " - + (int)ShapeFixParameters.AutoCorrectPrecisionMode + "\n"; + + static_cast(ShapeFixParameters.AutoCorrectPrecisionMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -454,14 +454,14 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "(adding/removing edges etc.)\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "modify.topology :\t " + (int)ShapeFixParameters.ModifyTopologyMode + "\n"; + aResult += aScope + "modify.topology :\t " + static_cast(ShapeFixParameters.ModifyTopologyMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to modify geometry of the edges and vertices\n"; aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n"; - aResult += aScope + "modify.geometry :\t " + (int)ShapeFixParameters.ModifyGeometryMode + "\n"; + aResult += aScope + "modify.geometry :\t " + static_cast(ShapeFixParameters.ModifyGeometryMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -470,7 +470,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!and FixConnected() for lastand first edges\n"; aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n"; - aResult += aScope + "closed.wire :\t " + (int)ShapeFixParameters.ClosedWireMode + "\n"; + aResult += aScope + "closed.wire :\t " + static_cast(ShapeFixParameters.ClosedWireMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -481,35 +481,35 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n"; aResult += - aScope + "preference.pcurve :\t " + (int)ShapeFixParameters.PreferencePCurveMode + "\n"; + aScope + "preference.pcurve :\t " + static_cast(ShapeFixParameters.PreferencePCurveMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to reorder edges in the wire\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "reorder.edges :\t " + (int)ShapeFixParameters.FixReorderMode + "\n"; + aResult += aScope + "reorder.edges :\t " + static_cast(ShapeFixParameters.FixReorderMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to remove small edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "remove.small.edges :\t " + (int)ShapeFixParameters.FixSmallMode + "\n"; + aResult += aScope + "remove.small.edges :\t " + static_cast(ShapeFixParameters.FixSmallMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for fix connecting edges in the wire\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "connected.edges :\t " + (int)ShapeFixParameters.FixConnectedMode + "\n"; + aResult += aScope + "connected.edges :\t " + static_cast(ShapeFixParameters.FixConnectedMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for fix edges (3Dcurves and 2D curves)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "edge.curves :\t " + (int)ShapeFixParameters.FixEdgeCurvesMode + "\n"; + aResult += aScope + "edge.curves :\t " + static_cast(ShapeFixParameters.FixEdgeCurvesMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -517,14 +517,14 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "add.degenerated.edges :\t " + (int)ShapeFixParameters.FixDegeneratedMode + "\n"; + aScope + "add.degenerated.edges :\t " + static_cast(ShapeFixParameters.FixDegeneratedMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for add lacking edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "add.lacking.edges :\t " + (int)ShapeFixParameters.FixLackingMode + "\n"; + aResult += aScope + "add.lacking.edges :\t " + static_cast(ShapeFixParameters.FixLackingMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -532,21 +532,21 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "selfintersection :\t " + (int)ShapeFixParameters.FixSelfIntersectionMode + "\n"; + aScope + "selfintersection :\t " + static_cast(ShapeFixParameters.FixSelfIntersectionMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to remove loop\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "remove.loop :\t " + (int)ShapeFixParameters.RemoveLoopMode + "\n"; + aResult += aScope + "remove.loop :\t " + static_cast(ShapeFixParameters.RemoveLoopMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to fix edge if pcurve is directed opposite to 3d curve\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "reversed2d :\t " + (int)ShapeFixParameters.FixReversed2dMode + "\n"; + aResult += aScope + "reversed2d :\t " + static_cast(ShapeFixParameters.FixReversed2dMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -554,7 +554,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "the vertices\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "remove.pcurve :\t " + (int)ShapeFixParameters.FixRemovePCurveMode + "\n"; + aResult += aScope + "remove.pcurve :\t " + static_cast(ShapeFixParameters.FixRemovePCurveMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -562,7 +562,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "!Defines the mode allowed to remove 3d curve of the edge if it does not match the vertices\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "remove.curve3d :\t " + (int)ShapeFixParameters.FixRemoveCurve3dMode + "\n"; + aResult += aScope + "remove.curve3d :\t " + static_cast(ShapeFixParameters.FixRemoveCurve3dMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -570,14 +570,14 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "!Defines the mode allowed to add pcurve(s) of the edge if missing (by projecting 3d curve)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "add.pcurve :\t " + (int)ShapeFixParameters.FixAddPCurveMode + "\n"; + aResult += aScope + "add.pcurve :\t " + static_cast(ShapeFixParameters.FixAddPCurveMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to build 3d curve of the edge if missing\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "add.curve3d :\t " + (int)ShapeFixParameters.FixAddCurve3dMode + "\n"; + aResult += aScope + "add.curve3d :\t " + static_cast(ShapeFixParameters.FixAddCurve3dMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -585,7 +585,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "its orientation\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "correct.order.in.seam :\t " + (int)ShapeFixParameters.FixSeamMode + "\n"; + aResult += aScope + "correct.order.in.seam :\t " + static_cast(ShapeFixParameters.FixSeamMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -593,7 +593,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "curves of the edges in the wire are connected\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "shifted :\t " + (int)ShapeFixParameters.FixShiftedMode + "\n"; + aResult += aScope + "shifted :\t " + static_cast(ShapeFixParameters.FixShiftedMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -601,35 +601,35 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "edge.same.parameter :\t " + (int)ShapeFixParameters.FixEdgeSameParameterMode + "\n"; + aScope + "edge.same.parameter :\t " + static_cast(ShapeFixParameters.FixEdgeSameParameterMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for fix notched edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "notched.edges :\t " + (int)ShapeFixParameters.FixNotchedEdgesMode + "\n"; + aResult += aScope + "notched.edges :\t " + static_cast(ShapeFixParameters.FixNotchedEdgesMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for fix tail in wire\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "tail :\t " + (int)ShapeFixParameters.FixTailMode + "\n"; + aResult += aScope + "tail :\t " + static_cast(ShapeFixParameters.FixTailMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for max angle of the tails\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "max.tail.angle :\t " + (int)ShapeFixParameters.MaxTailAngle + "\n"; + aResult += aScope + "max.tail.angle :\t " + static_cast(ShapeFixParameters.MaxTailAngle) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for max tail width\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "max.tail.width :\t " + (int)ShapeFixParameters.MaxTailWidth + "\n"; + aResult += aScope + "max.tail.width :\t " + static_cast(ShapeFixParameters.MaxTailWidth) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -637,7 +637,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += aScope + "selfintersecting.edge :\t " - + (int)ShapeFixParameters.FixSelfIntersectingEdgeMode + "\n"; + + static_cast(ShapeFixParameters.FixSelfIntersectingEdgeMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -645,7 +645,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "intersecting.edges :\t " + (int)ShapeFixParameters.FixIntersectingEdgesMode + "\n"; + aScope + "intersecting.edges :\t " + static_cast(ShapeFixParameters.FixIntersectingEdgesMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -653,14 +653,14 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += aScope + "nonadjacent.intersecting.edges :\t " - + (int)ShapeFixParameters.FixNonAdjacentIntersectingEdgesMode + "\n"; + + static_cast(ShapeFixParameters.FixNonAdjacentIntersectingEdgesMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying ShapeFix::FixVertexPosition before all fixes\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "vertex.position :\t " + (int)ShapeFixParameters.FixVertexPositionMode + "\n"; + aResult += aScope + "vertex.position :\t " + static_cast(ShapeFixParameters.FixVertexPositionMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -670,7 +670,7 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; aResult += - aScope + "vertex.tolerance :\t " + (int)ShapeFixParameters.FixVertexToleranceMode + "\n"; + aScope + "vertex.tolerance :\t " + static_cast(ShapeFixParameters.FixVertexToleranceMode) + "\n"; aResult += "!\n"; return aResult; diff --git a/src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx b/src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx index 66a7a97b5a6..6a17ed1a167 100644 --- a/src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx +++ b/src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx @@ -54,13 +54,13 @@ bool DEBREP_ConfigurationNode::Load(const occ::handle& InternalParameters.WriteBinary = theResource->BooleanVal("write.binary", InternalParameters.WriteBinary, aScope); InternalParameters.WriteVersionBin = - (BinTools_FormatVersion)theResource->IntegerVal("write.version.binary", + static_cast(theResource->IntegerVal("write.version.binary", InternalParameters.WriteVersionBin, - aScope); + aScope)); InternalParameters.WriteVersionAscii = - (TopTools_FormatVersion)theResource->IntegerVal("write.version.ascii", + static_cast(theResource->IntegerVal("write.version.ascii", InternalParameters.WriteVersionAscii, - aScope); + aScope)); InternalParameters.WriteTriangles = theResource->BooleanVal("write.triangles", InternalParameters.WriteTriangles, aScope); InternalParameters.WriteNormals = @@ -176,7 +176,7 @@ bool DEBREP_ConfigurationNode::CheckContent(const occ::handleData(); + const char* aBytes = reinterpret_cast(theBuffer->Data()); return ::strstr(aBytes, "DBRep_DrawableShape") || ::strstr(aBytes, "CASCADE Topology V1") || ::strstr(aBytes, "CASCADE Topology V3"); } diff --git a/src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx b/src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx index 771bdd8d73e..38162d1ea81 100644 --- a/src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx +++ b/src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx @@ -52,9 +52,9 @@ bool DEXCAF_ConfigurationNode::Load(const occ::handle& THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); InternalParameters.ReadAppendMode = - (PCDM_ReaderFilter::AppendMode)theResource->IntegerVal("read.append.mode", + static_cast(theResource->IntegerVal("read.append.mode", InternalParameters.ReadAppendMode, - aScope); + aScope)); theResource->GetStringSeq("read.skip.values", InternalParameters.ReadSkipValues, aScope); theResource->GetStringSeq("read.values", InternalParameters.ReadValues, aScope); @@ -173,6 +173,6 @@ bool DEXCAF_ConfigurationNode::CheckContent(const occ::handleData(); + const char* aBytes = reinterpret_cast(theBuffer->Data()); return ::strncmp(aBytes, "BINFILE", 7) == 0; } diff --git a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx index 4cbe90f94e2..2d2a21d0f42 100644 --- a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx +++ b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx @@ -55,20 +55,19 @@ bool DEIGES_ConfigurationNode::Load(const occ::handle& THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); InternalParameters.ReadBSplineContinuity = - (DEIGES_Parameters::ReadMode_BSplineContinuity)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, - aScope); + aScope)); InternalParameters.ReadPrecisionMode = - (DEIGES_Parameters::ReadMode_Precision) - theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope); + static_cast(theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope)); InternalParameters.ReadPrecisionVal = theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope); InternalParameters.ReadMaxPrecisionMode = - (DEIGES_Parameters::ReadMode_MaxPrecision)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "read.maxprecision.mode", InternalParameters.ReadMaxPrecisionMode, - aScope); + aScope)); InternalParameters.ReadMaxPrecisionVal = theResource->RealVal("read.maxprecision.val", InternalParameters.ReadMaxPrecisionVal, aScope); InternalParameters.ReadSameParamMode = @@ -76,10 +75,10 @@ bool DEIGES_ConfigurationNode::Load(const occ::handle& InternalParameters.ReadSameParamMode, aScope); InternalParameters.ReadSurfaceCurveMode = - (DEIGES_Parameters::ReadMode_SurfaceCurve)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "read.surfacecurve.mode", InternalParameters.ReadSurfaceCurveMode, - aScope); + aScope)); InternalParameters.EncodeRegAngle = theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope); @@ -97,14 +96,14 @@ bool DEIGES_ConfigurationNode::Load(const occ::handle& theResource->BooleanVal("read.layer", InternalParameters.ReadLayer, aScope); InternalParameters.WriteBRepMode = - (DEIGES_Parameters::WriteMode_BRep)theResource->IntegerVal("write.brep.mode", + static_cast(theResource->IntegerVal("write.brep.mode", InternalParameters.WriteBRepMode, - aScope); + aScope)); InternalParameters.WriteConvertSurfaceMode = - (DEIGES_Parameters::WriteMode_ConvertSurface)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "write.convertsurface.mode", InternalParameters.WriteConvertSurfaceMode, - aScope); + aScope)); InternalParameters.WriteHeaderAuthor = theResource->StringVal("write.header.author", InternalParameters.WriteHeaderAuthor, aScope); InternalParameters.WriteHeaderCompany = @@ -114,15 +113,14 @@ bool DEIGES_ConfigurationNode::Load(const occ::handle& InternalParameters.WriteHeaderReciever = theResource->StringVal("write.header.receiver", InternalParameters.WriteHeaderReciever, aScope); InternalParameters.WritePrecisionMode = - (DEIGES_Parameters::WriteMode_PrecisionMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "write.precision.mode", InternalParameters.WritePrecisionMode, - aScope); + aScope)); InternalParameters.WritePrecisionVal = theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope); InternalParameters.WritePlaneMode = - (DEIGES_Parameters::WriteMode_PlaneMode) - theResource->IntegerVal("write.plane.mode", InternalParameters.WritePlaneMode, aScope); + static_cast(theResource->IntegerVal("write.plane.mode", InternalParameters.WritePlaneMode, aScope)); InternalParameters.WriteOffsetMode = theResource->BooleanVal("write.offset", InternalParameters.WriteOffsetMode, aScope); InternalParameters.WriteColor = @@ -420,7 +418,7 @@ bool DEIGES_ConfigurationNode::CheckContent(const occ::handleData(); + const char* aBytes = reinterpret_cast(theBuffer->Data()); if (aBytes[72] == 'S') { const char* aPtr = aBytes + 73; @@ -428,7 +426,7 @@ bool DEIGES_ConfigurationNode::CheckContent(const occ::handle(*++aPtr))) { return true; } diff --git a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Parameters.cxx b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Parameters.cxx index 4f0c7412eb0..6f5b27b31cd 100644 --- a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Parameters.cxx +++ b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Parameters.cxx @@ -20,13 +20,13 @@ void DEIGES_Parameters::InitFromStatic() { ReadBSplineContinuity = - (ReadMode_BSplineContinuity)Interface_Static::IVal("read.iges.bspline.continuity"); - ReadPrecisionMode = (ReadMode_Precision)Interface_Static::IVal("read.precision.mode"); + static_cast(Interface_Static::IVal("read.iges.bspline.continuity")); + ReadPrecisionMode = static_cast(Interface_Static::IVal("read.precision.mode")); ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); - ReadMaxPrecisionMode = (ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode"); + ReadMaxPrecisionMode = static_cast(Interface_Static::IVal("read.maxprecision.mode")); ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; - ReadSurfaceCurveMode = (ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode"); + ReadSurfaceCurveMode = static_cast(Interface_Static::IVal("read.surfacecurve.mode")); EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle"); ReadApproxd1 = Interface_Static::IVal("read.bspline.approxd1.mode") == 1; @@ -36,16 +36,16 @@ void DEIGES_Parameters::InitFromStatic() ReadName = Interface_Static::IVal("read.name") == 1; ReadLayer = Interface_Static::IVal("read.layer") == 1; - WriteBRepMode = (WriteMode_BRep)Interface_Static::IVal("write.brep.mode"); + WriteBRepMode = static_cast(Interface_Static::IVal("write.brep.mode")); WriteConvertSurfaceMode = - (WriteMode_ConvertSurface)Interface_Static::IVal("write.convertsurface.mode"); + static_cast(Interface_Static::IVal("write.convertsurface.mode")); WriteHeaderAuthor = Interface_Static::CVal("write.header.author"); WriteHeaderCompany = Interface_Static::CVal("write.header.company"); WriteHeaderProduct = Interface_Static::CVal("write.header.product"); WriteHeaderReciever = Interface_Static::CVal("write.header.receiver"); - WritePrecisionMode = (WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode"); + WritePrecisionMode = static_cast(Interface_Static::IVal("write.precision.mode")); WritePrecisionVal = Interface_Static::RVal("write.precision.val"); - WritePlaneMode = (WriteMode_PlaneMode)Interface_Static::IVal("write.plane.mode"); + WritePlaneMode = static_cast(Interface_Static::IVal("write.plane.mode")); WriteOffsetMode = Interface_Static::IVal("write.offset") == 1; WriteColor = Interface_Static::IVal("write.color") == 1; WriteName = Interface_Static::IVal("write.name") == 1; diff --git a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Provider.cxx b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Provider.cxx index 66774d58bf7..fb8cb78ee52 100644 --- a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Provider.cxx +++ b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Provider.cxx @@ -185,17 +185,17 @@ void DEIGES_Provider::initStatic(const occ::handle& theNod // Get previous values myOldValues.ReadBSplineContinuity = - (DEIGES_Parameters::ReadMode_BSplineContinuity)Interface_Static::IVal( - "read.iges.bspline.continuity"); + static_cast(Interface_Static::IVal( + "read.iges.bspline.continuity")); myOldValues.ReadPrecisionMode = - (DEIGES_Parameters::ReadMode_Precision)Interface_Static::IVal("read.precision.mode"); + static_cast(Interface_Static::IVal("read.precision.mode")); myOldValues.ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); myOldValues.ReadMaxPrecisionMode = - (DEIGES_Parameters::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode"); + static_cast(Interface_Static::IVal("read.maxprecision.mode")); myOldValues.ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); myOldValues.ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; myOldValues.ReadSurfaceCurveMode = - (DEIGES_Parameters::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode"); + static_cast(Interface_Static::IVal("read.surfacecurve.mode")); myOldValues.EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI; myOldValues.ReadApproxd1 = Interface_Static::IVal("read.iges.bspline.approxd1.mode") == 1; @@ -203,19 +203,19 @@ void DEIGES_Provider::initStatic(const occ::handle& theNod myOldValues.ReadOnlyVisible = Interface_Static::IVal("read.iges.onlyvisible") == 1; myOldValues.WriteBRepMode = - (DEIGES_Parameters::WriteMode_BRep)Interface_Static::IVal("write.iges.brep.mode"); + static_cast(Interface_Static::IVal("write.iges.brep.mode")); myOldValues.WriteConvertSurfaceMode = - (DEIGES_Parameters::WriteMode_ConvertSurface)Interface_Static::IVal( - "write.convertsurface.mode"); + static_cast(Interface_Static::IVal( + "write.convertsurface.mode")); myOldValues.WriteHeaderAuthor = Interface_Static::CVal("write.iges.header.author"); myOldValues.WriteHeaderCompany = Interface_Static::CVal("write.iges.header.company"); myOldValues.WriteHeaderProduct = Interface_Static::CVal("write.iges.header.product"); myOldValues.WriteHeaderReciever = Interface_Static::CVal("write.iges.header.receiver"); myOldValues.WritePrecisionMode = - (DEIGES_Parameters::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode"); + static_cast(Interface_Static::IVal("write.precision.mode")); myOldValues.WritePrecisionVal = Interface_Static::RVal("write.precision.val"); myOldValues.WritePlaneMode = - (DEIGES_Parameters::WriteMode_PlaneMode)Interface_Static::IVal("write.iges.plane.mode"); + static_cast(Interface_Static::IVal("write.iges.plane.mode")); myOldValues.WriteOffsetMode = Interface_Static::IVal("write.iges.offset.mode") == 1; myOldLengthUnit = Interface_Static::IVal("xstep.cascade.unit"); diff --git a/src/DataExchange/TKDEIGES/IGESCAFControl/IGESCAFControl_Writer.cxx b/src/DataExchange/TKDEIGES/IGESCAFControl/IGESCAFControl_Writer.cxx index 26afc260f56..2bf3834d57f 100644 --- a/src/DataExchange/TKDEIGES/IGESCAFControl/IGESCAFControl_Writer.cxx +++ b/src/DataExchange/TKDEIGES/IGESCAFControl/IGESCAFControl_Writer.cxx @@ -580,7 +580,7 @@ bool IGESCAFControl_Writer::WriteNames(const NCollection_Sequence& th for (int aCharPos = 1; aNameLength < 8; aCharPos++, aNameLength++) { anAsciiName->SetValue(aNameLength + 1, - IsAnAscii(aName.Value(aCharPos)) ? (char)aName.Value(aCharPos) : '?'); + IsAnAscii(aName.Value(aCharPos)) ? static_cast(aName.Value(aCharPos)) : '?'); } anIGESEntity->SetLabel(anAsciiName); diff --git a/src/DataExchange/TKDEIGES/IGESData/IGESData_BasicEditor.cxx b/src/DataExchange/TKDEIGES/IGESData/IGESData_BasicEditor.cxx index 16865a5a83e..9aaa3729a1a 100644 --- a/src/DataExchange/TKDEIGES/IGESData/IGESData_BasicEditor.cxx +++ b/src/DataExchange/TKDEIGES/IGESData/IGESData_BasicEditor.cxx @@ -139,9 +139,9 @@ bool IGESData_BasicEditor::SetUnitName(const char* const name) IGESData_GlobalSection GS = themodel->GlobalSection(); if (GS.UnitFlag() == 3) { - char* nam = (char*)name; + char* nam = const_cast(name); if (name[1] == 'H') - nam = (char*)&name[2]; + nam = const_cast(&name[2]); GS.SetUnitName(new TCollection_HAsciiString(nam)); themodel->SetGlobalSection(GS); return true; @@ -377,10 +377,10 @@ int IGESData_BasicEditor::AutoCorrectModel() int IGESData_BasicEditor::UnitNameFlag(const char* const name) { - char* nam = (char*)&name[0]; + char* nam = const_cast(&name[0]); if (name[1] == 'H') { - nam = (char*)&name[2]; + nam = const_cast(&name[2]); } if (!strcmp(nam, "INCH")) return 1; diff --git a/src/DataExchange/TKDEIGES/IGESData/IGESData_GlobalSection.cxx b/src/DataExchange/TKDEIGES/IGESData/IGESData_GlobalSection.cxx index d83dac8437b..d402c3b7b0d 100644 --- a/src/DataExchange/TKDEIGES/IGESData/IGESData_GlobalSection.cxx +++ b/src/DataExchange/TKDEIGES/IGESData/IGESData_GlobalSection.cxx @@ -413,53 +413,53 @@ occ::handle IGESData_GlobalSection::Params() const res->Append(text, lt, Interface_ParamText, 0); Sprintf(nombre, "%d", theIntegerBits); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); Sprintf(nombre, "%d", theMaxPower10Single); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); Sprintf(nombre, "%d", theMaxDigitsSingle); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); Sprintf(nombre, "%d", theMaxPower10Double); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); Sprintf(nombre, "%d", theMaxDigitsDouble); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); MakeHollerith(theReceiveName, text, lt); res->Append(text, lt, Interface_ParamText, 0); Interface_FloatWriter::Convert(theScale, nombre, true, 0., 0., "%f", "%f"); // Sprintf(nombre,"%f",theScale); - res->Append(nombre, (int)strlen(nombre), Interface_ParamReal, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamReal, 0); Sprintf(nombre, "%d", theUnitFlag); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); MakeHollerith(theUnitName, text, lt); res->Append(text, lt, Interface_ParamText, 0); Sprintf(nombre, "%d", theLineWeightGrad); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); Interface_FloatWriter::Convert(theMaxLineWeight, nombre, true, 0., 0., "%f", "%f"); // Sprintf(nombre,"%f",theMaxLineWeight); - res->Append(nombre, (int)strlen(nombre), Interface_ParamReal, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamReal, 0); MakeHollerith(theDate, text, lt); res->Append(text, lt, Interface_ParamText, 0); Interface_FloatWriter::Convert(theResolution, nombre, true, 0., 0., "%g", "%g"); // Sprintf(nombre,"%f",theResolution); - res->Append(nombre, (int)strlen(nombre), Interface_ParamReal, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamReal, 0); if (hasMaxCoord) Interface_FloatWriter::Convert(theMaxCoord, nombre, true, 0., 0., "%f", "%f"); // Sprintf(nombre,"%f",theMaxCoord); else nombre[0] = '\0'; - res->Append(nombre, (int)strlen(nombre), Interface_ParamReal, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamReal, 0); MakeHollerith(theAuthorName, text, lt); res->Append(text, lt, Interface_ParamText, 0); @@ -468,10 +468,10 @@ occ::handle IGESData_GlobalSection::Params() const res->Append(text, lt, Interface_ParamText, 0); Sprintf(nombre, "%d", theIGESVersion); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); Sprintf(nombre, "%d", theDraftingStandard); - res->Append(nombre, (int)strlen(nombre), Interface_ParamInteger, 0); + res->Append(nombre, static_cast(strlen(nombre)), Interface_ParamInteger, 0); if (!theLastChangeDate.IsNull()) { diff --git a/src/DataExchange/TKDEIGES/IGESData/IGESData_IGESReaderData.cxx b/src/DataExchange/TKDEIGES/IGESData/IGESData_IGESReaderData.cxx index 787a0b8de4f..241cbbeb74f 100644 --- a/src/DataExchange/TKDEIGES/IGESData/IGESData_IGESReaderData.cxx +++ b/src/DataExchange/TKDEIGES/IGESData/IGESData_IGESReaderData.cxx @@ -49,7 +49,7 @@ occ::handle>> IGESDa void IGESData_IGESReaderData::AddGlobal(const Interface_ParamType atype, const char* const aval) { - theparh->Append(aval, (int)strlen(aval), atype, 0); + theparh->Append(aval, static_cast(strlen(aval)), atype, 0); } void IGESData_IGESReaderData::SetGlobalSection() diff --git a/src/DataExchange/TKDEIGES/IGESData/IGESData_IGESWriter.cxx b/src/DataExchange/TKDEIGES/IGESData/IGESData_IGESWriter.cxx index 57d919d0ec0..b71441167da 100644 --- a/src/DataExchange/TKDEIGES/IGESData/IGESData_IGESWriter.cxx +++ b/src/DataExchange/TKDEIGES/IGESData/IGESData_IGESWriter.cxx @@ -97,14 +97,14 @@ void IGESData_IGESWriter::SendStartLine(const char* const startline) { Standard_PCharacter pstartline; // - pstartline = (Standard_PCharacter)startline; + pstartline = const_cast(startline); // size_t lst = strlen(startline); if (lst == 0) return; if (thestar.IsNull()) thestar = new NCollection_HSequence>(); - if (lst <= (size_t)MaxcarsG) + if (lst <= static_cast(MaxcarsG)) { thestar->Append(new TCollection_HAsciiString(startline)); return; @@ -314,7 +314,7 @@ void IGESData_IGESWriter::DirPart(const occ::handle& anent) i = 7; while (sn != 0) { - snum[i] = (char)((sn % 10) + 48); + snum[i] = static_cast((sn % 10) + 48); sn = sn / 10; i--; } @@ -412,7 +412,7 @@ void IGESData_IGESWriter::AddString(const char* const val, const int lnval, cons { int lnstr = lnval; if (lnstr <= 0) - lnstr = (int)strlen(val); + lnstr = static_cast(strlen(val)); if (!thecurr.CanGet(lnstr + more + 1)) { // + 1 (18-SEP-1996) to be sure that the separator n is not at the head of line @@ -549,7 +549,7 @@ static void writefnes(Standard_OStream& S, const char* const ligne) { if (ligne[i] == '\0') return; - val = (char)(ligne[i] ^ (150 + (i & 3))); + val = static_cast(ligne[i] ^ (150 + (i & 3))); S << val; } } @@ -579,7 +579,7 @@ bool IGESData_IGESWriter::Print(Standard_OStream& S) const if (fnes) { for (i = 0; i < MaxcarsG; i++) - blancs[i] = (char)(blancs[i] ^ (150 + (i & 3))); + blancs[i] = static_cast(blancs[i] ^ (150 + (i & 3))); } if (thesect != 4) diff --git a/src/DataExchange/TKDEIGES/IGESData/IGESData_ParamReader.cxx b/src/DataExchange/TKDEIGES/IGESData/IGESData_ParamReader.cxx index 695ec183663..0951b50ebd5 100644 --- a/src/DataExchange/TKDEIGES/IGESData/IGESData_ParamReader.cxx +++ b/src/DataExchange/TKDEIGES/IGESData/IGESData_ParamReader.cxx @@ -97,7 +97,7 @@ IGESData_ReadStage IGESData_ParamReader::Stage() const void IGESData_ParamReader::NextStage() { if (thestage != IGESData_ReadEnd) - thestage = (IGESData_ReadStage)(((long)thestage) + 1); + thestage = static_cast((static_cast(thestage)) + 1); } //================================================================================================= diff --git a/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_LineFontDefPattern.cxx b/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_LineFontDefPattern.cxx index bc02bf0c219..60eaff778c9 100644 --- a/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_LineFontDefPattern.cxx +++ b/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_LineFontDefPattern.cxx @@ -65,7 +65,7 @@ bool IGESGraph_LineFontDefPattern::IsVisible(const int Index) const int length = theDisplayPattern->Length(); tempStr[0] = theDisplayPattern->Value(length - ((nbSegs - Index) / 4)); tempStr[1] = 0; - int tempVal = (int)strtol(tempStr, (char**)nullptr, 16); + int tempVal = static_cast(strtol(tempStr, (char**)nullptr, 16)); // Now get the BIT out of tempVal int mask = 0x01; mask <<= ((nbSegs - Index) % 4); diff --git a/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_ToolTextFontDef.cxx b/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_ToolTextFontDef.cxx index b9f779003df..8a320bd94ad 100644 --- a/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_ToolTextFontDef.cxx +++ b/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_ToolTextFontDef.cxx @@ -375,7 +375,7 @@ void IGESGraph_ToolTextFontDef::OwnDump(const occ::handle S << "\n"; for (J = 1; J <= nbmotions; J++) { - S << "Pen up(1) / down(0) flag : " << (int)ent->IsPenUp(I, J) << " Next Pen Position : "; + S << "Pen up(1) / down(0) flag : " << static_cast(ent->IsPenUp(I, J)) << " Next Pen Position : "; ent->NextPenPosition(I, J, IX, IY); S << " X=" << IX << " Y=" << IY << "\n"; } diff --git a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_Dumper.cxx b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_Dumper.cxx index ded0d00d6a2..7eb38ee9fb5 100644 --- a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_Dumper.cxx +++ b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_Dumper.cxx @@ -101,7 +101,7 @@ bool IGESSelect_Dumper::WriteOwn(IFSelect_SessionFile& file, double rangemin, rangemax; TCollection_AsciiString mainform, forminrange; ff->Format(zerosup, mainform, hasrange, forminrange, rangemin, rangemax); - file.SendText((char*)(zerosup ? "zerosup" : "nozerosup")); + file.SendText(const_cast(zerosup ? "zerosup" : "nozerosup")); file.SendText(mainform.ToCString()); if (hasrange) { @@ -158,7 +158,7 @@ bool IGESSelect_Dumper::WriteOwn(IFSelect_SessionFile& file, if (type == STANDARD_TYPE(IGESSelect_SplineToBSpline)) { bool tryc2 = GetCasted(IGESSelect_SplineToBSpline, item)->OptionTryC2(); - file.SendText((char*)(tryc2 ? "TryC2" : "Normal")); + file.SendText(const_cast(tryc2 ? "TryC2" : "Normal")); return true; } return false; diff --git a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_IGESTypeForm.cxx b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_IGESTypeForm.cxx index a13039fe0ab..70128b6e7cf 100644 --- a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_IGESTypeForm.cxx +++ b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_IGESTypeForm.cxx @@ -26,7 +26,7 @@ static char typeval[30]; // une seule reponse a la fois ... IGESSelect_IGESTypeForm::IGESSelect_IGESTypeForm(const bool withform) // JR/Hp - : IFSelect_Signature((const char*)(withform ? "IGES Type & Form Numbers" : "IGES Type Number")) + : IFSelect_Signature((withform ? "IGES Type & Form Numbers" : "IGES Type Number")) //: IFSelect_Signature (withform ? "IGES Type & Form Numbers" : "IGES Type Number") { theform = withform; @@ -37,7 +37,7 @@ void IGESSelect_IGESTypeForm::SetForm(const bool withform) theform = withform; thename.Clear(); // JR/Hp - const char* astr = (const char*)(withform ? "IGES Type & Form Numbers" : "IGES Type Number"); + const char* astr = (withform ? "IGES Type & Form Numbers" : "IGES Type Number"); thename.AssignCat(astr); } diff --git a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignColor.cxx b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignColor.cxx index 063c3af45e8..78728ea6002 100644 --- a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignColor.cxx +++ b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignColor.cxx @@ -147,13 +147,13 @@ const char* IGESSelect_SignColor::Value(const occ::handle& if (!color.IsNull()) color->RGBIntensity(red, green, blue); if (red >= 0) - valbuf.AssignCat(IFSelect_Signature::IntValue(int(red))); + valbuf.AssignCat(IFSelect_Signature::IntValue(static_cast(red))); valbuf.AssignCat(","); if (green >= 0) - valbuf.AssignCat(IFSelect_Signature::IntValue(int(green))); + valbuf.AssignCat(IFSelect_Signature::IntValue(static_cast(green))); valbuf.AssignCat(","); if (blue >= 0) - valbuf.AssignCat(IFSelect_Signature::IntValue(int(blue))); + valbuf.AssignCat(IFSelect_Signature::IntValue(static_cast(blue))); // RED value } @@ -186,7 +186,7 @@ const char* IGESSelect_SignColor::Value(const occ::handle& if (!color.IsNull()) color->RGBIntensity(red, green, blue); if (red >= 0) - return IFSelect_Signature::IntValue(int(red)); + return IFSelect_Signature::IntValue(static_cast(red)); // GREEN Value } @@ -219,7 +219,7 @@ const char* IGESSelect_SignColor::Value(const occ::handle& if (!color.IsNull()) color->RGBIntensity(red, green, blue); if (green >= 0) - return IFSelect_Signature::IntValue(int(green)); + return IFSelect_Signature::IntValue(static_cast(green)); // BLUE Value } @@ -252,7 +252,7 @@ const char* IGESSelect_SignColor::Value(const occ::handle& if (!color.IsNull()) color->RGBIntensity(red, green, blue); if (blue >= 0) - return IFSelect_Signature::IntValue(int(blue)); + return IFSelect_Signature::IntValue(static_cast(blue)); } return valbuf.ToCString(); diff --git a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignLevelNumber.cxx b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignLevelNumber.cxx index 37e134eb35c..6ed33e60673 100644 --- a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignLevelNumber.cxx +++ b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignLevelNumber.cxx @@ -40,7 +40,7 @@ const char* IGESSelect_SignLevelNumber::Value( if (igesent.IsNull()) { const char* astr; - astr = (const char*)(thecountmode ? " NO LEVEL" : "/0/"); + astr = (thecountmode ? " NO LEVEL" : "/0/"); return astr; } // if (igesent.IsNull()) return (thecountmode ? " NO LEVEL" : "/0/"); @@ -53,7 +53,7 @@ const char* IGESSelect_SignLevelNumber::Value( if (level < 0) { const char* astr; - astr = (const char*)(thecountmode ? " NO LEVEL" : "/0/"); + astr = (thecountmode ? " NO LEVEL" : "/0/"); return astr; } // if (level < 0) return (thecountmode ? " NO LEVEL" : "/0/"); diff --git a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignStatus.cxx b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignStatus.cxx index 3964c9c7503..211d668cbe3 100644 --- a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignStatus.cxx +++ b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_SignStatus.cxx @@ -73,7 +73,7 @@ bool IGESSelect_SignStatus::Matches(const occ::handle& ent, vir++; continue; } - val = int(car - 48); + val = (car - 48); if (car == 'V' && vir == 0) val = 0; if (car == 'B' && vir == 0) diff --git a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_WorkLibrary.cxx b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_WorkLibrary.cxx index 48150908d23..70ce2add99d 100644 --- a/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_WorkLibrary.cxx +++ b/src/DataExchange/TKDEIGES/IGESSelect/IGESSelect_WorkLibrary.cxx @@ -78,7 +78,7 @@ int IGESSelect_WorkLibrary::ReadFile(const char* const name occ::handle igesmod = new IGESData_IGESModel; DeclareAndCast(IGESData_Protocol, prot, protocol); - char* pname = (char*)name; + char* pname = const_cast(name); int status = IGESFile_Read(pname, igesmod, prot); if (status < 0) diff --git a/src/DataExchange/TKDEIGES/IGESToBRep/IGESToBRep_Reader.cxx b/src/DataExchange/TKDEIGES/IGESToBRep/IGESToBRep_Reader.cxx index 047a7aae3f2..9b696257f4f 100644 --- a/src/DataExchange/TKDEIGES/IGESToBRep/IGESToBRep_Reader.cxx +++ b/src/DataExchange/TKDEIGES/IGESToBRep/IGESToBRep_Reader.cxx @@ -145,7 +145,7 @@ int IGESToBRep_Reader::LoadFile(const char* const filename) OSD_Timer c; c.Reset(); c.Start(); - char* pfilename = (char*)filename; + char* pfilename = const_cast(filename); int StatusFile = IGESFile_Read(pfilename, model, protocol); if (StatusFile != 0) { diff --git a/src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx b/src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx index e750c620307..bece148ead2 100644 --- a/src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx +++ b/src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx @@ -52,13 +52,13 @@ bool DEOBJ_ConfigurationNode::Load(const occ::handle& t InternalParameters.FileLengthUnit = theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope); InternalParameters.SystemCS = - (RWMesh_CoordinateSystem)(theResource->IntegerVal("system.cs", - (int)InternalParameters.SystemCS, + static_cast(theResource->IntegerVal("system.cs", + static_cast(InternalParameters.SystemCS), aScope) % 2); InternalParameters.FileCS = - (RWMesh_CoordinateSystem)(theResource->IntegerVal("file.cs", - (int)InternalParameters.FileCS, + static_cast(theResource->IntegerVal("file.cs", + static_cast(InternalParameters.FileCS), aScope) % 2); diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafReader.cxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafReader.cxx index 16200296ea2..8fcb717fdc8 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafReader.cxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafReader.cxx @@ -98,8 +98,8 @@ bool RWObj_CafReader::performMesh(std::istream& theStream, aCtx->SetCreateShapes(true); aCtx->SetShapeReceiver(this); aCtx->SetTransformation(myCoordSysConverter); - aCtx->SetMemoryLimit(myMemoryLimitMiB == -1 ? size_t(-1) - : size_t(myMemoryLimitMiB * 1024 * 1024)); + aCtx->SetMemoryLimit(myMemoryLimitMiB == -1 ? static_cast(-1) + : static_cast(myMemoryLimitMiB * 1024 * 1024)); bool isDone = false; if (theToProbe) { diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafWriter.cxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafWriter.cxx index a7fd2a07bb0..dd214355a78 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafWriter.cxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafWriter.cxx @@ -34,13 +34,13 @@ namespace //! Trivial cast. inline NCollection_Vec3 objXyzToVec(const gp_XYZ& thePnt) { - return NCollection_Vec3((float)thePnt.X(), (float)thePnt.Y(), (float)thePnt.Z()); + return NCollection_Vec3(static_cast(thePnt.X()), static_cast(thePnt.Y()), static_cast(thePnt.Z())); } //! Trivial cast. inline NCollection_Vec2 objXyToVec(const gp_XY& thePnt) { - return NCollection_Vec2((float)thePnt.X(), (float)thePnt.Y()); + return NCollection_Vec2(static_cast(thePnt.X()), static_cast(thePnt.Y())); } //! Read name attribute. diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_MtlReader.cxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_MtlReader.cxx index 85db38e7ef1..f5e4d6fa829 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_MtlReader.cxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_MtlReader.cxx @@ -205,7 +205,7 @@ bool RWObj_MtlReader::Read(const TCollection_AsciiString& theFolder, aPos = aNext; if (aSpecular >= 0.0) { - aMat.Shininess = (float)std::min(aSpecular / 1000.0, 1.0); + aMat.Shininess = static_cast(std::min(aSpecular / 1000.0, 1.0)); hasAspect = true; } } @@ -217,7 +217,7 @@ bool RWObj_MtlReader::Read(const TCollection_AsciiString& theFolder, aPos = aNext; if (validateScalar(aTransp) && aTransp <= 0.99) { - aMat.Transparency = (float)aTransp; + aMat.Transparency = static_cast(aTransp); hasAspect = true; } } @@ -230,7 +230,7 @@ bool RWObj_MtlReader::Read(const TCollection_AsciiString& theFolder, aPos = aNext; if (validateScalar(anAlpha) && anAlpha >= 0.01) { - aMat.Transparency = float(1.0 - anAlpha); + aMat.Transparency = static_cast(1.0 - anAlpha); hasAspect = true; } } diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_ObjMaterialMap.cxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_ObjMaterialMap.cxx index 046a967a33a..9538c93a404 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_ObjMaterialMap.cxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_ObjMaterialMap.cxx @@ -96,7 +96,7 @@ void RWObj_ObjMaterialMap::DefineMaterial(const XCAFPrs_Style& theStyl { hasMaterial = true; aDiffQ = theStyle.GetColorSurf(); - anAmbQ = Quantity_Color((NCollection_Vec3)theStyle.GetColorSurf() * 0.25f); + anAmbQ = Quantity_Color(NCollection_Vec3(theStyle.GetColorSurf()) * 0.25f); if (theStyle.GetColorSurfRGBA().Alpha() < 1.0f) { aTransp = 1.0f - theStyle.GetColorSurfRGBA().Alpha(); diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.cxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.cxx index 7f0a2f00d67..339b07938ef 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.cxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.cxx @@ -67,7 +67,7 @@ static bool isClockwisePolygon(const occ::handle //================================================================================================= RWObj_Reader::RWObj_Reader() - : myMemLimitBytes(size_t(-1)), + : myMemLimitBytes(static_cast(-1)), myMemEstim(0), myNbLines(0), myNbProbeNodes(0), @@ -124,7 +124,7 @@ bool RWObj_Reader::read(std::istream& theStream, Standard_ReadLineBuffer aBuffer(THE_BUFFER_SIZE); aBuffer.SetMultilineMode(true); - const int aNbMiBTotal = int(aFileLen / (1024 * 1024)); + const int aNbMiBTotal = static_cast(aFileLen / (1024 * 1024)); int aNbMiBPassed = 0; Message_ProgressScope aPS(theProgress, "Reading text OBJ file", aNbMiBTotal); OSD_Timer aTimer; @@ -150,7 +150,7 @@ bool RWObj_Reader::read(std::istream& theStream, return false; } - const int aNbMiBRead = int(aPosition / (1024 * 1024)); + const int aNbMiBRead = static_cast(aPosition / (1024 * 1024)); aPS.Next(aNbMiBRead - aNbMiBPassed); aNbMiBPassed = aNbMiBRead; aTimer.Reset(); @@ -289,7 +289,7 @@ void RWObj_Reader::pushIndices(const char* thePos) for (int aNode = 0;; ++aNode) { NCollection_Vec3 a3Indices(-1, -1, -1); - a3Indices[0] = int(strtol(thePos, &aNext, 10) - 1); + a3Indices[0] = static_cast(strtol(thePos, &aNext, 10) - 1); if (aNext == thePos) { break; @@ -302,7 +302,7 @@ void RWObj_Reader::pushIndices(const char* thePos) ++thePos; if (*thePos != '/') { - a3Indices[1] = int(strtol(thePos, &aNext, 10) - 1); + a3Indices[1] = static_cast(strtol(thePos, &aNext, 10) - 1); thePos = aNext; } @@ -312,7 +312,7 @@ void RWObj_Reader::pushIndices(const char* thePos) ++thePos; if (!IsSpace(*thePos)) { - a3Indices[2] = int(strtol(thePos, &aNext, 10) - 1); + a3Indices[2] = static_cast(strtol(thePos, &aNext, 10) - 1); thePos = aNext; } } @@ -397,7 +397,7 @@ void RWObj_Reader::pushIndices(const char* thePos) } } - if (myCurrElem.size() < size_t(aNode)) + if (myCurrElem.size() < static_cast(aNode)) { myCurrElem.resize(aNode * 2, -1); } @@ -483,7 +483,7 @@ gp_XYZ RWObj_Reader::polygonCenter(const NCollection_Array1& theIndices) aCenter += getNode(aPntIter.Value()).XYZ(); } - aCenter /= (double)theIndices.Size(); + aCenter /= static_cast(theIndices.Size()); return aCenter; } @@ -724,7 +724,7 @@ bool RWObj_Reader::checkMemory() } Message::SendFail(TCollection_AsciiString("Error: OBJ file content does not fit into ") - + int(myMemLimitBytes / (1024 * 1024)) + " MiB limit." + + static_cast(myMemLimitBytes / (1024 * 1024)) + " MiB limit." + "\nMesh data will be truncated."); myToAbort = true; return false; diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.hxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.hxx index 3568362bf1a..9afa86ae0e5 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.hxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.hxx @@ -213,9 +213,9 @@ private: { char* aNext = nullptr; NCollection_Vec2 anUV; - anUV.x() = (float)Strtod(theUV, &aNext); + anUV.x() = static_cast(Strtod(theUV, &aNext)); theUV = aNext; - anUV.y() = (float)Strtod(theUV, &aNext); + anUV.y() = static_cast(Strtod(theUV, &aNext)); myMemEstim += sizeof(NCollection_Vec2); myObjVertsUV.Append(anUV); @@ -340,7 +340,7 @@ protected: if (myIsSinglePrecision) { myVec3Vec->Append( - NCollection_Vec3((float)thePnt.X(), (float)thePnt.Y(), (float)thePnt.Z())); + NCollection_Vec3(static_cast(thePnt.X()), static_cast(thePnt.Y()), static_cast(thePnt.Z()))); } else { diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Tools.hxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Tools.hxx index e6c83da1769..a092caa5490 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Tools.hxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Tools.hxx @@ -27,11 +27,11 @@ namespace RWObj_Tools inline bool ReadVec3(const char* thePos, char*& theNext, NCollection_Vec3& theVec) { const char* aPos = thePos; - theVec.x() = (float)Strtod(aPos, &theNext); + theVec.x() = static_cast(Strtod(aPos, &theNext)); aPos = theNext; - theVec.y() = (float)Strtod(aPos, &theNext); + theVec.y() = static_cast(Strtod(aPos, &theNext)); aPos = theNext; - theVec.z() = (float)Strtod(aPos, &theNext); + theVec.z() = static_cast(Strtod(aPos, &theNext)); return aPos != theNext; } @@ -51,7 +51,7 @@ inline bool ReadVec3(const char* thePos, char*& theNext, gp_XYZ& theVec) inline bool ReadName(const char* thePos, TCollection_AsciiString& theName) { int aFrom = 0; - int aTail = (int)std::strlen(thePos) - 1; + int aTail = static_cast(std::strlen(thePos)) - 1; if (aTail >= 0 && thePos[aTail] == '\n') { --aTail; diff --git a/src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx b/src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx index fcfd94a7dd6..2b73b647644 100644 --- a/src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx +++ b/src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx @@ -53,13 +53,13 @@ bool DEPLY_ConfigurationNode::Load(const occ::handle& t InternalParameters.FileLengthUnit = theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope); InternalParameters.SystemCS = - (RWMesh_CoordinateSystem)(theResource->IntegerVal("system.cs", - (int)InternalParameters.SystemCS, + static_cast(theResource->IntegerVal("system.cs", + static_cast(InternalParameters.SystemCS), aScope) % 2); InternalParameters.FileCS = - (RWMesh_CoordinateSystem)(theResource->IntegerVal("file.cs", - (int)InternalParameters.FileCS, + static_cast(theResource->IntegerVal("file.cs", + static_cast(InternalParameters.FileCS), aScope) % 2); @@ -225,6 +225,6 @@ bool DEPLY_ConfigurationNode::CheckContent(const occ::handle { return false; } - const char* aBytes = (const char*)theBuffer->Data(); + const char* aBytes = reinterpret_cast(theBuffer->Data()); return !::strncmp(aBytes, "ply", 3) && ::isspace(aBytes[3]); } diff --git a/src/DataExchange/TKDEPLY/RWPly/RWPly_CafWriter.cxx b/src/DataExchange/TKDEPLY/RWPly/RWPly_CafWriter.cxx index 33a262a84d4..3f0abcdd30a 100644 --- a/src/DataExchange/TKDEPLY/RWPly/RWPly_CafWriter.cxx +++ b/src/DataExchange/TKDEPLY/RWPly/RWPly_CafWriter.cxx @@ -236,10 +236,10 @@ bool RWPly_CafWriter::writeNodes(RWPly_PlyWriterContext& theWriter, // NCollection_Vec4 aColorF = Quantity_ColorRGBA::Convert_LinearRGB_To_sRGB // (theFace.FaceColor()); NCollection_Vec4 aColorF = theFace.FaceColor(); - aColorVec.SetValues((unsigned char)int(aColorF.r() * 255.0f), - (unsigned char)int(aColorF.g() * 255.0f), - (unsigned char)int(aColorF.b() * 255.0f), - (unsigned char)int(aColorF.a() * 255.0f)); + aColorVec.SetValues(static_cast(static_cast(aColorF.r() * 255.0f)), + static_cast(static_cast(aColorF.g() * 255.0f)), + static_cast(static_cast(aColorF.b() * 255.0f)), + static_cast(static_cast(aColorF.a() * 255.0f))); } for (int aNodeIter = theFace.NodeLower(); aNodeIter <= aNodeUpper && thePSentry.More(); ++aNodeIter, thePSentry.Next()) @@ -249,13 +249,13 @@ bool RWPly_CafWriter::writeNodes(RWPly_PlyWriterContext& theWriter, if (theFace.HasNormals()) { gp_Dir aNorm = theFace.NormalTransformed(aNodeIter); - aNormVec.SetValues((float)aNorm.X(), (float)aNorm.Y(), (float)aNorm.Z()); + aNormVec.SetValues(static_cast(aNorm.X()), static_cast(aNorm.Y()), static_cast(aNorm.Z())); myCSTrsf.TransformNormal(aNormVec); } if (theFace.HasTexCoords()) { const gp_Pnt2d aUV = theFace.NodeTexCoord(aNodeIter); - aTexVec.SetValues((float)aUV.X(), (float)aUV.Y()); + aTexVec.SetValues(static_cast(aUV.X()), static_cast(aUV.Y())); } if (!theWriter.WriteVertex(aNode, aNormVec, aTexVec, aColorVec)) diff --git a/src/DataExchange/TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx b/src/DataExchange/TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx index 7f892e7e368..8a24db09e6a 100644 --- a/src/DataExchange/TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx +++ b/src/DataExchange/TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx @@ -236,24 +236,24 @@ bool RWPly_PlyWriterContext::WriteVertex(const gp_Pnt& thePoi if (myIsDoublePrec) { - *myStream << (double)thePoint.X() << " " << (double)thePoint.Y() << " " << (double)thePoint.Z(); + *myStream << thePoint.X() << " " << thePoint.Y() << " " << thePoint.Z(); } else { - *myStream << (float)thePoint.X() << " " << (float)thePoint.Y() << " " << (float)thePoint.Z(); + *myStream << static_cast(thePoint.X()) << " " << static_cast(thePoint.Y()) << " " << static_cast(thePoint.Z()); } if (myHasNormals) { - *myStream << " " << (float)theNorm.x() << " " << (float)theNorm.y() << " " - << (float)theNorm.z(); + *myStream << " " << static_cast(theNorm.x()) << " " << static_cast(theNorm.y()) << " " + << static_cast(theNorm.z()); } if (myHasTexCoords) { - *myStream << " " << (float)theUV.x() << " " << (float)theUV.y(); + *myStream << " " << static_cast(theUV.x()) << " " << static_cast(theUV.y()); } if (myHasColors) { - *myStream << " " << (int)theColor.r() << " " << (int)theColor.g() << " " << (int)theColor.b(); + *myStream << " " << static_cast(theColor.r()) << " " << static_cast(theColor.g()) << " " << static_cast(theColor.b()); } *myStream << "\n"; if (++myNbVerts > myNbHeaderVerts) diff --git a/src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx b/src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx index dd2fbbf0b05..13ac75e42c4 100644 --- a/src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx +++ b/src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx @@ -55,20 +55,19 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); InternalParameters.ReadBSplineContinuity = - (DESTEP_Parameters::ReadMode_BSplineContinuity)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "read.iges.bspline.continuity", InternalParameters.ReadBSplineContinuity, - aScope); + aScope)); InternalParameters.ReadPrecisionMode = - (DESTEP_Parameters::ReadMode_Precision) - theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope); + static_cast(theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope)); InternalParameters.ReadPrecisionVal = theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope); InternalParameters.ReadMaxPrecisionMode = - (DESTEP_Parameters::ReadMode_MaxPrecision)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "read.maxprecision.mode", InternalParameters.ReadMaxPrecisionMode, - aScope); + aScope)); InternalParameters.ReadMaxPrecisionVal = theResource->RealVal("read.maxprecision.val", InternalParameters.ReadMaxPrecisionVal, aScope); InternalParameters.ReadSameParamMode = @@ -76,34 +75,32 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& InternalParameters.ReadSameParamMode, aScope); InternalParameters.ReadSurfaceCurveMode = - (DESTEP_Parameters::ReadMode_SurfaceCurve)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "read.surfacecurve.mode", InternalParameters.ReadSurfaceCurveMode, - aScope); + aScope)); InternalParameters.EncodeRegAngle = theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope); InternalParameters.AngleUnit = - (DESTEP_Parameters::AngleUnitMode)theResource->IntegerVal("angleunit.mode", + static_cast(theResource->IntegerVal("angleunit.mode", InternalParameters.AngleUnit, - aScope); + aScope)); InternalParameters.ReadProductMode = theResource->BooleanVal("read.product.mode", InternalParameters.ReadProductMode, aScope); InternalParameters.ReadProductContext = - (DESTEP_Parameters::ReadMode_ProductContext)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "read.product.context", InternalParameters.ReadProductContext, - aScope); + aScope)); InternalParameters.ReadShapeRepr = - (DESTEP_Parameters::ReadMode_ShapeRepr)theResource->IntegerVal("read.shape.repr", + static_cast(theResource->IntegerVal("read.shape.repr", InternalParameters.ReadShapeRepr, - aScope); + aScope)); InternalParameters.ReadTessellated = - (DESTEP_Parameters::RWMode_Tessellated) - theResource->IntegerVal("read.tessellated", InternalParameters.ReadTessellated, aScope); + static_cast(theResource->IntegerVal("read.tessellated", InternalParameters.ReadTessellated, aScope)); InternalParameters.ReadAssemblyLevel = - (DESTEP_Parameters::ReadMode_AssemblyLevel) - theResource->IntegerVal("read.assembly.level", InternalParameters.ReadAssemblyLevel, aScope); + static_cast(theResource->IntegerVal("read.assembly.level", InternalParameters.ReadAssemblyLevel, aScope)); InternalParameters.ReadRelationship = theResource->BooleanVal("read.shape.relationship", InternalParameters.ReadRelationship, aScope); InternalParameters.ReadShapeAspect = @@ -117,9 +114,9 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& InternalParameters.ReadSubshapeNames, aScope); InternalParameters.ReadCodePage = - (Resource_FormatType)theResource->IntegerVal("read.codepage", + static_cast(theResource->IntegerVal("read.codepage", InternalParameters.ReadCodePage, - aScope); + aScope)); InternalParameters.ReadNonmanifold = theResource->BooleanVal("read.nonmanifold", InternalParameters.ReadNonmanifold, aScope); InternalParameters.ReadIdeas = @@ -144,23 +141,22 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& theResource->BooleanVal("read.productmetadata", InternalParameters.ReadProductMetadata, aScope); InternalParameters.WritePrecisionMode = - (DESTEP_Parameters::WriteMode_PrecisionMode)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "write.precision.mode", InternalParameters.WritePrecisionMode, - aScope); + aScope)); InternalParameters.WritePrecisionVal = theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope); InternalParameters.WriteAssembly = - (DESTEP_Parameters::WriteMode_Assembly)theResource->IntegerVal("write.assembly", + static_cast(theResource->IntegerVal("write.assembly", InternalParameters.WriteAssembly, - aScope); + aScope)); InternalParameters.WriteSchema = - (DESTEP_Parameters::WriteMode_StepSchema)theResource->IntegerVal("write.schema", + static_cast(theResource->IntegerVal("write.schema", InternalParameters.WriteSchema, - aScope); + aScope)); InternalParameters.WriteTessellated = - (DESTEP_Parameters::RWMode_Tessellated) - theResource->IntegerVal("write.tessellated", InternalParameters.WriteTessellated, aScope); + static_cast(theResource->IntegerVal("write.tessellated", InternalParameters.WriteTessellated, aScope)); InternalParameters.WriteProductName = theResource->StringVal("write.product.name", InternalParameters.WriteProductName, aScope); InternalParameters.WriteSurfaceCurMode = @@ -168,12 +164,11 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& InternalParameters.WriteSurfaceCurMode, aScope); InternalParameters.WriteUnit = - (UnitsMethods_LengthUnit)theResource->IntegerVal("write.unit", + static_cast(theResource->IntegerVal("write.unit", InternalParameters.WriteUnit, - aScope); + aScope)); InternalParameters.WriteVertexMode = - (DESTEP_Parameters::WriteMode_VertexMode) - theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope); + static_cast(theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope)); InternalParameters.WriteSubshapeNames = theResource->BooleanVal("write.stepcaf.subshapes.name", InternalParameters.WriteSubshapeNames, @@ -195,9 +190,9 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& InternalParameters.WriteVisMaterial = theResource->BooleanVal("write.vismaterial", InternalParameters.WriteVisMaterial, aScope); InternalParameters.WriteModelType = - (STEPControl_StepModelType)theResource->IntegerVal("write.model.type", + static_cast(theResource->IntegerVal("write.model.type", InternalParameters.WriteModelType, - aScope); + aScope)); InternalParameters.CleanDuplicates = theResource->BooleanVal("write.cleanduplicates", InternalParameters.CleanDuplicates, aScope); InternalParameters.WriteScalingTrsf = @@ -680,7 +675,7 @@ bool DESTEP_ConfigurationNode::CheckContent(const occ::handleData(); + const char* aBytes = reinterpret_cast(theBuffer->Data()); if (::strstr(aBytes, "IFC")) { return false; diff --git a/src/DataExchange/TKDESTEP/DESTEP/DESTEP_Parameters.cxx b/src/DataExchange/TKDESTEP/DESTEP/DESTEP_Parameters.cxx index e3498f2961d..500051a18e6 100644 --- a/src/DataExchange/TKDESTEP/DESTEP/DESTEP_Parameters.cxx +++ b/src/DataExchange/TKDESTEP/DESTEP/DESTEP_Parameters.cxx @@ -23,60 +23,60 @@ DESTEP_Parameters::DESTEP_Parameters() = default; void DESTEP_Parameters::InitFromStatic() { - ReadBSplineContinuity = (DESTEP_Parameters::ReadMode_BSplineContinuity)Interface_Static::IVal( - "read.iges.bspline.continuity"); + ReadBSplineContinuity = static_cast(Interface_Static::IVal( + "read.iges.bspline.continuity")); ReadPrecisionMode = - (DESTEP_Parameters::ReadMode_Precision)Interface_Static::IVal("read.precision.mode"); + static_cast(Interface_Static::IVal("read.precision.mode")); ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); ReadMaxPrecisionMode = - (DESTEP_Parameters::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode"); + static_cast(Interface_Static::IVal("read.maxprecision.mode")); ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; ReadSurfaceCurveMode = - (DESTEP_Parameters::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode"); + static_cast(Interface_Static::IVal("read.surfacecurve.mode")); EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI; - AngleUnit = (DESTEP_Parameters::AngleUnitMode)Interface_Static::IVal("step.angleunit.mode"); + AngleUnit = static_cast(Interface_Static::IVal("step.angleunit.mode")); ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1; ReadProductContext = - (DESTEP_Parameters::ReadMode_ProductContext)Interface_Static::IVal("read.step.product.context"); + static_cast(Interface_Static::IVal("read.step.product.context")); ReadShapeRepr = - (DESTEP_Parameters::ReadMode_ShapeRepr)Interface_Static::IVal("read.step.shape.repr"); + static_cast(Interface_Static::IVal("read.step.shape.repr")); ReadTessellated = - (DESTEP_Parameters::RWMode_Tessellated)Interface_Static::IVal("read.step.tessellated"); + static_cast(Interface_Static::IVal("read.step.tessellated")); ReadAssemblyLevel = - (DESTEP_Parameters::ReadMode_AssemblyLevel)Interface_Static::IVal("read.step.assembly.level"); + static_cast(Interface_Static::IVal("read.step.assembly.level")); ReadRelationship = Interface_Static::IVal("read.step.shape.relationship") == 1; ReadShapeAspect = Interface_Static::IVal("read.step.shape.aspect") == 1; ReadConstrRelation = Interface_Static::IVal("read.step.constructivegeom.relationship") == 1; ReadSubshapeNames = Interface_Static::IVal("read.stepcaf.subshapes.name") == 1; - ReadCodePage = (Resource_FormatType)Interface_Static::IVal("read.step.codepage"); + ReadCodePage = static_cast(Interface_Static::IVal("read.step.codepage")); ReadNonmanifold = Interface_Static::IVal("read.step.nonmanifold") == 1; ReadIdeas = Interface_Static::IVal("read.step.ideas") == 1; ReadAllShapes = Interface_Static::IVal("read.step.all.shapes") == 1; ReadRootTransformation = Interface_Static::IVal("read.step.root.transformation") == 1; WritePrecisionMode = - (DESTEP_Parameters::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode"); + static_cast(Interface_Static::IVal("write.precision.mode")); WritePrecisionVal = Interface_Static::RVal("write.precision.val"); WriteAssembly = - (DESTEP_Parameters::WriteMode_Assembly)Interface_Static::IVal("write.step.assembly"); + static_cast(Interface_Static::IVal("write.step.assembly")); WriteSchema = - (DESTEP_Parameters::WriteMode_StepSchema)Interface_Static::IVal("write.step.schema"); + static_cast(Interface_Static::IVal("write.step.schema")); WriteTessellated = - (DESTEP_Parameters::RWMode_Tessellated)Interface_Static::IVal("write.step.tessellated"); + static_cast(Interface_Static::IVal("write.step.tessellated")); WriteProductName = Interface_Static::CVal("write.step.product.name"); WriteSurfaceCurMode = Interface_Static::IVal("write.surfacecurve.mode") == 1; - WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.step.unit"); + WriteUnit = static_cast(Interface_Static::IVal("write.step.unit")); WriteVertexMode = - (DESTEP_Parameters::WriteMode_VertexMode)Interface_Static::IVal("write.step.vertex.mode"); + static_cast(Interface_Static::IVal("write.step.vertex.mode")); WriteSubshapeNames = Interface_Static::IVal("write.stepcaf.subshapes.name") == 1; WriteColor = Interface_Static::IVal("write.color") == 1; WriteNonmanifold = Interface_Static::IVal("write.step.nonmanifold") == 1; WriteName = Interface_Static::IVal("write.name") == 1; WriteLayer = Interface_Static::IVal("write.layer") == 1; WriteProps = Interface_Static::IVal("write.props") == 1; - WriteModelType = (STEPControl_StepModelType)Interface_Static::IVal("write.model.type"); + WriteModelType = static_cast(Interface_Static::IVal("write.model.type")); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_GDTProperty.cxx b/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_GDTProperty.cxx index 7595be1a0e3..b82a8a9105c 100644 --- a/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_GDTProperty.cxx +++ b/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_GDTProperty.cxx @@ -662,7 +662,7 @@ void STEPCAFControl_GDTProperty::GetDimClassOfTolerance( theG = XCAFDimTolObjects_DimensionGrade_IT01; if (!aGrade.IsNull() && !aGrade->String().IsEqual("01") && aGrade->IsIntegerValue()) { - theG = (XCAFDimTolObjects_DimensionGrade)(aGrade->IntegerValue() + 1); + theG = static_cast(aGrade->IntegerValue() + 1); } } @@ -1075,7 +1075,7 @@ occ::handle STEPCAFControl_GDTProperty::GetLimitsAndFit if (theGrade == XCAFDimTolObjects_DimensionGrade_IT01) aGradeStr = new TCollection_HAsciiString("01"); else - aGradeStr = new TCollection_HAsciiString((int)theGrade + 1); + aGradeStr = new TCollection_HAsciiString(static_cast(theGrade) + 1); switch (theFormVariance) { diff --git a/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Reader.cxx index 5317d542d0f..c21bbf32415 100644 --- a/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -998,9 +998,9 @@ static void propagateColorToParts(const occ::handle& theSTool TDF_Label aColorL, aDummyColorL; for (int aType = 1; aType <= 3; aType++) { - if (theCTool->GetColor(theRoot, (XCAFDoc_ColorType)aType, aColorL) - && !theCTool->GetColor(anOriginalL, (XCAFDoc_ColorType)aType, aDummyColorL)) - theCTool->SetColor(anOriginalL, aColorL, (XCAFDoc_ColorType)aType); + if (theCTool->GetColor(theRoot, static_cast(aType), aColorL) + && !theCTool->GetColor(anOriginalL, static_cast(aType), aDummyColorL)) + theCTool->SetColor(anOriginalL, aColorL, static_cast(aType)); } if (!theCTool->IsVisible(theRoot)) theCTool->SetVisibility(anOriginalL, false); @@ -3334,13 +3334,13 @@ bool STEPCAFControl_Reader::readDatumsAP242(const occ::handleLower(); m <= aModif->Upper(); m++) { if (aModif->Value(m).CaseNumber() == 2) - aXCAFModifiers.Append((XCAFDimTolObjects_DatumSingleModif)aModif->Value(m) + aXCAFModifiers.Append(static_cast(aModif->Value(m) .SimpleDatumReferenceModifierMember() - ->Value()); + ->Value())); else if (aModif->Value(m).CaseNumber() == 1) { aXCAFModifWithVal = - (XCAFDimTolObjects_DatumModifWithValue)(aModif->Value(m) + static_cast(aModif->Value(m) .DatumReferenceModifierWithValue() ->ModifierType() + 1); @@ -3394,13 +3394,13 @@ bool STEPCAFControl_Reader::readDatumsAP242(const occ::handleLower(); k <= aModifE->Upper(); k++) { if (aModifE->Value(k).CaseNumber() == 2) - aXCAFModifiers.Append((XCAFDimTolObjects_DatumSingleModif)aModifE->Value(k) + aXCAFModifiers.Append(static_cast(aModifE->Value(k) .SimpleDatumReferenceModifierMember() - ->Value()); + ->Value())); else if (aModifE->Value(k).CaseNumber() == 1) { aXCAFModifWithVal = - (XCAFDimTolObjects_DatumModifWithValue)(aModifE->Value(k) + static_cast(aModifE->Value(k) .DatumReferenceModifierWithValue() ->ModifierType() + 1); @@ -4688,7 +4688,7 @@ static void setGeomTolObjectToXCAF(const occ::handle& the else if (aModifiers->Value(i) == StepDimTol_GTMMaximumMaterialRequirement) aTolObj->SetMaterialRequirementModifier(XCAFDimTolObjects_GeomToleranceMatReqModif_M); else - aTolObj->AddModifier((XCAFDimTolObjects_GeomToleranceModif)aModifiers->Value(i)); + aTolObj->AddModifier(static_cast(aModifiers->Value(i))); } } double aVal = 0; diff --git a/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_AP203Context.cxx b/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_AP203Context.cxx index 84778d09186..3b5aabd3a4c 100644 --- a/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_AP203Context.cxx +++ b/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_AP203Context.cxx @@ -113,7 +113,7 @@ occ::handle STEPConstruct_AP203Context::DefaultDateAndTim long shift = 0; _get_timezone(&shift); #else - int shift = int(timezone); + int shift = static_cast(timezone); #endif int shifth = abs(shift) / 3600; int shiftm = (abs(shift) - shifth * 3600) / 60; diff --git a/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_RenderingProperties.cxx b/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_RenderingProperties.cxx index 3a389d2bdd8..0bad8a08ac0 100644 --- a/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_RenderingProperties.cxx +++ b/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_RenderingProperties.cxx @@ -345,7 +345,7 @@ XCAFDoc_VisMaterialCommon STEPConstruct_RenderingProperties::CreateXCAFMaterial( // Convert STEP specular exponent to XCAF shininess using fixed scale factor const double kScaleFactor = 128.0; const double aShininess = mySpecularExponent.first / kScaleFactor; - aMaterial.Shininess = (float)std::min(1.0, aShininess); + aMaterial.Shininess = static_cast(std::min(1.0, aShininess)); } return aMaterial; diff --git a/src/DataExchange/TKDESTEP/StepAP209/StepAP209_Construct.cxx b/src/DataExchange/TKDESTEP/StepAP209/StepAP209_Construct.cxx index 44c2fb6e4ea..3613636cc5e 100644 --- a/src/DataExchange/TKDESTEP/StepAP209/StepAP209_Construct.cxx +++ b/src/DataExchange/TKDESTEP/StepAP209/StepAP209_Construct.cxx @@ -1126,7 +1126,7 @@ bool StepAP209_Construct::CreateAddingEntities( smodel->AddEntity(CUTO); smodel->SetIdentLabel(CUTO, smodel->Number(CUTO)); occ::handle LT = new StepBasic_LocalTime; - LT->Init(date.Hour(), true, date.Minute(), true, (double)date.Second(), CUTO); + LT->Init(date.Hour(), true, date.Minute(), true, static_cast(date.Second()), CUTO); smodel->AddWithRefs(LT); smodel->SetIdentLabel(LT, smodel->Number(LT)); occ::handle DAT = new StepBasic_DateAndTime; diff --git a/src/DataExchange/TKDESTEP/StepData/StepData_Field.cxx b/src/DataExchange/TKDESTEP/StepData/StepData_Field.cxx index 807000ccf70..a633e890666 100644 --- a/src/DataExchange/TKDESTEP/StepData/StepData_Field.cxx +++ b/src/DataExchange/TKDESTEP/StepData/StepData_Field.cxx @@ -347,7 +347,7 @@ void StepData_Field::SetList2(const int siz1, const int siz2, const int f1, cons // WARNING: we don't handle expansion... theint = siz1; - thereal = double(siz2); + thereal = static_cast(siz2); theany.Nullify(); int kind = thekind; if (thekind == KindSelect) @@ -442,7 +442,7 @@ void StepData_Field::Set(const occ::handle& val) kind = KindInteger; thekind = kind | KindList2; theint = hi2->ColLength(); - thereal = double(hi2->RowLength()); + thereal = static_cast(hi2->RowLength()); return; } DeclareAndCast(NCollection_HArray2, hr2, val); @@ -450,7 +450,7 @@ void StepData_Field::Set(const occ::handle& val) { thekind = KindInteger | KindList2; theint = hr2->ColLength(); - thereal = double(hi2->RowLength()); + thereal = static_cast(hi2->RowLength()); return; } DeclareAndCast(NCollection_HArray2>, ht2, val); @@ -460,7 +460,7 @@ void StepData_Field::Set(const occ::handle& val) kind = KindAny; thekind = kind | KindList2; theint = ht2->ColLength(); - thereal = double(hi2->RowLength()); + thereal = static_cast(hi2->RowLength()); return; } } @@ -733,7 +733,7 @@ int StepData_Field::Length(const int index) const if ((thekind & KindArity) == KindList2) { if (index == 2) - return int(thereal); + return static_cast(thereal); else return theint; } diff --git a/src/DataExchange/TKDESTEP/StepData/StepData_StepDumper.cxx b/src/DataExchange/TKDESTEP/StepData/StepData_StepDumper.cxx index c3ab1141eea..33b193e0ad5 100644 --- a/src/DataExchange/TKDESTEP/StepData/StepData_StepDumper.cxx +++ b/src/DataExchange/TKDESTEP/StepData/StepData_StepDumper.cxx @@ -213,7 +213,7 @@ bool StepData_StepDumper::Dump(Standard_OStream& S, if (ids.Value(i) <= 0 || ids.Value(i) == i) continue; Sprintf(unid, "%d:#%d", i, ids.Value(i)); - nbc = (int)strlen(unid); + nbc = static_cast(strlen(unid)); nbr = ((80 - nbc) % 4) + 2; nbl += nbc; if (nbl + nbr0 > 79) diff --git a/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderData.cxx b/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderData.cxx index 84255ee87f7..d86b72748e0 100644 --- a/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderData.cxx +++ b/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderData.cxx @@ -149,7 +149,7 @@ void StepData_StepReaderData::cleanText(const occ::handle(aResString.Value(aStringInd + 2) & 255)); if (aPageId >= 'A' && aPageId <= 'I') { - aLocalFormatType = (Resource_FormatType)(Resource_FormatType_iso8859_1 + (aPageId - 'A')); + aLocalFormatType = static_cast(Resource_FormatType_iso8859_1 + (aPageId - 'A')); } else { @@ -175,9 +175,9 @@ void StepData_StepReaderData::cleanText(const occ::handle(convertCharacterTo16bit(aResString.Value(aStringInd + 3))); aResChar = - (aResChar << 4) | (char)convertCharacterTo16bit(aResString.Value(aStringInd + 4)); + (aResChar << 4) | static_cast(convertCharacterTo16bit(aResString.Value(aStringInd + 4))); const char aStrForConvert[2] = {aResChar, '\0'}; // clang-format off aTempExtString = TCollection_ExtendedString(aStrForConvert, false); // pass through without conversion @@ -465,7 +465,7 @@ void StepData_StepReaderData::AddStepParam(const int num, } else { - char* numlstchar = (char*)(aval + 1); + char* numlstchar = const_cast(aval + 1); numid = (*numlstchar) - 48; // -48 ('0') -1 (adresse [] depuis 0) // Interface_FileReaderData::AddParam (num,subl[numid].ToCString(),atype,numid); Interface_FileReaderData::AddParam(num, aval, atype, numid); diff --git a/src/DataExchange/TKDESTEP/StepData/StepData_StepWriter.cxx b/src/DataExchange/TKDESTEP/StepData/StepData_StepWriter.cxx index e93e9848f5b..90b2f2c9dcf 100644 --- a/src/DataExchange/TKDESTEP/StepData/StepData_StepWriter.cxx +++ b/src/DataExchange/TKDESTEP/StepData/StepData_StepWriter.cxx @@ -491,7 +491,7 @@ void StepData_StepWriter::SendComment(const char* const text) { if (!thecomm) throw Interface_InterfaceMismatch("StepWriter : Comment"); - AddString(text, (int)strlen(text)); + AddString(text, static_cast(strlen(text))); } //================================================================================================= @@ -776,7 +776,7 @@ void StepData_StepWriter::OpenTypedSub(const char* const subtype) { AddParam(); if (subtype[0] != '\0') - AddString(subtype, (int)strlen(subtype)); + AddString(subtype, static_cast(strlen(subtype))); AddString(textlist); thefirst = true; thelevel++; @@ -807,7 +807,7 @@ void StepData_StepWriter::Send(const int val) char lval[12]; AddParam(); Sprintf(lval, "%d", val); - AddString(lval, (int)strlen(lval)); + AddString(lval, static_cast(strlen(lval))); } //================================================================================================= @@ -951,7 +951,7 @@ void StepData_StepWriter::Send(const occ::handle& val) else Sprintf(lident, "%d:#%d", idnum, idtrue); AddParam(); - AddString(lident, (int)strlen(lident)); + AddString(lident, static_cast(strlen(lident))); } } @@ -994,7 +994,7 @@ void StepData_StepWriter::SendString(const TCollection_AsciiString& val) void StepData_StepWriter::SendString(const char* const val) { AddParam(); - AddString(val, (int)strlen(val)); + AddString(val, static_cast(strlen(val))); } // SendEnum: note, we send an Enum label ... so between . . diff --git a/src/DataExchange/TKDESTEP/StepData/StepData_UndefinedEntity.cxx b/src/DataExchange/TKDESTEP/StepData/StepData_UndefinedEntity.cxx index 473c141d4a8..0b68b241f95 100644 --- a/src/DataExchange/TKDESTEP/StepData/StepData_UndefinedEntity.cxx +++ b/src/DataExchange/TKDESTEP/StepData/StepData_UndefinedEntity.cxx @@ -106,7 +106,7 @@ void StepData_UndefinedEntity::ReadRecord(const occ::handle(strlen(val)); int mval = -1; for (int j = 0; j < lval; j++) { diff --git a/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_SimpleDatumReferenceModifierMember.cxx b/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_SimpleDatumReferenceModifierMember.cxx index 921179aad15..a3e9b3e502a 100644 --- a/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_SimpleDatumReferenceModifierMember.cxx +++ b/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_SimpleDatumReferenceModifierMember.cxx @@ -69,7 +69,7 @@ void StepDimTol_SimpleDatumReferenceModifierMember::SetEnumText(const int /*theV void StepDimTol_SimpleDatumReferenceModifierMember::SetValue( const StepDimTol_SimpleDatumReferenceModifier theValue) { - SetInt(int(theValue)); + SetInt(static_cast(theValue)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/StepElement/StepElement_CurveElementFreedom.cxx b/src/DataExchange/TKDESTEP/StepElement/StepElement_CurveElementFreedom.cxx index 82595dcbe51..dfb127ffffb 100644 --- a/src/DataExchange/TKDESTEP/StepElement/StepElement_CurveElementFreedom.cxx +++ b/src/DataExchange/TKDESTEP/StepElement/StepElement_CurveElementFreedom.cxx @@ -68,7 +68,7 @@ void StepElement_CurveElementFreedom::SetEnumeratedCurveElementFreedom( occ::handle name = new TCollection_HAsciiString("ENUMERATED_CURVE_ELEMENT_FREEDOM"); SelMem->SetName(name->ToCString()); - SelMem->SetEnum((int)val); + SelMem->SetEnum(static_cast(val)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/StepElement/StepElement_CurveElementPurpose.cxx b/src/DataExchange/TKDESTEP/StepElement/StepElement_CurveElementPurpose.cxx index 11f5e7ed7ba..b63e7ab5bd1 100644 --- a/src/DataExchange/TKDESTEP/StepElement/StepElement_CurveElementPurpose.cxx +++ b/src/DataExchange/TKDESTEP/StepElement/StepElement_CurveElementPurpose.cxx @@ -65,7 +65,7 @@ void StepElement_CurveElementPurpose::SetEnumeratedCurveElementPurpose( occ::handle name = new TCollection_HAsciiString("ENUMERATED_CURVE_ELEMENT_PURPOSE"); SelMem->SetName(name->ToCString()); - SelMem->SetEnum((int)val); + SelMem->SetEnum(static_cast(val)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/StepElement/StepElement_ElementAspect.cxx b/src/DataExchange/TKDESTEP/StepElement/StepElement_ElementAspect.cxx index 3122aa76822..6c28cc0dc30 100644 --- a/src/DataExchange/TKDESTEP/StepElement/StepElement_ElementAspect.cxx +++ b/src/DataExchange/TKDESTEP/StepElement/StepElement_ElementAspect.cxx @@ -79,7 +79,7 @@ void StepElement_ElementAspect::SetElementVolume(const StepElement_ElementVolume return; occ::handle name = new TCollection_HAsciiString("ELEMENT_VOLUME"); SelMem->SetName(name->ToCString()); - SelMem->SetEnum((int)val); + SelMem->SetEnum(static_cast(val)); } //================================================================================================= @@ -359,7 +359,7 @@ void StepElement_ElementAspect::SetCurveEdge(const StepElement_CurveEdge val) return; occ::handle name = new TCollection_HAsciiString("CURVE_EDGE"); SelMem->SetName(name->ToCString()); - SelMem->SetEnum((int)val); + SelMem->SetEnum(static_cast(val)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/StepElement/StepElement_MeasureOrUnspecifiedValue.cxx b/src/DataExchange/TKDESTEP/StepElement/StepElement_MeasureOrUnspecifiedValue.cxx index fd87ed7dd5b..dd238695c29 100644 --- a/src/DataExchange/TKDESTEP/StepElement/StepElement_MeasureOrUnspecifiedValue.cxx +++ b/src/DataExchange/TKDESTEP/StepElement/StepElement_MeasureOrUnspecifiedValue.cxx @@ -101,7 +101,7 @@ void StepElement_MeasureOrUnspecifiedValue::SetUnspecifiedValue( return; occ::handle name = new TCollection_HAsciiString("UNSPECIFIED_VALUE"); SelMem->SetName(name->ToCString()); - SelMem->SetEnum((int)val); + SelMem->SetEnum(static_cast(val)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/StepElement/StepElement_SurfaceElementPurpose.cxx b/src/DataExchange/TKDESTEP/StepElement/StepElement_SurfaceElementPurpose.cxx index ecce70051ec..09fea87f41c 100644 --- a/src/DataExchange/TKDESTEP/StepElement/StepElement_SurfaceElementPurpose.cxx +++ b/src/DataExchange/TKDESTEP/StepElement/StepElement_SurfaceElementPurpose.cxx @@ -65,7 +65,7 @@ void StepElement_SurfaceElementPurpose::SetEnumeratedSurfaceElementPurpose( occ::handle name = new TCollection_HAsciiString("EnumeratedSurfaceElementPurpose"); SelMem->SetName(name->ToCString()); - SelMem->SetEnum((int)val); + SelMem->SetEnum(static_cast(val)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/StepElement/StepElement_VolumeElementPurpose.cxx b/src/DataExchange/TKDESTEP/StepElement/StepElement_VolumeElementPurpose.cxx index b0cbe9fd265..bf35216a7df 100644 --- a/src/DataExchange/TKDESTEP/StepElement/StepElement_VolumeElementPurpose.cxx +++ b/src/DataExchange/TKDESTEP/StepElement/StepElement_VolumeElementPurpose.cxx @@ -65,7 +65,7 @@ void StepElement_VolumeElementPurpose::SetEnumeratedVolumeElementPurpose( occ::handle name = new TCollection_HAsciiString("EnumeratedVolumeElementPurpose"); SelMem->SetName(name->ToCString()); - SelMem->SetEnum((int)val); + SelMem->SetEnum(static_cast(val)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/StepFEA/StepFEA_DegreeOfFreedom.cxx b/src/DataExchange/TKDESTEP/StepFEA/StepFEA_DegreeOfFreedom.cxx index 4a352dbbd79..9722d2e7e20 100644 --- a/src/DataExchange/TKDESTEP/StepFEA/StepFEA_DegreeOfFreedom.cxx +++ b/src/DataExchange/TKDESTEP/StepFEA/StepFEA_DegreeOfFreedom.cxx @@ -65,7 +65,7 @@ void StepFEA_DegreeOfFreedom::SetEnumeratedDegreeOfFreedom( occ::handle name = new TCollection_HAsciiString("ENUMERATED_DEGREE_OF_FREEDOM"); SelMem->SetName(name->ToCString()); - SelMem->SetEnum((int)val); + SelMem->SetEnum(static_cast(val)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/StepFile/StepFile_ReadData.cxx b/src/DataExchange/TKDESTEP/StepFile/StepFile_ReadData.cxx index 3e7ea9dc25b..491015218b1 100644 --- a/src/DataExchange/TKDESTEP/StepFile/StepFile_ReadData.cxx +++ b/src/DataExchange/TKDESTEP/StepFile/StepFile_ReadData.cxx @@ -155,7 +155,7 @@ void StepFile_ReadData::CreateNewText(const char* theNewText, int theLenText) return; } // If error argument exists - prepare size to new text value and old result text - const int aLength = (myErrorArg) ? theLenText + (int)strlen(myResText) : theLenText; + const int aLength = (myErrorArg) ? theLenText + static_cast(strlen(myResText)) : theLenText; char* anOldResText = myResText; @@ -166,7 +166,7 @@ void StepFile_ReadData::CreateNewText(const char* theNewText, int theLenText) if (myErrorArg) { strcpy(myResText, anOldResText); - strcpy(myResText + (int)strlen(anOldResText), theNewText); + strcpy(myResText + static_cast(strlen(anOldResText)), theNewText); return; } strcpy(myResText, theNewText); @@ -235,7 +235,7 @@ void StepFile_ReadData::RecordListStart() else { aBufSub[0] = '$'; - aBufSub[1] = (char)(myNumSub + 48); + aBufSub[1] = static_cast(myNumSub + 48); aBufSub[2] = '\0'; } aSubRec->myIdent = RecordNewText(aBufSub); @@ -525,7 +525,7 @@ char* StepFile_ReadData::RecordNewText(char* theText) char* aSavResText; char* aNewText; aSavResText = myResText; - CreateNewText(theText, (int)strlen(theText)); + CreateNewText(theText, static_cast(strlen(theText))); aNewText = myResText; myResText = aSavResText; return aNewText; @@ -579,7 +579,7 @@ void StepFile_ReadData::PrintRecord(Record* theRecord) while (myCurrArg != nullptr) { aNumArg++; - anArgLen = (int)strlen(myCurrArg->myValue) + 18; + anArgLen = static_cast(strlen(myCurrArg->myValue)) + 18; aNumLen += anArgLen; if (aNumLen > 132) { diff --git a/src/DataExchange/TKDESTEP/StepToGeom/StepToGeom.cxx b/src/DataExchange/TKDESTEP/StepToGeom/StepToGeom.cxx index 32f24016602..aab6b9a1d76 100644 --- a/src/DataExchange/TKDESTEP/StepToGeom/StepToGeom.cxx +++ b/src/DataExchange/TKDESTEP/StepToGeom/StepToGeom.cxx @@ -1732,7 +1732,7 @@ occ::handle StepToGeom::MakePolyline(const occ::handlePnt()); else return nullptr; - Knots.SetValue(i, double(i - 1)); + Knots.SetValue(i, static_cast(i - 1)); Mults.SetValue(i, 1); } Mults.SetValue(1, 2); @@ -1767,7 +1767,7 @@ occ::handle StepToGeom::MakePolyline2d( Poles.SetValue(i, P->Pnt2d()); else return nullptr; - Knots.SetValue(i, double(i - 1)); + Knots.SetValue(i, static_cast(i - 1)); Mults.SetValue(i, 1); } Mults.SetValue(1, 2); diff --git a/src/DataExchange/TKDESTEP/StepVisual/StepVisual_MarkerMember.cxx b/src/DataExchange/TKDESTEP/StepVisual/StepVisual_MarkerMember.cxx index 0e3fade2ef7..e02a00adba7 100644 --- a/src/DataExchange/TKDESTEP/StepVisual/StepVisual_MarkerMember.cxx +++ b/src/DataExchange/TKDESTEP/StepVisual/StepVisual_MarkerMember.cxx @@ -56,7 +56,7 @@ void StepVisual_MarkerMember::SetEnumText(const int /*val*/, const char* const t void StepVisual_MarkerMember::SetValue(const StepVisual_MarkerType val) { - SetInt(int(val)); + SetInt(static_cast(val)); } StepVisual_MarkerType StepVisual_MarkerMember::Value() const diff --git a/src/DataExchange/TKDESTEP/StepVisual/StepVisual_NullStyleMember.cxx b/src/DataExchange/TKDESTEP/StepVisual/StepVisual_NullStyleMember.cxx index b73695b59b8..02d9d2b7d0f 100644 --- a/src/DataExchange/TKDESTEP/StepVisual/StepVisual_NullStyleMember.cxx +++ b/src/DataExchange/TKDESTEP/StepVisual/StepVisual_NullStyleMember.cxx @@ -45,7 +45,7 @@ void StepVisual_NullStyleMember::SetEnumText(const int /*theValue*/, const char* void StepVisual_NullStyleMember::SetValue(const StepVisual_NullStyle theValue) { - SetInt(int(theValue)); + SetInt(static_cast(theValue)); } //================================================================================================= diff --git a/src/DataExchange/TKDESTL/DESTL/DESTL_ConfigurationNode.cxx b/src/DataExchange/TKDESTL/DESTL/DESTL_ConfigurationNode.cxx index 9059cf6a6e2..2f2aa3b5954 100644 --- a/src/DataExchange/TKDESTL/DESTL/DESTL_ConfigurationNode.cxx +++ b/src/DataExchange/TKDESTL/DESTL/DESTL_ConfigurationNode.cxx @@ -167,7 +167,7 @@ bool DESTL_ConfigurationNode::CheckContent(const occ::handle { return false; } - const char* aBytes = (const char*)theBuffer->Data(); + const char* aBytes = reinterpret_cast(theBuffer->Data()); // binary STL has no header for identification - format can be detected only by file extension return !(::strncmp(aBytes, "solid", 5) || ::strncmp(aBytes, "SOLID", 5)) && isspace(aBytes[5]); } diff --git a/src/DataExchange/TKDESTL/RWStl/RWStl.cxx b/src/DataExchange/TKDESTL/RWStl/RWStl.cxx index 75d9ffd549a..8bdc781fc78 100644 --- a/src/DataExchange/TKDESTL/RWStl/RWStl.cxx +++ b/src/DataExchange/TKDESTL/RWStl/RWStl.cxx @@ -59,7 +59,7 @@ inline static void convertDouble(const double theValue, char* theResult) char c[4]; } anUnion; - anUnion.i = (float)theValue; + anUnion.i = static_cast(theValue); theResult[0] = anUnion.c[0]; theResult[1] = anUnion.c[1]; diff --git a/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.cxx b/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.cxx index e505b2293c8..63e6c9bb029 100644 --- a/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.cxx +++ b/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.cxx @@ -206,7 +206,7 @@ bool RWStl_Reader::IsAscii(Standard_IStream& theStream, const bool isSeekgAvaila } // if file is shorter than size of binary file with 1 facet, it must be ascii - if (aNbRead < std::streamsize(THE_STL_MIN_FILE_SIZE)) + if (aNbRead < static_cast(THE_STL_MIN_FILE_SIZE)) { return true; } @@ -215,7 +215,7 @@ bool RWStl_Reader::IsAscii(Standard_IStream& theStream, const bool isSeekgAvaila // (note that binary STL file may start with the same bytes "solid " as Ascii one) for (int aByteIter = 0; aByteIter < aNbRead; ++aByteIter) { - if ((unsigned char)aBuffer[aByteIter] > (unsigned char)'~') + if (static_cast(aBuffer[aByteIter]) > static_cast('~')) { return false; } @@ -263,7 +263,7 @@ static bool ReadVertex(const char* theStr, double& theX, double& theY, double& t const char* aStr = theStr; // skip 'vertex' - while (isspace((unsigned char)*aStr) || isalpha((unsigned char)*aStr)) + while (isspace(static_cast(*aStr)) || isalpha(static_cast(*aStr))) ++aStr; // read values @@ -311,7 +311,7 @@ bool RWStl_Reader::ReadAscii(Standard_IStream& theStream, // report progress every 1 MiB of read data const int aStepB = 1024 * 1024; - const int aNbSteps = 1 + int((GETPOS(theUntilPos) - aStartPos) / aStepB); + const int aNbSteps = 1 + static_cast((GETPOS(theUntilPos) - aStartPos) / aStepB); Message_ProgressScope aPS(theProgress, "Reading text STL file", aNbSteps); int64_t aProgressPos = aStartPos + aStepB; int aNbLine = 1; @@ -413,14 +413,14 @@ bool RWStl_Reader::ReadBinary(Standard_IStream& theStream, const Message_Progres // read file header at first char aHeader[THE_STL_HEADER_SIZE + 1]; - if (theStream.read(aHeader, THE_STL_HEADER_SIZE).gcount() != std::streamsize(THE_STL_HEADER_SIZE)) + if (theStream.read(aHeader, THE_STL_HEADER_SIZE).gcount() != static_cast(THE_STL_HEADER_SIZE)) { Message::SendFail("Error: Corrupted binary STL file"); return false; } // number of facets is stored as 32-bit integer at position 80 - const int aNbFacets = *(int32_t*)(aHeader + 80); + const int aNbFacets = *reinterpret_cast(aHeader + 80); MergeNodeTool aMergeTool(this, aNbFacets); aMergeTool.SetMergeAngle(myMergeAngle); diff --git a/src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx b/src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx index 09dcc47fb35..a785a5154bb 100644 --- a/src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx +++ b/src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx @@ -53,25 +53,25 @@ bool DEVRML_ConfigurationNode::Load(const occ::handle& InternalParameters.ReadFileUnit = theResource->RealVal("read.file.unit", InternalParameters.ReadFileUnit, aScope); InternalParameters.ReadFileCoordinateSys = - (RWMesh_CoordinateSystem)theResource->IntegerVal("read.file.coordinate.system", + static_cast(theResource->IntegerVal("read.file.coordinate.system", InternalParameters.ReadFileCoordinateSys, - aScope); + aScope)); InternalParameters.ReadSystemCoordinateSys = - (RWMesh_CoordinateSystem)theResource->IntegerVal("read.system.coordinate.system", + static_cast(theResource->IntegerVal("read.system.coordinate.system", InternalParameters.ReadSystemCoordinateSys, - aScope); + aScope)); InternalParameters.ReadFillIncomplete = theResource->BooleanVal("read.fill.incomplete", InternalParameters.ReadFillIncomplete, aScope); InternalParameters.WriterVersion = - (WriteMode_WriterVersion)theResource->IntegerVal("writer.version", + static_cast(theResource->IntegerVal("writer.version", InternalParameters.WriterVersion, - aScope); + aScope)); InternalParameters.WriteRepresentationType = - (WriteMode_RepresentationType)theResource->IntegerVal( + static_cast(theResource->IntegerVal( "write.representation.type", InternalParameters.WriteRepresentationType, - aScope); + aScope)); return true; } diff --git a/src/DataExchange/TKDEVRML/VrmlConverter/VrmlConverter_DeflectionCurve.cxx b/src/DataExchange/TKDEVRML/VrmlConverter/VrmlConverter_DeflectionCurve.cxx index cb454b70752..33ea7386f98 100644 --- a/src/DataExchange/TKDEVRML/VrmlConverter/VrmlConverter_DeflectionCurve.cxx +++ b/src/DataExchange/TKDEVRML/VrmlConverter/VrmlConverter_DeflectionCurve.cxx @@ -157,7 +157,7 @@ static void DrawCurve(Adaptor3d_Curve& aCurve, if (!Precision::IsInfinite(Radius)) { double DU = std::sqrt(8.0 * TheDeflection / Radius); - int N = int(std::abs(U2 - U1) / DU); + int N = static_cast(std::abs(U2 - U1) / DU); if (N > 0) { diff --git a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Geometry.cxx b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Geometry.cxx index 1ba38f8f5e5..360b4eff996 100644 --- a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Geometry.cxx +++ b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Geometry.cxx @@ -518,7 +518,7 @@ VrmlData_ErrorStatus VrmlData_TextureCoordinate::Read(VrmlData_InBuffer& theBuff gp_XY* aPoints = reinterpret_cast(Scene().Allocator()->Allocate(myLength * sizeof(gp_XY))); myPoints = aPoints; - for (int i = 0; i < int(myLength); i++) + for (int i = 0; i < static_cast(myLength); i++) aPoints[i] = vecValues(i); } } @@ -615,7 +615,7 @@ VrmlData_ErrorStatus VrmlData_ArrayVec3d::ReadArray(VrmlData_InBuffer& theBuffer gp_XYZ* anArray = reinterpret_cast(Scene().Allocator()->Allocate(myLength * sizeof(gp_XYZ))); myArray = anArray; - for (int i = 0; i < int(myLength); i++) + for (int i = 0; i < static_cast(myLength); i++) anArray[i] = vecValues(i); } } diff --git a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_IndexedFaceSet.cxx b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_IndexedFaceSet.cxx index de29a39e983..a5c6af246b8 100644 --- a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_IndexedFaceSet.cxx +++ b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_IndexedFaceSet.cxx @@ -92,14 +92,14 @@ const occ::handle& VrmlData_IndexedFaceSet::TShape() // list of nodes: const gp_XYZ* arrNodes = myCoords->Values(); - const int nNodes = (int)myCoords->Length(); + const int nNodes = static_cast(myCoords->Length()); NCollection_Map mapNodeId; NCollection_Map mapPolyId; NCollection_List> aPolygons; NCollection_List aNorms; int i = 0; - for (; i < (int)myNbPolygons; i++) + for (; i < static_cast(myNbPolygons); i++) { const int* arrIndice = myArrPolygons[i]; int nn = arrIndice[0]; @@ -245,7 +245,7 @@ const occ::handle& VrmlData_IndexedFaceSet::TShape() } else { - for (i = 0; i < (int)myNbPolygons; i++) + for (i = 0; i < static_cast(myNbPolygons); i++) { if (mapPolyId.Contains(i)) // check to avoid previously skipped faces { diff --git a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_IndexedLineSet.cxx b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_IndexedLineSet.cxx index ee5b7aa24d9..1e6171bf684 100644 --- a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_IndexedLineSet.cxx +++ b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_IndexedLineSet.cxx @@ -60,7 +60,7 @@ const occ::handle& VrmlData_IndexedLineSet::TShape() // Create the Wire TopoDS_Wire aWire; aBuilder.MakeWire(aWire); - for (i = 0; i < (int)myNbPolygons; i++) + for (i = 0; i < static_cast(myNbPolygons); i++) { const int* arrIndice; const int nNodes = Polygon(i, arrIndice); diff --git a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Node.cxx b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Node.cxx index 083b796211a..456456a7238 100644 --- a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Node.cxx +++ b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Node.cxx @@ -85,7 +85,7 @@ void VrmlData_Node::setName(const char* theName, const char* theSuffix) size_t len[2] = {strlen(theName) + 1, 0}; if (theSuffix) len[1] = strlen(theSuffix); - char* aName = (char*)Scene().Allocator()->Allocate(len[0] + len[1]); + char* aName = static_cast(Scene().Allocator()->Allocate(len[0] + len[1])); myName = aName; memcpy(aName, theName, len[0]); if (len[1]) @@ -520,7 +520,7 @@ VrmlData_ImageTexture::VrmlData_ImageTexture(const VrmlData_Scene& theScene, : VrmlData_Texture(theScene, theName, theRepS, theRepT), myURL(theScene.Allocator()) { - myURL.Append(theURL ? (const char*)theURL : ""); + myURL.Append(theURL ? theURL : ""); } //================================================================================================= diff --git a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Scene.cxx b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Scene.cxx index 830a6b166cb..d93e3f78a43 100644 --- a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Scene.cxx +++ b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_Scene.cxx @@ -164,7 +164,7 @@ void VrmlData_Scene::SetVrmlDir(const TCollection_ExtendedString& theDir) return; } const char16_t aTerminator = aDir.Value(aDir.Length()); - if (aTerminator != char16_t('\\') && aTerminator != char16_t('/')) + if (aTerminator != static_cast('\\') && aTerminator != static_cast('/')) #ifdef _WIN32 aDir += TCollection_ExtendedString("\\"); #else @@ -443,7 +443,7 @@ VrmlData_ErrorStatus VrmlData_Scene::ReadWord(VrmlData_InBuffer& theBuffer while (*ptr != '\0' && *ptr != '\n' && *ptr != '\r' && *ptr != ' ' && *ptr != '\t' && *ptr != '{' && *ptr != '}' && *ptr != ',' && *ptr != '[' && *ptr != ']') ptr++; - const int aLen = int(ptr - theBuffer.LinePtr); + const int aLen = static_cast(ptr - theBuffer.LinePtr); if (aLen <= 0) aStatus = VrmlData_StringInputError; else @@ -892,7 +892,7 @@ VrmlData_ErrorStatus VrmlData_Scene::ReadArrIndex(VrmlData_InBuffer& theBuffer, else { for (size_t i = 0; i < aNbBlocks; i++) - anArray[i] = vecIndice((int)i); + anArray[i] = vecIndice(static_cast(i)); theNBlocks = aNbBlocks; theArray = anArray; } @@ -944,7 +944,7 @@ VrmlData_ErrorStatus VrmlData_Scene::WriteArrIndex(const char* thePrefix, if (i == nVal - 1) break; ptr = strchr(ptr, ',') + 1; - if ((ptr - &buf[0]) > (ptrdiff_t)aLineLimit) + if ((ptr - &buf[0]) > static_cast(aLineLimit)) { WriteLine(buf); ptr = &buf[0]; diff --git a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_UnknownNode.hxx b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_UnknownNode.hxx index 5b413571967..0703e3a2363 100644 --- a/src/DataExchange/TKDEVRML/VrmlData/VrmlData_UnknownNode.hxx +++ b/src/DataExchange/TKDEVRML/VrmlData/VrmlData_UnknownNode.hxx @@ -43,7 +43,7 @@ public: : VrmlData_Node(theScene, theName) { if (theTitle) - myTitle = (const char*)theTitle; + myTitle = theTitle; } /** diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Color.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Color.cxx index 4b7e57be465..25004669f52 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Color.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Color.cxx @@ -130,7 +130,7 @@ void XCAFDoc_Color::Set(const double R, const double G, const double B, const do Quantity_Color aColor; aColor.SetValues(R, G, B, Quantity_TOC_RGB); myColor.SetRGB(aColor); - myColor.SetAlpha((float)alpha); + myColor.SetAlpha(static_cast(alpha)); } //================================================================================================= diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx index 16d01794415..e286643673d 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx @@ -344,7 +344,7 @@ occ::handle XCAFDoc_Datum::GetObject() const { NCollection_Sequence aModifiers; for (int i = 1; i <= anArr->Length(); i++) - aModifiers.Append((XCAFDimTolObjects_DatumSingleModif)anArr->Value(i)); + aModifiers.Append(static_cast(anArr->Value(i))); anObj->SetModifiers(aModifiers); } @@ -358,7 +358,7 @@ occ::handle XCAFDoc_Datum::GetObject() const .FindChild(ChildLab_ModifierWithValue) .FindAttribute(TDataStd_Real::GetID(), aModifierWithValueV)) { - anObj->SetModifierWithValue((XCAFDimTolObjects_DatumModifWithValue)aModifierWithValueM->Get(), + anObj->SetModifierWithValue(static_cast(aModifierWithValueM->Get()), aModifierWithValueV->Get()); } } @@ -423,7 +423,7 @@ occ::handle XCAFDoc_Datum::GetObject() const .FindChild(ChildLab_DTargetType) .FindAttribute(TDataStd_Integer::GetID(), aDTargetType)) { - anObj->SetDatumTargetType((XCAFDimTolObjects_DatumTargetType)aDTargetType->Get()); + anObj->SetDatumTargetType(static_cast(aDTargetType->Get())); if (anObj->GetDatumTargetType() == XCAFDimTolObjects_DatumTargetType_Area) { occ::handle aDatumTarget; diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx index 34586613d04..7a2c879d69d 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx @@ -340,7 +340,7 @@ occ::handle XCAFDoc_Dimension::GetObject() co occ::handle aType; if (Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType)) { - anObj->SetType((XCAFDimTolObjects_DimensionType)aType->Get()); + anObj->SetType(static_cast(aType->Get())); } occ::handle aVal; @@ -353,7 +353,7 @@ occ::handle XCAFDoc_Dimension::GetObject() co occ::handle aQualifier; if (Label().FindChild(ChildLab_Qualifier).FindAttribute(TDataStd_Integer::GetID(), aQualifier)) { - anObj->SetQualifier((XCAFDimTolObjects_DimensionQualifier)aQualifier->Get()); + anObj->SetQualifier(static_cast(aQualifier->Get())); } occ::handle anAngularQualifier; @@ -361,7 +361,7 @@ occ::handle XCAFDoc_Dimension::GetObject() co .FindChild(ChildLab_AngularQualifier) .FindAttribute(TDataStd_Integer::GetID(), anAngularQualifier)) { - anObj->SetAngularQualifier((XCAFDimTolObjects_AngularQualifier)anAngularQualifier->Get()); + anObj->SetAngularQualifier(static_cast(anAngularQualifier->Get())); } occ::handle aClass; @@ -369,8 +369,8 @@ occ::handle XCAFDoc_Dimension::GetObject() co && !aClass->Array().IsNull() && aClass->Array()->Length() > 0) { anObj->SetClassOfTolerance(aClass->Array()->Value(1) != 0, - (XCAFDimTolObjects_DimensionFormVariance)aClass->Array()->Value(2), - (XCAFDimTolObjects_DimensionGrade)aClass->Array()->Value(3)); + static_cast(aClass->Array()->Value(2)), + static_cast(aClass->Array()->Value(3))); } occ::handle aDec; @@ -388,7 +388,7 @@ occ::handle XCAFDoc_Dimension::GetObject() co { NCollection_Sequence aM; for (int i = 1; i <= aModifiers->Array()->Length(); i++) - aM.Append((XCAFDimTolObjects_DimensionModif)aModifiers->Array()->Value(i)); + aM.Append(static_cast(aModifiers->Array()->Value(i))); anObj->SetModifiers(aM); } diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx index e5f6620bf92..bafa68c8d23 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx @@ -244,7 +244,7 @@ void XCAFDoc_GeomTolerance::SetObject( if (theObject->HasAffectedPlane()) { TDF_Label aLAffectedPlane = Label().FindChild(ChildLab_AffectedPlane); - TDataStd_Integer::Set(aLAffectedPlane, (int)theObject->GetAffectedPlaneType()); + TDataStd_Integer::Set(aLAffectedPlane, static_cast(theObject->GetAffectedPlaneType())); TDataXtd_Plane::Set(aLAffectedPlane, theObject->GetAffectedPlane()); } } @@ -269,7 +269,7 @@ occ::handle XCAFDoc_GeomTolerance::GetObj occ::handle aType; if (Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType)) { - anObj->SetType((XCAFDimTolObjects_GeomToleranceType)aType->Get()); + anObj->SetType(static_cast(aType->Get())); } occ::handle aTypeOfValue; @@ -277,7 +277,7 @@ occ::handle XCAFDoc_GeomTolerance::GetObj .FindChild(ChildLab_TypeOfValue) .FindAttribute(TDataStd_Integer::GetID(), aTypeOfValue)) { - anObj->SetTypeOfValue((XCAFDimTolObjects_GeomToleranceTypeValue)aTypeOfValue->Get()); + anObj->SetTypeOfValue(static_cast(aTypeOfValue->Get())); } occ::handle aValue; @@ -292,13 +292,13 @@ occ::handle XCAFDoc_GeomTolerance::GetObj .FindAttribute(TDataStd_Integer::GetID(), aMatReqModif)) { anObj->SetMaterialRequirementModifier( - (XCAFDimTolObjects_GeomToleranceMatReqModif)aMatReqModif->Get()); + static_cast(aMatReqModif->Get())); } occ::handle aZoneModif; if (Label().FindChild(ChildLab_ZoneModif).FindAttribute(TDataStd_Integer::GetID(), aZoneModif)) { - anObj->SetZoneModifier((XCAFDimTolObjects_GeomToleranceZoneModif)aZoneModif->Get()); + anObj->SetZoneModifier(static_cast(aZoneModif->Get())); } occ::handle aValueOfZoneModif; @@ -315,7 +315,7 @@ occ::handle XCAFDoc_GeomTolerance::GetObj { NCollection_Sequence aModifiers; for (int i = 1; i <= anArr->Length(); i++) - aModifiers.Append((XCAFDimTolObjects_GeomToleranceModif)anArr->Value(i)); + aModifiers.Append(static_cast(anArr->Value(i))); anObj->SetModifiers(aModifiers); } @@ -413,7 +413,7 @@ occ::handle XCAFDoc_GeomTolerance::GetObj TDataXtd_Geometry::Plane(anAffectedPlaneAttr->Label(), aPlane); occ::handle aTypeAttr; Label().FindChild(ChildLab_AffectedPlane).FindAttribute(TDataStd_Integer::GetID(), aTypeAttr); - anObj->SetAffectedPlane(aPlane, (XCAFDimTolObjects_ToleranceZoneAffectedPlane)aTypeAttr->Get()); + anObj->SetAffectedPlane(aPlane, static_cast(aTypeAttr->Get())); } return anObj; diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_NoteBinData.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_NoteBinData.cxx index 0f8c47fe510..b854c58482b 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_NoteBinData.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_NoteBinData.cxx @@ -95,10 +95,10 @@ bool XCAFDoc_NoteBinData::Set(const TCollection_ExtendedString& theTitle, Backup(); - if (theFile.Size() > (size_t)IntegerLast()) + if (theFile.Size() > static_cast(IntegerLast())) return false; - myData.reset(new NCollection_HArray1(1, (int)theFile.Size())); + myData.reset(new NCollection_HArray1(1, static_cast(theFile.Size()))); int nbReadBytes = 0; theFile.Read((void*)&myData->First(), myData->Length(), nbReadBytes); if (nbReadBytes < myData->Length()) diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_ShapeTool.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_ShapeTool.cxx index 182a5b0e920..cbd15839f04 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_ShapeTool.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_ShapeTool.cxx @@ -1212,9 +1212,9 @@ static void DumpAssembly(Standard_OStream& theDumpLog, if (deep) { - theDumpLog << "(" << *(void**)&S.TShape(); + theDumpLog << "(" << *reinterpret_cast(&S.TShape()); if (!S.Location().IsIdentity()) - theDumpLog << ", " << *(void**)&S.Location(); + theDumpLog << ", " << *reinterpret_cast(&S.Location()); theDumpLog << ") "; } theDumpLog << std::endl; @@ -1311,9 +1311,9 @@ void XCAFDoc_ShapeTool::DumpShape(Standard_OStream& theDumpLog, if (deep) { - theDumpLog << "(" << *(void**)&S.TShape(); + theDumpLog << "(" << *reinterpret_cast(&S.TShape()); if (!S.Location().IsIdentity()) - theDumpLog << ", " << *(void**)&S.Location(); + theDumpLog << ", " << *reinterpret_cast(&S.Location()); theDumpLog << ") "; } } diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_View.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_View.cxx index 4cb71db6489..cdf6205f0a6 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_View.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_View.cxx @@ -160,7 +160,7 @@ occ::handle XCAFDoc_View::GetObject() const occ::handle aType; if (Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType)) { - anObj->SetType((XCAFView_ProjectionType)aType->Get()); + anObj->SetType(static_cast(aType->Get())); } // Projection point diff --git a/src/DataExchange/TKXSBase/IFGraph/IFGraph_SubPartsIterator.cxx b/src/DataExchange/TKXSBase/IFGraph/IFGraph_SubPartsIterator.cxx index 1a884499c1f..0dd033c7527 100644 --- a/src/DataExchange/TKXSBase/IFGraph/IFGraph_SubPartsIterator.cxx +++ b/src/DataExchange/TKXSBase/IFGraph/IFGraph_SubPartsIterator.cxx @@ -94,7 +94,7 @@ occ::handle IFGraph_SubPartsIterator::Model() const void IFGraph_SubPartsIterator::AddPart() { - theparts->Append(int(0)); + theparts->Append((0)); thepart = theparts->Length(); } diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_DispPerSignature.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_DispPerSignature.cxx index 729ab1769aa..13e4db6d04e 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_DispPerSignature.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_DispPerSignature.cxx @@ -42,7 +42,7 @@ void IFSelect_DispPerSignature::SetSignCounter(const occ::handleName()); + return (thesign.IsNull() ? "???" : thesign->Name()); } TCollection_AsciiString IFSelect_DispPerSignature::Label() const diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_Editor.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_Editor.cxx index 783b8ed17a5..f1193191563 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_Editor.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_Editor.cxx @@ -59,15 +59,15 @@ void IFSelect_Editor::SetValue(const int num, thenames.Bind(shortname, num); if (lng > themaxsh) themaxsh = lng; - lng = (int)strlen(typval->Name()); + lng = static_cast(strlen(typval->Name())); if (lng > themaxco) themaxco = lng; - lng = (int)strlen(typval->Label()); + lng = static_cast(strlen(typval->Label())); if (lng > themaxla) themaxla = lng; thenames.Bind(typval->Name(), num); - int edm = (int)editmode; + int edm = static_cast(editmode); thevalues.SetValue(num, typval); theshorts.SetValue(num, shn); themodes.SetValue(num, edm); @@ -119,7 +119,7 @@ IFSelect_EditValue IFSelect_Editor::EditMode(const int num) const if (num < 1 || num > thenbval) return IFSelect_EditDynamic; int edm = themodes.Value(num); - return (IFSelect_EditValue)edm; + return static_cast(edm); } void IFSelect_Editor::PrintNames(Standard_OStream& S) const diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModifReorder.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModifReorder.cxx index cd004ff30e0..39ed35a4d0a 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModifReorder.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModifReorder.cxx @@ -43,7 +43,7 @@ void IFSelect_ModifReorder::Perform(IFSelect_ContextModif& TCollection_AsciiString IFSelect_ModifReorder::Label() const { - const char* astr = (const char*)(thertl ? "Reorder, Roots last" : "Reorder, Roots first"); + const char* astr = (thertl ? "Reorder, Roots last" : "Reorder, Roots first"); return TCollection_AsciiString(astr); // ( thertl ? "Reorder, Roots last" : "Reorder, Roots first"); } diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_SignType.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_SignType.cxx index 6ecf2248c40..03a5bf54397 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_SignType.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_SignType.cxx @@ -22,7 +22,7 @@ IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SignType, IFSelect_Signature) static const char* nulsign = ""; IFSelect_SignType::IFSelect_SignType(const bool nopk) - : IFSelect_Signature((const char*)(nopk ? "Class Type" : "Dynamic Type")), + : IFSelect_Signature((nopk ? "Class Type" : "Dynamic Type")), thenopk(nopk) { } diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_Signature.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_Signature.cxx index 1f1d4561b33..9372743a009 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_Signature.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_Signature.cxx @@ -111,7 +111,7 @@ bool IFSelect_Signature::MatchValue(const char* const val, char cardeb = text.Value(1); int ln, lnt, i, j; ln = text.Length(); - lnt = (int)(strlen(val) - ln); + lnt = static_cast(strlen(val) - ln); for (i = 0; i <= lnt; i++) { if (val[i] == cardeb) diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx index 0363f956762..d2058db2b14 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx @@ -562,7 +562,7 @@ Interface_CheckIterator IFSelect_WorkSession::ModelCheckList(const bool complete } Interface_CheckTool cht(Graph()); checks = (complete ? cht.CompleteCheckList() : cht.AnalyseCheckList()); - checks.SetName((char*)(complete ? "Model Complete Check List" : "Model Syntactic Check List")); + checks.SetName(const_cast(complete ? "Model Complete Check List" : "Model Syntactic Check List")); return checks; } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_FileParameter.cxx b/src/DataExchange/TKXSBase/Interface/Interface_FileParameter.cxx index b134ae32af2..59894d22b54 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_FileParameter.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_FileParameter.cxx @@ -37,7 +37,7 @@ void Interface_FileParameter::Init(const TCollection_AsciiString& val, void Interface_FileParameter::Init(const char* const val, const Interface_ParamType typ) { - theval = (Standard_PCharacter)val; // Principle: Allocation managed by container (ParamSet) + theval = const_cast(val); // Principle: Allocation managed by container (ParamSet) thetype = typ; thenum = 0; } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_FloatWriter.cxx b/src/DataExchange/TKXSBase/Interface/Interface_FloatWriter.cxx index bc8d41e6e9a..0af208a7f62 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_FloatWriter.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_FloatWriter.cxx @@ -111,7 +111,7 @@ int Interface_FloatWriter::Convert(const double val, for (int i = 0; i < anMasSize; ++i) lxp[i] = '\0'; - pText = (char*)text; + pText = const_cast(text); // if ((val >= R1 && val < R2) || (val <= -R1 && val > -R2)) Sprintf(pText, rangeform, val); @@ -157,5 +157,5 @@ int Interface_FloatWriter::Convert(const double val, pText[j0 + 5] = lxp[4]; pText[j0 + 6] = '\0'; } - return (int)strlen(text); + return static_cast(strlen(text)); } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_InterfaceModel.cxx b/src/DataExchange/TKXSBase/Interface/Interface_InterfaceModel.cxx index 2d977532b50..73774a1ddf4 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_InterfaceModel.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_InterfaceModel.cxx @@ -713,7 +713,7 @@ bool Interface_InterfaceModel::SetCategoryNumber(const int num, const int val) c->SetValue(i, thecategory->Value(i)); thecategory = c; } - char cval = (char)(val + 32); + char cval = static_cast(val + 32); thecategory->SetValue(num, cval); return true; } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_LineBuffer.cxx b/src/DataExchange/TKXSBase/Interface/Interface_LineBuffer.cxx index e6fe161366c..bd5e99e1373 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_LineBuffer.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_LineBuffer.cxx @@ -181,7 +181,7 @@ occ::handle Interface_LineBuffer::Moved() void Interface_LineBuffer::Add(const char* const theText) { - Add(theText, (int)strlen(theText)); + Add(theText, static_cast(strlen(theText))); } void Interface_LineBuffer::Add(const char* const text, const int lntext) diff --git a/src/DataExchange/TKXSBase/Interface/Interface_MSG.cxx b/src/DataExchange/TKXSBase/Interface/Interface_MSG.cxx index 7c1630ee9bb..3b07fd21039 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_MSG.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_MSG.cxx @@ -35,7 +35,7 @@ static bool theraise = false; static char blank[] = " "; -static int maxblank = (int)strlen(blank); +static int maxblank = static_cast(strlen(blank)); Interface_MSG::Interface_MSG(const char* const key) : thekey(key), @@ -415,7 +415,7 @@ void Interface_MSG::TDate(const char* const text, } } } - char* pText = (char*)text; + char* pText = const_cast(text); if (!format || format[0] == '\0') Sprintf(pText, "%4.4d-%2.2d-%2.2d:%2.2d-%2.2d-%2.2d", y2, m2, d2, h2, n2, s2); else if ((format[0] == 'c' || format[0] == 'C') && format[1] == ':') @@ -525,7 +525,7 @@ const char* Interface_MSG::Blanks(const int val, const int max) const char* Interface_MSG::Blanks(const char* const val, const int max) { - int lng = (int)strlen(val); + int lng = static_cast(strlen(val)); if (lng > maxblank || lng > max) return ""; return &blank[maxblank - max + lng]; @@ -547,7 +547,7 @@ void Interface_MSG::Print(Standard_OStream& S, const char* const val, const int Print(S, val, maxblank, just); return; } - int lng = (int)strlen(val); + int lng = static_cast(strlen(val)); if (lng > max) { S << val; diff --git a/src/DataExchange/TKXSBase/Interface/Interface_ParamSet.cxx b/src/DataExchange/TKXSBase/Interface/Interface_ParamSet.cxx index 3076aecb3c7..19a7a887937 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_ParamSet.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_ParamSet.cxx @@ -62,7 +62,7 @@ int Interface_ParamSet::Append(const char* const val, if (thelnval + lnval + 1 > thelnres) { // Insufficient character reservation: first increase - int newres = (int)(thelnres * 2 + lnval); + int newres = (thelnres * 2 + lnval); char* newval = new char[newres]; for (i = 0; i < thelnval; i++) newval[i] = theval[i]; // szv#4:S4163:12Mar99 `<= thelnres` was wrong @@ -76,8 +76,8 @@ int Interface_ParamSet::Append(const char* const val, { Interface_FileParameter& OFP = thelist->ChangeValue(i); Interface_ParamType otyp = OFP.ParamType(); - char* oval = (char*)OFP.CValue(); - int delta = (int)(oval - poldVal); + char* oval = const_cast(OFP.CValue()); + int delta = static_cast(oval - poldVal); // if (oval < theval || oval >= (theval+thelnres)) // continue; //hors reserve //szv#4:S4163:12Mar99 `oval >` was wrong int onum = OFP.EntityNumber(); @@ -100,7 +100,7 @@ int Interface_ParamSet::Append(const char* const val, FP.Init(&theval[thelnval], typ); if (nument != 0) FP.SetEntityNumber(nument); - thelnval += (int)(lnval + 1); + thelnval += (lnval + 1); } return thenbpar; } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_STAT.cxx b/src/DataExchange/TKXSBase/Interface/Interface_STAT.cxx index ca1391e78cb..be2f1dba7c6 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_STAT.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_STAT.cxx @@ -267,13 +267,13 @@ int Interface_STAT::Percent(const bool phase) TheStat.numitem * TheStat.stw; // current step // proportion for this phase double prophase = enphase / (TheStat.nbitp * TheStat.otph); - int res = int(prophase * 100.); + int res = static_cast(prophase * 100.); if (phase) return res; // that's it for this phase // counting in the phases double encours = (TheStat.oldph + TheStat.phw * prophase) / TheStat.otal; - res = int(encours * 100.); + res = static_cast(encours * 100.); return res; } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_SignType.cxx b/src/DataExchange/TKXSBase/Interface/Interface_SignType.cxx index 94e8e931208..f20976fd45e 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_SignType.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_SignType.cxx @@ -33,7 +33,7 @@ TCollection_AsciiString Interface_SignType::Text( const char* Interface_SignType::ClassName(const char* const typnam) { - char* tn = (char*)typnam; + char* tn = const_cast(typnam); for (int i = 0; tn[i] != '\0'; i++) { if (tn[i] == '_') diff --git a/src/DataExchange/TKXSBase/Interface/Interface_TypedValue.cxx b/src/DataExchange/TKXSBase/Interface/Interface_TypedValue.cxx index 358b7bf9400..377f193bd2c 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_TypedValue.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_TypedValue.cxx @@ -41,10 +41,10 @@ Interface_ParamType Interface_TypedValue::Type() const MoniTool_ValueType Interface_TypedValue::ParamTypeToValueType(const Interface_ParamType type) { - return (MoniTool_ValueType)type; + return static_cast(type); } // same values Interface_ParamType Interface_TypedValue::ValueTypeToParamType(const MoniTool_ValueType type) { - return (Interface_ParamType)type; + return static_cast(type); } // same values diff --git a/src/DataExchange/TKXSBase/Interface/Interface_UndefinedContent.cxx b/src/DataExchange/TKXSBase/Interface/Interface_UndefinedContent.cxx index cf3d180815b..37766799dd7 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_UndefinedContent.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_UndefinedContent.cxx @@ -147,7 +147,7 @@ void Interface_UndefinedContent::AddLiteral(const Interface_ParamType const occ::handle& val) { Reservate(thenbparams + 1, thenbstr + 1); - int desc = int(ptype); + int desc = static_cast(ptype); thenbstr++; thenbparams++; thevalues->SetValue(thenbstr, val); @@ -159,7 +159,7 @@ void Interface_UndefinedContent::AddEntity(const Interface_ParamType const occ::handle& ent) { Reservate(thenbparams + 1, 0); - int desc = int(ptype); + int desc = static_cast(ptype); theentities.Append(ent); desc += Content_LocalRef << Content_LocalShift; // "It is an Entity" thenbparams++; // Rank: thenbparams - thenbstr @@ -231,7 +231,7 @@ void Interface_UndefinedContent::SetLiteral(const int } // Put the new value in place and rebuild the Param descriptor thevalues->SetValue(rang, val); - desc = int(ptype) + (rang << Content_NumberShift); + desc = static_cast(ptype) + (rang << Content_NumberShift); theparams->SetValue(num, desc); } @@ -271,7 +271,7 @@ void Interface_UndefinedContent::SetEntity(const int else theentities.SetValue(rang, ent); - desc = int(ptype) + (Content_LocalRef << Content_LocalShift) + (rang << Content_NumberShift); + desc = static_cast(ptype) + (Content_LocalRef << Content_LocalShift) + (rang << Content_NumberShift); theparams->SetValue(num, desc); } diff --git a/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx b/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx index 40b6745c418..a53e9c0100f 100644 --- a/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx +++ b/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx @@ -451,7 +451,7 @@ bool MoniTool_CaseData::Integer(const int nd, int& val) const if (thekind(nd) != 11) return false; double rval = p->X(); - val = (int)rval; + val = static_cast(rval); return true; } diff --git a/src/DataExchange/TKXSBase/Transfer/Transfer_Binder.cxx b/src/DataExchange/TKXSBase/Transfer/Transfer_Binder.cxx index 025098125fa..36df8fef62d 100644 --- a/src/DataExchange/TKXSBase/Transfer/Transfer_Binder.cxx +++ b/src/DataExchange/TKXSBase/Transfer/Transfer_Binder.cxx @@ -36,7 +36,7 @@ void Transfer_Binder::Merge(const occ::handle& other) { if (other.IsNull()) return; - if ((int)theexecst < (int)other->StatusExec()) + if (static_cast(theexecst) < static_cast(other->StatusExec())) theexecst = other->StatusExec(); thecheck->GetMessages(other->Check()); } diff --git a/src/DataExchange/TKXSBase/TransferBRep/TransferBRep.cxx b/src/DataExchange/TKXSBase/TransferBRep/TransferBRep.cxx index 58ed01201d9..17166bf25d9 100644 --- a/src/DataExchange/TKXSBase/TransferBRep/TransferBRep.cxx +++ b/src/DataExchange/TKXSBase/TransferBRep/TransferBRep.cxx @@ -323,7 +323,7 @@ void TransferBRep::TransferResultInfo( for (int index = 1; index <= SeqLen; index++) { // JR/Hp : - TopAbs_ShapeEnum CurrentType = (TopAbs_ShapeEnum)ShapeTypes->Value(index); + TopAbs_ShapeEnum CurrentType = static_cast(ShapeTypes->Value(index)); // TopAbs_ShapeEnum CurrentType = (TopAbs_ShapeEnum)ShapeTypes->Value (index); if (CurrentType == ShapeType || CurrentType == TopAbs_SHAPE) { diff --git a/src/DataExchange/TKXSBase/XSControl/XSControl_FuncShape.cxx b/src/DataExchange/TKXSBase/XSControl/XSControl_FuncShape.cxx index 036bc2e7bec..d5236dc0503 100644 --- a/src/DataExchange/TKXSBase/XSControl/XSControl_FuncShape.cxx +++ b/src/DataExchange/TKXSBase/XSControl/XSControl_FuncShape.cxx @@ -505,7 +505,7 @@ static IFSelect_ReturnStatus XSControl_fromshape(const occ::handle(arg1); TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1); if (Shape.IsNull()) { @@ -724,7 +724,7 @@ static IFSelect_ReturnStatus XSControl_trconnexentities( sout << "Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s" << std::endl; return IFSelect_RetError; } - const char* a1 = (const char*)arg1; + const char* a1 = arg1; TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1); if (Shape.IsNull()) { @@ -907,7 +907,7 @@ static IFSelect_ReturnStatus XSControl_twrite(const occ::handleArg(i); + const char* ai = pilot->Arg(i); TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(ai); if (Shape.IsNull()) { @@ -1072,7 +1072,7 @@ int XSControl_FuncShape::MoreShapes(const occ::handle& sout << " -> taken " << nbsh << " Shapes" << std::endl; return nbsh; } - const char* a1 = (const char*)name; + const char* a1 = name; TopoDS_Shape Shape = session->Vars()->GetShape(a1); if (Shape.IsNull()) { diff --git a/src/DataExchange/TKXSBase/XSControl/XSControl_TransferReader.cxx b/src/DataExchange/TKXSBase/XSControl/XSControl_TransferReader.cxx index fd459c33815..0137afc293d 100644 --- a/src/DataExchange/TKXSBase/XSControl/XSControl_TransferReader.cxx +++ b/src/DataExchange/TKXSBase/XSControl/XSControl_TransferReader.cxx @@ -815,7 +815,7 @@ int XSControl_TransferReader::TransferOne(const occ::handle& << " Ident : " << lab->ToCString() << Interface_MSG::Blanks(14 - lab->Length()) << "******\n"; sout << "****** Type : " << myModel->TypeName(ent, false) - << Interface_MSG::Blanks((int)(44 - strlen(myModel->TypeName(ent, false)))) << "******"; + << Interface_MSG::Blanks(static_cast(44 - strlen(myModel->TypeName(ent, false)))) << "******"; sout << "\n*******************************************************************\n"; } diff --git a/src/DataExchange/TKXSBase/XSControl/XSControl_Utils.cxx b/src/DataExchange/TKXSBase/XSControl/XSControl_Utils.cxx index c91d7c0c11d..8dbcc7a5ac5 100644 --- a/src/DataExchange/TKXSBase/XSControl/XSControl_Utils.cxx +++ b/src/DataExchange/TKXSBase/XSControl/XSControl_Utils.cxx @@ -208,7 +208,7 @@ void XSControl_Utils::DateValues(const char* const text, const char* XSControl_Utils::ToCString(const occ::handle& strval) const { // JR/Hp - const char* astr = (const char*)(strval.IsNull() ? "" : strval->ToCString()); + const char* astr = (strval.IsNull() ? "" : strval->ToCString()); return astr; // return (strval.IsNull() ? "" : strval->ToCString()); } @@ -278,7 +278,7 @@ const char* XSControl_Utils::ExtendedToAscii(const char16_t* const str) const { int unext = bufext.Value(i); unext = unext & 127; - char uncar = char(unext); + char uncar = static_cast(unext); bufasc.AssignCat(uncar); } return bufasc.ToCString(); @@ -293,7 +293,7 @@ const char* XSControl_Utils::CStrValue(const occ::handle& li if (!linha.IsNull()) { // JR/Hp - const char* astr = (const char*)(num > linha->Length() ? "" : linha->Value(num)->ToCString()); + const char* astr = (num > linha->Length() ? "" : linha->Value(num)->ToCString()); return astr; // return (num > linha->Length() ? "" : linha->Value(num)->ToCString()); } @@ -302,7 +302,7 @@ const char* XSControl_Utils::CStrValue(const occ::handle& li if (!lina.IsNull()) { // JR/Hp - const char* astr = (const char*)(num > lina->Length() ? "" : lina->Value(num).ToCString()); + const char* astr = (num > lina->Length() ? "" : lina->Value(num).ToCString()); return astr; // return (num > lina->Length() ? "" : lina->Value(num).ToCString()); } @@ -312,7 +312,7 @@ const char* XSControl_Utils::CStrValue(const occ::handle& li { // JR/Hp const char* astr = - (const char*)(num > linhe->Length() ? "" : ExtendedToAscii(linhe->Value(num)->ToExtString())); + (num > linhe->Length() ? "" : ExtendedToAscii(linhe->Value(num)->ToExtString())); return astr; // return (num > linhe->Length() ? "" : ExtendedToAscii(linhe->Value(num)->ToExtString())); } @@ -322,7 +322,7 @@ const char* XSControl_Utils::CStrValue(const occ::handle& li { // JR/Hp const char* astr = - (const char*)(num > linee->Length() ? "" : ExtendedToAscii(linee->Value(num).ToExtString())); + (num > linee->Length() ? "" : ExtendedToAscii(linee->Value(num).ToExtString())); return astr; // return (num > linee->Length() ? "" : ExtendedToAscii(linee->Value(num).T } diff --git a/src/DataExchange/TKXSBase/XSControl/XSControl_WorkSession.cxx b/src/DataExchange/TKXSBase/XSControl/XSControl_WorkSession.cxx index 291786669e5..095aa98c6cf 100644 --- a/src/DataExchange/TKXSBase/XSControl/XSControl_WorkSession.cxx +++ b/src/DataExchange/TKXSBase/XSControl/XSControl_WorkSession.cxx @@ -122,7 +122,7 @@ void XSControl_WorkSession::SetController(const occ::handleName(rsc)); + const char* astr = (myController.IsNull() ? "" : myController->Name(rsc)); return astr; } diff --git a/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_ColorDriver.cxx b/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_ColorDriver.cxx index 10da53f6061..3a2d22d032d 100644 --- a/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_ColorDriver.cxx +++ b/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_ColorDriver.cxx @@ -56,7 +56,7 @@ bool XmlMXCAFDoc_ColorDriver::Paste(const XmlObjMgt_Persistent& theSource, } occ::handle anInt = occ::down_cast(theTarget); - anInt->Set((Quantity_NameOfColor)aValue); + anInt->Set(static_cast(aValue)); return true; } @@ -70,5 +70,5 @@ void XmlMXCAFDoc_ColorDriver::Paste(const occ::handle& theSource, XmlObjMgt_SRelocationTable&) const { occ::handle anInt = occ::down_cast(theSource); - XmlObjMgt::SetStringValue(theTarget, (int)anInt->GetNOC()); + XmlObjMgt::SetStringValue(theTarget, static_cast(anInt->GetNOC())); } diff --git a/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_NoteBinDataDriver.cxx b/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_NoteBinDataDriver.cxx index 55370b4483e..96f0653f41d 100644 --- a/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_NoteBinDataDriver.cxx +++ b/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_NoteBinDataDriver.cxx @@ -107,7 +107,7 @@ void XmlMXCAFDoc_NoteBinDataDriver::Paste(const occ::handle& theS anOSS << std::hex << aData->Value(i); } // clang-format off - char* dump = (char*)anOSS.str(); // copying! Don't forget to delete it. + char* dump = const_cast(anOSS.str()); // copying! Don't forget to delete it. // clang-format on XmlObjMgt::SetStringValue(theTarget, dump, true); delete[] dump; diff --git a/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_VisMaterialDriver.cxx b/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_VisMaterialDriver.cxx index f259192f731..bde6c0feded 100644 --- a/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_VisMaterialDriver.cxx +++ b/src/DataExchange/TKXmlXCAF/XmlMXCAFDoc/XmlMXCAFDoc_VisMaterialDriver.cxx @@ -110,7 +110,7 @@ static bool readReal(const XmlObjMgt_Element& theElement, double aValue = 0.0; if (XmlObjMgt::GetReal(theElement.getAttribute(theName), aValue)) { - theValue = (float)aValue; + theValue = static_cast(aValue); return true; } return false; @@ -135,11 +135,11 @@ static bool readVec3(const XmlObjMgt_Element& theElement, LDOMString aString = theElement.getAttribute(theName); const char* aPos = aString.GetString(); char* aNext = nullptr; - aVec3[0] = (float)Strtod(aPos, &aNext); + aVec3[0] = static_cast(Strtod(aPos, &aNext)); aPos = aNext; - aVec3[1] = (float)Strtod(aPos, &aNext); + aVec3[1] = static_cast(Strtod(aPos, &aNext)); aPos = aNext; - aVec3[2] = (float)Strtod(aPos, &aNext); + aVec3[2] = static_cast(Strtod(aPos, &aNext)); if (aPos != aNext) { theVec3 = aVec3; @@ -181,13 +181,13 @@ static bool readVec4(const XmlObjMgt_Element& theElement, LDOMString aString = theElement.getAttribute(theName); const char* aPos = aString.GetString(); char* aNext = nullptr; - aVec4[0] = (float)Strtod(aPos, &aNext); + aVec4[0] = static_cast(Strtod(aPos, &aNext)); aPos = aNext; - aVec4[1] = (float)Strtod(aPos, &aNext); + aVec4[1] = static_cast(Strtod(aPos, &aNext)); aPos = aNext; - aVec4[2] = (float)Strtod(aPos, &aNext); + aVec4[2] = static_cast(Strtod(aPos, &aNext)); aPos = aNext; - aVec4[3] = (float)Strtod(aPos, &aNext); + aVec4[3] = static_cast(Strtod(aPos, &aNext)); if (aPos != aNext) { theVec4 = aVec4; diff --git a/src/FoundationClasses/TKMath/BSplCLib/BSplCLib.cxx b/src/FoundationClasses/TKMath/BSplCLib/BSplCLib.cxx index f4ae0ef7178..09e317e2461 100644 --- a/src/FoundationClasses/TKMath/BSplCLib/BSplCLib.cxx +++ b/src/FoundationClasses/TKMath/BSplCLib/BSplCLib.cxx @@ -3128,7 +3128,7 @@ void BSplCLib::BuildSchoenbergPoints(const int Degree, { int ii, jj; double Inverse; - Inverse = 1.0e0 / (double)Degree; + Inverse = 1.0e0 / static_cast(Degree); for (ii = Parameters.Lower(); ii <= Parameters.Upper(); ii++) { @@ -3387,7 +3387,7 @@ void BSplCLib::Eval(const double Parameter, LocalRealArray[Index + kk] *= Inverse; } Index += ArrayDimension; - Inverse /= (double)ii; + Inverse /= static_cast(ii); } PLib::EvalPolynomial(Delta, NewRequest, @@ -3411,7 +3411,7 @@ void BSplCLib::Eval(const double Parameter, } LocalRealArray[Index] *= Inverse; Index += 1; - Inverse /= (double)ii; + Inverse /= static_cast(ii); } PLib::EvalPolynomial(Delta, NewRequest, Degree, 1, LocalRealArray[0], WeightsResults); } @@ -3565,7 +3565,7 @@ void BSplCLib::Eval(const double Parameter, LocalRealArray[Index + kk] *= Inverse; } Index += ArrayDimension; - Inverse /= (double)ii; + Inverse /= static_cast(ii); } PLib::EvalPolynomial(Delta, NewRequest, Degree, ArrayDimension, LocalRealArray[0], Results); } diff --git a/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_2.cxx b/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_2.cxx index 16ba056a1dc..56d8932ebb2 100644 --- a/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_2.cxx +++ b/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_2.cxx @@ -986,8 +986,8 @@ void BSplCLib::FunctionMultiply(const BSplCLib_EvaluatorFunction& FunctionPtr, { throw Standard_ConstructionError(); } - double* array_of_poles = (double*)&Poles(Poles.Lower()); - double* array_of_new_poles = (double*)&NewPoles(NewPoles.Lower()); + double* array_of_poles = const_cast(&Poles(Poles.Lower())); + double* array_of_new_poles = static_cast(&NewPoles(NewPoles.Lower())); BSplCLib::FunctionMultiply(FunctionPtr, BSplineDegree, BSplineFlatKnots, @@ -1017,8 +1017,8 @@ void BSplCLib::FunctionReparameterise(const BSplCLib_EvaluatorFunction& Function { throw Standard_ConstructionError(); } - double* array_of_poles = (double*)&Poles(Poles.Lower()); - double* array_of_new_poles = (double*)&NewPoles(NewPoles.Lower()); + double* array_of_poles = const_cast(&Poles(Poles.Lower())); + double* array_of_new_poles = static_cast(&NewPoles(NewPoles.Lower())); BSplCLib::FunctionReparameterise(FunctionPtr, BSplineDegree, BSplineFlatKnots, diff --git a/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_CurveComputation.pxx b/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_CurveComputation.pxx index 3be2a98d4e2..2f1c28f49ce 100644 --- a/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_CurveComputation.pxx +++ b/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_CurveComputation.pxx @@ -1093,7 +1093,7 @@ int BSplCLib_SolveBandedSystem(const math_Matrix& Matrix, { double *PArray, *WArray; PArray = (double*)&PolesArray(PolesArray.Lower()); - WArray = (double*)&WeightsArray(WeightsArray.Lower()); + WArray = static_cast(&WeightsArray(WeightsArray.Lower())); return BSplCLib::SolveBandedSystem(Matrix, UpperBandWidth, LowerBandWidth, @@ -1129,7 +1129,7 @@ void BSplCLib_Eval(const double Parameter, double Inverse, P[Dimension], *PArray, *WArray; int kk; PArray = (double*)&PolesArray(PolesArray.Lower()); - WArray = (double*)&WeightsArray(WeightsArray.Lower()); + WArray = const_cast(&WeightsArray(WeightsArray.Lower())); if (HomogeneousFlag) { BSplCLib::Eval(Parameter, @@ -1208,7 +1208,7 @@ void BSplCLib_CacheD0(const double Parameter, if (WeightsArray != NULL) { const NCollection_Array1& refWeights = *WeightsArray; - double* WArray = (double*)&refWeights(refWeights.Lower()); + double* WArray = const_cast(&refWeights(refWeights.Lower())); PLib::NoDerivativeEvalPolynomial(NewParameter, Degree, 1, Degree, WArray[0], Inverse); Inverse = 1.0e0 / Inverse; @@ -1251,7 +1251,7 @@ void BSplCLib_CacheD1(const double Parameter, if (WeightsArray != NULL) { const NCollection_Array1& refWeights = *WeightsArray; - double* WArray = (double*)&refWeights(refWeights.Lower()); + double* WArray = const_cast(&refWeights(refWeights.Lower())); PLib::EvalPolynomial(NewParameter, 1, Degree, 1, WArray[0], LocalWDerivatives[0]); LocalWDerivatives[1] /= SpanLenght; @@ -1321,7 +1321,7 @@ void BSplCLib_CacheD2(const double Parameter, if (WeightsArray != NULL) { const NCollection_Array1& refWeights = *WeightsArray; - double* WArray = (double*)&refWeights(refWeights.Lower()); + double* WArray = const_cast(&refWeights(refWeights.Lower())); PLib::EvalPolynomial(NewParameter, 2, Degree, 1, WArray[0], LocalWDerivatives[0]); @@ -1406,7 +1406,7 @@ void BSplCLib_CacheD3(const double Parameter, if (WeightsArray != NULL) { const NCollection_Array1& refWeights = *WeightsArray; - double* WArray = (double*)&refWeights(refWeights.Lower()); + double* WArray = const_cast(&refWeights(refWeights.Lower())); PLib::EvalPolynomial(NewParameter, 3, Degree, 1, WArray[0], LocalWDerivatives[0]); @@ -1488,7 +1488,7 @@ void BSplCLib_BuildCache(const double U, { Traits::CoordsToPointMultiplied(CachePoles(ii), dc.poles + LocalIndex, LocalValue); LocalIndex += Dimension + 1; - LocalValue *= SpanDomain / (double)ii; + LocalValue *= SpanDomain / static_cast(ii); } LocalIndex = Dimension; @@ -1497,7 +1497,7 @@ void BSplCLib_BuildCache(const double U, { (*CacheWeights)(ii) = dc.poles[LocalIndex] * LocalValue; LocalIndex += Dimension + 1; - LocalValue *= SpanDomain / (double)ii; + LocalValue *= SpanDomain / static_cast(ii); } } else @@ -1507,7 +1507,7 @@ void BSplCLib_BuildCache(const double U, { Traits::CoordsToPointMultiplied(CachePoles(ii), dc.poles + LocalIndex, LocalValue); LocalIndex += Dimension; - LocalValue *= SpanDomain / (double)ii; + LocalValue *= SpanDomain / static_cast(ii); } if (Weights != NULL) @@ -1564,7 +1564,7 @@ void BSplCLib_BuildCache(const double theParameter, BSplCLib::Bohm(aParam, theDegree, theDegree, *dc.knots, aDimension, *dc.poles); double aCoeff = 1.0; - double* aCache = (double*)&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol())); + double* aCache = static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); double* aPolyCoeffs = dc.poles; for (int i = 0; i <= theDegree; i++) @@ -1635,7 +1635,7 @@ void BSplCLib_Interpolate(const int Degree, { double *PArray, *WArray; PArray = (double*)&Poles(Poles.Lower()); - WArray = (double*)&Weights(Weights.Lower()); + WArray = static_cast(&Weights(Weights.Lower())); BSplCLib::Interpolate(Degree, FlatKnots, Parameters, diff --git a/src/FoundationClasses/TKMath/BSplSLib/BSplSLib.cxx b/src/FoundationClasses/TKMath/BSplSLib/BSplSLib.cxx index d7ab9d9cf73..b8b29e19c1c 100644 --- a/src/FoundationClasses/TKMath/BSplSLib/BSplSLib.cxx +++ b/src/FoundationClasses/TKMath/BSplSLib/BSplSLib.cxx @@ -2269,9 +2269,9 @@ void BSplSLib::BuildCache(const double U, P.SetZ(f * dc.poles[Index]); Index++; (*CacheWeights)(iii, jjj) = f * dc.poles[Index]; - factor[1] *= min_degree_domain / (double)(jjj); + factor[1] *= min_degree_domain / static_cast(jjj); } - factor[0] *= max_degree_domain / (double)(iii); + factor[0] *= max_degree_domain / static_cast(iii); } } else @@ -2309,9 +2309,9 @@ void BSplSLib::BuildCache(const double U, P.SetY(f * dc.poles[Index]); Index++; P.SetZ(f * dc.poles[Index]); - factor[1] *= min_degree_domain / (double)(jjj); + factor[1] *= min_degree_domain / static_cast(jjj); } - factor[0] *= max_degree_domain / (double)(iii); + factor[0] *= max_degree_domain / static_cast(iii); } if (Weights != nullptr) { @@ -2405,7 +2405,7 @@ void BSplSLib::BuildCache(const double theU, for (int kk = 0; kk <= d1; kk++) BSplCLib::Bohm(u2, d2, d2, *dc.knots2, aDimension, *(dc.poles + kk * aDimension * d2p1)); - double* aCache = (double*)&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol())); + double* aCache = static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); double aFactors[2]; // aFactors[0] corresponds to variable with minimal degree @@ -2431,7 +2431,7 @@ void BSplSLib::BuildCache(const double theU, // Fill the weights for the surface which is not locally polynomial if (aCacheShift > aDimension) { - aCache = (double*)&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol())); + aCache = static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); aCache += aCacheShift - 1; for (aRow = 0; aRow <= d2; aRow++) for (aCol = 0; aCol <= d1; aCol++) @@ -2476,7 +2476,7 @@ void BSplSLib::CacheD0(const double UParameter, double new_parameter[2], inverse; double* PArray = (double*)&(PolesArray(PolesArray.LowerCol(), PolesArray.LowerRow())); - double* myPoint = (double*)&aPoint; + double* myPoint = reinterpret_cast(&aPoint); if (UDegree <= VDegree) { min_degree = UDegree; @@ -2512,7 +2512,7 @@ void BSplSLib::CacheD0(const double UParameter, { dimension = min_degree + 1; const NCollection_Array2& refWeights = *WeightsArray; - double* WArray = (double*)&refWeights(refWeights.LowerCol(), refWeights.LowerRow()); + double* WArray = const_cast(&refWeights(refWeights.LowerCol(), refWeights.LowerRow())); PLib::NoDerivativeEvalPolynomial(new_parameter[0], max_degree, dimension, @@ -2572,7 +2572,7 @@ void BSplSLib::CacheD1(const double UParameter, double local_poles_array[2][2][3], local_poles_and_weights_array[2][2][4], local_weights_array[2][2]; double *my_vec_min, *my_vec_max, *my_point; - my_point = (double*)&aPoint; + my_point = reinterpret_cast(&aPoint); // // initialize in case of rational evaluation // because RationalDerivative will use all @@ -2629,8 +2629,8 @@ void BSplSLib::CacheD1(const double UParameter, new_parameter[1] = (UParameter - UCacheParameter) * inverse_min; dimension = 3 * (UDegree + 1); - my_vec_min = (double*)&aVecU; - my_vec_max = (double*)&aVecV; + my_vec_min = reinterpret_cast(&aVecU); + my_vec_max = reinterpret_cast(&aVecV); } else { @@ -2641,8 +2641,8 @@ void BSplSLib::CacheD1(const double UParameter, new_parameter[0] = (UParameter - UCacheParameter) * inverse_max; new_parameter[1] = (VParameter - VCacheParameter) * inverse_min; dimension = 3 * (VDegree + 1); - my_vec_min = (double*)&aVecV; - my_vec_max = (double*)&aVecU; + my_vec_min = reinterpret_cast(&aVecV); + my_vec_max = reinterpret_cast(&aVecU); } NCollection_LocalArray locpoles(2 * dimension); @@ -2661,7 +2661,7 @@ void BSplSLib::CacheD1(const double UParameter, { dimension = min_degree + 1; const NCollection_Array2& refWeights = *WeightsArray; - double* WArray = (double*)&refWeights(refWeights.LowerCol(), refWeights.LowerRow()); + double* WArray = const_cast(&refWeights(refWeights.LowerCol(), refWeights.LowerRow())); PLib::EvalPolynomial(new_parameter[0], 1, max_degree, dimension, WArray[0], locpoles[0]); PLib::EvalPolynomial(new_parameter[1], @@ -2756,7 +2756,7 @@ void BSplSLib::CacheD2(const double UParameter, double local_poles_array[3][3][3], local_poles_and_weights_array[3][3][4], local_weights_array[3][3]; double *my_vec_min, *my_vec_max, *my_vec_min_min, *my_vec_max_max, *my_vec_min_max, *my_point; - my_point = (double*)&aPoint; + my_point = reinterpret_cast(&aPoint); // // initialize in case the min and max degree are less than 2 @@ -2850,11 +2850,11 @@ void BSplSLib::CacheD2(const double UParameter, new_parameter[1] = (UParameter - UCacheParameter) * inverse_min; dimension = 3 * (UDegree + 1); - my_vec_min = (double*)&aVecU; - my_vec_max = (double*)&aVecV; - my_vec_min_min = (double*)&aVecUU; - my_vec_min_max = (double*)&aVecUV; - my_vec_max_max = (double*)&aVecVV; + my_vec_min = reinterpret_cast(&aVecU); + my_vec_max = reinterpret_cast(&aVecV); + my_vec_min_min = reinterpret_cast(&aVecUU); + my_vec_min_max = reinterpret_cast(&aVecUV); + my_vec_max_max = reinterpret_cast(&aVecVV); } else { @@ -2865,11 +2865,11 @@ void BSplSLib::CacheD2(const double UParameter, new_parameter[0] = (UParameter - UCacheParameter) * inverse_max; new_parameter[1] = (VParameter - VCacheParameter) * inverse_min; dimension = 3 * (VDegree + 1); - my_vec_min = (double*)&aVecV; - my_vec_max = (double*)&aVecU; - my_vec_min_min = (double*)&aVecVV; - my_vec_min_max = (double*)&aVecUV; - my_vec_max_max = (double*)&aVecUU; + my_vec_min = reinterpret_cast(&aVecV); + my_vec_max = reinterpret_cast(&aVecU); + my_vec_min_min = reinterpret_cast(&aVecVV); + my_vec_min_max = reinterpret_cast(&aVecUV); + my_vec_max_max = reinterpret_cast(&aVecUU); } NCollection_LocalArray locpoles(3 * dimension); @@ -2922,7 +2922,7 @@ void BSplSLib::CacheD2(const double UParameter, { dimension = min_degree + 1; const NCollection_Array2& refWeights = *WeightsArray; - double* WArray = (double*)&refWeights(refWeights.LowerCol(), refWeights.LowerRow()); + double* WArray = const_cast(&refWeights(refWeights.LowerCol(), refWeights.LowerRow())); PLib::EvalPolynomial(new_parameter[0], MinIndMax, max_degree, @@ -3614,7 +3614,7 @@ void BSplSLib::Interpolate(const int UDegree, } // interpolation of iso u - poles_array = (double*)&Points.ChangeValue(1, 1); + poles_array = static_cast(&Points.ChangeValue(1, 1)); BSplCLib::Interpolate(VDegree, VFlatKnots, VParameters, @@ -3632,7 +3632,7 @@ void BSplSLib::Interpolate(const int UDegree, ContactOrder = new (NCollection_HArray1)(1, ULength); ContactOrder->Init(0); - poles_array = (double*)&IsoPoles.ChangeValue(1, 1); + poles_array = static_cast(&IsoPoles.ChangeValue(1, 1)); for (ii = 1, kk = 1; ii <= ULength; ii++, kk += 4) { @@ -3703,7 +3703,7 @@ void BSplSLib::Interpolate(const int UDegree, } // interpolation of iso u - poles_array = (double*)&Points.ChangeValue(1, 1); + poles_array = static_cast(&Points.ChangeValue(1, 1)); BSplCLib::Interpolate(VDegree, VFlatKnots, VParameters, @@ -3721,7 +3721,7 @@ void BSplSLib::Interpolate(const int UDegree, ContactOrder = new (NCollection_HArray1)(1, ULength); ContactOrder->Init(0); - poles_array = (double*)&IsoPoles.ChangeValue(1, 1); + poles_array = static_cast(&IsoPoles.ChangeValue(1, 1)); for (ii = 1, kk = 1; ii <= ULength; ii++, kk += 3) { diff --git a/src/FoundationClasses/TKMath/BSplSLib/BSplSLib_Cache.cxx b/src/FoundationClasses/TKMath/BSplSLib/BSplSLib_Cache.cxx index dd51d480eb0..2d694eec350 100644 --- a/src/FoundationClasses/TKMath/BSplSLib/BSplSLib_Cache.cxx +++ b/src/FoundationClasses/TKMath/BSplSLib/BSplSLib_Cache.cxx @@ -31,7 +31,7 @@ namespace double* ConvertArray(const occ::handle>& theHArray) { const NCollection_Array2& anArray = theHArray->Array2(); - return (double*)&(anArray(anArray.LowerRow(), anArray.LowerCol())); + return const_cast(&(anArray(anArray.LowerRow(), anArray.LowerCol()))); } //================================================================================================= diff --git a/src/FoundationClasses/TKMath/Convert/Convert_CompPolynomialToPoles.cxx b/src/FoundationClasses/TKMath/Convert/Convert_CompPolynomialToPoles.cxx index b31c6bcaa03..8a73f144eca 100644 --- a/src/FoundationClasses/TKMath/Convert/Convert_CompPolynomialToPoles.cxx +++ b/src/FoundationClasses/TKMath/Convert/Convert_CompPolynomialToPoles.cxx @@ -206,7 +206,7 @@ void Convert_CompPolynomialToPoles::Perform(const int Nu index = 2; Tindex = TrueIntervals.Lower() + 1; Pindex = PolynomialIntervals.LowerRow(); - poles_array = (double*)&myPoles.ChangeValue(1, 1); + poles_array = static_cast(&myPoles.ChangeValue(1, 1)); NCollection_Array1 contact_array(aContactBuf[0], 1, num_poles, num_poles <= THE_MAX_POLES); @@ -232,7 +232,7 @@ void Convert_CompPolynomialToPoles::Perform(const int Nu coeff_index = ((index - 2) * Dimension * (std::max(MaxDegree, myDegree) + 1)) + Coefficients.Lower(); - coefficient_array = (double*)&(Coefficients(coeff_index)); + coefficient_array = const_cast(&(Coefficients(coeff_index))); int Deg = NumCoeffPerCurve(NumCoeffPerCurve.Lower() + index - 2) - 1; PLib::NoDerivativeEvalPolynomial(normalized_value, diff --git a/src/FoundationClasses/TKMath/Convert/Convert_ConeToBSplineSurface.cxx b/src/FoundationClasses/TKMath/Convert/Convert_ConeToBSplineSurface.cxx index e5dfef81f36..451c17ef562 100644 --- a/src/FoundationClasses/TKMath/Convert/Convert_ConeToBSplineSurface.cxx +++ b/src/FoundationClasses/TKMath/Convert/Convert_ConeToBSplineSurface.cxx @@ -45,7 +45,7 @@ static void ComputePoles(const double R, int i; // Number of spans : maximum opening = 150 degrees ( = PI / 1.2 rds) - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); std::array x; @@ -102,7 +102,7 @@ Convert_ConeToBSplineSurface::Convert_ConeToBSplineSurface(const gp_Cone& C, // construction of cone in the reference mark xOy. // Number of spans : maximum opening = 150 degrees ( = PI / 1.2 rds) - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); myNbUPoles = 2 * nbUSpans + 1; diff --git a/src/FoundationClasses/TKMath/Convert/Convert_ConicToBSplineCurve.cxx b/src/FoundationClasses/TKMath/Convert/Convert_ConicToBSplineCurve.cxx index e6ea9bc77c1..43d711153e8 100644 --- a/src/FoundationClasses/TKMath/Convert/Convert_ConicToBSplineCurve.cxx +++ b/src/FoundationClasses/TKMath/Convert/Convert_ConicToBSplineCurve.cxx @@ -372,7 +372,7 @@ void Convert_ConicToBSplineCurve::BuildCosAndSin( switch (Parameterisation) { case Convert_TgtThetaOver2: - num_spans = (int)std::trunc(1.2 * delta / M_PI) + 1; + num_spans = static_cast(std::trunc(1.2 * delta / M_PI)) + 1; tgt_theta_flag = 1; break; diff --git a/src/FoundationClasses/TKMath/Convert/Convert_CylinderToBSplineSurface.cxx b/src/FoundationClasses/TKMath/Convert/Convert_CylinderToBSplineSurface.cxx index 46cc318897d..4392db68d69 100644 --- a/src/FoundationClasses/TKMath/Convert/Convert_CylinderToBSplineSurface.cxx +++ b/src/FoundationClasses/TKMath/Convert/Convert_CylinderToBSplineSurface.cxx @@ -42,7 +42,7 @@ static void ComputePoles(const double R, int i; // Number of spans : maximum opening = 150 degrees ( = PI / 1.2 rds) - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); double UStart = U1; @@ -91,7 +91,7 @@ Convert_CylinderToBSplineSurface::Convert_CylinderToBSplineSurface(const gp_Cyli // construction of the cylinder in the reference mark xOy. // Number of spans : maximum opening = 150 degrees ( = PI / 1.2 rds) - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); myNbUPoles = 2 * nbUSpans + 1; diff --git a/src/FoundationClasses/TKMath/Convert/Convert_GridPolynomialToPoles.cxx b/src/FoundationClasses/TKMath/Convert/Convert_GridPolynomialToPoles.cxx index 45610d98e32..5628912963a 100644 --- a/src/FoundationClasses/TKMath/Convert/Convert_GridPolynomialToPoles.cxx +++ b/src/FoundationClasses/TKMath/Convert/Convert_GridPolynomialToPoles.cxx @@ -166,8 +166,8 @@ void Convert_GridPolynomialToPoles::Perform( NCollection_Array1 Patch(1, (myUDegree + 1) * dimension); NCollection_Array1 Point(1, 3); - double* Coeffs = (double*)&Patch.ChangeValue(1); - double* Digit = (double*)&Point.ChangeValue(1); + double* Coeffs = static_cast(&Patch.ChangeValue(1)); + double* Digit = static_cast(&Point.ChangeValue(1)); for (ii = 1, Uindex = 1; ii <= UParameters.Length(); ii++) { diff --git a/src/FoundationClasses/TKMath/Convert/Convert_SphereToBSplineSurface.cxx b/src/FoundationClasses/TKMath/Convert/Convert_SphereToBSplineSurface.cxx index 493c97207c4..56deab7f4f1 100644 --- a/src/FoundationClasses/TKMath/Convert/Convert_SphereToBSplineSurface.cxx +++ b/src/FoundationClasses/TKMath/Convert/Convert_SphereToBSplineSurface.cxx @@ -45,8 +45,8 @@ static void ComputePoles(const double R, int i, j; // Number of spans : maximum opening = 150 degrees ( = PI / 1.2 rds) - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; - int nbVSpans = (int)std::trunc(1.2 * deltaV / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; + int nbVSpans = static_cast(std::trunc(1.2 * deltaV / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); double AlfaV = deltaV / (nbVSpans * 2); @@ -115,8 +115,8 @@ Convert_SphereToBSplineSurface::Convert_SphereToBSplineSurface(const gp_Sphere& // construction of the sphere in the reference mark xOy. // Number of spans : maximum opening = 150 degrees ( = PI / 1.2 rds) - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; - int nbVSpans = (int)std::trunc(1.2 * deltaV / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; + int nbVSpans = static_cast(std::trunc(1.2 * deltaV / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); double AlfaV = deltaV / (nbVSpans * 2); @@ -208,7 +208,7 @@ Convert_SphereToBSplineSurface::Convert_SphereToBSplineSurface(const gp_Sphere& myNbUKnots = 4; deltaV = Param2 - Param1; - int nbVSpans = (int)std::trunc(1.2 * deltaV / M_PI) + 1; + int nbVSpans = static_cast(std::trunc(1.2 * deltaV / M_PI)) + 1; double AlfaV = deltaV / (nbVSpans * 2); myNbVPoles = 2 * nbVSpans + 1; myNbVKnots = nbVSpans + 1; @@ -237,7 +237,7 @@ Convert_SphereToBSplineSurface::Convert_SphereToBSplineSurface(const gp_Sphere& myNbVKnots = 3; deltaU = Param2 - Param1; - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); myNbUPoles = 2 * nbUSpans + 1; myNbUKnots = nbUSpans + 1; diff --git a/src/FoundationClasses/TKMath/Convert/Convert_TorusToBSplineSurface.cxx b/src/FoundationClasses/TKMath/Convert/Convert_TorusToBSplineSurface.cxx index 69bc70290c3..a01521ae080 100644 --- a/src/FoundationClasses/TKMath/Convert/Convert_TorusToBSplineSurface.cxx +++ b/src/FoundationClasses/TKMath/Convert/Convert_TorusToBSplineSurface.cxx @@ -46,8 +46,8 @@ static void ComputePoles(const double R, int i, j; // Number of spans : maximum opening = 150 degrees ( = PI / 1.2 rds) - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; - int nbVSpans = (int)std::trunc(1.2 * deltaV / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; + int nbVSpans = static_cast(std::trunc(1.2 * deltaV / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); double AlfaV = deltaV / (nbVSpans * 2); @@ -116,8 +116,8 @@ Convert_TorusToBSplineSurface::Convert_TorusToBSplineSurface(const gp_Torus& T, // construction of the torus in the reference mark xOy. // Number of spans : maximum opening = 150 degrees ( = PI / 1.2 rds) - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; - int nbVSpans = (int)std::trunc(1.2 * deltaV / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; + int nbVSpans = static_cast(std::trunc(1.2 * deltaV / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); double AlfaV = deltaV / (nbVSpans * 2); @@ -211,7 +211,7 @@ Convert_TorusToBSplineSurface::Convert_TorusToBSplineSurface(const gp_Torus& T, myNbUKnots = 4; deltaV = Param2 - Param1; - int nbVSpans = (int)std::trunc(1.2 * deltaV / M_PI) + 1; + int nbVSpans = static_cast(std::trunc(1.2 * deltaV / M_PI)) + 1; double AlfaV = deltaV / (nbVSpans * 2); myNbVPoles = 2 * nbVSpans + 1; myNbVKnots = nbVSpans + 1; @@ -240,7 +240,7 @@ Convert_TorusToBSplineSurface::Convert_TorusToBSplineSurface(const gp_Torus& T, myNbVKnots = 4; deltaU = Param2 - Param1; - int nbUSpans = (int)std::trunc(1.2 * deltaU / M_PI) + 1; + int nbUSpans = static_cast(std::trunc(1.2 * deltaU / M_PI)) + 1; double AlfaU = deltaU / (nbUSpans * 2); myNbUPoles = 2 * nbUSpans + 1; myNbUKnots = nbUSpans + 1; diff --git a/src/FoundationClasses/TKMath/PLib/PLib.cxx b/src/FoundationClasses/TKMath/PLib/PLib.cxx index 7bb1e4edbef..10355df103e 100644 --- a/src/FoundationClasses/TKMath/PLib/PLib.cxx +++ b/src/FoundationClasses/TKMath/PLib/PLib.cxx @@ -266,7 +266,7 @@ double PLib::Bin(const int N, const int P) Standard_OutOfRange_Raise_if(P < 0 || P > N, "PLib::Bin: parameter P is out of valid range [0, N]"); - return double(aBinom.Value(N, P)); + return static_cast(aBinom.Value(N, P)); } //================================================================================================= @@ -1092,8 +1092,8 @@ void PLib::EvalPoly2Var(const double UParameter, int Udim = (VDegree + 1) * Dimension, index = Udim * UDerivativeRequest; NCollection_Array1 Curve(1, Udim * (UDerivativeRequest + 1)); NCollection_Array1 Point(1, Dimension * (VDerivativeRequest + 1)); - double* Result = (double*)&Curve.ChangeValue(1); - double* Digit = (double*)&Point.ChangeValue(1); + double* Result = static_cast(&Curve.ChangeValue(1)); + double* Digit = static_cast(&Point.ChangeValue(1)); double* ResultArray; ResultArray = &Results; @@ -1229,7 +1229,7 @@ int PLib::EvalLagrange(const double Parameter, for (kk = 0; kk < Dimension; kk++) { ResultArray[Index + kk] *= difference; - ResultArray[Index + kk] += ResultArray[Index1 + kk] * (double)jj; + ResultArray[Index + kk] += ResultArray[Index1 + kk] * static_cast(jj); } } Index = (ii - 1) * Dimension; @@ -1377,7 +1377,7 @@ int PLib::EvalCubicHermite(const double Parameter, for (kk = 0; kk < Dimension; kk++) { ResultArray[Index + kk] *= difference; - ResultArray[Index + kk] += ResultArray[Index1 + kk] * (double)jj; + ResultArray[Index + kk] += ResultArray[Index1 + kk] * static_cast(jj); } } Index = (ii - 1) * Dimension; diff --git a/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfNodes.hxx b/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfNodes.hxx index 129c4fd736e..bb48a956d6b 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfNodes.hxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfNodes.hxx @@ -25,14 +25,14 @@ class Poly_ArrayOfNodes : public NCollection_AliasedArray<> public: //! Empty constructor of double-precision array. Poly_ArrayOfNodes() - : NCollection_AliasedArray((int)sizeof(gp_Pnt)) + : NCollection_AliasedArray(static_cast(sizeof(gp_Pnt))) { // } //! Constructor of double-precision array. Poly_ArrayOfNodes(int theLength) - : NCollection_AliasedArray((int)sizeof(gp_Pnt), theLength) + : NCollection_AliasedArray(static_cast(sizeof(gp_Pnt)), theLength) { // } @@ -58,7 +58,7 @@ public: Standard_EXPORT ~Poly_ArrayOfNodes(); //! Returns TRUE if array defines nodes with double precision. - bool IsDoublePrecision() const { return myStride == (int)sizeof(gp_Pnt); } + bool IsDoublePrecision() const { return myStride == static_cast(sizeof(gp_Pnt)); } //! Sets if array should define nodes with double or single precision. //! Raises exception if array was already allocated. @@ -69,7 +69,7 @@ public: throw Standard_ProgramError( "Poly_ArrayOfNodes::SetDoublePrecision() should be called before allocation"); } - myStride = int(theIsDouble ? sizeof(gp_Pnt) : sizeof(NCollection_Vec3)); + myStride = static_cast(theIsDouble ? sizeof(gp_Pnt) : sizeof(NCollection_Vec3)); } //! Copies data of theOther array to this. @@ -113,7 +113,7 @@ public: inline gp_Pnt Poly_ArrayOfNodes::Value(int theIndex) const { - if (myStride == (int)sizeof(gp_Pnt)) + if (myStride == static_cast(sizeof(gp_Pnt))) { return NCollection_AliasedArray::Value(theIndex); } @@ -129,7 +129,7 @@ inline gp_Pnt Poly_ArrayOfNodes::Value(int theIndex) const inline void Poly_ArrayOfNodes::SetValue(int theIndex, const gp_Pnt& theValue) { - if (myStride == (int)sizeof(gp_Pnt)) + if (myStride == static_cast(sizeof(gp_Pnt))) { NCollection_AliasedArray::ChangeValue(theIndex) = theValue; } @@ -137,7 +137,7 @@ inline void Poly_ArrayOfNodes::SetValue(int theIndex, const gp_Pnt& theValue) { NCollection_Vec3& aVec3 = NCollection_AliasedArray::ChangeValue>(theIndex); - aVec3.SetValues((float)theValue.X(), (float)theValue.Y(), (float)theValue.Z()); + aVec3.SetValues(static_cast(theValue.X()), static_cast(theValue.Y()), static_cast(theValue.Z())); } } diff --git a/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfUVNodes.hxx b/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfUVNodes.hxx index 6f5954cb310..f9a18479dde 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfUVNodes.hxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfUVNodes.hxx @@ -25,14 +25,14 @@ class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<> public: //! Empty constructor of double-precision array. Poly_ArrayOfUVNodes() - : NCollection_AliasedArray((int)sizeof(gp_Pnt2d)) + : NCollection_AliasedArray(static_cast(sizeof(gp_Pnt2d))) { // } //! Constructor of double-precision array. Poly_ArrayOfUVNodes(int theLength) - : NCollection_AliasedArray((int)sizeof(gp_Pnt2d), theLength) + : NCollection_AliasedArray(static_cast(sizeof(gp_Pnt2d)), theLength) { // } @@ -58,7 +58,7 @@ public: Standard_EXPORT ~Poly_ArrayOfUVNodes(); //! Returns TRUE if array defines nodes with double precision. - bool IsDoublePrecision() const { return myStride == (int)sizeof(gp_Pnt2d); } + bool IsDoublePrecision() const { return myStride == static_cast(sizeof(gp_Pnt2d)); } //! Sets if array should define nodes with double or single precision. //! Raises exception if array was already allocated. @@ -69,7 +69,7 @@ public: throw Standard_ProgramError( "Poly_ArrayOfUVNodes::SetDoublePrecision() should be called before allocation"); } - myStride = int(theIsDouble ? sizeof(gp_Pnt2d) : sizeof(NCollection_Vec2)); + myStride = static_cast(theIsDouble ? sizeof(gp_Pnt2d) : sizeof(NCollection_Vec2)); } //! Copies data of theOther array to this. @@ -113,7 +113,7 @@ public: inline gp_Pnt2d Poly_ArrayOfUVNodes::Value(int theIndex) const { - if (myStride == (int)sizeof(gp_Pnt2d)) + if (myStride == static_cast(sizeof(gp_Pnt2d))) { return NCollection_AliasedArray::Value(theIndex); } @@ -129,7 +129,7 @@ inline gp_Pnt2d Poly_ArrayOfUVNodes::Value(int theIndex) const inline void Poly_ArrayOfUVNodes::SetValue(int theIndex, const gp_Pnt2d& theValue) { - if (myStride == (int)sizeof(gp_Pnt2d)) + if (myStride == static_cast(sizeof(gp_Pnt2d))) { NCollection_AliasedArray::ChangeValue(theIndex) = theValue; } @@ -137,7 +137,7 @@ inline void Poly_ArrayOfUVNodes::SetValue(int theIndex, const gp_Pnt2d& theValue { NCollection_Vec2& aVec2 = NCollection_AliasedArray::ChangeValue>(theIndex); - aVec2.SetValues((float)theValue.X(), (float)theValue.Y()); + aVec2.SetValues(static_cast(theValue.X()), static_cast(theValue.Y())); } } diff --git a/src/FoundationClasses/TKMath/Poly/Poly_Connect.cxx b/src/FoundationClasses/TKMath/Poly/Poly_Connect.cxx index de4174033b5..43281d32903 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_Connect.cxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_Connect.cxx @@ -139,7 +139,7 @@ void Poly_Connect::Load(const occ::handle& theTriangulation) if (ced == nullptr) { // create the edge if not found - ced = (polyedge*)anIncAlloc->Allocate(sizeof(polyedge)); + ced = static_cast(anIncAlloc->Allocate(sizeof(polyedge))); ced->next = anEdges[anEdgeNodes[0]]; anEdges[anEdgeNodes[0]] = ced; ced->nd = anEdgeNodes[1]; diff --git a/src/FoundationClasses/TKMath/Poly/Poly_MakeLoops.cxx b/src/FoundationClasses/TKMath/Poly/Poly_MakeLoops.cxx index a2bddb2c608..2478e2ebcd7 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_MakeLoops.cxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_MakeLoops.cxx @@ -92,7 +92,7 @@ Poly_MakeLoops::LinkFlag Poly_MakeLoops::SetLinkOrientation(const Link& theLi if (aInd > 0) { Link& aLink = const_cast(myMapLink(aInd)); - aOri = (LinkFlag)(aLink.flags & LF_Both); + aOri = static_cast(aLink.flags & LF_Both); aLink.flags = theOrient; #ifdef OCCT_DEBUG myHelper->OnAddLink(aInd, aLink); diff --git a/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.cxx b/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.cxx index 57084f6634c..79edae7ac54 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.cxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.cxx @@ -75,11 +75,11 @@ Poly_MergeNodesTool::MergedNodesMap::MergedNodesMap(const int theNbBuckets) void Poly_MergeNodesTool::MergedNodesMap::SetMergeTolerance(double theTolerance) { - myTolerance = (float)theTolerance; + myTolerance = static_cast(theTolerance); myInvTol = 0.0f; if (myTolerance > 0.0f) { - myInvTol = float(1.0 / theTolerance); + myInvTol = static_cast(1.0 / theTolerance); } } @@ -110,7 +110,7 @@ inline size_t Poly_MergeNodesTool::MergedNodesMap::hashCode(const NCollection_Ve // compute DJB2 hash of a string const size_t aLength = sizeof(NCollection_Vec3); unsigned int aHashCode = 0; - const char* c = (const char*)&thePos; + const char* c = reinterpret_cast(&thePos); for (size_t i = 0; i < aLength; ++i, ++c) { aHashCode = ((aHashCode << 5) + aHashCode) ^ (*c); @@ -191,7 +191,7 @@ inline bool Poly_MergeNodesTool::MergedNodesMap::Bind(int& ReSize(Extent()); } - DataMapNode** aData = (DataMapNode**)myData1; + DataMapNode** aData = reinterpret_cast(myData1); const size_t aHash = hashCode(thePos, theNorm, NbBuckets()); for (DataMapNode* aNodeIter = aData[aHash]; aNodeIter != nullptr; aNodeIter = (DataMapNode*)aNodeIter->Next()) @@ -243,7 +243,7 @@ inline void Poly_MergeNodesTool::MergedNodesMap::ReSize(const int theSize) int aNbNewBuck = 0; if (BeginResize(theSize, aNbNewBuck, aNewData, aDummy)) { - if (DataMapNode** anOldData = (DataMapNode**)myData1) + if (DataMapNode** anOldData = reinterpret_cast(myData1)) { for (int anOldBuckIter = 0; anOldBuckIter <= NbBuckets(); ++anOldBuckIter) { diff --git a/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.hxx b/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.hxx index 842f6ec737e..3bf0ac7d2e9 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.hxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.hxx @@ -92,7 +92,7 @@ public: const gp_XYZ aVec01 = myPlaces[1] - myPlaces[0]; const gp_XYZ aVec02 = myPlaces[2] - myPlaces[0]; const gp_XYZ aCross = aVec01 ^ aVec02; - NCollection_Vec3 aNorm((float)aCross.X(), (float)aCross.Y(), (float)aCross.Z()); + NCollection_Vec3 aNorm(static_cast(aCross.X()), static_cast(aCross.Y()), static_cast(aCross.Z())); return aNorm.Normalized(); } @@ -161,7 +161,7 @@ private: { int aNodeIndex = myNbNodes; const gp_XYZ& aPlace = myPlaces[theTriNode]; - const NCollection_Vec3 aVec3((float)aPlace.X(), (float)aPlace.Y(), (float)aPlace.Z()); + const NCollection_Vec3 aVec3(static_cast(aPlace.X()), static_cast(aPlace.Y()), static_cast(aPlace.Z())); if (myNodeIndexMap.Bind(aNodeIndex, theIsOpposite, aVec3, myTriNormal)) { ++myNbNodes; @@ -228,8 +228,8 @@ private: //! Set merge angle. void SetMergeAngle(double theAngleRad) { - myAngle = (float)theAngleRad; - myAngleCos = (float)std::cos(theAngleRad); + myAngle = static_cast(theAngleRad); + myAngleCos = static_cast(std::cos(theAngleRad)); } //! Return TRUE if merge angle is non-zero. diff --git a/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.cxx b/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.cxx index a21afe9514f..3d96a4e38bd 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.cxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.cxx @@ -452,7 +452,7 @@ void Poly_Triangulation::ComputeNormals() const gp_XYZ aVec02 = aNode2.XYZ() - aNode0.XYZ(); const gp_XYZ aTriNorm = aVec01 ^ aVec02; const NCollection_Vec3 aNorm3f = - NCollection_Vec3(float(aTriNorm.X()), float(aTriNorm.Y()), float(aTriNorm.Z())); + NCollection_Vec3(static_cast(aTriNorm.X()), static_cast(aTriNorm.Y()), static_cast(aTriNorm.Z())); for (int aNodeIter = 0; aNodeIter < 3; ++aNodeIter) { myNormals.ChangeValue(anElem[aNodeIter] - 1) += aNorm3f; diff --git a/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.hxx b/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.hxx index 02f36ed5a0a..98faf74f2b3 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.hxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.hxx @@ -205,7 +205,7 @@ public: { SetNormal( theIndex, - NCollection_Vec3(float(theNormal.X()), float(theNormal.Y()), float(theNormal.Z()))); + NCollection_Vec3(static_cast(theNormal.X()), static_cast(theNormal.Y()), static_cast(theNormal.Z()))); } //! Returns mesh purpose bits. diff --git a/src/FoundationClasses/TKMath/TopLoc/TopLoc_Location.lxx b/src/FoundationClasses/TKMath/TopLoc/TopLoc_Location.lxx index e0c20e1cb39..6f9628b53d8 100644 --- a/src/FoundationClasses/TKMath/TopLoc/TopLoc_Location.lxx +++ b/src/FoundationClasses/TKMath/TopLoc/TopLoc_Location.lxx @@ -79,8 +79,8 @@ inline size_t TopLoc_Location::HashCode() const noexcept inline bool TopLoc_Location::IsEqual(const TopLoc_Location& theOther) const noexcept { - const void** p = (const void**)&myItems; - const void** q = (const void**)&theOther.myItems; + const void* const* p = reinterpret_cast(&myItems); + const void* const* q = reinterpret_cast(&theOther.myItems); if (*p == *q) { return true; diff --git a/src/FoundationClasses/TKMath/TopLoc/TopLoc_SListNodeOfItemLocation.lxx b/src/FoundationClasses/TKMath/TopLoc/TopLoc_SListNodeOfItemLocation.lxx index d25c20ef025..2d3b354e4a5 100644 --- a/src/FoundationClasses/TKMath/TopLoc/TopLoc_SListNodeOfItemLocation.lxx +++ b/src/FoundationClasses/TKMath/TopLoc/TopLoc_SListNodeOfItemLocation.lxx @@ -24,10 +24,10 @@ inline TopLoc_SListNodeOfItemLocation::TopLoc_SListNodeOfItemLocation( inline TopLoc_SListOfItemLocation& TopLoc_SListNodeOfItemLocation::Tail() const { - return (TopLoc_SListOfItemLocation&)myTail; + return const_cast(myTail); } inline TopLoc_ItemLocation& TopLoc_SListNodeOfItemLocation::Value() const { - return (TopLoc_ItemLocation&)myValue; + return const_cast(myValue); } diff --git a/src/FoundationClasses/TKMath/gp/gp_Trsf.cxx b/src/FoundationClasses/TKMath/gp/gp_Trsf.cxx index 3e8b719e50f..1ed21ccb818 100644 --- a/src/FoundationClasses/TKMath/gp/gp_Trsf.cxx +++ b/src/FoundationClasses/TKMath/gp/gp_Trsf.cxx @@ -958,7 +958,7 @@ bool gp_Trsf::InitFromJson(const Standard_SStream& theSStream, int& theStreamPos double ashape; OCCT_INIT_FIELD_VALUE_INTEGER(aStreamStr, aPos, ashape); - shape = (gp_TrsfForm)((int)ashape); + shape = static_cast(static_cast(ashape)); OCCT_INIT_FIELD_VALUE_REAL(aStreamStr, aPos, scale); diff --git a/src/FoundationClasses/TKMath/math/math_BFGS.cxx b/src/FoundationClasses/TKMath/math/math_BFGS.cxx index 8ac56526f02..3b77f890838 100644 --- a/src/FoundationClasses/TKMath/math/math_BFGS.cxx +++ b/src/FoundationClasses/TKMath/math/math_BFGS.cxx @@ -462,7 +462,7 @@ void math_BFGS::Dump(Standard_OStream& o) const o << " Number of iterations = " << NbIterations() << "\n"; } else - o << " Status = not Done because " << (int)TheStatus << "\n"; + o << " Status = not Done because " << static_cast(TheStatus) << "\n"; } //============================================================================= diff --git a/src/FoundationClasses/TKMath/math/math_FRPR.cxx b/src/FoundationClasses/TKMath/math/math_FRPR.cxx index f3948f2b7bc..0785015af78 100644 --- a/src/FoundationClasses/TKMath/math/math_FRPR.cxx +++ b/src/FoundationClasses/TKMath/math/math_FRPR.cxx @@ -220,6 +220,6 @@ void math_FRPR::Dump(Standard_OStream& o) const } else { - o << " Status = not Done because " << (int)TheStatus << "\n"; + o << " Status = not Done because " << static_cast(TheStatus) << "\n"; } } diff --git a/src/FoundationClasses/TKMath/math/math_FunctionAllRoots.cxx b/src/FoundationClasses/TKMath/math/math_FunctionAllRoots.cxx index ec8cd09791b..f4d40c6e015 100644 --- a/src/FoundationClasses/TKMath/math/math_FunctionAllRoots.cxx +++ b/src/FoundationClasses/TKMath/math/math_FunctionAllRoots.cxx @@ -183,9 +183,9 @@ math_FunctionAllRoots::math_FunctionAllRoots(math_FunctionWithDerivative& F, { // Recherche des solutions entre S.GetParameter(1) // et le debut du 1er intervalle nul - Nbrpt = (int)std::trunc( + Nbrpt = static_cast(std::trunc( std::abs((pdeb.Value(1) - S.GetParameter(1)) / (S.GetParameter(Nbp) - S.GetParameter(1))) - * Nbp); + * Nbp)); math_FunctionRoots Res(F, S.GetParameter(1), pdeb.Value(1), std::max(Nbrpt, NbpMin), EpsX, EpsF, 0.0); Standard_NumericError_Raise_if((!Res.IsDone()) || (Res.IsAllNull()), " "); @@ -198,9 +198,9 @@ math_FunctionAllRoots::math_FunctionAllRoots(math_FunctionWithDerivative& F, } for (int k = 2; k <= pdeb.Length(); k++) { - Nbrpt = (int)std::trunc( + Nbrpt = static_cast(std::trunc( std::abs((pdeb.Value(k) - pfin.Value(k - 1)) / (S.GetParameter(Nbp) - S.GetParameter(1))) - * Nbp); + * Nbp)); math_FunctionRoots Res(F, pfin.Value(k - 1), pdeb.Value(k), std::max(Nbrpt, NbpMin), EpsX, EpsF, 0.0); Standard_NumericError_Raise_if((!Res.IsDone()) || (Res.IsAllNull()), " "); @@ -215,9 +215,9 @@ math_FunctionAllRoots::math_FunctionAllRoots(math_FunctionWithDerivative& F, { // Recherche des solutions entre la fin du // dernier intervalle nul et Value(Nbp). - Nbrpt = (int)std::trunc(std::abs((S.GetParameter(Nbp) - pfin.Value(pdeb.Length())) + Nbrpt = static_cast(std::trunc(std::abs((S.GetParameter(Nbp) - pfin.Value(pdeb.Length())) / (S.GetParameter(Nbp) - S.GetParameter(1))) - * Nbp); + * Nbp)); math_FunctionRoots Res(F, pfin.Value(pdeb.Length()), S.GetParameter(Nbp), diff --git a/src/FoundationClasses/TKMath/math/math_FunctionSetRoot.cxx b/src/FoundationClasses/TKMath/math/math_FunctionSetRoot.cxx index 95df36041f1..4de5ea1455a 100644 --- a/src/FoundationClasses/TKMath/math/math_FunctionSetRoot.cxx +++ b/src/FoundationClasses/TKMath/math/math_FunctionSetRoot.cxx @@ -220,7 +220,7 @@ static bool MinimizeDirection(const math_Vector& P0, invnorme = Delta.Norm(); if (invnorme <= Eps) return false; - invnorme = ((double)1) / invnorme; + invnorme = (static_cast(1)) / invnorme; F.Initialize(P1, Delta); diff --git a/src/FoundationClasses/TKMath/math/math_GlobOptMin.cxx b/src/FoundationClasses/TKMath/math/math_GlobOptMin.cxx index f339d4154ea..a692028bd79 100644 --- a/src/FoundationClasses/TKMath/math/math_GlobOptMin.cxx +++ b/src/FoundationClasses/TKMath/math/math_GlobOptMin.cxx @@ -97,7 +97,7 @@ math_GlobOptMin::math_GlobOptMin(math_MultipleVarFunction* theFunc, mySameTol = theSameTol; const int aMaxSquareSearchSol = 200; - int aSolNb = int(std::pow(3.0, double(myN))); + int aSolNb = static_cast(std::pow(3.0, static_cast(myN))); myMinCellFilterSol = std::max(2 * aSolNb, aMaxSquareSearchSol); initCellSize(); ComputeInitSol(); diff --git a/src/FoundationClasses/TKMath/math/math_NewtonMinimum.cxx b/src/FoundationClasses/TKMath/math/math_NewtonMinimum.cxx index b3863071354..d2cea3546d1 100644 --- a/src/FoundationClasses/TKMath/math/math_NewtonMinimum.cxx +++ b/src/FoundationClasses/TKMath/math/math_NewtonMinimum.cxx @@ -262,7 +262,7 @@ void math_NewtonMinimum::Dump(Standard_OStream& o) const { o << "math_Newton Optimisation: "; o << " Done =" << Done << std::endl; - o << " Status = " << (int)TheStatus << std::endl; + o << " Status = " << static_cast(TheStatus) << std::endl; o << " Location Vector = " << Location() << std::endl; o << " Minimum value = " << Minimum() << std::endl; o << " Previous value = " << PreviousMinimum << std::endl; diff --git a/src/FoundationClasses/TKMath/math/math_Powell.cxx b/src/FoundationClasses/TKMath/math/math_Powell.cxx index 1ff4970299a..00237efb663 100644 --- a/src/FoundationClasses/TKMath/math/math_Powell.cxx +++ b/src/FoundationClasses/TKMath/math/math_Powell.cxx @@ -240,6 +240,6 @@ void math_Powell::Dump(Standard_OStream& o) const } else { - o << " Status = not Done because " << (int)TheStatus << "\n"; + o << " Status = not Done because " << static_cast(TheStatus) << "\n"; } } diff --git a/src/FoundationClasses/TKernel/FSD/FSD_Base64.cxx b/src/FoundationClasses/TKernel/FSD/FSD_Base64.cxx index 1cadb3cd9fd..d7ecdadac0f 100644 --- a/src/FoundationClasses/TKernel/FSD/FSD_Base64.cxx +++ b/src/FoundationClasses/TKernel/FSD/FSD_Base64.cxx @@ -43,7 +43,7 @@ size_t FSD_Base64::Encode(char* theEncodedStr, for (size_t i = 0; i < theDataLen - aPad; i += 3) { uint32_t aWord = - (uint32_t(theData[i]) << 16) + (uint32_t(theData[i + 1]) << 8) + theData[i + 2]; + (static_cast(theData[i]) << 16) + (static_cast(theData[i + 1]) << 8) + theData[i + 2]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 18]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 12 & 0x3F]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 6 & 0x3F]; @@ -53,7 +53,7 @@ size_t FSD_Base64::Encode(char* theEncodedStr, { if (aPad != 0) { - uint32_t aWord = uint32_t(theData[theDataLen - 2]) << 8 | theData[theDataLen - 1]; + uint32_t aWord = static_cast(theData[theDataLen - 2]) << 8 | theData[theDataLen - 1]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 10]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 4 & 0x03F]; theEncodedStr[iStr++] = aBase64Chars[(aWord & 0xF) << 2]; @@ -79,7 +79,7 @@ size_t FSD_Base64::Encode(char* theEncodedStr, TCollection_AsciiString FSD_Base64::Encode(const uint8_t* theData, const size_t theDataLen) { size_t aStrLen = Encode(nullptr, 0, theData, theDataLen); - TCollection_AsciiString aStr((int)aStrLen, 0); + TCollection_AsciiString aStr(static_cast(aStrLen), 0); Encode(const_cast(aStr.ToCString()), aStrLen, theData, theDataLen); return aStr; } @@ -126,10 +126,10 @@ size_t FSD_Base64::Decode(uint8_t* theDecodedData, // Decoding loop for (size_t i = 0; i < aNbIter; i += 4) { - unsigned aWord = (aBase64Codes[unsigned(theEncodedStr[i])] << 18) - + (aBase64Codes[unsigned(theEncodedStr[i + 1])] << 12) - + (aBase64Codes[unsigned(theEncodedStr[i + 2])] << 6) - + aBase64Codes[unsigned(theEncodedStr[i + 3])]; + unsigned aWord = (aBase64Codes[static_cast(theEncodedStr[i])] << 18) + + (aBase64Codes[static_cast(theEncodedStr[i + 1])] << 12) + + (aBase64Codes[static_cast(theEncodedStr[i + 2])] << 6) + + aBase64Codes[static_cast(theEncodedStr[i + 3])]; *theDecodedData++ = static_cast(aWord >> 16); *theDecodedData++ = static_cast(aWord >> 8 & 0xFF); *theDecodedData++ = static_cast(aWord & 0xFF); @@ -138,13 +138,13 @@ size_t FSD_Base64::Decode(uint8_t* theDecodedData, // Decoding pad bytes if (aPad > 0) { - unsigned aWord = (aBase64Codes[unsigned(theEncodedStr[aNbIter])] << 18) - + (aBase64Codes[unsigned(theEncodedStr[aNbIter + 1])] << 12); + unsigned aWord = (aBase64Codes[static_cast(theEncodedStr[aNbIter])] << 18) + + (aBase64Codes[static_cast(theEncodedStr[aNbIter + 1])] << 12); *theDecodedData++ = static_cast(aWord >> 16); if (aPad > 1) { - aWord += (aBase64Codes[unsigned(theEncodedStr[aNbIter + 2])] << 6); + aWord += (aBase64Codes[static_cast(theEncodedStr[aNbIter + 2])] << 6); *theDecodedData++ = static_cast(aWord >> 8 & 0xFF); } } diff --git a/src/FoundationClasses/TKernel/FSD/FSD_BinaryFile.cxx b/src/FoundationClasses/TKernel/FSD/FSD_BinaryFile.cxx index 0cd00619259..7ed2bc213f5 100644 --- a/src/FoundationClasses/TKernel/FSD/FSD_BinaryFile.cxx +++ b/src/FoundationClasses/TKernel/FSD/FSD_BinaryFile.cxx @@ -258,7 +258,7 @@ int FSD_BinaryFile::PutInteger(Standard_OStream& theOStream, if (!theOnlyCount) { - theOStream.write((char*)&t, sizeof(int)); + theOStream.write(reinterpret_cast(&t), sizeof(int)); if (theOStream.fail()) { throw Storage_StreamWriteError(); @@ -335,7 +335,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetReference(int& aValue) //======================================================================= void FSD_BinaryFile::GetReference(Standard_IStream& theIStream, int& aValue) { - theIStream.read((char*)&aValue, sizeof(int)); + theIStream.read(reinterpret_cast(&aValue), sizeof(int)); if (theIStream.gcount() != sizeof(int)) { @@ -385,7 +385,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetInteger(int& aValue) void FSD_BinaryFile::GetInteger(Standard_IStream& theIStream, int& theValue) { - theIStream.read((char*)&theValue, sizeof(int)); + theIStream.read(reinterpret_cast(&theValue), sizeof(int)); if (theIStream.gcount() != sizeof(int)) { @@ -467,7 +467,7 @@ Storage_Error FSD_BinaryFile::BeginWriteInfoSection() if (!fwrite(FSD_BinaryFile::MagicNumber(), strlen(FSD_BinaryFile::MagicNumber()), 1, myStream)) throw Storage_StreamWriteError(); - myHeader.binfo = (int)ftell(myStream); + myHeader.binfo = static_cast(ftell(myStream)); WriteHeader(); return Storage_VSOk; @@ -544,7 +544,7 @@ int FSD_BinaryFile::WriteInfo(Standard_OStream& Storage_Error FSD_BinaryFile::EndWriteInfoSection() { - myHeader.einfo = (int)ftell(myStream); + myHeader.einfo = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -747,7 +747,7 @@ Storage_Error FSD_BinaryFile::EndReadInfoSection() Storage_Error FSD_BinaryFile::BeginWriteCommentSection() { - myHeader.bcomment = (int)ftell(myStream); + myHeader.bcomment = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -797,7 +797,7 @@ int FSD_BinaryFile::WriteComment( Storage_Error FSD_BinaryFile::EndWriteCommentSection() { - myHeader.ecomment = (int)ftell(myStream); + myHeader.ecomment = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -871,7 +871,7 @@ Storage_Error FSD_BinaryFile::EndReadCommentSection() Storage_Error FSD_BinaryFile::BeginWriteTypeSection() { - myHeader.btype = (int)ftell(myStream); + myHeader.btype = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -895,7 +895,7 @@ void FSD_BinaryFile::WriteTypeInformations(const int typeNu Storage_Error FSD_BinaryFile::EndWriteTypeSection() { - myHeader.etype = (int)ftell(myStream); + myHeader.etype = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -971,7 +971,7 @@ Storage_Error FSD_BinaryFile::EndReadTypeSection() Storage_Error FSD_BinaryFile::BeginWriteRootSection() { - myHeader.broot = (int)ftell(myStream); + myHeader.broot = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -997,7 +997,7 @@ void FSD_BinaryFile::WriteRoot(const TCollection_AsciiString& rootName, Storage_Error FSD_BinaryFile::EndWriteRootSection() { - myHeader.eroot = (int)ftell(myStream); + myHeader.eroot = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -1078,7 +1078,7 @@ Storage_Error FSD_BinaryFile::EndReadRootSection() Storage_Error FSD_BinaryFile::BeginWriteRefSection() { - myHeader.bref = (int)ftell(myStream); + myHeader.bref = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -1101,7 +1101,7 @@ void FSD_BinaryFile::WriteReferenceType(const int reference, const int typeNum) Storage_Error FSD_BinaryFile::EndWriteRefSection() { - myHeader.eref = (int)ftell(myStream); + myHeader.eref = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -1175,7 +1175,7 @@ Storage_Error FSD_BinaryFile::EndReadRefSection() Storage_Error FSD_BinaryFile::BeginWriteDataSection() { - myHeader.bdata = (int)ftell(myStream); + myHeader.bdata = static_cast(ftell(myStream)); return Storage_VSOk; } @@ -1207,7 +1207,7 @@ void FSD_BinaryFile::EndWritePersistentObjectData() {} Storage_Error FSD_BinaryFile::EndWriteDataSection() { - myHeader.edata = (int)ftell(myStream); + myHeader.edata = static_cast(ftell(myStream)); fseek(myStream, myHeader.binfo, SEEK_SET); WriteHeader(); @@ -1319,7 +1319,7 @@ void FSD_BinaryFile::ReadString(TCollection_AsciiString& aString) GetInteger(size); if (size > 0) { - char* c = (char*)Standard::Allocate((size + 1) * sizeof(char)); + char* c = static_cast(Standard::Allocate((size + 1) * sizeof(char))); if (!fread(c, size, 1, myStream)) throw Storage_StreamWriteError(); c[size] = '\0'; @@ -1344,7 +1344,7 @@ void FSD_BinaryFile::ReadString(Standard_IStream& theIStream, TCollection_AsciiS if (size > 0) { - char* c = (char*)Standard::Allocate((size + 1) * sizeof(char)); + char* c = static_cast(Standard::Allocate((size + 1) * sizeof(char))); if (!theIStream.good()) { @@ -1459,7 +1459,7 @@ void FSD_BinaryFile::ReadExtendedString(TCollection_ExtendedString& aString) GetInteger(size); if (size > 0) { - char16_t* c = (char16_t*)Standard::Allocate((size + 1) * sizeof(char16_t)); + char16_t* c = static_cast(Standard::Allocate((size + 1) * sizeof(char16_t))); if (!fread(c, size * sizeof(char16_t), 1, myStream)) throw Storage_StreamWriteError(); c[size] = '\0'; @@ -1489,15 +1489,15 @@ void FSD_BinaryFile::ReadExtendedString(Standard_IStream& theIStream, if (size > 0) { - char16_t* c = (char16_t*)Standard::Allocate((size + 1) * sizeof(char16_t)); + char16_t* c = static_cast(Standard::Allocate((size + 1) * sizeof(char16_t))); if (!theIStream.good()) { throw Storage_StreamReadError(); } - const std::streamsize aNbBytes = std::streamsize(sizeof(char16_t) * size); - theIStream.read((char*)c, aNbBytes); + const std::streamsize aNbBytes = static_cast(sizeof(char16_t) * size); + theIStream.read(reinterpret_cast(c), aNbBytes); if (theIStream.gcount() != aNbBytes) { throw Storage_StreamReadError(); @@ -1656,7 +1656,7 @@ void FSD_BinaryFile::ReadHeaderData(Standard_IStream& theIS Storage_Position FSD_BinaryFile::Tell() { - return (Storage_Position)ftell(myStream); + return static_cast(ftell(myStream)); } //======================================================================= @@ -1735,7 +1735,7 @@ inline uint64_t OCCT_InverseSizeSpecialized<8>(const uint64_t theValue, int) size_t FSD_BinaryFile::InverseSize(const size_t theValue) { - return (size_t)OCCT_InverseSizeSpecialized(theValue, 0); + return static_cast(OCCT_InverseSizeSpecialized(theValue, 0)); } uint64_t FSD_BinaryFile::InverseUint64(const uint64_t theValue) diff --git a/src/FoundationClasses/TKernel/FSD/FSD_File.cxx b/src/FoundationClasses/TKernel/FSD/FSD_File.cxx index b91cac0d3e8..077cbd0a822 100644 --- a/src/FoundationClasses/TKernel/FSD/FSD_File.cxx +++ b/src/FoundationClasses/TKernel/FSD/FSD_File.cxx @@ -210,10 +210,10 @@ void FSD_File::WriteExtendedLine(const TCollection_ExtendedString& buffer) c = (extBuffer[i] & 0x0000FF00) >> 8; d = extBuffer[i] & 0x000000FF; - myStream << (char)c << (char)d; + myStream << static_cast(c) << static_cast(d); } - myStream << (char)0 << "\n"; + myStream << static_cast(0) << "\n"; } //================================================================================================= @@ -237,7 +237,7 @@ void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer) count = 0; if (count < SIZEOFNORMALEXTENDEDSECTION) { - i = (char16_t)c; + i = static_cast(c); if (c == '\0') fin = true; i = (i << 8); @@ -252,8 +252,8 @@ void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer) if (c != '\n') { fin = false; - i |= (0x00FF & (char16_t)c); - buffer += (char16_t)i; + i |= (0x00FF & static_cast(c)); + buffer += i; } } else @@ -433,7 +433,7 @@ Storage_BaseDriver& FSD_File::PutCharacter(const char aValue) Storage_BaseDriver& FSD_File::PutExtCharacter(const char16_t aValue) { - myStream << (short)aValue << " "; + myStream << static_cast(aValue) << " "; if (myStream.bad()) throw Storage_StreamWriteError(); return *this; @@ -453,7 +453,7 @@ Storage_BaseDriver& FSD_File::PutInteger(const int aValue) Storage_BaseDriver& FSD_File::PutBoolean(const bool aValue) { - myStream << ((int)aValue) << " "; + myStream << (static_cast(aValue)) << " "; if (myStream.bad()) throw Storage_StreamWriteError(); return *this; @@ -463,7 +463,7 @@ Storage_BaseDriver& FSD_File::PutBoolean(const bool aValue) Storage_BaseDriver& FSD_File::PutReal(const double aValue) { - myStream << ((double)aValue) << " "; + myStream << (aValue) << " "; if (myStream.bad()) throw Storage_StreamWriteError(); return *this; @@ -506,7 +506,7 @@ Storage_BaseDriver& FSD_File::GetCharacter(char& aValue) throw Storage_StreamTypeMismatchError(); myStream.clear(std::ios::goodbit); // .clear(0) is not portable } - aValue = (char)i; + aValue = static_cast(i); return *this; } @@ -578,7 +578,7 @@ Storage_BaseDriver& FSD_File::GetShortReal(float& aValue) if (!OSD::CStringToReal(realbuffer, r)) throw Storage_StreamTypeMismatchError(); - aValue = (float)r; + aValue = static_cast(r); return *this; #else diff --git a/src/FoundationClasses/TKernel/Message/Message_AlertExtended.cxx b/src/FoundationClasses/TKernel/Message/Message_AlertExtended.cxx index 4677aeeff5f..3ca675d4679 100644 --- a/src/FoundationClasses/TKernel/Message/Message_AlertExtended.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_AlertExtended.cxx @@ -70,7 +70,7 @@ bool Message_AlertExtended::SupportsMerge() const // hierarchical alerts can not be merged for (int aGravIter = Message_Trace; aGravIter <= Message_Fail; ++aGravIter) { - if (!myCompositAlerts->Alerts((Message_Gravity)aGravIter).IsEmpty()) + if (!myCompositAlerts->Alerts(static_cast(aGravIter)).IsEmpty()) { return false; } diff --git a/src/FoundationClasses/TKernel/Message/Message_Algorithm.cxx b/src/FoundationClasses/TKernel/Message/Message_Algorithm.cxx index 11fae045929..77a7f435ab6 100644 --- a/src/FoundationClasses/TKernel/Message/Message_Algorithm.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_Algorithm.cxx @@ -383,7 +383,7 @@ TCollection_ExtendedString Message_Algorithm::PrepareReport( int nb = 1; for (; nb <= theReportSeq.Length() && nb <= theMaxCount; nb++) { - aNewReport += (const char*)(nb > 1 ? ", \'" : "\'"); + aNewReport += (nb > 1 ? ", \'" : "\'"); aNewReport += theReportSeq.Value(nb)->String(); aNewReport += "\'"; } diff --git a/src/FoundationClasses/TKernel/Message/Message_AttributeMeter.cxx b/src/FoundationClasses/TKernel/Message/Message_AttributeMeter.cxx index e3e1f8e030d..4192aa52df6 100644 --- a/src/FoundationClasses/TKernel/Message/Message_AttributeMeter.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_AttributeMeter.cxx @@ -224,12 +224,12 @@ void Message_AttributeMeter::SetAlertMetrics(const occ::handleSetStartValue(aMetricType, - (double)aMemInfo.ValuePreciseMiB(anIterator.Value())); + aMemInfo.ValuePreciseMiB(anIterator.Value())); } else { aMeterAttribute->SetStopValue(aMetricType, - (double)aMemInfo.ValuePreciseMiB(anIterator.Value())); + aMemInfo.ValuePreciseMiB(anIterator.Value())); } } } diff --git a/src/FoundationClasses/TKernel/Message/Message_CompositeAlerts.cxx b/src/FoundationClasses/TKernel/Message/Message_CompositeAlerts.cxx index ff45fe5a9cc..fc862106628 100644 --- a/src/FoundationClasses/TKernel/Message/Message_CompositeAlerts.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_CompositeAlerts.cxx @@ -89,7 +89,7 @@ bool Message_CompositeAlerts::HasAlert(const occ::handle& theAler for (int aGravIter = Message_Trace; aGravIter <= Message_Fail; ++aGravIter) { const NCollection_List>& anAlerts = - Alerts((Message_Gravity)aGravIter); + Alerts(static_cast(aGravIter)); if (anAlerts.Contains(theAlert)) { return true; diff --git a/src/FoundationClasses/TKernel/Message/Message_ExecStatus.hxx b/src/FoundationClasses/TKernel/Message/Message_ExecStatus.hxx index 14ff97c4e5d..661c4c146f5 100644 --- a/src/FoundationClasses/TKernel/Message/Message_ExecStatus.hxx +++ b/src/FoundationClasses/TKernel/Message/Message_ExecStatus.hxx @@ -230,13 +230,13 @@ public: //! in range [1, StatusesPerType] static int LocalStatusIndex(Message_Status theStatus) { - return ((unsigned int)theStatus & (unsigned int)MIndex) + 1; + return (static_cast(theStatus) & static_cast(MIndex)) + 1; } //! Returns status type (DONE, WARN, ALARM, or FAIL) static Message_StatusType TypeOfStatus(Message_Status theStatus) { - return (Message_StatusType)((unsigned int)theStatus & (unsigned int)MType); + return static_cast(static_cast(theStatus) & static_cast(MType)); } //! Returns status with index theIndex in whole range [FirstStatus, LastStatus] @@ -244,13 +244,13 @@ public: { int indx = theIndex - 1; if (indx < 32) - return (Message_Status)(Message_DONE + indx); + return static_cast(Message_DONE + indx); else if (indx < 64) - return (Message_Status)(Message_WARN + (indx - 32)); + return static_cast(Message_WARN + (indx - 32)); else if (indx < 96) - return (Message_Status)(Message_ALARM + (indx - 64)); + return static_cast(Message_ALARM + (indx - 64)); else if (indx < 128) - return (Message_Status)(Message_FAIL + (indx - 96)); + return static_cast(Message_FAIL + (indx - 96)); return Message_None; } diff --git a/src/FoundationClasses/TKernel/Message/Message_Msg.cxx b/src/FoundationClasses/TKernel/Message/Message_Msg.cxx index 5ae5aa41bae..c3831462e70 100644 --- a/src/FoundationClasses/TKernel/Message/Message_Msg.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_Msg.cxx @@ -43,7 +43,7 @@ Message_Msg::Message_Msg(const Message_Msg& theMsg) Message_Msg::Message_Msg(const char* const theMsgCode) { - TCollection_AsciiString aKey((char*)theMsgCode); + TCollection_AsciiString aKey(const_cast(theMsgCode)); Set(Message_MsgFile::Msg(aKey)); } @@ -58,7 +58,7 @@ Message_Msg::Message_Msg(const TCollection_ExtendedString& theMsgCode) void Message_Msg::Set(const char* const theMsg) { - TCollection_AsciiString aMsg((char*)theMsg); + TCollection_AsciiString aMsg(const_cast(theMsg)); Set(aMsg); } @@ -124,7 +124,7 @@ void Message_Msg::Set(const TCollection_ExtendedString& theMsg) default: continue; } - mySeqOfFormats.Append(int(aFormatType)); // type + mySeqOfFormats.Append(static_cast(aFormatType)); // type mySeqOfFormats.Append(aStart); // beginning pos mySeqOfFormats.Append(i + 1 - aStart); // length } @@ -260,7 +260,7 @@ int Message_Msg::getFormat(const int theType, TCollection_AsciiString& theFormat theFormat = TCollection_AsciiString(aLen, ' '); for (int j = 1; j <= aLen; j++) if (IsAnAscii(myMessageBody.Value(aFirst + j))) - theFormat.SetValue(j, (char)myMessageBody.Value(aFirst + j)); + theFormat.SetValue(j, static_cast(myMessageBody.Value(aFirst + j))); // delete information on this placeholder mySeqOfFormats.Remove(i, i + 2); // return start position diff --git a/src/FoundationClasses/TKernel/Message/Message_MsgFile.cxx b/src/FoundationClasses/TKernel/Message/Message_MsgFile.cxx index 6a9ae0da484..1021ce982a6 100644 --- a/src/FoundationClasses/TKernel/Message/Message_MsgFile.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_MsgFile.cxx @@ -233,7 +233,7 @@ static int GetFileSize(FILE* theFile) if (fseek(theFile, 0, SEEK_SET) != 0) return -1; - return (int)nRealFileSize; + return static_cast(nRealFileSize); } //======================================================================= @@ -342,7 +342,7 @@ bool Message_MsgFile::LoadFromEnv(const char* const theEnvName, bool Message_MsgFile::LoadFromString(const char* const theContent, const int theLength) { - int aStringSize = theLength >= 0 ? theLength : (int)strlen(theContent); + int aStringSize = theLength >= 0 ? theLength : static_cast(strlen(theContent)); NCollection_Buffer aBuffer(NCollection_BaseAllocator::CommonBaseAllocator()); if (aStringSize <= 0 || !aBuffer.Allocate(aStringSize + 2)) { diff --git a/src/FoundationClasses/TKernel/Message/Message_PrinterOStream.cxx b/src/FoundationClasses/TKernel/Message/Message_PrinterOStream.cxx index 70c3d4cbb1c..f8a170bdcf0 100644 --- a/src/FoundationClasses/TKernel/Message/Message_PrinterOStream.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_PrinterOStream.cxx @@ -96,7 +96,7 @@ void Message_PrinterOStream::Close() { if (!myStream) return; - Standard_OStream* ostr = (Standard_OStream*)myStream; + Standard_OStream* ostr = static_cast(myStream); myStream = nullptr; ostr->flush(); @@ -147,7 +147,7 @@ void Message_PrinterOStream::send(const TCollection_AsciiString& theString, } } - Standard_OStream* aStream = (Standard_OStream*)myStream; + Standard_OStream* aStream = static_cast(myStream); if (toIntense || aColor != Message_ConsoleColor_Default) { SetConsoleTextColor(aStream, aColor, toIntense); diff --git a/src/FoundationClasses/TKernel/Message/Message_PrinterOStream.hxx b/src/FoundationClasses/TKernel/Message/Message_PrinterOStream.hxx index 28e0ef4d0a8..e9176265507 100644 --- a/src/FoundationClasses/TKernel/Message/Message_PrinterOStream.hxx +++ b/src/FoundationClasses/TKernel/Message/Message_PrinterOStream.hxx @@ -60,7 +60,7 @@ public: ~Message_PrinterOStream() override { Close(); } //! Returns reference to the output stream - Standard_OStream& GetStream() const { return *(Standard_OStream*)myStream; } + Standard_OStream& GetStream() const { return *static_cast(myStream); } //! Returns TRUE if text output into console should be colorized depending on message gravity; //! TRUE by default. diff --git a/src/FoundationClasses/TKernel/Message/Message_ProgressScope.hxx b/src/FoundationClasses/TKernel/Message/Message_ProgressScope.hxx index bceb8ea33cd..f5bed749e9f 100644 --- a/src/FoundationClasses/TKernel/Message/Message_ProgressScope.hxx +++ b/src/FoundationClasses/TKernel/Message/Message_ProgressScope.hxx @@ -275,8 +275,8 @@ public: //! @name Preparation methods if (!theName.IsEmpty()) { myIsOwnName = true; - myName = (char*)Standard::AllocateOptimal(size_t(theName.Length()) + size_t(1)); - char* aName = (char*)myName; + myName = static_cast(Standard::AllocateOptimal(static_cast(theName.Length()) + static_cast(1))); + char* aName = const_cast(myName); memcpy(aName, theName.ToCString(), theName.Length()); aName[theName.Length()] = '\0'; } diff --git a/src/FoundationClasses/TKernel/Message/Message_Report.cxx b/src/FoundationClasses/TKernel/Message/Message_Report.cxx index b8010b93cc2..45aa711fb56 100644 --- a/src/FoundationClasses/TKernel/Message/Message_Report.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_Report.cxx @@ -86,7 +86,7 @@ bool Message_Report::HasAlert(const occ::handle& theType) { for (int iGravity = Message_Trace; iGravity <= Message_Fail; ++iGravity) { - if (HasAlert(theType, (Message_Gravity)iGravity)) + if (HasAlert(theType, static_cast(iGravity))) return true; } return false; @@ -296,7 +296,7 @@ void Message_Report::Dump(Standard_OStream& theOS) { for (int iGravity = Message_Trace; iGravity <= Message_Fail; ++iGravity) { - Dump(theOS, (Message_Gravity)iGravity); + Dump(theOS, static_cast(iGravity)); } } @@ -323,7 +323,7 @@ void Message_Report::SendMessages(const occ::handle& theMesse { for (int aGravIter = Message_Trace; aGravIter <= Message_Fail; ++aGravIter) { - SendMessages(theMessenger, (Message_Gravity)aGravIter); + SendMessages(theMessenger, static_cast(aGravIter)); } } @@ -346,7 +346,7 @@ void Message_Report::Merge(const occ::handle& theOther) { for (int aGravIter = Message_Trace; aGravIter <= Message_Fail; ++aGravIter) { - Merge(theOther, (Message_Gravity)aGravIter); + Merge(theOther, static_cast(aGravIter)); } } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.cxx b/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.cxx index e99243c1c03..463005a5296 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.cxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.cxx @@ -170,7 +170,7 @@ NCollection_AccAllocator::Block* NCollection_AccAllocator::findBlock(void* const theKey.Value--; aBlock = myBlocks.ChangeSeek(theKey); - if (aBlock && (uint8_t*)aBlock->address + (size_t)myBlockSize > theAddress) + if (aBlock && static_cast(aBlock->address) + (size_t)myBlockSize > theAddress) { return aBlock; } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.hxx index 698799fde8e..cab92cae016 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.hxx @@ -156,9 +156,9 @@ protected: SetFreeSize(theSize); } - void SetFreeSize(const size_t theSize) noexcept { allocStart = (uint8_t*)address + theSize; } + void SetFreeSize(const size_t theSize) noexcept { allocStart = static_cast(address) + theSize; } - size_t FreeSize() const noexcept { return (uint8_t*)allocStart - (uint8_t*)address; } + size_t FreeSize() const noexcept { return (uint8_t*)allocStart - static_cast(address); } AlignedPtr Allocate(const AlignedSize theSize) noexcept { diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_AliasedArray.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_AliasedArray.hxx index 14bb5448a6c..5b01af007c7 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_AliasedArray.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_AliasedArray.hxx @@ -246,7 +246,7 @@ public: { Standard_OutOfRange_Raise_if(theIndex < 0 || theIndex >= mySize, "NCollection_AliasedArray::value(), out of range index"); - return myData + size_t(myStride) * size_t(theIndex); + return myData + size_t(myStride) * static_cast(theIndex); } //! Access raw bytes of specified element. @@ -254,7 +254,7 @@ public: { Standard_OutOfRange_Raise_if(theIndex < 0 || theIndex >= mySize, "NCollection_AliasedArray::changeValue(), out of range index"); - return myData + size_t(myStride) * size_t(theIndex); + return myData + size_t(myStride) * static_cast(theIndex); } //! Initialize the items with theValue diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_BaseList.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_BaseList.hxx index a384063bfc9..ba495fa426c 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_BaseList.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_BaseList.hxx @@ -82,7 +82,7 @@ public: protected: void Init(const NCollection_BaseList& theList, NCollection_ListNode* const thePrev) noexcept { - myCurrent = thePrev ? thePrev->Next() : (NCollection_ListNode*)theList.PLast(); + myCurrent = thePrev ? thePrev->Next() : const_cast(theList.PLast()); myPrevious = thePrev; } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_BaseMap.cxx b/src/FoundationClasses/TKernel/NCollection/NCollection_BaseMap.cxx index 6c1dbf5976a..ba9682a747c 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_BaseMap.cxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_BaseMap.cxx @@ -34,10 +34,10 @@ bool NCollection_BaseMap::BeginResize(const int NbBuckets, else return false; } - data1 = (NCollection_ListNode**)Standard::Allocate((N + 1) * sizeof(NCollection_ListNode*)); + data1 = static_cast(Standard::Allocate((N + 1) * sizeof(NCollection_ListNode*))); if (isDouble) { - data2 = (NCollection_ListNode**)Standard::Allocate((N + 1) * sizeof(NCollection_ListNode*)); + data2 = static_cast(Standard::Allocate((N + 1) * sizeof(NCollection_ListNode*))); } else data2 = nullptr; @@ -114,7 +114,7 @@ void NCollection_BaseMap::Statistics(Standard_OStream& S) const S << "\nStatistics for the first Key\n"; for (i = 0; i <= mySize; i++) sizes[i] = 0; - data = (NCollection_ListNode**)myData1; + data = myData1; nb = 0; for (i = 0; i <= myNbBuckets; i++) { @@ -141,7 +141,7 @@ void NCollection_BaseMap::Statistics(Standard_OStream& S) const } } - double mean = ((double)l) / ((double)nb); + double mean = (static_cast(l)) / (static_cast(nb)); S << "\n\nMean of length : " << mean << "\n"; delete[] sizes; diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_BasePointerVector.cxx b/src/FoundationClasses/TKernel/NCollection/NCollection_BasePointerVector.cxx index 22e3aaf12a9..43d200225ff 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_BasePointerVector.cxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_BasePointerVector.cxx @@ -58,7 +58,7 @@ void NCollection_BasePointerVector::Append(const void* thePnt) } myArray = myAllocator.reallocate(myArray, myCapacity); } - myArray[mySize++] = (void*)thePnt; + myArray[mySize++] = const_cast(thePnt); } //================================================================================================= @@ -79,7 +79,7 @@ void NCollection_BasePointerVector::SetValue(const size_t theInd, const void* th memset(myArray + mySize, 0, (theInd - mySize) * sizeof(void**)); mySize = theInd; } - myArray[theInd] = (void*)thePnt; + myArray[theInd] = const_cast(thePnt); } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_Buffer.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_Buffer.hxx index f5da57a1e87..6a84d298eff 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_Buffer.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_Buffer.hxx @@ -80,7 +80,7 @@ public: mySize = theSize; if (theSize != 0 || !myAllocator.IsNull()) { - myData = (uint8_t*)myAllocator->Allocate(theSize); + myData = static_cast(myAllocator->Allocate(theSize)); } if (myData == nullptr) diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_CellFilter.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_CellFilter.hxx index a16d4dbbc7a..8afaac6fa5c 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_CellFilter.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_CellFilter.hxx @@ -260,8 +260,8 @@ protected: // INT_MAX it is decreased correspondingly for the value of INT_MAX. If the value // of index is less than INT_MIN it is increased correspondingly for the absolute // value of INT_MIN. - index[i] = Cell_IndexType((aVal > INT_MAX - 1) ? fmod(aVal, (double)INT_MAX) - : (aVal < INT_MIN + 1) ? fmod(aVal, (double)INT_MIN) + index[i] = static_cast((aVal > INT_MAX - 1) ? fmod(aVal, static_cast(INT_MAX)) + : (aVal < INT_MIN + 1) ? fmod(aVal, static_castINT_MIN) : aVal); } } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_OccAllocator.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_OccAllocator.hxx index 93e8f91a62c..77254efe174 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_OccAllocator.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_OccAllocator.hxx @@ -163,7 +163,7 @@ public: } //! Estimate maximum array size - size_t max_size() const noexcept { return ((size_t)(-1) / sizeof(ItemType)); } + size_t max_size() const noexcept { return (static_cast(-1) / sizeof(ItemType)); } bool operator==(const NCollection_OccAllocator& theOther) const noexcept { diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_PackedMap.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_PackedMap.hxx index b67933ff9ca..fb10e97afa4 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_PackedMap.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_PackedMap.hxx @@ -690,7 +690,7 @@ protected: aRes = aRes + (aRes >> 16); aRes = aRes + (aRes >> 32); theMask = (theMask & MASK_HIGH) | ((static_cast(aRes) - 1) & MASK_LOW); - return size_t(aRes & 0x7f); + return static_cast(aRes & 0x7f); } else { @@ -702,7 +702,7 @@ protected: aRes = aRes + (aRes >> 8); aRes = aRes + (aRes >> 16); theMask = (theMask & MASK_HIGH) | ((aRes - 1) & MASK_LOW); - return size_t(aRes & 0x3f); + return static_cast(aRes & 0x3f); } } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.cxx b/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.cxx index 4199728b4f6..9ccca50b54f 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.cxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.cxx @@ -32,7 +32,7 @@ void NCollection_SparseArrayBase::allocData(const size_t iBlock) while (iBlock >= newNbBlocks) newNbBlocks *= 2; - void** newData = (void**)Standard::AllocateOptimal(newNbBlocks * sizeof(void*)); + void** newData = static_cast(Standard::AllocateOptimal(newNbBlocks * sizeof(void*))); if (myNbBlocks > 0) memcpy(newData, myData, myNbBlocks * sizeof(void*)); memset(newData + myNbBlocks, 0, (newNbBlocks - myNbBlocks) * sizeof(void*)); @@ -271,7 +271,7 @@ bool NCollection_SparseArrayBase::unsetValue(const size_t theIndex, DestroyItemF //================================================================================================= NCollection_SparseArrayBase::Iterator::Iterator(const NCollection_SparseArrayBase* theArray) - : myArr((NCollection_SparseArrayBase*)theArray), + : myArr(const_cast(theArray)), myHasMore(false), myIBlock(0), myInd(0), @@ -318,7 +318,7 @@ void NCollection_SparseArrayBase::Iterator::Next() void NCollection_SparseArrayBase::Iterator::init(const NCollection_SparseArrayBase* theArray) { - myArr = (NCollection_SparseArrayBase*)theArray; + myArr = const_cast(theArray); myHasMore = false; if (myArr) { diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.hxx index dd1fd8d155a..572784ab3e5 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.hxx @@ -81,9 +81,9 @@ private: public: //! Initializes the block by pointer to block data Block(void* const theAddr, const size_t theNbItems, const size_t theItemSize) - : Count((size_t*)theAddr), - Array((char*)theAddr + sizeof(size_t)), - Bits((Cell*)((char*)theAddr + sizeof(size_t) + theNbItems * theItemSize)) + : Count(static_cast(theAddr)), + Array(static_cast(theAddr) + sizeof(size_t)), + Bits(reinterpret_cast(static_cast(theAddr) + sizeof(size_t) + theNbItems * theItemSize)) { } @@ -99,7 +99,7 @@ private: const size_t /*theNbItems*/, const size_t /*theItemSize*/) noexcept { - return (char*)theAddress + sizeof(size_t); + return static_cast(theAddress) + sizeof(size_t); } public: @@ -108,9 +108,9 @@ private: Cell Set(size_t i) noexcept { Cell* abyte = Bits + i / BitsPerCell(); - Cell amask = (Cell)('\1' << (i % BitsPerCell())); - Cell anold = (Cell)(*abyte & amask); - *abyte = (Cell)(*abyte | amask); + Cell amask = static_cast('\1' << (i % BitsPerCell())); + Cell anold = static_cast(*abyte & amask); + *abyte = static_cast(*abyte | amask); return !anold; } @@ -118,8 +118,8 @@ private: Cell IsSet(size_t i) noexcept { Cell* abyte = Bits + i / BitsPerCell(); - Cell amask = (Cell)('\1' << (i % BitsPerCell())); - return (Cell)(*abyte & amask); + Cell amask = static_cast('\1' << (i % BitsPerCell())); + return static_cast(*abyte & amask); } //! Unset bit for i-th item; returns non-null if that bit @@ -127,9 +127,9 @@ private: Cell Unset(size_t i) noexcept { Cell* abyte = Bits + i / BitsPerCell(); - Cell amask = (Cell)('\1' << (i % BitsPerCell())); - Cell anold = (Cell)(*abyte & amask); - *abyte = (Cell)(*abyte & ~amask); + Cell amask = static_cast('\1' << (i % BitsPerCell())); + Cell anold = static_cast(*abyte & amask); + *abyte = static_cast(*abyte & ~amask); return anold; } @@ -220,7 +220,7 @@ protected: //! Find address of the item in the block by index (in the block) void* getItem(const Block& theBlock, size_t theInd) const noexcept { - return ((char*)theBlock.Array) + myItemSize * theInd; + return (static_cast(theBlock.Array)) + myItemSize * theInd; } //! Direct const access to the item diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_UBTreeFiller.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_UBTreeFiller.hxx index 8b43d76b659..8c124b7b8fc 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_UBTreeFiller.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_UBTreeFiller.hxx @@ -181,7 +181,7 @@ int NCollection_UBTreeFiller::CheckTree(Standard_OStream { int aNumber(0); const double aLen = checkNode(myTree.Root(), 0, aNumber); - const double num = (double)aNumber; + const double num = static_cast(aNumber); const double aLen1 = sqrt(aLen / num); const double aLen0 = log(num) / log(2.); char buf[128]; diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.hxx index ea80f213262..2df33e1c814 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.hxx @@ -123,7 +123,7 @@ public: //! @return the advance in bytes to store current symbol in UTF-32. //! Always 4 bytes (method for consistency). - constexpr int AdvanceBytesUtf32() const noexcept { return int(sizeof(char32_t)); } + constexpr int AdvanceBytesUtf32() const noexcept { return static_cast(sizeof(char32_t)); } //! Fill the UTF-8 buffer within current Unicode symbol. //! Use method AdvanceUtf8() to allocate buffer with enough size. diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.lxx b/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.lxx index ebdfb0e9768..69b5850ec4a 100755 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.lxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.lxx @@ -107,15 +107,15 @@ inline int NCollection_UtfIterator::AdvanceBytesUtf8() const // UTF-16 surrogate values are illegal in UTF-32 return 0; } - else if (myCharUtf32 < char32_t(0x80)) + else if (myCharUtf32 < static_cast(0x80)) { return 1; } - else if (myCharUtf32 < char32_t(0x800)) + else if (myCharUtf32 < static_cast(0x800)) { return 2; } - else if (myCharUtf32 < char32_t(0x10000)) + else if (myCharUtf32 < static_cast(0x10000)) { return 3; } @@ -136,7 +136,7 @@ template inline char* NCollection_UtfIterator::GetUtf8(char* theBuffer) const { // unsigned arithmetic used - return (char*)GetUtf8((unsigned char*)theBuffer); + return (char*)GetUtf8(reinterpret_cast(theBuffer)); } //================================================================================================= @@ -150,19 +150,19 @@ inline unsigned char* NCollection_UtfIterator::GetUtf8(unsigned char* theB // UTF-16 surrogate values are illegal in UTF-32 return theBuffer; } - else if (myCharUtf32 < char32_t(0x80)) + else if (myCharUtf32 < static_cast(0x80)) { *theBuffer++ = static_cast(aChar | UTF8_FIRST_BYTE_MARK[1]); return theBuffer; } - else if (myCharUtf32 < char32_t(0x800)) + else if (myCharUtf32 < static_cast(0x800)) { *++theBuffer = static_cast((aChar | UTF8_BYTE_MARK) & UTF8_BYTE_MASK); aChar >>= 6; *--theBuffer = static_cast(aChar | UTF8_FIRST_BYTE_MARK[2]); return theBuffer + 2; } - else if (myCharUtf32 < char32_t(0x10000)) + else if (myCharUtf32 < static_cast(0x10000)) { theBuffer += 3; *--theBuffer = static_cast((aChar | UTF8_BYTE_MARK) & UTF8_BYTE_MASK); @@ -256,8 +256,8 @@ inline char16_t* NCollection_UtfIterator::GetUtf16(char16_t* theBuffer) co { // surrogate pair char32_t aChar = myCharUtf32 - UTF16_SURROGATE_LOW_BASE; - *theBuffer++ = char16_t((aChar >> UTF16_SURROGATE_HIGH_SHIFT) + UTF16_SURROGATE_HIGH_START); - *theBuffer++ = char16_t((aChar & UTF16_SURROGATE_LOW_MASK) + UTF16_SURROGATE_LOW_START); + *theBuffer++ = static_cast((aChar >> UTF16_SURROGATE_HIGH_SHIFT) + UTF16_SURROGATE_HIGH_START); + *theBuffer++ = static_cast((aChar & UTF16_SURROGATE_LOW_MASK) + UTF16_SURROGATE_LOW_START); return theBuffer; } } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_UtfString.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_UtfString.hxx index ced6a0c1da1..b7585bac57f 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_UtfString.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_UtfString.hxx @@ -296,7 +296,7 @@ private: //! @name low-level methods //! Provides bytes interface to avoid incorrect pointer arithmetics. static void strCopy(uint8_t* theStrDst, const uint8_t* theStrSrc, const int theSizeBytes) noexcept { - std::memcpy(theStrDst, theStrSrc, (size_t)theSizeBytes); + std::memcpy(theStrDst, theStrSrc, static_cast(theSizeBytes)); } //! Compare two Unicode strings per-byte. @@ -306,7 +306,7 @@ private: //! @name low-level methods const int theSizeBytes2) noexcept { return (theSizeBytes1 == theSizeBytes2) - && (std::memcmp(theString1, theString2, (size_t)theSizeBytes1) == 0); + && (std::memcmp(theString1, theString2, static_cast(theSizeBytes1)) == 0); } private: //! @name private fields diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_Vec3.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_Vec3.hxx index f32a6e5195b..b063dc6042d 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_Vec3.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_Vec3.hxx @@ -79,7 +79,7 @@ public: //! Constructor from 2-components vector + optional 3rd value. explicit constexpr NCollection_Vec3(const NCollection_Vec2& theVec2, - Element_t theZ = Element_t(0)) noexcept + Element_t theZ = static_cast(0)) noexcept : v{theVec2[0], theVec2[1], theZ} { } diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Chronometer.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Chronometer.cxx index 421601265fe..eacc127aa96 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Chronometer.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Chronometer.cxx @@ -62,8 +62,8 @@ void OSD_Chronometer::GetProcessCPU(double& theUserSeconds, double& theSystemSec tms aCurrentTMS{}; times(&aCurrentTMS); - theUserSeconds = (double)aCurrentTMS.tms_utime / aCLK_TCK; - theSystemSeconds = (double)aCurrentTMS.tms_stime / aCLK_TCK; + theUserSeconds = static_cast(aCurrentTMS.tms_utime) / aCLK_TCK; + theSystemSeconds = static_cast(aCurrentTMS.tms_stime) / aCLK_TCK; } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Directory.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Directory.cxx index 5dd52195ccf..6a4b5bbac1c 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Directory.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Directory.cxx @@ -105,7 +105,7 @@ void OSD_Directory::Build(const OSD_Protection& theProtect) #else errno = 0; TCollection_AsciiString aBuffer; - mode_t anInternalProt = (mode_t)theProtect.Internal(); + mode_t anInternalProt = static_cast(theProtect.Internal()); myPath.SystemName(aBuffer); umask(0); int aStatus = mkdir(aBuffer.ToCString(), anInternalProt); diff --git a/src/FoundationClasses/TKernel/OSD/OSD_DirectoryIterator.cxx b/src/FoundationClasses/TKernel/OSD/OSD_DirectoryIterator.cxx index b3c377c5437..3e318221c08 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_DirectoryIterator.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_DirectoryIterator.cxx @@ -58,7 +58,7 @@ void OSD_DirectoryIterator::Initialize(const OSD_Path& where, const TCollection_ myMask = Mask; if (myDescr) { - closedir((DIR*)myDescr); + closedir(static_cast(myDescr)); myDescr = nullptr; } myInit = 1; @@ -114,13 +114,13 @@ void OSD_DirectoryIterator::Next() do { - myEntry = readdir((DIR*)myDescr); + myEntry = readdir(static_cast(myDescr)); if (!myEntry) { // No file found myEntry = nullptr; // Keep pointer clean myFlag = false; // No more files/directory - closedir((DIR*)myDescr); // so close directory + closedir(static_cast(myDescr)); // so close directory myDescr = nullptr; again = 0; } @@ -130,10 +130,10 @@ void OSD_DirectoryIterator::Next() // if (!strcmp(entry->d_name,"..")) continue; 2 directories. // Is it a directory ? - const TCollection_AsciiString aFullName = myPlace + "/" + ((struct dirent*)myEntry)->d_name; + const TCollection_AsciiString aFullName = myPlace + "/" + (static_cast(myEntry))->d_name; stat(aFullName.ToCString(), &stat_buf); if (S_ISDIR(stat_buf.st_mode)) // Ensure me it's not a file - if (strcmp_joker(myMask.ToCString(), ((struct dirent*)myEntry)->d_name)) + if (strcmp_joker(myMask.ToCString(), (static_cast(myEntry))->d_name)) { // Does it follow mask ? myFlag = true; @@ -154,7 +154,7 @@ OSD_Directory OSD_DirectoryIterator::Values() int position; if (myEntry) - Name = ((struct dirent*)myEntry)->d_name; + Name = (static_cast(myEntry))->d_name; position = Name.Search("."); diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Disk.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Disk.cxx index 1d2ba14a142..7d2b8a6b115 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Disk.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Disk.cxx @@ -176,7 +176,7 @@ int OSD_Disk::DiskSize() if (statvfs(myDiskName.ToCString(), &aBuffer) == 0) { unsigned long aBSize512 = aBuffer.f_frsize / 512; - return int(aBuffer.f_blocks * aBSize512); + return static_cast(aBuffer.f_blocks * aBSize512); } myError.SetValue(errno, Iam, "OSD_Disk: statvfs failed."); return 0; @@ -206,7 +206,7 @@ int OSD_Disk::DiskFree() if (statvfs(myDiskName.ToCString(), &aBuffer) == 0) { unsigned long aBSize512 = aBuffer.f_frsize / 512; - return int(aBuffer.f_bavail * aBSize512); + return static_cast(aBuffer.f_bavail * aBSize512); } myError.SetValue(errno, Iam, "OSD_Disk: statvfs failed."); return 0; diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Environment.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Environment.cxx index a4b50bfc8e9..13603e4bd4b 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Environment.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Environment.cxx @@ -147,7 +147,7 @@ void OSD_Environment::Build() // Allocation memoire. Surtout tout la heap! index = Ibuffer++; char** aTmp; - aTmp = (char**)realloc(buffer, Ibuffer * sizeof(char*)); + aTmp = static_cast(realloc(buffer, Ibuffer * sizeof(char*))); if (aTmp) { buffer = aTmp; @@ -160,7 +160,7 @@ void OSD_Environment::Build() } // create a new entry in the buffer and add it to environment - buffer[index] = (char*)malloc(len + myValue.Length() + 2); + buffer[index] = static_cast(malloc(len + myValue.Length() + 2)); Sprintf(buffer[index], "%s=%s", myName.ToCString(), myValue.ToCString()); putenv(buffer[index]); diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Error.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Error.cxx index 2de4144e20d..d48b54699b9 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Error.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Error.cxx @@ -43,7 +43,7 @@ bool OSD_Error::Failed() const void OSD_Error::SetValue(const int errcode, const int from, const TCollection_AsciiString& message) { myErrno = errcode; - myCode = (OSD_WhoAmI)from; + myCode = static_cast(from); myMessage = message; } diff --git a/src/FoundationClasses/TKernel/OSD/OSD_File.cxx b/src/FoundationClasses/TKernel/OSD/OSD_File.cxx index 19983384105..f11f7459b20 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_File.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_File.cxx @@ -805,7 +805,7 @@ void OSD_File::Read(TCollection_AsciiString& theBuffer, const int theNbBytes) #ifdef _WIN32 Read(&aBuffer.ChangeFirst(), theNbBytes, aNbBytesRead); #else - aNbBytesRead = (int)read(myFileChannel, &aBuffer.ChangeFirst(), theNbBytes); + aNbBytesRead = static_cast(read(myFileChannel, &aBuffer.ChangeFirst(), theNbBytes)); if (aNbBytesRead == -1) { aNbBytesRead = 0; @@ -989,10 +989,10 @@ void OSD_File::ReadLine(TCollection_AsciiString& theBuffer, } #else NCollection_Array1 aBuffer(0, theNbBytes); - char* aBufferGets = fgets(&aBuffer.ChangeFirst(), theNbBytes, (FILE*)myFILE); + char* aBufferGets = fgets(&aBuffer.ChangeFirst(), theNbBytes, static_cast(myFILE)); if (aBufferGets == nullptr) { - if (!feof((FILE*)myFILE)) + if (!feof(static_cast(myFILE))) { myError.SetValue(errno, Iam, "ReadLine"); return; @@ -1005,7 +1005,7 @@ void OSD_File::ReadLine(TCollection_AsciiString& theBuffer, else { aBuffer.ChangeLast() = '\0'; - theNbBytesRead = (int)strlen(aBufferGets); + theNbBytesRead = static_cast(strlen(aBufferGets)); theBuffer.SetValue(1, aBufferGets); theBuffer.Trunc(theNbBytesRead); } @@ -1116,7 +1116,7 @@ void OSD_File::Read(void* const theBuffer, const int theNbBytes, int& theNbReadB theNbReadBytes = (int)aNbReadBytes; #else theNbReadBytes = 0; - int aNbReadBytes = (int)read(myFileChannel, (char*)theBuffer, theNbBytes); + int aNbReadBytes = static_cast(read(myFileChannel, static_cast(theBuffer), theNbBytes)); if (aNbReadBytes == -1) { myError.SetValue(errno, Iam, "Read"); @@ -1165,7 +1165,7 @@ void OSD_File::Write(void* const theBuffer, const int theNbBytes) _osd_wnt_set_error(myError, OSD_WFile); } #else - const int aNbWritten = (int)write(myFileChannel, (const char*)theBuffer, theNbBytes); + const int aNbWritten = static_cast(write(myFileChannel, static_cast(theBuffer), theNbBytes)); if (aNbWritten == -1) { myError.SetValue(errno, Iam, "Write"); @@ -1267,7 +1267,7 @@ void OSD_File::Close() myFileChannel = -1; if (myFILE != nullptr) { - (void)fclose((FILE*)myFILE); + (void)fclose(static_cast(myFILE)); myFILE = nullptr; } #endif @@ -1570,7 +1570,7 @@ size_t OSD_File::Size() myError.SetValue(errno, Iam, "Size"); return 0; } - return (size_t)aStatBuf.st_size; + return static_cast(aStatBuf.st_size); #endif } @@ -1647,7 +1647,7 @@ void OSD_File::Rewind() aDistanceToMove.QuadPart = 0; SetFilePointerEx(myFileHandle, aDistanceToMove, NULL, FILE_BEGIN); #else - rewind((FILE*)myFILE); + rewind(static_cast(myFILE)); #endif } diff --git a/src/FoundationClasses/TKernel/OSD/OSD_FileIterator.cxx b/src/FoundationClasses/TKernel/OSD/OSD_FileIterator.cxx index 784c1773ca2..50da116f7c8 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_FileIterator.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_FileIterator.cxx @@ -79,7 +79,7 @@ void OSD_FileIterator::Initialize(const OSD_Path& where, const TCollection_Ascii myMask = Mask; if (myDescr) { - closedir((DIR*)myDescr); + closedir(static_cast(myDescr)); myDescr = nullptr; } myInit = 1; @@ -135,28 +135,28 @@ void OSD_FileIterator::Next() do { - myEntry = readdir((DIR*)myDescr); + myEntry = readdir(static_cast(myDescr)); if (!myEntry) { // No file found myEntry = nullptr; // Keep pointer clean myFlag = false; // No more files/directory - closedir((DIR*)myDescr); // so close directory + closedir(static_cast(myDescr)); // so close directory myDescr = nullptr; again = 0; } else { - if (!strcmp(((struct dirent*)myEntry)->d_name, ".")) + if (!strcmp((static_cast(myEntry))->d_name, ".")) continue; - if (!strcmp(((struct dirent*)myEntry)->d_name, "..")) + if (!strcmp((static_cast(myEntry))->d_name, "..")) continue; // Is it a file ? - const TCollection_AsciiString aFullName = myPlace + "/" + ((struct dirent*)myEntry)->d_name; + const TCollection_AsciiString aFullName = myPlace + "/" + (static_cast(myEntry))->d_name; stat(aFullName.ToCString(), &stat_buf); if (S_ISREG(stat_buf.st_mode)) // LD : Ensure me it's a regular file - if (strcmp_joker(myMask.ToCString(), ((struct dirent*)myEntry)->d_name)) + if (strcmp_joker(myMask.ToCString(), (static_cast(myEntry))->d_name)) { // Does it follow mask ? myFlag = true; @@ -177,7 +177,7 @@ OSD_File OSD_FileIterator::Values() int position; if (myEntry) - Name = ((struct dirent*)myEntry)->d_name; + Name = (static_cast(myEntry))->d_name; position = Name.Search("."); diff --git a/src/FoundationClasses/TKernel/OSD/OSD_FileNode.cxx b/src/FoundationClasses/TKernel/OSD/OSD_FileNode.cxx index e2352d1b04e..ec60f8c115b 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_FileNode.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_FileNode.cxx @@ -175,7 +175,7 @@ int static copy_file(const char* src, const char* trg) const int BUFSIZE = 4096; char buf[BUFSIZE]; int n = 0; - while ((n = (int)read(fds, buf, BUFSIZE)) > 0) + while ((n = static_cast(read(fds, buf, BUFSIZE))) > 0) { if (write(fdo, buf, n) != n) { @@ -263,10 +263,10 @@ OSD_Protection OSD_FileNode::Protection() w |= OSD_X; s = g; - thisProt.SetValues((OSD_SingleProtection)s, - (OSD_SingleProtection)u, - (OSD_SingleProtection)g, - (OSD_SingleProtection)w); + thisProt.SetValues(static_cast(s), + static_cast(u), + static_cast(g), + static_cast(w)); return (thisProt); } @@ -284,7 +284,7 @@ void OSD_FileNode::SetProtection(const OSD_Protection& Prot) TCollection_AsciiString aBuffer; myPath.SystemName(aBuffer); - status = chmod(aBuffer.ToCString(), (mode_t)Prot.Internal()); + status = chmod(aBuffer.ToCString(), static_cast(Prot.Internal())); if (status == -1) myError.SetValue(errno, Iam, "SetProtection"); } @@ -309,7 +309,7 @@ Quantity_Date OSD_FileNode::CreationMoment() myPath.SystemName(aBuffer); if (!stat(aBuffer.ToCString(), &buffer)) { - time_t aTime = (time_t)buffer.st_ctime; + time_t aTime = static_cast(buffer.st_ctime); decode = localtime(&aTime); result.SetValues(decode->tm_mon + 1, decode->tm_mday, @@ -345,7 +345,7 @@ Quantity_Date OSD_FileNode::AccessMoment() myPath.SystemName(aBuffer); if (!stat(aBuffer.ToCString(), &buffer)) { - time_t aTime = (time_t)buffer.st_ctime; + time_t aTime = static_cast(buffer.st_ctime); decode = localtime(&aTime); result.SetValues(decode->tm_mon + 1, decode->tm_mday, diff --git a/src/FoundationClasses/TKernel/OSD/OSD_FileSystem.cxx b/src/FoundationClasses/TKernel/OSD/OSD_FileSystem.cxx index dd1ce236d4a..a3623b56529 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_FileSystem.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_FileSystem.cxx @@ -86,7 +86,7 @@ std::shared_ptr OSD_FileSystem::OpenIStream( aNewStream = anOldStream; if (theOffset >= 0) { - aNewStream->seekg((std::streamoff)theOffset, std::ios_base::beg); + aNewStream->seekg(static_cast(theOffset), std::ios_base::beg); } } if (aNewStream.get() == nullptr) @@ -101,7 +101,7 @@ std::shared_ptr OSD_FileSystem::OpenIStream( aNewStream.reset(new OSD_IStreamBuffer(theUrl.ToCString(), aFileBuf)); if (theOffset > 0) { - aNewStream->seekg((std::streamoff)theOffset, std::ios_base::beg); + aNewStream->seekg(static_cast(theOffset), std::ios_base::beg); } } return aNewStream; diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Host.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Host.cxx index f12ac14e2fe..b72145e346f 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Host.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Host.cxx @@ -148,10 +148,10 @@ TCollection_AsciiString OSD_Host::InternetAddress() memcpy(&internet_address, aHostByName, sizeof(struct hostent)); // Gets each bytes into integers - a = (unsigned char)internet_address.h_addr_list[0][0]; - b = (unsigned char)internet_address.h_addr_list[0][1]; - c = (unsigned char)internet_address.h_addr_list[0][2]; - d = (unsigned char)internet_address.h_addr_list[0][3]; + a = static_cast(internet_address.h_addr_list[0][0]); + b = static_cast(internet_address.h_addr_list[0][1]); + c = static_cast(internet_address.h_addr_list[0][2]); + d = static_cast(internet_address.h_addr_list[0][3]); Sprintf(buffer, "%d.%d.%d.%d", a, b, c, d); result = buffer; return (result); diff --git a/src/FoundationClasses/TKernel/OSD/OSD_LocalFileSystem.cxx b/src/FoundationClasses/TKernel/OSD/OSD_LocalFileSystem.cxx index e72dc713713..d4d34488152 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_LocalFileSystem.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_LocalFileSystem.cxx @@ -72,14 +72,14 @@ std::shared_ptr OSD_LocalFileSystem::OpenStreamBuffer( if (theOutBufSize && ((theMode & std::ios::in) != 0)) { *theOutBufSize = (int64_t)aNewBuf->pubseekoff(0, std::ios_base::end, std::ios_base::in); - if (aNewBuf->pubseekoff((std::streamoff)theOffset, std::ios_base::beg, std::ios_base::in) < 0) + if (aNewBuf->pubseekoff(static_cast(theOffset), std::ios_base::beg, std::ios_base::in) < 0) { *theOutBufSize = 0; return std::shared_ptr(); } } else if (theOffset > 0 - && aNewBuf->pubseekoff((std::streamoff)theOffset, + && aNewBuf->pubseekoff(static_cast(theOffset), std::ios_base::beg, (theMode & std::ios::in) != 0 ? std::ios_base::in : std::ios_base::out) diff --git a/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx b/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx index 6119b225f29..d4b2b47e9eb 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx @@ -61,7 +61,7 @@ void OSD_MemInfo::SetActive(const bool theActive) { for (int anIter = 0; anIter < MemCounter_NB; ++anIter) { - SetActive((Counter)anIter, theActive); + SetActive(static_cast(anIter), theActive); } } @@ -71,7 +71,7 @@ void OSD_MemInfo::Clear() { for (int anIter = 0; anIter < MemCounter_NB; ++anIter) { - myCounters[anIter] = size_t(-1); + myCounters[anIter] = static_cast(-1); } } @@ -228,13 +228,13 @@ void OSD_MemInfo::Update() } else if (IsActive(MemPrivate) && strncmp(aBuff, "VmData:", strlen("VmData:")) == 0) { - if (myCounters[MemPrivate] == size_t(-1)) + if (myCounters[MemPrivate] == static_cast(-1)) ++myCounters[MemPrivate]; myCounters[MemPrivate] += atol(aBuff + strlen("VmData:")) * 1024; } else if (IsActive(MemPrivate) && strncmp(aBuff, "VmStk:", strlen("VmStk:")) == 0) { - if (myCounters[MemPrivate] == size_t(-1)) + if (myCounters[MemPrivate] == static_cast(-1)) ++myCounters[MemPrivate]; myCounters[MemPrivate] += atol(aBuff + strlen("VmStk:")) * 1024; } @@ -271,37 +271,37 @@ TCollection_AsciiString OSD_MemInfo::ToString() const if (hasValue(MemPrivate)) { anInfo += - TCollection_AsciiString(" Private memory: ") + int(ValueMiB(MemPrivate)) + " MiB\n"; + TCollection_AsciiString(" Private memory: ") + static_cast(ValueMiB(MemPrivate)) + " MiB\n"; } if (hasValue(MemWorkingSet)) { anInfo += - TCollection_AsciiString(" Working Set: ") + int(ValueMiB(MemWorkingSet)) + " MiB"; + TCollection_AsciiString(" Working Set: ") + static_cast(ValueMiB(MemWorkingSet)) + " MiB"; if (hasValue(MemWorkingSetPeak)) { - anInfo += TCollection_AsciiString(" (peak: ") + int(ValueMiB(MemWorkingSetPeak)) + " MiB)"; + anInfo += TCollection_AsciiString(" (peak: ") + static_cast(ValueMiB(MemWorkingSetPeak)) + " MiB)"; } anInfo += "\n"; } if (hasValue(MemSwapUsage)) { anInfo += - TCollection_AsciiString(" Pagefile usage: ") + int(ValueMiB(MemSwapUsage)) + " MiB"; + TCollection_AsciiString(" Pagefile usage: ") + static_cast(ValueMiB(MemSwapUsage)) + " MiB"; if (hasValue(MemSwapUsagePeak)) { - anInfo += TCollection_AsciiString(" (peak: ") + int(ValueMiB(MemSwapUsagePeak)) + " MiB)"; + anInfo += TCollection_AsciiString(" (peak: ") + static_cast(ValueMiB(MemSwapUsagePeak)) + " MiB)"; } anInfo += "\n"; } if (hasValue(MemVirtual)) { anInfo += - TCollection_AsciiString(" Virtual memory: ") + int(ValueMiB(MemVirtual)) + " MiB\n"; + TCollection_AsciiString(" Virtual memory: ") + static_cast(ValueMiB(MemVirtual)) + " MiB\n"; } if (hasValue(MemHeapUsage)) { anInfo += - TCollection_AsciiString(" Heap memory: ") + int(ValueMiB(MemHeapUsage)) + " MiB\n"; + TCollection_AsciiString(" Heap memory: ") + static_cast(ValueMiB(MemHeapUsage)) + " MiB\n"; } return anInfo; } @@ -312,7 +312,7 @@ size_t OSD_MemInfo::Value(const OSD_MemInfo::Counter theCounter) const { if (theCounter < 0 || theCounter >= MemCounter_NB || !IsActive(theCounter)) { - return size_t(-1); + return static_cast(-1); } return myCounters[theCounter]; } @@ -323,9 +323,9 @@ size_t OSD_MemInfo::ValueMiB(const OSD_MemInfo::Counter theCounter) const { if (theCounter < 0 || theCounter >= MemCounter_NB || !IsActive(theCounter)) { - return size_t(-1); + return static_cast(-1); } - return (myCounters[theCounter] == size_t(-1)) ? size_t(-1) + return (myCounters[theCounter] == static_cast(-1)) ? static_cast(-1) : (myCounters[theCounter] / (1024 * 1024)); } @@ -337,9 +337,9 @@ double OSD_MemInfo::ValuePreciseMiB(const OSD_MemInfo::Counter theCounter) const { return -1.0; } - return (myCounters[theCounter] == size_t(-1)) + return (myCounters[theCounter] == static_cast(-1)) ? -1.0 - : ((double)myCounters[theCounter] / (1024.0 * 1024.0)); + : (static_cast(myCounters[theCounter]) / (1024.0 * 1024.0)); } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.hxx b/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.hxx index 8a662a9cba6..6d4b2458d79 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.hxx @@ -116,7 +116,7 @@ protected: //! Return true if the counter is active and the value is valid bool hasValue(const OSD_MemInfo::Counter theCounter) const { - return IsActive(theCounter) && myCounters[theCounter] != size_t(-1); + return IsActive(theCounter) && myCounters[theCounter] != static_cast(-1); } private: diff --git a/src/FoundationClasses/TKernel/OSD/OSD_OpenFile.cxx b/src/FoundationClasses/TKernel/OSD/OSD_OpenFile.cxx index 9910efcd5ee..a47d5e112c8 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_OpenFile.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_OpenFile.cxx @@ -126,7 +126,7 @@ std::time_t OSD_FileStatCTime(const char* theName) struct stat aStat; if (stat(theName, &aStat) == 0) { - aTime = (std::time_t)aStat.st_ctime; + aTime = static_cast(aStat.st_ctime); } #endif return aTime; diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Parallel.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Parallel.cxx index 1f7b98a2d47..d493d36b4df 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Parallel.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Parallel.cxx @@ -260,7 +260,7 @@ int OSD_Parallel::NbLogicalProcessors() // _SC_NPROCESSORS_CONF Number of processors configured // _SC_NPROCESSORS_MAX Max number of processors supported by platform // _SC_NPROCESSORS_ONLN Number of processors online - aNumLogicalProcessors = (int)sysconf(_SC_NPROCESSORS_ONLN); + aNumLogicalProcessors = static_cast(sysconf(_SC_NPROCESSORS_ONLN)); #endif return aNumLogicalProcessors; } diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Path.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Path.cxx index 22bd052c152..8c11d4f41f0 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Path.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Path.cxx @@ -212,7 +212,7 @@ static void UnixExtract(const TCollection_AsciiString& what, pos = trek.SearchFromEnd("|"); // Extract name if (pos != -1) { - p = (Standard_PCharacter)trek.ToCString(); + p = const_cast(trek.ToCString()); name = &p[pos]; if (name.Length()) trek.Remove(pos + 1, name.Length()); @@ -287,7 +287,7 @@ static void DosExtract(const TCollection_AsciiString& what, pos = trek.SearchFromEnd("|"); // Extract name if (pos != -1) { - p = (Standard_PCharacter)trek.ToCString(); + p = const_cast(trek.ToCString()); name = &p[pos]; if (name.Length()) trek.Remove(pos + 1, name.Length()); @@ -332,7 +332,7 @@ static void MacExtract(const TCollection_AsciiString& what, pos = trek.SearchFromEnd("|"); // Extract name if (pos != -1) { - p = (Standard_PCharacter)trek.ToCString(); + p = const_cast(trek.ToCString()); name = &p[pos + 1]; trek.Remove(trek.Search(name), name.Length()); } @@ -583,7 +583,7 @@ static void P2MAC(TCollection_AsciiString& Way) int i, l; Way.ChangeAll('|', ':'); - l = (int)Way.Length(); + l = Way.Length(); for (i = 1; i <= l; i++) // Replace '^' by "::" if (Way.Value(i) == '^') { @@ -609,7 +609,7 @@ static void P2UNIX(TCollection_AsciiString& Way) Way.ChangeAll('|', '/'); - l = (int)Way.Length(); + l = Way.Length(); for (i = 1; i <= l; i++) // Replace '^' by "../" if (Way.Value(i) == '^') { @@ -636,7 +636,7 @@ static void P2DOS(TCollection_AsciiString& Way) Way.ChangeAll('|', '\\'); - l = (int)Way.Length(); + l = Way.Length(); for (i = 1; i <= l; i++) // Replace '^' by ".." if (Way.Value(i) == '^') { @@ -717,7 +717,7 @@ void OSD_Path::SystemName(TCollection_AsciiString& FullName, const OSD_SysType a case OSD_OS2: case OSD_WindowsNT: // MSDOS-like syntax { - int length = (int)myDisk.Length(); + int length = myDisk.Length(); P2DOS(Way); if (length != 1) diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Process.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Process.cxx index 4a56523c707..ef275f7424d 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Process.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Process.cxx @@ -80,7 +80,7 @@ Quantity_Date OSD_Process::SystemDate() myError.SetValue(errno, Iam, "GetSystem"); else { - memcpy(&transfert, localtime((time_t*)&tval.tv_sec), sizeof(struct tm)); + memcpy(&transfert, localtime(static_cast(&tval.tv_sec)), sizeof(struct tm)); month = transfert.tm_mon + 1; // Add to January (month #1) day = transfert.tm_mday; year = transfert.tm_year; diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SharedLibrary.cxx b/src/FoundationClasses/TKernel/OSD/OSD_SharedLibrary.cxx index 36c5d39415e..c5447c0640a 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SharedLibrary.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SharedLibrary.cxx @@ -157,10 +157,10 @@ bool OSD_SharedLibrary::DlOpen(const OSD_LoadMode aMode) OSD_Function OSD_SharedLibrary::DlSymb(const char* const aName) const { void (*fp)(); - fp = (void (*)())dlsym(myHandle, aName); + fp = reinterpret_cast(dlsym(myHandle, aName)); if (!BAD(fp)) { - return (OSD_Function)fp; + return reinterpret_cast(fp); } else { @@ -189,7 +189,7 @@ void OSD_SharedLibrary::DlClose() const // ---------------------------------------------------------------- const char* OSD_SharedLibrary::DlError() const { - return (char*)dlerror(); + return dlerror(); } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx index b3cb7275e28..36bd0b38211 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx @@ -187,7 +187,7 @@ bool OSD_Thread::Run(void* const data, } else { - myThreadId = (Standard_ThreadId)myThread; + myThreadId = static_cast(myThread); } #endif return myThread != OSD_PTHREAD_NULL; @@ -358,6 +358,6 @@ Standard_ThreadId OSD_Thread::Current() #ifdef _WIN32 return GetCurrentThreadId(); #else - return (Standard_ThreadId)pthread_self(); + return static_cast(pthread_self()); #endif } diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Timer.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Timer.cxx index e2ab6a3a235..dc59decab2e 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Timer.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Timer.cxx @@ -34,7 +34,7 @@ static void timeToHoursMinutesSeconds(double theTimeSec, int& theMinutes, double& theSeconds) { - int aSec = (int)theTimeSec; + int aSec = static_cast(theTimeSec); theHours = aSec / 3600; theMinutes = (aSec - theHours * 3600) / 60; theSeconds = theTimeSec - theHours * 3600 - theMinutes * 60; diff --git a/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx b/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx index 11b7077691a..33fa6c4a0ef 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx @@ -935,7 +935,7 @@ static void SegvHandler(const int theSignal, siginfo_t* theSigInfo, void* const const int aStackLength = OSD_SignalStackTraceLength; const int aStackBufLen = std::max(aStackLength * 200, 2048); - char* aStackBuffer = aStackLength != 0 ? (char*)alloca(aStackBufLen) : nullptr; + char* aStackBuffer = aStackLength != 0 ? static_cast(alloca(aStackBufLen)) : nullptr; if (aStackBuffer != nullptr) { memset(aStackBuffer, 0, aStackBufLen); diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_Color.cxx b/src/FoundationClasses/TKernel/Quantity/Quantity_Color.cxx index 0be82024cd8..0731b4c5dd6 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_Color.cxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_Color.cxx @@ -161,7 +161,7 @@ void Quantity_Color::SetEpsilon(const double theEpsilon) noexcept NCollection_Vec3 Quantity_Color::valuesOf(const Quantity_NameOfColor theName, const Quantity_TypeOfColor theType) { - if ((int)theName < 0 || (int)theName > Quantity_NOC_WHITE) + if (static_cast(theName) < 0 || static_cast(theName) > Quantity_NOC_WHITE) { throw Standard_OutOfRange("Bad name"); } @@ -187,7 +187,7 @@ NCollection_Vec3 Quantity_Color::valuesOf(const Quantity_NameOfColor theN const char* Quantity_Color::StringName(const Quantity_NameOfColor theName) noexcept { - if ((int)theName < 0 || (int)theName > Quantity_NOC_WHITE) + if (static_cast(theName) < 0 || static_cast(theName) > Quantity_NOC_WHITE) { return "UNDEFINED"; } @@ -211,7 +211,7 @@ bool Quantity_Color::ColorFromName(const char* const theName, const char* aColorName = THE_COLORS[anIter].StringName; if (aName == aColorName) { - theColor = (Quantity_NameOfColor)anIter; + theColor = static_cast(anIter); return true; } } @@ -309,7 +309,7 @@ Quantity_Color::Quantity_Color(const NCollection_Vec3& theRgb) void Quantity_Color::ChangeContrast(const double theDelta) { NCollection_Vec3 aHls = Convert_LinearRGB_To_HLS(myRgb); - aHls[2] += aHls[2] * float(theDelta) / 100.0f; // saturation + aHls[2] += aHls[2] * static_cast(theDelta) / 100.0f; // saturation if ((aHls[2] <= 1.0f) && (aHls[2] >= 0.0f)) { myRgb = Convert_HLS_To_LinearRGB(aHls); @@ -321,7 +321,7 @@ void Quantity_Color::ChangeContrast(const double theDelta) void Quantity_Color::ChangeIntensity(const double theDelta) { NCollection_Vec3 aHls = Convert_LinearRGB_To_HLS(myRgb); - aHls[1] += aHls[1] * float(theDelta) / 100.0f; // light + aHls[1] += aHls[1] * static_cast(theDelta) / 100.0f; // light if ((aHls[1] <= 1.0f) && (aHls[1] >= 0.0f)) { myRgb = Convert_HLS_To_LinearRGB(aHls); @@ -339,32 +339,32 @@ void Quantity_Color::SetValues(const double theC1, { case Quantity_TOC_RGB: { validateRgbRange(theC1, theC2, theC3); - myRgb.SetValues(float(theC1), float(theC2), float(theC3)); + myRgb.SetValues(static_cast(theC1), static_cast(theC2), static_cast(theC3)); break; } case Quantity_TOC_sRGB: { validateRgbRange(theC1, theC2, theC3); - myRgb.SetValues((float)Convert_sRGB_To_LinearRGB(theC1), - (float)Convert_sRGB_To_LinearRGB(theC2), - (float)Convert_sRGB_To_LinearRGB(theC3)); + myRgb.SetValues(static_cast(Convert_sRGB_To_LinearRGB(theC1)), + static_cast(Convert_sRGB_To_LinearRGB(theC2)), + static_cast(Convert_sRGB_To_LinearRGB(theC3))); break; } case Quantity_TOC_HLS: { validateHlsRange(theC1, theC2, theC3); myRgb = - Convert_HLS_To_LinearRGB(NCollection_Vec3(float(theC1), float(theC2), float(theC3))); + Convert_HLS_To_LinearRGB(NCollection_Vec3(static_cast(theC1), static_cast(theC2), static_cast(theC3))); break; } case Quantity_TOC_CIELab: { validateLabRange(theC1, theC2, theC3); myRgb = - Convert_Lab_To_LinearRGB(NCollection_Vec3(float(theC1), float(theC2), float(theC3))); + Convert_Lab_To_LinearRGB(NCollection_Vec3(static_cast(theC1), static_cast(theC2), static_cast(theC3))); break; } case Quantity_TOC_CIELch: { validateLchRange(theC1, theC2, theC3); myRgb = Convert_Lab_To_LinearRGB( - Convert_Lch_To_Lab(NCollection_Vec3(float(theC1), float(theC2), float(theC3)))); + Convert_Lch_To_Lab(NCollection_Vec3(static_cast(theC1), static_cast(theC2), static_cast(theC3)))); break; } } @@ -376,8 +376,8 @@ void Quantity_Color::Delta(const Quantity_Color& theColor, double& theDC, double { const NCollection_Vec3 aHls1 = Convert_LinearRGB_To_HLS(myRgb); const NCollection_Vec3 aHls2 = Convert_LinearRGB_To_HLS(theColor.myRgb); - theDC = double(aHls1[2] - aHls2[2]); // saturation - theDI = double(aHls1[1] - aHls2[1]); // light + theDC = static_cast(aHls1[2] - aHls2[2]); // saturation + theDI = static_cast(aHls1[1] - aHls2[1]); // light } // ======================================================================= @@ -493,9 +493,9 @@ void Quantity_Color::Values(double& theR1, break; } case Quantity_TOC_sRGB: { - theR1 = Convert_LinearRGB_To_sRGB((double)myRgb.r()); - theR2 = Convert_LinearRGB_To_sRGB((double)myRgb.g()); - theR3 = Convert_LinearRGB_To_sRGB((double)myRgb.b()); + theR1 = Convert_LinearRGB_To_sRGB(static_cast(myRgb.r())); + theR2 = Convert_LinearRGB_To_sRGB(static_cast(myRgb.g())); + theR3 = Convert_LinearRGB_To_sRGB(static_cast(myRgb.b())); break; } case Quantity_TOC_HLS: { @@ -546,7 +546,7 @@ NCollection_Vec3 Quantity_Color::Convert_HLS_To_sRGB(const NCollection_Ve else { aHue /= 60.0f; - aHueIndex = (int)aHue; + aHueIndex = static_cast(aHue); } switch (aHueIndex) @@ -666,7 +666,7 @@ NCollection_Vec3 Quantity_Color::Convert_LinearRGB_To_Lab( double aa = CIELAB_A_COEFF * (afX - afY); double ab = CIELAB_B_COEFF * (afY - afZ); - return NCollection_Vec3((float)aL, (float)aa, (float)ab); + return NCollection_Vec3(static_cast(aL), static_cast(aa), static_cast(ab)); } // ======================================================================= @@ -689,7 +689,7 @@ NCollection_Vec3 Quantity_Color::Convert_Lab_To_LinearRGB( const int NBSTEPS = 1000; for (int aRate = NBSTEPS;; aRate--) { - double aC = aRate / (double)NBSTEPS; + double aC = aRate / static_cast(NBSTEPS); // convert to XYZ for D65 / 2 deg (CIE 1931) standard illuminant double afY = (aL + CIELAB_L_OFFSET) / CIELAB_L_COEFF; @@ -709,7 +709,7 @@ NCollection_Vec3 Quantity_Color::Convert_Lab_To_LinearRGB( // exit if we are in range or at zero C if (aRate == 0 || (aR >= 0. && aR <= 1. && aG >= 0. && aG <= 1. && aB >= 0. && aB <= 1.)) { - return NCollection_Vec3((float)aR, (float)aG, (float)aB); + return NCollection_Vec3(static_cast(aR), static_cast(aG), static_cast(aB)); } } } @@ -731,7 +731,7 @@ NCollection_Vec3 Quantity_Color::Convert_Lab_To_Lch( if (aH < 0.) aH += 360.; - return NCollection_Vec3(theLab[0], (float)aC, (float)aH); + return NCollection_Vec3(theLab[0], static_cast(aC), static_cast(aH)); } // ======================================================================= @@ -750,7 +750,7 @@ NCollection_Vec3 Quantity_Color::Convert_Lch_To_Lab( double aa = aC * std::cos(aH); double ab = aC * std::sin(aH); - return NCollection_Vec3(theLch[0], (float)aa, (float)ab); + return NCollection_Vec3(theLch[0], static_cast(aa), static_cast(ab)); } //================================================================================================= @@ -768,6 +768,6 @@ bool Quantity_Color::InitFromJson(const Standard_SStream& theSStream, int& theSt double aRed, aGreen, aBlue; OCCT_INIT_VECTOR_CLASS(Standard_Dump::Text(theSStream), "RGB", aPos, 3, &aRed, &aGreen, &aBlue) - SetValues((float)aRed, (float)aGreen, (float)aBlue, Quantity_TOC_RGB); + SetValues(static_cast(aRed), static_cast(aGreen), static_cast(aBlue), Quantity_TOC_RGB); return true; } diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_Color.hxx b/src/FoundationClasses/TKernel/Quantity/Quantity_Color.hxx index d7c36da5766..d965b369eb4 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_Color.hxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_Color.hxx @@ -214,7 +214,7 @@ public: static TCollection_AsciiString ColorToHex(const Quantity_Color& theColor, const bool theToPrefixHash = true) noexcept { - NCollection_Vec3 anSRgb = Convert_LinearRGB_To_sRGB((NCollection_Vec3)theColor); + NCollection_Vec3 anSRgb = Convert_LinearRGB_To_sRGB(NCollection_Vec3(theColor)); NCollection_Vec3 anSRgbInt(anSRgb * 255.0f + NCollection_Vec3(0.5f)); char aBuff[10]; Sprintf(aBuff, @@ -381,7 +381,7 @@ public: double& theB) noexcept { const NCollection_Vec3 anRgb = - Convert_HLS_To_sRGB(NCollection_Vec3((float)theH, (float)theL, (float)theS)); + Convert_HLS_To_sRGB(NCollection_Vec3(static_cast(theH), static_cast(theL), static_cast(theS))); theR = anRgb[0]; theG = anRgb[1]; theB = anRgb[2]; @@ -396,7 +396,7 @@ public: double& theS) noexcept { const NCollection_Vec3 aHls = - Convert_sRGB_To_HLS(NCollection_Vec3((float)theR, (float)theG, (float)theB)); + Convert_sRGB_To_HLS(NCollection_Vec3(static_cast(theR), static_cast(theG), static_cast(theB))); theH = aHls[0]; theL = aHls[1]; theS = aHls[2]; diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.cxx b/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.cxx index 70998889e9e..1cc586bfbe1 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.cxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.cxx @@ -237,6 +237,6 @@ bool Quantity_ColorRGBA::InitFromJson(const Standard_SStream& theSStream, int& t &aBlue, &anAlpha) - SetValues((float)aRed, (float)aGreen, (float)aBlue, (float)anAlpha); + SetValues(static_cast(aRed), static_cast(aGreen), static_cast(aBlue), static_cast(anAlpha)); return true; } diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.hxx b/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.hxx index 251ecd2541b..db8a31a22a2 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.hxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.hxx @@ -87,7 +87,7 @@ public: bool IsDifferent(const Quantity_ColorRGBA& theOther) const noexcept { return myRgb.IsDifferent(theOther.GetRGB()) - || std::abs(myAlpha - theOther.myAlpha) > (float)Quantity_Color::Epsilon(); + || std::abs(myAlpha - theOther.myAlpha) > static_cast(Quantity_Color::Epsilon()); } //! Returns true if the distance between colors is greater than Epsilon(). @@ -100,7 +100,7 @@ public: bool IsEqual(const Quantity_ColorRGBA& theOther) const noexcept { return myRgb.IsEqual(theOther.GetRGB()) - && std::abs(myAlpha - theOther.myAlpha) <= (float)Quantity_Color::Epsilon(); + && std::abs(myAlpha - theOther.myAlpha) <= static_cast(Quantity_Color::Epsilon()); } //! Two colors are considered to be equal if their distance is no greater than Epsilon(). @@ -141,7 +141,7 @@ public: static TCollection_AsciiString ColorToHex(const Quantity_ColorRGBA& theColor, const bool theToPrefixHash = true) noexcept { - NCollection_Vec4 anSRgb = Convert_LinearRGB_To_sRGB((NCollection_Vec4)theColor); + NCollection_Vec4 anSRgb = Convert_LinearRGB_To_sRGB(NCollection_Vec4(theColor)); NCollection_Vec4 anSRgbInt(anSRgb * 255.0f + NCollection_Vec4(0.5f)); char aBuff[12]; Sprintf(aBuff, diff --git a/src/FoundationClasses/TKernel/Resource/Resource_Manager.cxx b/src/FoundationClasses/TKernel/Resource/Resource_Manager.cxx index 3cb4e52b338..12253f2ad16 100644 --- a/src/FoundationClasses/TKernel/Resource/Resource_Manager.cxx +++ b/src/FoundationClasses/TKernel/Resource/Resource_Manager.cxx @@ -502,7 +502,7 @@ void Resource_Manager::SetResource(const char* const aResource, const char16_t* myExtStrMap(Resource) = ExtValue; } // - pStr = (Standard_PCharacter)FormatStr.ToCString(); + pStr = const_cast(FormatStr.ToCString()); // Resource_Unicode::ConvertUnicodeToFormat(ExtValue, pStr, // FormatStr.ToCString(), diff --git a/src/FoundationClasses/TKernel/Resource/Resource_Unicode.cxx b/src/FoundationClasses/TKernel/Resource/Resource_Unicode.cxx index 45c112a60fe..cfb5f17f390 100644 --- a/src/FoundationClasses/TKernel/Resource/Resource_Unicode.cxx +++ b/src/FoundationClasses/TKernel/Resource/Resource_Unicode.cxx @@ -59,22 +59,22 @@ void Resource_Unicode::ConvertSJISToUnicode(const char* const fromstr, if (issjis1(*currentstr)) { - ph = ((unsigned int)*currentstr); + ph = (static_cast(*currentstr)); // Be Careful with first and second !! currentstr++; - pl = ((unsigned int)*currentstr); + pl = (static_cast(*currentstr)); currentstr++; Resource_sjis_to_unicode(&ph, &pl); - char16_t curcar = ((char16_t)((ph << 8) | pl)); + char16_t curcar = (static_cast((ph << 8) | pl)); TCollection_ExtendedString curext(curcar); tostr.AssignCat(curext); } else { - TCollection_ExtendedString curext(((char)*currentstr)); + TCollection_ExtendedString curext((static_cast(*currentstr))); currentstr++; tostr.AssignCat(curext); } @@ -94,22 +94,22 @@ void Resource_Unicode::ConvertEUCToUnicode(const char* const fromstr, if (iseuc(*currentstr)) { - ph = ((unsigned int)*currentstr); + ph = (static_cast(*currentstr)); // Be Careful with first and second !! currentstr++; - pl = ((unsigned int)*currentstr); + pl = (static_cast(*currentstr)); currentstr++; Resource_euc_to_unicode(&ph, &pl); - char16_t curcar = ((char16_t)((ph << 8) | pl)); + char16_t curcar = (static_cast((ph << 8) | pl)); TCollection_ExtendedString curext(curcar); tostr.AssignCat(curext); } else { - TCollection_ExtendedString curext(((char)*currentstr)); + TCollection_ExtendedString curext((static_cast(*currentstr))); currentstr++; tostr.AssignCat(curext); } @@ -129,22 +129,22 @@ void Resource_Unicode::ConvertGBToUnicode(const char* const fromstr, if (isshift(*currentstr)) { - ph = ((unsigned int)*currentstr); + ph = (static_cast(*currentstr)); // Be Careful with first and second !! currentstr++; - pl = ((unsigned int)*currentstr); + pl = (static_cast(*currentstr)); currentstr++; Resource_gb_to_unicode(&ph, &pl); - char16_t curcar = ((char16_t)((ph << 8) | pl)); + char16_t curcar = (static_cast((ph << 8) | pl)); TCollection_ExtendedString curext(curcar); tostr.AssignCat(curext); } else { - TCollection_ExtendedString curext(((char)*currentstr)); + TCollection_ExtendedString curext((static_cast(*currentstr))); currentstr++; tostr.AssignCat(curext); } @@ -165,9 +165,9 @@ bool Resource_Unicode::ConvertGBKToUnicode(const char* const fromstr, { if (*currentch < 0x30 || *currentch > 0x39) { - TCollection_ExtendedString curext3(((char)*currentch)); - TCollection_ExtendedString curext2(((char)gb3)); - TCollection_ExtendedString curext1(((char)gb2)); + TCollection_ExtendedString curext3((static_cast(*currentch))); + TCollection_ExtendedString curext2((static_cast(gb3))); + TCollection_ExtendedString curext1((static_cast(gb2))); tostr.Insert(0, curext3); tostr.Insert(0, curext2); tostr.Insert(0, curext1); @@ -179,7 +179,7 @@ bool Resource_Unicode::ConvertGBKToUnicode(const char* const fromstr, if (codepnt < 23940) { unsigned short uni = gbkuni[codepnt]; - char16_t curcar = ((char16_t)uni); + char16_t curcar = (static_cast(uni)); TCollection_ExtendedString curext(curcar); tostr.AssignCat(curext); currentch++; @@ -192,12 +192,12 @@ bool Resource_Unicode::ConvertGBKToUnicode(const char* const fromstr, { if (*currentch >= 0x81 && *currentch <= 0xFE) { - gb3 = (unsigned int)(*currentch); + gb3 = static_cast(*currentch); currentch++; continue; } - TCollection_ExtendedString curext2(((char)*currentch)); - TCollection_ExtendedString curext1(((char)gb2)); + TCollection_ExtendedString curext2((static_cast(*currentch))); + TCollection_ExtendedString curext1((static_cast(gb2))); tostr.Insert(0, curext2); tostr.Insert(0, curext1); return false; @@ -206,7 +206,7 @@ bool Resource_Unicode::ConvertGBKToUnicode(const char* const fromstr, { if (*currentch >= 0x30 && *currentch <= 0x39) { - gb2 = (unsigned int)(*currentch); + gb2 = static_cast(*currentch); currentch++; continue; } @@ -223,7 +223,7 @@ bool Resource_Unicode::ConvertGBKToUnicode(const char* const fromstr, if (pointer < 23940) { unsigned short uni = gbkuni[pointer]; - char16_t curcar = ((char16_t)uni); + char16_t curcar = (static_cast(uni)); TCollection_ExtendedString curext(curcar); tostr.AssignCat(curext); currentch++; @@ -233,7 +233,7 @@ bool Resource_Unicode::ConvertGBKToUnicode(const char* const fromstr, if (*currentch <= 0x7F) { // ASCII symbol - TCollection_ExtendedString curext(((char)*currentch)); + TCollection_ExtendedString curext((static_cast(*currentch))); currentch++; tostr.Insert(0, curext); continue; @@ -245,14 +245,14 @@ bool Resource_Unicode::ConvertGBKToUnicode(const char* const fromstr, if (*currentch <= 0x7F) { // ASCII symbol - TCollection_ExtendedString curext(((char)*currentch)); + TCollection_ExtendedString curext((static_cast(*currentch))); currentch++; tostr.AssignCat(curext); } else if (*currentch == 0x80) { // Special symbol - char16_t curcar = ((char16_t)((0x20 << 8) | 0xAC)); + char16_t curcar = (static_cast((0x20 << 8) | 0xAC)); TCollection_ExtendedString curext(curcar); tostr.AssignCat(curext); currentch++; @@ -260,7 +260,7 @@ bool Resource_Unicode::ConvertGBKToUnicode(const char* const fromstr, else if (*currentch >= 0x81 && *currentch <= 0xFE) { // Chinese symbol - gb1 = (unsigned int)(*currentch); + gb1 = static_cast(*currentch); currentch++; } else @@ -295,26 +295,26 @@ bool Resource_Unicode::ConvertBig5ToUnicode(const char* const fromstr, switch (pointer) { case 1133: { - tostr.Insert(aLength + 1, (char16_t)0x00CA); - tostr.Insert(aLength + 2, (char16_t)0x0304); + tostr.Insert(aLength + 1, static_cast(0x00CA)); + tostr.Insert(aLength + 2, static_cast(0x0304)); currentch++; continue; } case 1135: { - tostr.Insert(aLength + 1, (char16_t)0x00CA); - tostr.Insert(aLength + 2, (char16_t)0x030C); + tostr.Insert(aLength + 1, static_cast(0x00CA)); + tostr.Insert(aLength + 2, static_cast(0x030C)); currentch++; continue; } case 1164: { - tostr.Insert(aLength + 1, (char16_t)0x00EA); - tostr.Insert(aLength + 2, (char16_t)0x0304); + tostr.Insert(aLength + 1, static_cast(0x00EA)); + tostr.Insert(aLength + 2, static_cast(0x0304)); currentch++; continue; } case 1166: { - tostr.Insert(aLength + 1, (char16_t)0x00EA); - tostr.Insert(aLength + 2, (char16_t)0x030C); + tostr.Insert(aLength + 1, static_cast(0x00EA)); + tostr.Insert(aLength + 2, static_cast(0x030C)); currentch++; continue; } @@ -324,7 +324,7 @@ bool Resource_Unicode::ConvertBig5ToUnicode(const char* const fromstr, unsigned int uni = big5uni[pointer]; if (uni <= 0xFFFF) { - char16_t curcar = ((char16_t)uni); + char16_t curcar = (static_cast(uni)); tostr.Insert(aLength + 1, curcar); } else @@ -336,9 +336,9 @@ bool Resource_Unicode::ConvertBig5ToUnicode(const char* const fromstr, if (aStr16.Size() != 4) return false; // not a surrogate pair const char16_t* aChar16 = aStr16.ToCString(); - tostr.Insert(aLength + 1, (char16_t)(*aChar16)); + tostr.Insert(aLength + 1, (*aChar16)); aChar16++; - tostr.Insert(aLength + 2, (char16_t)(*aChar16)); + tostr.Insert(aLength + 2, (*aChar16)); } currentch++; continue; @@ -349,7 +349,7 @@ bool Resource_Unicode::ConvertBig5ToUnicode(const char* const fromstr, if (*currentch <= 0x7F) { // ASCII symbol - TCollection_ExtendedString curext(((char)*currentch)); + TCollection_ExtendedString curext((static_cast(*currentch))); currentch++; tostr.Insert(0, curext); continue; @@ -361,14 +361,14 @@ bool Resource_Unicode::ConvertBig5ToUnicode(const char* const fromstr, if (*currentch <= 0x7F) { // ASCII symbol - TCollection_ExtendedString curext(((char)*currentch)); + TCollection_ExtendedString curext((static_cast(*currentch))); currentch++; tostr.AssignCat(curext); } else if (*currentch >= 0x81 && *currentch <= 0xFE) { // Chinese symbol - big5lead = (unsigned int)(*currentch); + big5lead = static_cast(*currentch); currentch++; } else @@ -400,16 +400,16 @@ bool Resource_Unicode::ConvertUnicodeToSJIS(const TCollection_ExtendedString& fr { curcar = fromstr.Value(nbext); nbext++; - ph = (((unsigned int)curcar) >> 8) & 0xFF; - pl = ((unsigned int)curcar) & 0xFF; + ph = ((static_cast(curcar)) >> 8) & 0xFF; + pl = (static_cast(curcar)) & 0xFF; Resource_unicode_to_sjis(&ph, &pl); if (issjis1(ph)) { if (nbtrans < (maxsize - 3)) { - tostr[nbtrans] = ((char)ph); + tostr[nbtrans] = (static_cast(ph)); nbtrans++; - tostr[nbtrans] = ((char)pl); + tostr[nbtrans] = (static_cast(pl)); nbtrans++; } else @@ -420,7 +420,7 @@ bool Resource_Unicode::ConvertUnicodeToSJIS(const TCollection_ExtendedString& fr } else { - tostr[nbtrans] = ((char)pl); + tostr[nbtrans] = (static_cast(pl)); nbtrans++; } if (nbtrans >= (maxsize - 1)) @@ -455,16 +455,16 @@ bool Resource_Unicode::ConvertUnicodeToEUC(const TCollection_ExtendedString& fro { curcar = fromstr.Value(nbext); nbext++; - ph = (((unsigned int)curcar) >> 8) & 0xFF; - pl = ((unsigned int)curcar) & 0xFF; + ph = ((static_cast(curcar)) >> 8) & 0xFF; + pl = (static_cast(curcar)) & 0xFF; Resource_unicode_to_euc(&ph, &pl); if (iseuc(ph)) { if (nbtrans < (maxsize - 3)) { - tostr[nbtrans] = ((char)ph); + tostr[nbtrans] = (static_cast(ph)); nbtrans++; - tostr[nbtrans] = ((char)pl); + tostr[nbtrans] = (static_cast(pl)); nbtrans++; } else @@ -475,7 +475,7 @@ bool Resource_Unicode::ConvertUnicodeToEUC(const TCollection_ExtendedString& fro } else { - tostr[nbtrans] = ((char)pl); + tostr[nbtrans] = (static_cast(pl)); nbtrans++; } if (nbtrans >= (maxsize - 1)) @@ -510,16 +510,16 @@ bool Resource_Unicode::ConvertUnicodeToGB(const TCollection_ExtendedString& from { curcar = fromstr.Value(nbext); nbext++; - ph = (((unsigned int)curcar) >> 8) & 0xFF; - pl = ((unsigned int)curcar) & 0xFF; + ph = ((static_cast(curcar)) >> 8) & 0xFF; + pl = (static_cast(curcar)) & 0xFF; Resource_unicode_to_gb(&ph, &pl); if (isshift(ph)) { if (nbtrans < (maxsize - 3)) { - tostr[nbtrans] = ((char)ph); + tostr[nbtrans] = (static_cast(ph)); nbtrans++; - tostr[nbtrans] = ((char)pl); + tostr[nbtrans] = (static_cast(pl)); nbtrans++; } else @@ -530,7 +530,7 @@ bool Resource_Unicode::ConvertUnicodeToGB(const TCollection_ExtendedString& from } else { - tostr[nbtrans] = ((char)curcar) & 0xFF; + tostr[nbtrans] = (static_cast(curcar)) & 0xFF; nbtrans++; } if (nbtrans >= (maxsize - 1)) @@ -565,11 +565,11 @@ bool Resource_Unicode::ConvertUnicodeToANSI(const TCollection_ExtendedString& fr { curcar = fromstr.Value(nbext); nbext++; - ph = ((unsigned int)curcar) >> 8; - pl = ((unsigned int)curcar) & 0xFF; + ph = (static_cast(curcar)) >> 8; + pl = (static_cast(curcar)) & 0xFF; if (ph == 0) { - tostr[nbtrans] = ((char)pl); + tostr[nbtrans] = (static_cast(pl)); } else { @@ -684,12 +684,12 @@ void Resource_Unicode::ConvertFormatToUnicode(const Resource_FormatType theFor case Resource_FormatType_iso8859_8: case Resource_FormatType_iso8859_9: case Resource_FormatType_CP850: { - const int aCodePageIndex = (int)theFormat - (int)Resource_FormatType_CP1250; + const int aCodePageIndex = static_cast(theFormat) - static_cast(Resource_FormatType_CP1250); const char16_t* const aCodePage = THE_CODEPAGES_ANSI[aCodePageIndex]; theToStr.Clear(); for (const char* anInputPntr = theFromStr; *anInputPntr != '\0'; ++anInputPntr) { - unsigned char anInputChar = (unsigned char)(*anInputPntr); + unsigned char anInputChar = static_cast(*anInputPntr); char16_t aRes = (anInputChar & 0x80) != 0 ? aCodePage[(0x7f & anInputChar)] : anInputChar; if (aRes == 0) { @@ -762,7 +762,7 @@ bool Resource_Unicode::ConvertUnicodeToFormat(const Resource_FormatType { return false; } - const int aCodePageIndex = (int)theFormat - (int)Resource_FormatType_CP1250; + const int aCodePageIndex = static_cast(theFormat) - static_cast(Resource_FormatType_CP1250); const char16_t* const aCodePage = THE_CODEPAGES_ANSI[aCodePageIndex]; for (int aToCharInd = 0; aToCharInd < theMaxSize - 1; ++aToCharInd) { diff --git a/src/FoundationClasses/TKernel/Standard/Standard.cxx b/src/FoundationClasses/TKernel/Standard/Standard.cxx index 4a9ac8fd3f3..7788253fd76 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard.cxx @@ -440,7 +440,7 @@ void* Standard::Reallocate(void* theStorage, const size_t theSize) throw Standard_OutOfMemory("Standard_MMgrRaw::Reallocate(): realloc failed"); return aNewStorage; #else - void* aNewStorage = (void*)realloc(theStorage, theSize); + void* aNewStorage = realloc(theStorage, theSize); if (!aNewStorage) throw Standard_OutOfMemory("Standard_MMgrRaw::Reallocate(): realloc failed"); return aNewStorage; diff --git a/src/FoundationClasses/TKernel/Standard/Standard_CLocaleSentry.cxx b/src/FoundationClasses/TKernel/Standard/Standard_CLocaleSentry.cxx index 4e055b471b5..3d6c479b998 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_CLocaleSentry.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_CLocaleSentry.cxx @@ -98,7 +98,7 @@ Standard_CLocaleSentry::Standard_CLocaleSentry() Standard_CLocaleSentry::~Standard_CLocaleSentry() { #if defined(OCCT_CLOCALE_POSIX2008) - uselocale((locale_t)myPrevLocale); + uselocale(static_cast(myPrevLocale)); #else if (myPrevLocale != NULL) { diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Character.hxx b/src/FoundationClasses/TKernel/Standard/Standard_Character.hxx index d30f114ff09..50fe20cc8f7 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Character.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Character.hxx @@ -47,7 +47,7 @@ constexpr bool IsEqual(const char One, const char Two) // ================================================================== inline bool IsAlphabetic(const char me) { - return std::isalpha((unsigned char)me) != 0; + return std::isalpha(static_cast(me)) != 0; } // ================================================================== @@ -55,7 +55,7 @@ inline bool IsAlphabetic(const char me) // ================================================================== inline bool IsDigit(const char me) { - return std::isdigit((unsigned char)me) != 0; + return std::isdigit(static_cast(me)) != 0; } // ================================================================== @@ -63,7 +63,7 @@ inline bool IsDigit(const char me) // ================================================================== inline bool IsXDigit(const char me) { - return std::isxdigit((unsigned char)me) != 0; + return std::isxdigit(static_cast(me)) != 0; } // ================================================================== @@ -79,7 +79,7 @@ inline bool IsAlphanumeric(const char me) // ================================================================== inline bool IsControl(const char me) { - return std::iscntrl((unsigned char)me) != 0; + return std::iscntrl(static_cast(me)) != 0; } // ================================================================== @@ -87,7 +87,7 @@ inline bool IsControl(const char me) // ================================================================== inline bool IsGraphic(const char me) { - return std::isgraph((unsigned char)me) != 0; + return std::isgraph(static_cast(me)) != 0; } // ================================================================== @@ -95,7 +95,7 @@ inline bool IsGraphic(const char me) // ================================================================== inline bool IsLowerCase(const char me) { - return std::islower((unsigned char)me) != 0; + return std::islower(static_cast(me)) != 0; } // ================================================================== @@ -103,7 +103,7 @@ inline bool IsLowerCase(const char me) // ================================================================== inline bool IsPrintable(const char me) { - return std::isprint((unsigned char)me) != 0; + return std::isprint(static_cast(me)) != 0; } // ================================================================== @@ -120,7 +120,7 @@ inline bool IsPunctuation(const char me) // ================================================================== inline bool IsSpace(const char me) { - return std::isspace((unsigned char)me) != 0; + return std::isspace(static_cast(me)) != 0; } // ================================================================== @@ -128,7 +128,7 @@ inline bool IsSpace(const char me) // ================================================================== inline bool IsUpperCase(const char me) { - return std::isupper((unsigned char)me) != 0; + return std::isupper(static_cast(me)) != 0; } // ================================================================== @@ -136,7 +136,7 @@ inline bool IsUpperCase(const char me) // ================================================================== inline char LowerCase(const char me) { - return (char)(unsigned char)std::tolower((unsigned char)me); + return static_cast(static_cast(std::tolower(static_cast(me)))); } // ================================================================== @@ -144,7 +144,7 @@ inline char LowerCase(const char me) // ================================================================== inline char UpperCase(const char me) { - return (char)(unsigned char)std::toupper((unsigned char)me); + return static_cast(static_cast(std::toupper(static_cast(me)))); } #endif diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Dump.cxx b/src/FoundationClasses/TKernel/Standard/Standard_Dump.cxx index 0c18953991f..0a21315859a 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Dump.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Dump.cxx @@ -442,7 +442,7 @@ bool Standard_Dump::SplitJson( if (!SplitJson(aSubStreamStr, theKeyToValues)) return false; - aNextIndex = aClosePos + int(JsonKeyLength(Standard_JsonKey_CloseChild)); + aNextIndex = aClosePos + (JsonKeyLength(Standard_JsonKey_CloseChild)); break; } case Standard_JsonKey_SeparatorValueToValue: { @@ -606,16 +606,16 @@ bool Standard_Dump::jsonKey(const TCollection_AsciiString& theStreamStr, { TCollection_AsciiString aSubStreamStr = theStreamStr.SubString(theStartIndex, theStreamStr.Length()); - for (int aKeyId = (int)Standard_JsonKey_OpenChild; + for (int aKeyId = static_cast(Standard_JsonKey_OpenChild); aKeyId <= Standard_JsonKey_SeparatorValueToValue; aKeyId++) { - Standard_JsonKey aKey = (Standard_JsonKey)aKeyId; + Standard_JsonKey aKey = static_cast(aKeyId); const char* aKeyToStr = JsonKeyToString(aKey); if (!aSubStreamStr.StartsWith(aKeyToStr)) continue; - theNextIndex = theStartIndex + int(JsonKeyLength(aKey)); + theNextIndex = theStartIndex + (JsonKeyLength(aKey)); theKey = aKey; return true; } @@ -663,7 +663,7 @@ const char* Standard_Dump::JsonKeyToString(const Standard_JsonKey theKey) // ======================================================================= int Standard_Dump::JsonKeyLength(const Standard_JsonKey theKey) { - return (int)strlen(JsonKeyToString(theKey)); + return static_cast(strlen(JsonKeyToString(theKey))); } // ======================================================================= diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx b/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx index 3f7ff5264a1..e499b37f558 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx @@ -58,7 +58,7 @@ void Standard_ErrorHandler::Unlink() myCallbackPtr = nullptr; while (aPtr) { - Standard_ErrorHandler::Callback* aCallback = (Standard_ErrorHandler::Callback*)aPtr; + Standard_ErrorHandler::Callback* aCallback = static_cast(aPtr); aPtr = aCallback->myNext; // Call destructor explicitly, as we know that it will not be called automatically aCallback->DestroyCallback(); @@ -126,7 +126,7 @@ void Standard_ErrorHandler::Callback::RegisterCallback() myHandler = aHandler; myNext = aHandler->myCallbackPtr; if (myNext) - ((Standard_ErrorHandler::Callback*)myNext)->myPrev = this; + (static_cast(myNext))->myPrev = this; aHandler->myCallbackPtr = this; } } @@ -136,11 +136,11 @@ void Standard_ErrorHandler::Callback::UnregisterCallback() if (!myHandler) return; if (myNext) - ((Standard_ErrorHandler::Callback*)myNext)->myPrev = myPrev; + (static_cast(myNext))->myPrev = myPrev; if (myPrev) - ((Standard_ErrorHandler::Callback*)myPrev)->myNext = myNext; - else if (((Standard_ErrorHandler*)myHandler)->myCallbackPtr == this) - ((Standard_ErrorHandler*)myHandler)->myCallbackPtr = (Standard_ErrorHandler::Callback*)myNext; + (static_cast(myPrev))->myNext = myNext; + else if ((static_cast(myHandler))->myCallbackPtr == this) + (static_cast(myHandler))->myCallbackPtr = static_cast(myNext); myHandler = myNext = myPrev = nullptr; } #endif diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ExtCharacter.hxx b/src/FoundationClasses/TKernel/Standard/Standard_ExtCharacter.hxx index 07992bccdea..13ede93b037 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ExtCharacter.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ExtCharacter.hxx @@ -35,7 +35,7 @@ inline char16_t ToExtCharacter(const char achar) { // extension a zero (partie haute-->octet de gauche) de achar - return (char16_t)((unsigned char)achar & 0x00ff); + return static_cast(static_cast(achar) & 0x00ff); } // ------------------------------------------------------------------ @@ -44,7 +44,7 @@ inline char16_t ToExtCharacter(const char achar) inline char ToCharacter(const char16_t achar) { // recuperer partie basse(octet de droite) de achar - return (char)(unsigned char)(achar & 0x00ff); + return static_cast(static_cast(achar & 0x00ff)); } // ------------------------------------------------------------------ diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Failure.cxx b/src/FoundationClasses/TKernel/Standard/Standard_Failure.cxx index cf85853f991..7620139ff70 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Failure.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Failure.cxx @@ -36,7 +36,7 @@ Standard_Failure::StringRef* Standard_Failure::StringRef::Allocate(const char* t } const size_t aLen = std::strlen(theString); - StringRef* aStrPtr = (StringRef*)Standard::AllocateOptimal(aLen + sizeof(int) + 1); + StringRef* aStrPtr = static_cast(Standard::AllocateOptimal(aLen + sizeof(int) + 1)); if (aStrPtr != nullptr) { std::strcpy(&aStrPtr->Message[0], theString); @@ -80,7 +80,7 @@ void Standard_Failure::captureStackTrace() { // Limit stack allocation to 64KB to prevent stack overflow const int aStackBufLen = std::clamp(aStackLength * 200, 2048, 65536); - char* aStackBuffer = (char*)alloca(aStackBufLen); + char* aStackBuffer = static_cast(alloca(aStackBufLen)); if (aStackBuffer != nullptr) { std::memset(aStackBuffer, 0, aStackBufLen); diff --git a/src/FoundationClasses/TKernel/Standard/Standard_GUID.cxx b/src/FoundationClasses/TKernel/Standard/Standard_GUID.cxx index 8117b5ac25f..ff7593e0aff 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_GUID.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_GUID.cxx @@ -54,7 +54,7 @@ Standard_PCharacter Standard_GUID_GetValue32(Standard_PCharacter tmpBuffer, int& { strncpy(strtmp, tmpBuffer, pos); strtmp[pos] = '\0'; - my32b = (int)strtoul(strtmp, (char**)nullptr, 16); + my32b = static_cast(strtoul(strtmp, (char**)nullptr, 16)); } else return nullptr; @@ -73,7 +73,7 @@ Standard_PCharacter Standard_GUID_GetValue16(Standard_PCharacter tmpBuffer, char { strncpy(strtmp, tmpBuffer, pos); strtmp[pos] = '\0'; - my32b = (char16_t)strtoul(strtmp, (char**)nullptr, 16); + my32b = static_cast(strtoul(strtmp, (char**)nullptr, 16)); } else return nullptr; @@ -89,7 +89,7 @@ Standard_PCharacter Standard_GUID_GetValue8(Standard_PCharacter tmpBuffer, uint8 strncpy(strtmp, tmpBuffer, 2); strtmp[2] = '\0'; - my32b = (uint8_t)strtoul(strtmp, (char**)nullptr, 16); + my32b = static_cast(strtoul(strtmp, (char**)nullptr, 16)); // std::cout << "V8 :" << hex(my32b) << std::endl; return &tmpBuffer[2]; } @@ -179,7 +179,7 @@ Standard_GUID::Standard_GUID(const char* const aGuid) my8b5(0), my8b6(0) { - char* tmpBuffer = (char*)aGuid; + char* tmpBuffer = const_cast(aGuid); if (!CheckGUIDFormat(tmpBuffer)) throw Standard_RangeError("Invalid format of GUID"); @@ -217,7 +217,7 @@ Standard_GUID::Standard_GUID(const char16_t* const aGuid) int i = 0; while (i < Standard_GUID_SIZE) { - tmpBuffer[i] = (char)aGuid[i]; + tmpBuffer[i] = static_cast(aGuid[i]); i++; } @@ -249,15 +249,15 @@ void Standard_GUID::ToCString(const Standard_PCharacter aStrGuid) const Sprintf(aStrGuid, "%.8x-%.4x-%.4x-%.4x-%.2x%.2x%.2x%.2x%.2x%.2x", my32b, - (unsigned short)my16b1, - (unsigned short)my16b2, - (unsigned short)my16b3, - (unsigned char)my8b1, - (unsigned char)my8b2, - (unsigned char)my8b3, - (unsigned char)my8b4, - (unsigned char)my8b5, - (unsigned char)my8b6); + static_cast(my16b1), + static_cast(my16b2), + static_cast(my16b3), + static_cast(my8b1), + static_cast(my8b2), + static_cast(my8b3), + static_cast(my8b4), + static_cast(my8b5), + static_cast(my8b6)); } //================================================================================================= @@ -269,10 +269,10 @@ void Standard_GUID::ToExtString(const Standard_PExtCharacter aStrGuid) const for (int i = 0; i < Standard_GUID_SIZE; i++) { - aStrGuid[i] = (char16_t)sguid[i]; + aStrGuid[i] = static_cast(sguid[i]); } - aStrGuid[Standard_GUID_SIZE] = (char16_t)0; + aStrGuid[Standard_GUID_SIZE] = static_cast(0); } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/Standard/Standard_HashUtils.lxx b/src/FoundationClasses/TKernel/Standard/Standard_HashUtils.lxx index 2fadb8c8d16..3dc61ee2906 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_HashUtils.lxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_HashUtils.lxx @@ -74,12 +74,12 @@ inline T unaligned_load(const char* thePnt) noexcept inline uint64_t MurmurHash64A(const void* theKey, int theLen, uint64_t theSeed) noexcept { - static constexpr uint64_t aMul = (((uint64_t)0xc6a4a793UL) << 32UL) + (uint64_t)0x5bd1e995UL; + static constexpr uint64_t aMul = ((static_cast(0xc6a4a793UL)) << 32UL) + static_cast(0x5bd1e995UL); const char* const aBuf = static_cast(theKey); // Remove the bytes not divisible by the sizeof(uint64_t). This // allows the main loop to process the data as 64-bit integers. - const uint64_t aLenAligned = theLen & ~(uint64_t)0x7; + const uint64_t aLenAligned = theLen & ~static_cast(0x7); const char* const anEnd = aBuf + aLenAligned; uint64_t aHash = theSeed ^ (theLen * aMul); for (const char* aPnt = aBuf; aPnt != anEnd; aPnt += 8) diff --git a/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx b/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx index 83c46868894..93bab3b3506 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx @@ -159,7 +159,7 @@ Standard_MMgrOpt::Standard_MMgrOpt(const bool aClear, // initialize parameters myClear = aClear; - myMMap = (int)aMMap; + myMMap = static_cast(aMMap); myCellSize = aCellSize; myNbPages = aNbPages; myThreshold = aThreshold; @@ -265,7 +265,7 @@ void Standard_MMgrOpt::Initialize() // clang-format off myFreeListMax = INDEX_CELL(ROUNDUP_CELL(myThreshold-BLOCK_SHIFT)); // all blocks less than myThreshold are to be recycled // clang-format on - myFreeList = (size_t**)calloc(myFreeListMax + 1, sizeof(size_t*)); + myFreeList = static_cast(calloc(myFreeListMax + 1, sizeof(size_t*))); myCellSize = ROUNDUP16(myCellSize); } @@ -321,7 +321,7 @@ void* Standard_MMgrOpt::Allocate(const size_t aSize) // of the memory block; use it to update list pointer // to point to next free block size_t* aBlock = myFreeList[Index]; - myFreeList[Index] = *(size_t**)aBlock; + myFreeList[Index] = *reinterpret_cast(aBlock); // unlock the mutex myMutex.unlock(); @@ -363,7 +363,7 @@ void* Standard_MMgrOpt::Allocate(const size_t aSize) if (aPIndex > 0 && aPIndex <= myFreeListMax) { myMutex.lock(); - *(size_t**)myNextAddr = myFreeList[aPIndex]; + *reinterpret_cast(myNextAddr) = myFreeList[aPIndex]; myFreeList[aPIndex] = myNextAddr; myMutex.unlock(); } @@ -372,7 +372,7 @@ void* Standard_MMgrOpt::Allocate(const size_t aSize) // set end pointer to the end of the new pool myEndBlock = aBlock + Size / sizeof(size_t); // record in the first bytes of the pool the address of the previous one - *(size_t**)aBlock = myAllocList; + *reinterpret_cast(aBlock) = myAllocList; // and make new pool current (last) // and get pointer to the first memory block in the pool myAllocList = aBlock; @@ -394,14 +394,14 @@ void* Standard_MMgrOpt::Allocate(const size_t aSize) myMutex.unlock(); // we use operator ?: instead of if() since it is faster - size_t* aBlock = (size_t*)(myClear ? calloc(RoundSizeN + BLOCK_SHIFT, sizeof(size_t)) + size_t* aBlock = static_cast(myClear ? calloc(RoundSizeN + BLOCK_SHIFT, sizeof(size_t)) : malloc((RoundSizeN + BLOCK_SHIFT) * sizeof(size_t))); // if allocation failed, try to free some memory by purging free lists, and retry if (!aBlock) { if (Purge(false)) - aBlock = (size_t*)calloc(RoundSizeN + BLOCK_SHIFT, sizeof(size_t)); + aBlock = static_cast(calloc(RoundSizeN + BLOCK_SHIFT, sizeof(size_t))); // if still not succeeded, raise exception if (!aBlock) throw Standard_OutOfMemory("Standard_MMgrOpt::Allocate(): malloc failed"); @@ -464,7 +464,7 @@ void Standard_MMgrOpt::Free(void* theStorage) std::lock_guard aLock(myMutex); // in the memory block header, record address of the next free block - *(size_t**)aBlock = myFreeList[Index]; + *reinterpret_cast(aBlock) = myFreeList[Index]; // add new block to be first in the list myFreeList[Index] = aBlock; } @@ -496,7 +496,7 @@ int Standard_MMgrOpt::Purge(bool) while (aFree) { size_t* anOther = aFree; - aFree = *(size_t**)aFree; + aFree = *reinterpret_cast(aFree); free(anOther); nbFreed++; } @@ -538,7 +538,7 @@ int Standard_MMgrOpt::Purge(bool) { aPools[iPool] = aNextPool; aFreeSize[iPool] = 0; - aNextPool = *(size_t**)aNextPool; // get next pool + aNextPool = *reinterpret_cast(aNextPool); // get next pool } const int iLast = iPool - 1; @@ -561,7 +561,7 @@ int Standard_MMgrOpt::Purge(bool) break; } } - aFree = *(size_t**)aFree; // get next free block + aFree = *reinterpret_cast(aFree); // get next free block } } @@ -598,9 +598,9 @@ int Standard_MMgrOpt::Purge(bool) if (j <= iLastFree) { // remove - aFree = *(size_t**)aFree; + aFree = *reinterpret_cast(aFree); if (aPrevFree) - *(size_t**)aPrevFree = aFree; // link to previous + *reinterpret_cast(aPrevFree) = aFree; // link to previous else myFreeList[i] = aFree; nbFreed++; @@ -609,7 +609,7 @@ int Standard_MMgrOpt::Purge(bool) { // skip aPrevFree = aFree; - aFree = *(size_t**)aFree; + aFree = *reinterpret_cast(aFree); } } } @@ -633,7 +633,7 @@ int Standard_MMgrOpt::Purge(bool) // and connect it to the list of pools that have been processed // and remain non-free if (aPrev) - *(size_t**)aPrev = aNext; + *reinterpret_cast(aPrev) = aNext; else myAllocList = aNext; } @@ -665,7 +665,7 @@ void Standard_MMgrOpt::FreePools() { size_t* aBlock = aFree; // next pool address is stored in first 8 bytes of each pool - aFree = *(size_t**)aFree; + aFree = *reinterpret_cast(aFree); // free pool (note that its size is calculated rather than stored) FreeMemory(aBlock, myPageSize * myNbPages); } @@ -700,7 +700,7 @@ void* Standard_MMgrOpt::Reallocate(void* theStorage, const size_t theNewSize) Free(theStorage); // clear newly added part of the block if (myClear) - memset(((char*)newStorage) + OldSize, 0, theNewSize - OldSize); + memset((static_cast(newStorage)) + OldSize, 0, theNewSize - OldSize); } return newStorage; } @@ -728,8 +728,7 @@ size_t* Standard_MMgrOpt::AllocMemory(size_t& Size) // allocate memory // note that on UNIX myMMap is file descriptor for /dev/null - aBlock = (size_t*) - mmap((char*)MMAP_BASE_ADDRESS, AlignedSize, PROT_READ | PROT_WRITE, MMAP_FLAGS, myMMap, 0); + aBlock = static_cast(mmap((char*)MMAP_BASE_ADDRESS, AlignedSize, PROT_READ | PROT_WRITE, MMAP_FLAGS, myMMap, 0)); if (aBlock == MAP_FAILED /* -1 */) { int errcode = errno; @@ -798,7 +797,7 @@ size_t* Standard_MMgrOpt::AllocMemory(size_t& Size) // else just allocate by malloc or calloc else { - aBlock = (size_t*)(myClear ? calloc(Size, sizeof(char)) : malloc(Size)); + aBlock = static_cast(myClear ? calloc(Size, sizeof(char)) : malloc(Size)); // check the result if (!aBlock) { @@ -830,7 +829,7 @@ void Standard_MMgrOpt::FreeMemory(void* aBlock, #ifndef _WIN32 // align size to page size, just the same as in AllocMemory() const size_t AlignedSize = PAGE_ALIGN(aSize, myPageSize); - munmap((char*)aBlock, AlignedSize); + munmap(static_cast(aBlock), AlignedSize); #else // recover handle to the memory mapping stored just before the block const HANDLE* aMBlock = (const HANDLE*)aBlock; diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ReadLineBuffer.hxx b/src/FoundationClasses/TKernel/Standard/Standard_ReadLineBuffer.hxx index 7e68dbb56c3..29c610281a1 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ReadLineBuffer.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ReadLineBuffer.hxx @@ -282,7 +282,7 @@ protected: //! @return true if reading was finished without errors. bool readStream(std::istream& theStream, size_t theLen, size_t& theReadLen) { - theReadLen = (size_t)theStream.read(&myReadBuffer.front(), theLen).gcount(); + theReadLen = static_cast(theStream.read(&myReadBuffer.front(), theLen).gcount()); return !theStream.bad(); } diff --git a/src/FoundationClasses/TKernel/Standard/Standard_StackTrace.cxx b/src/FoundationClasses/TKernel/Standard/Standard_StackTrace.cxx index 967cd47e776..f02ac5370fb 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_StackTrace.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_StackTrace.cxx @@ -325,7 +325,7 @@ bool Standard::StackTrace(char* theBuffer, #else const int aTopSkip = theNbTopSkip + 1; // skip this function call and specified extra number int aNbTraces = theNbTraces + aTopSkip; - void** aStackArr = (void**)alloca(sizeof(void*) * aNbTraces); + void** aStackArr = static_cast(alloca(sizeof(void*) * aNbTraces)); if (aStackArr == nullptr) { return false; @@ -345,7 +345,7 @@ bool Standard::StackTrace(char* theBuffer, } const size_t aLenInit = strlen(theBuffer); - size_t aLimit = (size_t)theBufferSize - aLenInit - 1; + size_t aLimit = static_cast(theBufferSize) - aLenInit - 1; if (aLimit > 14) { strcat(theBuffer, "\n==Backtrace=="); diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Strtod.cxx b/src/FoundationClasses/TKernel/Standard/Standard_Strtod.cxx index 8b2587a2c2e..b1bfb54ca3a 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Strtod.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Strtod.cxx @@ -1223,17 +1223,17 @@ static Bigint* Balloc(int k MTd) rv = (Bigint*)MALLOC(sizeof(Bigint) + (x - 1) * sizeof(ULong)); #else len = (sizeof(Bigint) + (x - 1) * sizeof(ULong) + sizeof(double) - 1) / sizeof(double); - if (k <= Kmax && (unsigned long)(pmem_next - private_mem) + len <= PRIVATE_mem + if (k <= Kmax && static_cast(pmem_next - private_mem) + len <= PRIVATE_mem #ifdef MULTIPLE_THREADS && TI == TI1 #endif ) { - rv = (Bigint*)pmem_next; + rv = reinterpret_cast(pmem_next); pmem_next += len; } else - rv = (Bigint*)MALLOC(len * sizeof(double)); + rv = static_cast(MALLOC(len * sizeof(double))); #endif rv->k = k; rv->maxwds = x; @@ -1297,7 +1297,7 @@ static Bigint* multadd(Bigint* b, int m, int a MTd) /* multiply by m and add a * do { #ifdef ULLong - y = *x * (ULLong)m + carry; + y = *x * static_cast(m) + carry; carry = y >> 32; *x++ = y & FFFFFFFF; #else @@ -1323,7 +1323,7 @@ static Bigint* multadd(Bigint* b, int m, int a MTd) /* multiply by m and add a * Bfree(b MTa); b = b1; } - b->x[wds++] = (ULong)carry; + b->x[wds++] = static_cast(carry); b->wds = wds; } return b; @@ -1501,11 +1501,11 @@ static Bigint* mult(Bigint* a, Bigint* b MTd) carry = 0; do { - z = *x++ * (ULLong)y + *xc + carry; + z = *x++ * static_cast(y) + *xc + carry; carry = z >> 32; *xc++ = z & FFFFFFFF; } while (x < xae); - *xc = (ULong)carry; + *xc = static_cast(carry); } } #else @@ -1771,14 +1771,14 @@ static Bigint* diff(Bigint* a, Bigint* b MTd) #ifdef ULLong do { - y = (ULLong)*xa++ - *xb++ - borrow; - borrow = y >> 32 & (ULong)1; + y = static_cast(*xa++) - *xb++ - borrow; + borrow = y >> 32 & static_cast(1); *xc++ = y & FFFFFFFF; } while (xb < xbe); while (xa < xae) { y = *xa++ - borrow; - borrow = y >> 32 & (ULong)1; + borrow = y >> 32 & static_cast(1); *xc++ = y & FFFFFFFF; } #else @@ -1961,7 +1961,7 @@ static Bigint* d2b(U* d, int* e, int* bits MTd) z |= Exp_msk11; #endif #else - if ((de = (int)(d0 >> Exp_shift))) + if ((de = static_cast(d0 >> Exp_shift))) z |= Exp_msk1; #endif #ifdef Pack_32 @@ -2234,11 +2234,11 @@ static void hexnan(U* rvp, const char** sp) udx0 = 1; s = *sp; /* allow optional initial 0x or 0X */ - while ((c = *(const unsigned char*)(s + 1)) && c <= ' ') + while ((c = *reinterpret_cast(s + 1)) && c <= ' ') ++s; if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')) s += 2; - while ((c = *(const unsigned char*)++s)) + while ((c = *reinterpret_cast(++s))) { if ((c1 = hexdig[c])) c = c1 & 0xf; @@ -2313,7 +2313,7 @@ static Bigint* increment(Bigint* b MTd) xe = x + b->wds; do { - if (*x < (ULong)0xffffffffL) + if (*x < static_cast(0xffffffffL)) { ++*x; return b; @@ -2364,7 +2364,7 @@ static void rshift(Bigint* b, int k) while (x < xe) *x1++ = *x++; } - if ((b->wds = int(x1 - b->x)) == 0) + if ((b->wds = static_cast(x1 - b->x)) == 0) b->x[0] = 0; } @@ -2450,7 +2450,7 @@ void gethex(const char** sp, U* rvp, int rounding, int sign MTd) /**** if (!hexdig['0']) hexdig_init(); ****/ havedig = 0; - s0 = *(const unsigned char**)sp + 2; + s0 = *reinterpret_cast(sp) + 2; while (s0[havedig] == '0') havedig++; s0 += havedig; @@ -2504,7 +2504,7 @@ void gethex(const char** sp, U* rvp, int rounding, int sign MTd) s++; } /*}*/ if (decpt) - e = -(((Long)(s - decpt)) << 2); + e = -((static_cast(s - decpt)) << 2); pcheck: s1 = s; big = esign = 0; @@ -2588,7 +2588,7 @@ void gethex(const char** sp, U* rvp, int rounding, int sign MTd) word1(rvp) = Big1; return; } - n = int(s1 - s0 - 1); + n = static_cast(s1 - s0 - 1); for (k = 0; n > (1 << (kshift - 2)) - 1; n >>= 1) k++; b = Balloc(k MTa); @@ -2621,7 +2621,7 @@ void gethex(const char** sp, U* rvp, int rounding, int sign MTd) n += 4; } *x++ = L; - b->wds = n = int(x - b->x); + b->wds = n = static_cast(x - b->x); n = ULbits * n - hi0bits(L); nbits = Nbits; lostbits = 0; @@ -2844,10 +2844,10 @@ static int quorem(Bigint* b, Bigint* S) do { #ifdef ULLong - ys = *sx++ * (ULLong)q + carry; + ys = *sx++ * static_cast(q) + carry; carry = ys >> 32; y = *bx - (ys & FFFFFFFF) - borrow; - borrow = y >> 32 & (ULong)1; + borrow = y >> 32 & static_cast(1); *bx++ = y & FFFFFFFF; #else #ifdef Pack_32 @@ -2890,7 +2890,7 @@ static int quorem(Bigint* b, Bigint* S) ys = *sx++ + carry; carry = ys >> 32; y = *bx - (ys & FFFFFFFF) - borrow; - borrow = y >> 32 & (ULong)1; + borrow = y >> 32 & static_cast(1); *bx++ = y & FFFFFFFF; #else #ifdef Pack_32 @@ -3282,7 +3282,7 @@ double Strtod(const char* s00, char** se) z = 10 * z + c - '0'; #endif nd0 = nd; - bc.dp0 = bc.dp1 = int(s - s0); + bc.dp0 = bc.dp1 = static_cast(s - s0); for (s1 = s; s1 > s0 && *--s1 == '0';) ++nz1; #ifdef USE_LOCALE @@ -3312,7 +3312,7 @@ double Strtod(const char* s00, char** se) if (c == '.') { c = *++s; - bc.dp1 = int(s - s0); + bc.dp1 = static_cast(s - s0); bc.dplen = bc.dp1 - bc.dp0; if (!nd) { @@ -3320,7 +3320,7 @@ double Strtod(const char* s00, char** se) nz++; if (c > '0' && c <= '9') { - bc.dp0 = int(s0 - s); + bc.dp0 = static_cast(s0 - s); bc.dp1 = bc.dp0 + bc.dplen; s0 = s; nf += nz; @@ -3396,7 +3396,7 @@ double Strtod(const char* s00, char** se) */ e = 19999; /* safe for 16 bit ints */ else - e = (int)L; + e = L; if (esign) e = -e; } @@ -3940,15 +3940,15 @@ double Strtod(const char* s00, char** se) yz /= 10; e1 += 1; } - y = ULong(yz / 100000000); + y = static_cast(yz / 100000000); } else if (nd > 9) { i = nd - 9; - y = ULong((yz >> i) / pfive[i - 1]); + y = static_cast((yz >> i) / pfive[i - 1]); } else - y = ULong(yz); + y = static_cast(yz); dval(&rv) = yz; #endif /*}*/ @@ -4688,7 +4688,7 @@ for (;;) if (y == z) { /* Can we stop now? */ - L = (Long)aadj; + L = static_cast(aadj); aadj -= L; /* The tolerances below are conservative. */ if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask) @@ -4762,7 +4762,7 @@ if (bc.scale) else if (!oldinexact) clear_inexact(); #endif if (se) - *se = (char*)s; + *se = const_cast(s); return sign ? -dval(&rv) : dval(&rv); } diff --git a/src/FoundationClasses/TKernel/Storage/Storage_BaseDriver.cxx b/src/FoundationClasses/TKernel/Storage/Storage_BaseDriver.cxx index 1ac62dffd6f..1f5c9096606 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_BaseDriver.cxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_BaseDriver.cxx @@ -39,7 +39,7 @@ TCollection_AsciiString Storage_BaseDriver::ReadMagicNumber(Standard_IStream& th while (theIStream.good() && (aReadCharNb < aMagicNumberLen)) { theIStream.get(aChar); - aReadCharNb += (size_t)theIStream.gcount(); + aReadCharNb += static_cast(theIStream.gcount()); aReadMagicNumber += aChar; } diff --git a/src/FoundationClasses/TKernel/Storage/Storage_BucketOfPersistent.hxx b/src/FoundationClasses/TKernel/Storage/Storage_BucketOfPersistent.hxx index 65504c98ae2..abac6cbf410 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_BucketOfPersistent.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_BucketOfPersistent.hxx @@ -42,7 +42,7 @@ public: mySpaceSize(200000), myCurrentSpace(-1) { - mySpace = (Standard_Persistent**)Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize); + mySpace = static_cast(Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize)); } Storage_Bucket(const int theSpaceSize) @@ -50,7 +50,7 @@ public: mySpaceSize(theSpaceSize), myCurrentSpace(-1) { - mySpace = (Standard_Persistent**)Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize); + mySpace = static_cast(Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize)); } void Clear(); diff --git a/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx b/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx index 4faed32e834..7e240cc1829 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx @@ -88,7 +88,7 @@ Storage_BucketOfPersistent::Storage_BucketOfPersistent(const int theBucketSize, myNumberOfBucketAllocated(theBucketNumber), myBucketSize(theBucketSize) { - myBuckets = (Storage_Bucket**)Standard::Allocate(sizeof(Storage_Bucket*) * theBucketNumber); + myBuckets = static_cast(Standard::Allocate(sizeof(Storage_Bucket*) * theBucketNumber)); myBuckets[0] = new Storage_Bucket(myBucketSize); myCurrentBucket = myBuckets[0]; myLength = 0; @@ -152,7 +152,7 @@ void Storage_BucketOfPersistent::Append(const occ::handle& if (myNumberOfBucket > myNumberOfBucketAllocated) { size_t e = sizeof(Storage_Bucket*) * myNumberOfBucketAllocated; - myBuckets = (Storage_Bucket**)Standard::Reallocate(myBuckets, e * 2); + myBuckets = static_cast(Standard::Reallocate(myBuckets, e * 2)); myNumberOfBucketAllocated *= 2; } @@ -802,7 +802,7 @@ TCollection_AsciiString Storage_Schema::ICreationDate() char nowstr[SLENGTH]; time_t nowbin; struct tm* nowstruct; - if (time(&nowbin) == (time_t)-1) + if (time(&nowbin) == static_cast(-1)) { #ifdef OCCT_DEBUG std::cerr << "Storage ERROR : Could not get time of day from time()" << std::endl; @@ -811,7 +811,7 @@ TCollection_AsciiString Storage_Schema::ICreationDate() nowstruct = localtime(&nowbin); - if (strftime(nowstr, SLENGTH, "%m/%d/%Y", nowstruct) == (size_t)0) + if (strftime(nowstr, SLENGTH, "%m/%d/%Y", nowstruct) == static_cast(0)) { #ifdef OCCT_DEBUG std::cerr << "Storage ERROR : Could not get string from strftime()" << std::endl; diff --git a/src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.cxx b/src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.cxx index ea74e53ed0c..8a4c26127b0 100644 --- a/src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.cxx +++ b/src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.cxx @@ -204,7 +204,7 @@ TCollection_AsciiString::TCollection_AsciiString(const TCollection_AsciiString& TCollection_AsciiString::TCollection_AsciiString(const TCollection_AsciiString& theString1, const char* const theString2) { - const int aStr2Len = int(theString2 ? strlen(theString2) : 0); + const int aStr2Len = static_cast(theString2 ? strlen(theString2) : 0); allocate(theString1.myLength + aStr2Len); if (theString1.myLength != 0) { @@ -793,7 +793,7 @@ bool TCollection_AsciiString::EndsWith(const char* const theEndString, const int int TCollection_AsciiString::IntegerValue() const { char* ptr; - int value = (int)strtol(myString, &ptr, 10); + int value = static_cast(strtol(myString, &ptr, 10)); if (ptr != myString) return value; @@ -809,7 +809,7 @@ bool TCollection_AsciiString::IsIntegerValue() const if (ptr != myString) { - for (int i = int(ptr - myString); i < myLength; i++) + for (int i = static_cast(ptr - myString); i < myLength; i++) { if (myString[i] == '.') return false; // what about 'e','x',etc ??? @@ -977,7 +977,7 @@ void TCollection_AsciiString::Read(Standard_IStream& theStream) theStream.width(oldWidth); // put to string - reallocate(int(strlen(buffer))); + reallocate(static_cast(strlen(buffer))); memcpy(myString, buffer, myLength); } @@ -1271,9 +1271,9 @@ int TCollection_AsciiString::UsefullLength() const for (NCollection_UtfIterator anIter(myString); *anIter != 0; ++anIter) { const char32_t aChar = *anIter; - if (aChar > char32_t(0x7F) || std::isgraph(static_cast(aChar)) != 0) + if (aChar > static_cast(0x7F) || std::isgraph(static_cast(aChar)) != 0) { - aLastGraphicEnd = int(anIter.BufferNext() - myString); + aLastGraphicEnd = static_cast(anIter.BufferNext() - myString); } } return aLastGraphicEnd; diff --git a/src/FoundationClasses/TKernel/TCollection/TCollection_ExtendedString.cxx b/src/FoundationClasses/TKernel/TCollection/TCollection_ExtendedString.cxx index 05a2222c846..162570846d8 100644 --- a/src/FoundationClasses/TKernel/TCollection/TCollection_ExtendedString.cxx +++ b/src/FoundationClasses/TKernel/TCollection/TCollection_ExtendedString.cxx @@ -132,11 +132,11 @@ TCollection_ExtendedString::TCollection_ExtendedString(const char* const theStri { return; } - reallocate((int)strlen(theString)); + reallocate(static_cast(strlen(theString))); } else { - allocate((int)strlen(theString)); + allocate(static_cast(strlen(theString))); } for (int aCharIter = 0; aCharIter < myLength; ++aCharIter) { @@ -1172,7 +1172,7 @@ int TCollection_ExtendedString::ToUTF8CString(Standard_PCharacter& theCString) c anIterWrite = anIterRead.GetUtf(anIterWrite); } *anIterWrite = '\0'; - return int(anIterWrite - theCString); + return static_cast(anIterWrite - theCString); } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/TCollection/TCollection_HExtendedString.cxx b/src/FoundationClasses/TKernel/TCollection/TCollection_HExtendedString.cxx index 59824037639..2d16a79c823 100644 --- a/src/FoundationClasses/TKernel/TCollection/TCollection_HExtendedString.cxx +++ b/src/FoundationClasses/TKernel/TCollection/TCollection_HExtendedString.cxx @@ -258,5 +258,5 @@ bool TCollection_HExtendedString::IsSameState( TCollection_ExtendedString& TCollection_HExtendedString::ChangeString() const { - return (TCollection_ExtendedString&)myString; + return const_cast(myString); } diff --git a/src/FoundationClasses/TKernel/Units/Units_Measurement.cxx b/src/FoundationClasses/TKernel/Units/Units_Measurement.cxx index 407554b1d25..2bcbfb41db2 100644 --- a/src/FoundationClasses/TKernel/Units/Units_Measurement.cxx +++ b/src/FoundationClasses/TKernel/Units/Units_Measurement.cxx @@ -95,14 +95,14 @@ void Units_Measurement::Convert(const char* const aunit) Units_Measurement Units_Measurement::Integer() const { - return Units_Measurement((int)themeasurement, thetoken); + return Units_Measurement(static_cast(themeasurement), thetoken); } //================================================================================================= Units_Measurement Units_Measurement::Fractional() const { - return Units_Measurement(themeasurement - (int)themeasurement, thetoken); + return Units_Measurement(themeasurement - static_cast(themeasurement), thetoken); } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/Units/Units_Token.cxx b/src/FoundationClasses/TKernel/Units/Units_Token.cxx index b30476df1c8..7bbc4207603 100644 --- a/src/FoundationClasses/TKernel/Units/Units_Token.cxx +++ b/src/FoundationClasses/TKernel/Units/Units_Token.cxx @@ -275,7 +275,7 @@ bool Units_Token::IsEqual(const char* const astring) const unsigned int length = string.Length(); #endif if (strlen(astring) == length) - return strncmp(string.ToCString(), astring, unsigned(length)) == 0; + return strncmp(string.ToCString(), astring, (length)) == 0; else return false; } diff --git a/src/FoundationClasses/TKernel/Units/Units_Token.lxx b/src/FoundationClasses/TKernel/Units/Units_Token.lxx index 57f7f04c668..3d21822ebe2 100644 --- a/src/FoundationClasses/TKernel/Units/Units_Token.lxx +++ b/src/FoundationClasses/TKernel/Units/Units_Token.lxx @@ -78,8 +78,8 @@ inline bool Units_Token::IsNotEqual(const char* const astring) const { TCollection_AsciiString string = Word(); int length = string.Length(); - if (strlen(astring) == (unsigned int)length) - return strncmp(string.ToCString(), astring, unsigned(length)) != 0; + if (strlen(astring) == static_cast(length)) + return strncmp(string.ToCString(), astring, static_cast(length)) != 0; else return true; } @@ -103,8 +103,8 @@ inline bool Units_Token::IsLessOrEqual(const char* const astring) const { TCollection_AsciiString string = Word(); int length = string.Length(); - if (strlen(astring) >= (unsigned int)length) - return strncmp(string.ToCString(), astring, unsigned(length)) == 0; + if (strlen(astring) >= static_cast(length)) + return strncmp(string.ToCString(), astring, static_cast(length)) == 0; else return false; } @@ -115,7 +115,7 @@ inline bool Units_Token::IsGreater(const char* const astring) const { TCollection_AsciiString string = Word(); int length = string.Length(); - return strncmp(string.ToCString(), astring, unsigned(length)) > 0; + return strncmp(string.ToCString(), astring, static_cast(length)) > 0; } //================================================================================================= @@ -125,7 +125,7 @@ inline bool Units_Token::IsGreater(const occ::handle& atoken) const TCollection_AsciiString string1 = Word(); TCollection_AsciiString string2 = atoken->Word(); int length = string1.Length(); - return strncmp(string1.ToCString(), string2.ToCString(), unsigned(length)) > 0; + return strncmp(string1.ToCString(), string2.ToCString(), static_cast(length)) > 0; } //================================================================================================= @@ -135,5 +135,5 @@ inline bool Units_Token::IsGreaterOrEqual(const occ::handle& atoken TCollection_AsciiString string1 = Word(); TCollection_AsciiString string2 = atoken->Word(); int length = string1.Length(); - return strncmp(string1.ToCString(), string2.ToCString(), unsigned(length)) >= 0; + return strncmp(string1.ToCString(), string2.ToCString(), static_cast(length)) >= 0; } diff --git a/src/FoundationClasses/TKernel/Units/Units_UnitsDictionary.cxx b/src/FoundationClasses/TKernel/Units/Units_UnitsDictionary.cxx index faa9c204441..25898bfd3fe 100644 --- a/src/FoundationClasses/TKernel/Units/Units_UnitsDictionary.cxx +++ b/src/FoundationClasses/TKernel/Units/Units_UnitsDictionary.cxx @@ -82,7 +82,7 @@ static const char* readLine(TCollection_AsciiString& theLine, const char* theStr if (*aCharIter == '\n') { - const int aLineLen = int(aCharIter - theString); + const int aLineLen = static_cast(aCharIter - theString); if (aLineLen != 0) { theLine = TCollection_AsciiString(theString, aLineLen); @@ -259,7 +259,7 @@ void Units_UnitsDictionary::Creates() if (convert[0] == '[') { coeff = 1.; - i = (int)strlen(convert); + i = static_cast(strlen(convert)); convert[i - 1] = 0; ismove = true; charnumber = 1; @@ -293,7 +293,7 @@ void Units_UnitsDictionary::Creates() if (convert[charnumber] == '(') { - i = (int)strlen(convert); + i = static_cast(strlen(convert)); convert[i - 1] = 0; Units_MathSentence mathsentence(&convert[charnumber + 1]); if (ismove) diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_BOP.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_BOP.cxx index 2da583c014b..0a74ff9772c 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_BOP.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_BOP.cxx @@ -411,7 +411,7 @@ void BOPAlgo_BOP::fillPIConstants(const double theWhole, BOPAlgo_PISteps& theSte void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { - myPaveFiller = (BOPAlgo_PaveFiller*)&theFiller; + myPaveFiller = const_cast(&theFiller); myDS = myPaveFiller->PDS(); myContext = myPaveFiller->Context(); myFuzzyValue = myPaveFiller->FuzzyValue(); diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Builder.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Builder.cxx index 28adcb4bd05..2b48bb6b303 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Builder.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Builder.cxx @@ -310,7 +310,7 @@ void BOPAlgo_Builder::fillPISteps(BOPAlgo_PISteps& theSteps) const void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { - myPaveFiller = (BOPAlgo_PaveFiller*)&theFiller; + myPaveFiller = const_cast(&theFiller); myDS = myPaveFiller->PDS(); myContext = myPaveFiller->Context(); myFuzzyValue = myPaveFiller->FuzzyValue(); diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_BuilderSolid.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_BuilderSolid.cxx index 8b9fb58cdb2..2e7ebddcf60 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_BuilderSolid.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_BuilderSolid.cxx @@ -677,7 +677,7 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes(const Message_ProgressRange& th return; } const TopoDS_Shape& aSolid = aMSLF.FindKey(i); - TopoDS_Shape* pSolid = (TopoDS_Shape*)&aSolid; + TopoDS_Shape* pSolid = const_cast(&aSolid); const NCollection_List& aLF = aMSLF(i); if (aLF.IsEmpty()) diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx index 347b6913a9c..5e85366034b 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -205,7 +205,7 @@ void BOPAlgo_CheckerSI::PostTreat() int i, aNb, n1, n2; BOPDS_Pair aPK; // - NCollection_Map& aMPK = *((NCollection_Map*)&myDS->Interferences()); + NCollection_Map& aMPK = *(const_cast*>(&myDS->Interferences())); // 0 NCollection_Vector& aVVs = myDS->InterfVV(); @@ -407,7 +407,7 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection(const Message_ProgressRange& t BOPDS_Pair aPK; - NCollection_Map& aMPK = *((NCollection_Map*)&myDS->Interferences()); + NCollection_Map& aMPK = *(const_cast*>(&myDS->Interferences())); aMPK.Clear(); BOPAlgo_VectorOfFaceSelfIntersect aVFace; diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_MakerVolume.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_MakerVolume.cxx index a7f4473bd0a..5348a735d70 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_MakerVolume.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_MakerVolume.cxx @@ -103,7 +103,7 @@ void BOPAlgo_MakerVolume::PerformInternal1(const BOPAlgo_PaveFiller& theFille const Message_ProgressRange& theRange) { Message_ProgressScope aPS(theRange, "Building volumes", 100); - myPaveFiller = (BOPAlgo_PaveFiller*)&theFiller; + myPaveFiller = const_cast(&theFiller); myDS = myPaveFiller->PDS(); myContext = myPaveFiller->Context(); // diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx index d40cd68aee6..59ca71894c2 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx @@ -374,9 +374,9 @@ class FillGap NCollection_List, TopTools_ShapeMapHasher>& theEFMap) { - myEFMap = (NCollection_IndexedDataMap, - TopTools_ShapeMapHasher>*)&theEFMap; + TopTools_ShapeMapHasher>*>(&theEFMap); } //! Sets the FS connection map @@ -384,9 +384,9 @@ class FillGap NCollection_List, TopTools_ShapeMapHasher>& theFSMap) { - myFSMap = (NCollection_IndexedDataMap, - TopTools_ShapeMapHasher>*)&theFSMap; + TopTools_ShapeMapHasher>*>(&theFSMap); } //! Defines the parallel processing mode diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Section.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Section.cxx index 686281e2648..2dc3d0239ef 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Section.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Section.cxx @@ -101,7 +101,7 @@ void BOPAlgo_Section::PerformInternal1(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { Message_ProgressScope aPS(theRange, "Building result of SECTION operation", 100); - myPaveFiller = (BOPAlgo_PaveFiller*)&theFiller; + myPaveFiller = const_cast(&theFiller); myDS = myPaveFiller->PDS(); myContext = myPaveFiller->Context(); // diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_ShellSplitter.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_ShellSplitter.cxx index 2b0d78fe39e..0c77201fd11 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_ShellSplitter.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_ShellSplitter.cxx @@ -59,7 +59,7 @@ class BOPAlgo_CBK // void SetConnexityBlock(const BOPTools_ConnexityBlock& aCB) { - myPCB = (BOPTools_ConnexityBlock*)&aCB; + myPCB = const_cast(&aCB); } // diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Tools.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Tools.cxx index 766df6930a8..dedf7eae18d 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Tools.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_Tools.cxx @@ -1259,7 +1259,7 @@ class BOPAlgo_FillIn3DParts : public BOPAlgo_ParallelAlgo //! Sets the ShapeBox structure void SetShapeBoxVector(const BOPAlgo_VectorOfShapeBox& theShapeBox) { - myVShapeBox = (BOPAlgo_VectorOfShapeBox*)&theShapeBox; + myVShapeBox = const_cast(&theShapeBox); }; //! Sets the context diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_WireSplitter.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_WireSplitter.cxx index 41141f167ce..a349cc61278 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_WireSplitter.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_WireSplitter.cxx @@ -50,7 +50,7 @@ BOPAlgo_WireSplitter::~BOPAlgo_WireSplitter() = default; void BOPAlgo_WireSplitter::SetWES(const BOPAlgo_WireEdgeSet& theWES) { - myWES = (BOPAlgo_WireEdgeSet*)&theWES; + myWES = const_cast(&theWES); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Curve.lxx b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Curve.lxx index 480f71dfada..be1871085d4 100644 --- a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Curve.lxx +++ b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Curve.lxx @@ -95,7 +95,7 @@ inline void BOPDS_Curve::InitPaveBlock1() inline occ::handle& BOPDS_Curve::ChangePaveBlock1() { - occ::handle* pPB = (occ::handle*)&myPaveBlocks.First(); + occ::handle* pPB = static_cast*>(&myPaveBlocks.First()); return *pPB; } diff --git a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Iterator.cxx b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Iterator.cxx index c8d4fac07f3..cdc9d97248b 100644 --- a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Iterator.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Iterator.cxx @@ -183,7 +183,7 @@ int BOPDS_Iterator::BlockLength() const return 1; } // - aNbIIs = (int)(aCfPredict * (double)aNbIIs); + aNbIIs = static_cast(aCfPredict * static_cast(aNbIIs)); return aNbIIs; } @@ -230,8 +230,8 @@ void BOPDS_Iterator::Value(int& theI1, int& theI2) const const BOPDS_Pair& aPair = myIterator.Value(); aPair.Indices(n1, n2); // - iT1 = (int)(myDS->ShapeInfo(n1).ShapeType()); - iT2 = (int)(myDS->ShapeInfo(n2).ShapeType()); + iT1 = static_cast(myDS->ShapeInfo(n1).ShapeType()); + iT2 = static_cast(myDS->ShapeInfo(n2).ShapeType()); // theI1 = n1; theI2 = n2; diff --git a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_SubIterator.cxx b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_SubIterator.cxx index 39b356c6922..61a822a1c4e 100644 --- a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_SubIterator.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_SubIterator.cxx @@ -65,8 +65,8 @@ void BOPDS_SubIterator::Value(int& theI1, int& theI2) const const BOPDS_Pair& aPKB = myIterator.Value(); aPKB.Indices(n1, n2); // - iT1 = (int)(myDS->ShapeInfo(n1).ShapeType()); - iT2 = (int)(myDS->ShapeInfo(n2).ShapeType()); + iT1 = static_cast(myDS->ShapeInfo(n1).ShapeType()); + iT2 = static_cast(myDS->ShapeInfo(n2).ShapeType()); // theI1 = n1; theI2 = n2; diff --git a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_SubIterator.hxx b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_SubIterator.hxx index 7ebd6f04f94..e3a0aebc24a 100644 --- a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_SubIterator.hxx +++ b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_SubIterator.hxx @@ -54,7 +54,7 @@ public: //! Sets the first set of indices to process void SetSubSet1(const NCollection_List& theLI) { - mySubSet1 = (NCollection_List*)&theLI; + mySubSet1 = const_cast*>(&theLI); } //! Returns the first set of indices to process @@ -63,7 +63,7 @@ public: //! Sets the second set of indices to process void SetSubSet2(const NCollection_List& theLI) { - mySubSet2 = (NCollection_List*)&theLI; + mySubSet2 = const_cast*>(&theLI); } //! Returns the second set of indices to process diff --git a/src/ModelingAlgorithms/TKBO/BOPTools/BOPTools_AlgoTools.cxx b/src/ModelingAlgorithms/TKBO/BOPTools/BOPTools_AlgoTools.cxx index e9346cd366c..0a904ebccc6 100644 --- a/src/ModelingAlgorithms/TKBO/BOPTools/BOPTools_AlgoTools.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPTools/BOPTools_AlgoTools.cxx @@ -1516,7 +1516,7 @@ bool BOPTools_AlgoTools::IsHole(const TopoDS_Shape& aW, const TopoDS_Shape& aFac aNbS *= 4; } // - dU = (aT2 - aT1) / (double)(aNbS - 1); + dU = (aT2 - aT1) / static_cast(aNbS - 1); aU = aT1; aU1 = aT1; if (aOr == TopAbs_REVERSED) diff --git a/src/ModelingAlgorithms/TKBO/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx b/src/ModelingAlgorithms/TKBO/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx index 7043ac8bfe1..9e9b4ccdafd 100644 --- a/src/ModelingAlgorithms/TKBO/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx +++ b/src/ModelingAlgorithms/TKBO/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx @@ -43,7 +43,7 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo(const BOPAlgo_PaveFiller& aPF) myIsIntersectionNeeded(false), myBuilder(nullptr) { - myDSFiller = (BOPAlgo_PaveFiller*)&aPF; + myDSFiller = const_cast(&aPF); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx index 528597b72c7..eb346b3c68b 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx @@ -2065,7 +2065,7 @@ bool IntTools_BeanFaceIntersector::TestComputeCoinside() { double cfp = myFirstParameter, clp = myLastParameter; const int nbSeg = 23; - double cdp = (clp - cfp) / (double)nbSeg; + double cdp = (clp - cfp) / static_cast(nbSeg); int i = 0; @@ -2095,7 +2095,7 @@ bool IntTools_BeanFaceIntersector::TestComputeCoinside() for (i = 1; i < nbSeg; i++) { - double aPar = (cfp + ((double)i) * cdp); + double aPar = (cfp + (static_cast(i)) * cdp); if (Distance(aPar, U, V) > myCriteria) return false; @@ -2500,26 +2500,26 @@ static void CheckSampling(const IntTools_CurveRangeSample& theCurveRange int aSamplesNb = theCurveRange.GetDepth() == 0 ? 1 : theCurveData.GetNbSample(); // check - if ((pow((double)theCurveData.GetNbSample(), (double)(theCurveRange.GetDepth() + 1)) > dLimit) - || ((DiffC / (double)aSamplesNb) < theCurveData.GetMinRange())) + if ((pow(static_cast(theCurveData.GetNbSample()), static_cast(theCurveRange.GetDepth() + 1)) > dLimit) + || ((DiffC / static_cast(aSamplesNb)) < theCurveData.GetMinRange())) { bAllowSamplingC = false; } aSamplesNb = theSurfaceRange.GetDepthU() == 0 ? 1 : theSurfaceData.GetNbSampleU(); - if ((pow((double)theSurfaceData.GetNbSampleU(), (double)(theSurfaceRange.GetDepthU() + 1)) + if ((pow(static_cast(theSurfaceData.GetNbSampleU()), static_cast(theSurfaceRange.GetDepthU() + 1)) > dLimit) - || ((DiffU / (double)aSamplesNb) < theSurfaceData.GetMinRangeU())) + || ((DiffU / static_cast(aSamplesNb)) < theSurfaceData.GetMinRangeU())) { bAllowSamplingU = false; } aSamplesNb = theSurfaceRange.GetDepthV() == 0 ? 1 : theSurfaceData.GetNbSampleV(); - if ((pow((double)theSurfaceData.GetNbSampleV(), (double)(theSurfaceRange.GetDepthV() + 1)) + if ((pow(static_cast(theSurfaceData.GetNbSampleV()), static_cast(theSurfaceRange.GetDepthV() + 1)) > dLimit) - || ((DiffV / (double)aSamplesNb) < theSurfaceData.GetMinRangeV())) + || ((DiffV / static_cast(aSamplesNb)) < theSurfaceData.GetMinRangeV())) { bAllowSamplingV = false; } diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Context.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Context.cxx index f390beb76e5..cb4d53b83f6 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Context.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Context.cxx @@ -200,7 +200,7 @@ Bnd_Box& IntTools_Context::BndBox(const TopoDS_Shape& aS) if (!myBndBoxDataMap.Find(aS, pBox)) { // - pBox = (Bnd_Box*)myAllocator->Allocate(sizeof(Bnd_Box)); + pBox = static_cast(myAllocator->Allocate(sizeof(Bnd_Box))); new (pBox) Bnd_Box(); // Bnd_Box& aBox = *pBox; @@ -234,7 +234,7 @@ IntTools_FClass2d& IntTools_Context::FClass2d(const TopoDS_Face& aF) aFF.Orientation(TopAbs_FORWARD); aTolF = BRep_Tool::Tolerance(aFF); // - pFClass2d = (IntTools_FClass2d*)myAllocator->Allocate(sizeof(IntTools_FClass2d)); + pFClass2d = static_cast(myAllocator->Allocate(sizeof(IntTools_FClass2d))); new (pFClass2d) IntTools_FClass2d(aFF, aTolF); // myFClass2dMap.Bind(aFF, pFClass2d); @@ -254,7 +254,7 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF) const occ::handle& aS = BRep_Tool::Surface(aF); // pProjPS = - (GeomAPI_ProjectPointOnSurf*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf)); + static_cast(myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf))); new (pProjPS) GeomAPI_ProjectPointOnSurf(); pProjPS->Init(aS, Umin, Usup, Vmin, Vsup, myPOnSTolerance); pProjPS->SetExtremaFlag(Extrema_ExtFlag_MIN); /// @@ -276,7 +276,7 @@ GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPC(const TopoDS_Edge& aE) occ::handle aC3D = BRep_Tool::Curve(aE, f, l); // pProjPC = - (GeomAPI_ProjectPointOnCurve*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve)); + static_cast(myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve))); new (pProjPC) GeomAPI_ProjectPointOnCurve(); pProjPC->Init(aC3D, f, l); // @@ -298,7 +298,7 @@ GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPT(const occ::handleLastParameter(); // pProjPT = - (GeomAPI_ProjectPointOnCurve*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve)); + static_cast(myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve))); new (pProjPT) GeomAPI_ProjectPointOnCurve(); pProjPT->Init(aC3D, f, l); // @@ -314,7 +314,7 @@ BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier(const TopoDS_Soli BRepClass3d_SolidClassifier* pSC = nullptr; if (!mySClassMap.Find(aSolid, pSC)) { - pSC = (BRepClass3d_SolidClassifier*)myAllocator->Allocate(sizeof(BRepClass3d_SolidClassifier)); + pSC = static_cast(myAllocator->Allocate(sizeof(BRepClass3d_SolidClassifier))); new (pSC) BRepClass3d_SolidClassifier(aSolid); // mySClassMap.Bind(aSolid, pSC); @@ -330,7 +330,7 @@ BRepAdaptor_Surface& IntTools_Context::SurfaceAdaptor(const TopoDS_Face& theFace if (!mySurfAdaptorMap.Find(theFace, pBAS)) { // - pBAS = (BRepAdaptor_Surface*)myAllocator->Allocate(sizeof(BRepAdaptor_Surface)); + pBAS = static_cast(myAllocator->Allocate(sizeof(BRepAdaptor_Surface))); new (pBAS) BRepAdaptor_Surface(theFace, true); // mySurfAdaptorMap.Bind(theFace, pBAS); @@ -361,7 +361,7 @@ Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF) aEpsT = Precision::PConfusion(); // Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr); - pHatcher = (Geom2dHatch_Hatcher*)myAllocator->Allocate(sizeof(Geom2dHatch_Hatcher)); + pHatcher = static_cast(myAllocator->Allocate(sizeof(Geom2dHatch_Hatcher))); new (pHatcher) Geom2dHatch_Hatcher(aIntr, aTolHatch2D, aTolHatch3D, true, false); // aFF = aF; @@ -401,7 +401,7 @@ Bnd_OBB& IntTools_Context::OBB(const TopoDS_Shape& aS, const double theGap) Bnd_OBB* pBox = nullptr; if (!myOBBMap.Find(aS, pBox)) { - pBox = (Bnd_OBB*)myAllocator->Allocate(sizeof(Bnd_OBB)); + pBox = static_cast(myAllocator->Allocate(sizeof(Bnd_OBB))); new (pBox) Bnd_OBB(); // Bnd_OBB& aBox = *pBox; @@ -420,8 +420,8 @@ IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData(const TopoDS_Fa IntTools_SurfaceRangeLocalizeData* pSData = nullptr; if (!myProjSDataMap.Find(aF, pSData)) { - pSData = (IntTools_SurfaceRangeLocalizeData*)myAllocator->Allocate( - sizeof(IntTools_SurfaceRangeLocalizeData)); + pSData = static_cast(myAllocator->Allocate( + sizeof(IntTools_SurfaceRangeLocalizeData))); new (pSData) IntTools_SurfaceRangeLocalizeData(3, 3, 10. * Precision::PConfusion(), diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_CurveRangeSample.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_CurveRangeSample.cxx index b4e10b56781..4e7eee603ef 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_CurveRangeSample.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_CurveRangeSample.cxx @@ -40,9 +40,9 @@ IntTools_Range IntTools_CurveRangeSample::GetRange(const double theFirst, } else { - double tmp = pow(double(theNbSample), double(GetDepth())); - double localdiffC = diffC / double(tmp); - double aFirstC = theFirst + double(myIndex) * localdiffC; + double tmp = pow(static_cast(theNbSample), static_cast(GetDepth())); + double localdiffC = diffC / (tmp); + double aFirstC = theFirst + static_cast(myIndex) * localdiffC; double aLastC = aFirstC + localdiffC; aResult.SetFirst(aFirstC); aResult.SetLast(aLastC); diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_EdgeEdge.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_EdgeEdge.cxx index 8f9606052da..a6207c5e2e3 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_EdgeEdge.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_EdgeEdge.cxx @@ -281,7 +281,7 @@ bool IntTools_EdgeEdge::IsCoincident() } } // - aCoeff = (double)iCnt / ((double)aNbSeg + 1); + aCoeff = static_cast(iCnt) / (static_cast(aNbSeg) + 1); return aCoeff > aTresh; } @@ -1360,7 +1360,7 @@ int SplitRangeOnSegments(const double aT1, if (aDt < theResolution) { aSeg = aDiff / theResolution; - aNbSegments = int(aSeg) + 1; + aNbSegments = static_cast(aSeg) + 1; aDt = aDiff / aNbSegments; } // diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_EdgeFace.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_EdgeFace.cxx index 09dd9ac0eae..2d812bfcc69 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_EdgeFace.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_EdgeFace.cxx @@ -144,7 +144,7 @@ bool IntTools_EdgeFace::IsCoincident() isClassified = true; } // - const double aCoeff = (double)iCnt / ((double)aNbSeg + 1); + const double aCoeff = static_cast(iCnt) / (static_cast(aNbSeg) + 1); return (aCoeff > aTresh); } @@ -844,7 +844,7 @@ int AdaptiveDiscret(const int iDiscret, aRadius = aCylinder.Radius(); dLR = 2 * aRadius; - iDiscretNew = (int)(aELength / dLR); + iDiscretNew = static_cast(aELength / dLR); if (iDiscretNew < iDiscret) { diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_FClass2d.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_FClass2d.cxx index ebc06342a87..fd447241d04 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_FClass2d.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_FClass2d.cxx @@ -231,7 +231,7 @@ void IntTools_FClass2d::Init(const TopoDS_Face& aFace, const double TolUV) { nbs *= 4; } - du = (plbid - pfbid) / (double)(nbs - 1); + du = (plbid - pfbid) / static_cast(nbs - 1); // if (Or == TopAbs_FORWARD) { diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_FaceFace.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_FaceFace.cxx index 2f41acc8d50..28a55d92660 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_FaceFace.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_FaceFace.cxx @@ -1180,8 +1180,8 @@ reapprox:; else { myLConstruct.Part(i, fprm, lprm); - ifprm = (int)fprm; - ilprm = (int)lprm; + ifprm = static_cast(fprm); + ilprm = static_cast(lprm); } // if (myApprox1) @@ -1286,8 +1286,8 @@ reapprox:; else { myLConstruct.Part(i, fprm, lprm); - ifprm = (int)fprm; - ilprm = (int)lprm; + ifprm = static_cast(fprm); + ilprm = static_cast(lprm); } } @@ -2945,7 +2945,7 @@ bool CheckPCurve(const occ::handle& aPC, if (aSurf->IsUPeriodic()) { double aPer = aSurf->UPeriod(); - int nshift = (int)((u - umin) / aPer); + int nshift = static_cast((u - umin) / aPer); if (u < umin + aPer * nshift) nshift--; umin += aPer * nshift; @@ -2954,7 +2954,7 @@ bool CheckPCurve(const occ::handle& aPC, if (aSurf->IsVPeriodic()) { double aPer = aSurf->VPeriod(); - int nshift = (int)((v - vmin) / aPer); + int nshift = static_cast((v - vmin) / aPer); if (v < vmin + aPer * nshift) nshift--; vmin += aPer * nshift; diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Tools.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Tools.cxx index eacd738ea67..537ef2b6e59 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Tools.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Tools.cxx @@ -125,7 +125,7 @@ void IntTools_Tools::RejectLines(const NCollection_Sequence& aSI if (!aGTC.IsNull()) { aC3D = aGTC->BasisCurve(); - IntTools_Curve* pIC = (IntTools_Curve*)&IC; + IntTools_Curve* pIC = const_cast(&IC); pIC->SetCurve(aC3D); } // diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_TopolTool.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_TopolTool.cxx index 1a553b053f5..84a463f8be6 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_TopolTool.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_TopolTool.cxx @@ -153,9 +153,9 @@ void IntTools_TopolTool::ComputeSamplePoints() } if (aMaxAngle > Precision::Angular()) { - nbsu = int((usup - uinf) / aMaxAngle); + nbsu = static_cast((usup - uinf) / aMaxAngle); } - nbsv = (int)(vsup - vinf); + nbsv = static_cast(vsup - vinf); nbsv /= 10; if (nbsu < 2) @@ -190,9 +190,9 @@ void IntTools_TopolTool::ComputeSamplePoints() if (aMaxAngle > Precision::Angular()) { - nbsu = int((usup - uinf) / aMaxAngle); + nbsu = static_cast((usup - uinf) / aMaxAngle); } - nbsv = (int)(vsup - vinf); + nbsv = static_cast(vsup - vinf); nbsv /= 10; // if(nbsu < 2) nbsu = 2; @@ -246,7 +246,7 @@ void IntTools_TopolTool::ComputeSamplePoints() if (aMaxAngle > Precision::Angular()) { - nbsu = int((usup - uinf) / aMaxAngle); + nbsu = static_cast((usup - uinf) / aMaxAngle); } aMaxAngle = M_PI * 0.5; @@ -257,7 +257,7 @@ void IntTools_TopolTool::ComputeSamplePoints() if (aMaxAngle > Precision::Angular()) { - nbsv = int((vsup - vinf) / aMaxAngle); + nbsv = static_cast((vsup - vinf) / aMaxAngle); } if (nbsu < 10) nbsu = 10; @@ -322,7 +322,7 @@ void IntTools_TopolTool::ComputeSamplePoints() break; case GeomAbs_SurfaceOfExtrusion: { nbsu = 15; - nbsv = (int)(vsup - vinf); + nbsv = static_cast(vsup - vinf); nbsv /= 10; if (nbsv < 15) nbsv = 15; diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_WLineTool.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_WLineTool.cxx index ade65f53f47..03543d029ae 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_WLineTool.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_WLineTool.cxx @@ -1065,8 +1065,8 @@ bool IntTools_WLineTool::DecompositionOfWLine( else { theLConstructor.Part(j, fprm, lprm); - ifprm = (int)fprm; - ilprm = (int)lprm; + ifprm = static_cast(fprm); + ilprm = static_cast(lprm); } occ::handle aLineOn2S = new IntSurf_LineOn2S(); diff --git a/src/ModelingAlgorithms/TKBool/BRepAlgo/BRepAlgo.cxx b/src/ModelingAlgorithms/TKBool/BRepAlgo/BRepAlgo.cxx index db2ace1039f..df626125f31 100644 --- a/src/ModelingAlgorithms/TKBool/BRepAlgo/BRepAlgo.cxx +++ b/src/ModelingAlgorithms/TKBool/BRepAlgo/BRepAlgo.cxx @@ -668,7 +668,7 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire) for (i = 1; i <= nb_curve; i++) { if (CurveSeq(i)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - CurveSeq(i) = (*((occ::handle*)&(CurveSeq(i))))->BasisCurve(); + CurveSeq(i) = (*(reinterpret_cast*>(&(CurveSeq(i)))))->BasisCurve(); occ::handle aTrCurve = new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i)); @@ -746,7 +746,7 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire) else { if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - CurveSeq(1) = (*((occ::handle*)&(CurveSeq(1))))->BasisCurve(); + CurveSeq(1) = (*(reinterpret_cast*>(&(CurveSeq(1)))))->BasisCurve(); occ::handle aCopyCurve = occ::down_cast(CurveSeq(1)->Copy()); diff --git a/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_Draft.cxx b/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_Draft.cxx index f7f7e758e50..f9fe4ac8bd8 100644 --- a/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_Draft.cxx +++ b/src/ModelingAlgorithms/TKBool/BRepFill/BRepFill_Draft.cxx @@ -153,7 +153,7 @@ static bool GoodOrientation(const Bnd_Box& B, int ii, Ind; // #ifndef OCCT_DEBUG - int Nb = (int)(4 + (10 * r)); + int Nb = static_cast(4 + (10 * r)); // #else // int Nb = 4+(10*r); // #endif diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FaceEdgeIntersector.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FaceEdgeIntersector.cxx index 2fa439f7412..d899cca3489 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FaceEdgeIntersector.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FaceEdgeIntersector.cxx @@ -97,7 +97,7 @@ void TopOpeBRep_FaceEdgeIntersector::Perform(const TopoDS_Shape& SF, const TopoD const occ::handle C = BRep_Tool::Curve(myEdge, loc, f, l); occ::handle GGao1 = C->Transformed(loc.Transformation()); - occ::handle* PGCao1 = (occ::handle*)&GGao1; + occ::handle* PGCao1 = reinterpret_cast*>(&GGao1); myCurve.Load(*PGCao1, f, l); #ifdef OCCT_DEBUG diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesFiller.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesFiller.cxx index 9550abaa20b..0a5d56a44fb 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesFiller.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesFiller.cxx @@ -403,7 +403,7 @@ void TopOpeBRep_FacesFiller::VP_PositionOnL(TopOpeBRep_LineInter& L) const gp_Pnt& P3D = VP.Value(); bool VPequalVPONRESTRICTION = false; - TopOpeBRep_FacesIntersector& FI = *((TopOpeBRep_FacesIntersector*)((void*)myFacesIntersector)); + TopOpeBRep_FacesIntersector& FI = *(static_cast((void*)myFacesIntersector)); int iOL = 1, n = FI.NbLines(); for (iOL = 1; iOL <= n; iOL++) { diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx index 66efaa71c27..83007c97a4c 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx @@ -390,7 +390,7 @@ void TopOpeBRep_FacesIntersector::PrepareLines() int i; // int nbl=0; IntPatch_LineConstructor** Ptr = - (IntPatch_LineConstructor**)malloc(n * sizeof(IntPatch_LineConstructor*)); + static_cast(malloc(n * sizeof(IntPatch_LineConstructor*))); for (i = 1; i <= n; i++) { Ptr[i - 1] = new IntPatch_LineConstructor(2); @@ -943,8 +943,8 @@ static occ::handle BuildRLine( trans2 = atmpWLine->TransitionOnS2(); } - int ParamMinOnLine = (int)atmpWLine->Vertex(1).ParameterOnLine(); - int ParamMaxOnLine = (int)atmpWLine->Vertex(atmpWLine->NbVertex()).ParameterOnLine(); + int ParamMinOnLine = static_cast(atmpWLine->Vertex(1).ParameterOnLine()); + int ParamMaxOnLine = static_cast(atmpWLine->Vertex(atmpWLine->NbVertex()).ParameterOnLine()); for (int k = ParamMinOnLine; k <= ParamMaxOnLine; k++) { @@ -1210,7 +1210,7 @@ static void MergeWLinesIfAllSegmentsAlongRestriction( return; double TolVrtx = 1.e-5; - int testPointIndex = (sqVertexPoints.Length() > 3) ? ((int)sqVertexPoints.Length() / 2) : 2; + int testPointIndex = (sqVertexPoints.Length() > 3) ? (sqVertexPoints.Length() / 2) : 2; gp_Pnt testPoint = sqVertexPoints.Value(testPointIndex); double Fp = 0., Lp = 0.; @@ -1288,7 +1288,7 @@ static int GetArc(NCollection_Sequence>& theSlin, if (anEAddress == nullptr) continue; - TopoDS_Edge* anE = (TopoDS_Edge*)anEAddress; + TopoDS_Edge* anE = static_cast(anEAddress); occ::handle aCEdge = BRep_Tool::Curve(*anE, firstES1, lastES1); if (aCEdge.IsNull()) // e.g. degenerated edge, see OCC21770 continue; @@ -1381,7 +1381,7 @@ static int GetArc(NCollection_Sequence>& theSlin, } void* anEAddress = theDomainObj->Edge(); - TopoDS_Edge* anE = (TopoDS_Edge*)anEAddress; + TopoDS_Edge* anE = static_cast(anEAddress); TopoDS_Vertex V1, V2; TopExp::Vertices(*anE, V1, V2); double MaxVertexTol = std::max(BRep_Tool::Tolerance(V1), BRep_Tool::Tolerance(V2)); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_LineInter.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_LineInter.cxx index 5d20f2b147a..c8baa8a0f21 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_LineInter.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_LineInter.cxx @@ -359,7 +359,7 @@ void TopOpeBRep_LineInter::VPBounds(int& f, int& l, int& n) const { if (!myVPBDefined) { - TopOpeBRep_LineInter* p = (TopOpeBRep_LineInter*)this; // NYI deconst + TopOpeBRep_LineInter* p = const_cast(this); // NYI deconst p->SetOK(false); f = l = n = 0; return; @@ -491,7 +491,7 @@ occ::handle TopOpeBRep_LineInter::Curve() const C3D = new Geom_Hyperbola(myILG->Hyperbola()); break; default: - TopOpeBRep_LineInter* p = (TopOpeBRep_LineInter*)this; // NYI deconst + TopOpeBRep_LineInter* p = const_cast(this); // NYI deconst p->SetOK(false); break; } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_VPointInter.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_VPointInter.cxx index 8e8b42fc0bd..e1dba8a49ad 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_VPointInter.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_VPointInter.cxx @@ -36,7 +36,7 @@ static TCollection_AsciiString PRODINP("dinp "); void TopOpeBRep_VPointInter::SetPoint(const IntPatch_Point& P) { - myPPOI = (IntPatch_Point*)&P; + myPPOI = const_cast(&P); bool isOn1 = P.IsOnDomS1(); bool isOn2 = P.IsOnDomS2(); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_VPointInterIterator.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_VPointInterIterator.cxx index ec4ab27f6ef..61133f19cd6 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_VPointInterIterator.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_VPointInterIterator.cxx @@ -39,7 +39,7 @@ TopOpeBRep_VPointInterIterator::TopOpeBRep_VPointInterIterator(const TopOpeBRep_ void TopOpeBRep_VPointInterIterator::Init(const TopOpeBRep_LineInter& LI, const bool checkkeep) { - myLineInter = (TopOpeBRep_LineInter*)&LI; + myLineInter = const_cast(&LI); mycheckkeep = checkkeep; Init(); } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_WPointInter.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_WPointInter.cxx index 22ee34b25e9..5a35ce781ce 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_WPointInter.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_WPointInter.cxx @@ -26,7 +26,7 @@ TopOpeBRep_WPointInter::TopOpeBRep_WPointInter() = default; void TopOpeBRep_WPointInter::Set(const IntSurf_PntOn2S& P) { - myPP2S = (IntSurf_PntOn2S*)&P; + myPP2S = const_cast(&P); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_WPointInterIterator.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_WPointInterIterator.cxx index ab2039049b1..8ed7fa4e5e7 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_WPointInterIterator.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_WPointInterIterator.cxx @@ -38,7 +38,7 @@ TopOpeBRep_WPointInterIterator::TopOpeBRep_WPointInterIterator(const TopOpeBRep_ void TopOpeBRep_WPointInterIterator::Init(const TopOpeBRep_LineInter& LI) { - myLineInter = (TopOpeBRep_LineInter*)&LI; + myLineInter = const_cast(&LI); Init(); } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_sort.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_sort.cxx index 8ea92dd0731..3cadf05d4aa 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_sort.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_sort.cxx @@ -23,8 +23,8 @@ typedef NCollection_List>* BOA_t; static int compll(const void* v1, const void* v2) { - BOA_t l1 = *(BOA_t*)v1; - BOA_t l2 = *(BOA_t*)v2; + BOA_t l1 = *static_cast(v1); + BOA_t l2 = *static_cast(v2); if (l1->Extent() == 0) return (0); else if (l2->Extent() == 0) @@ -54,9 +54,9 @@ static void BREP_sortonparameter2(NCollection_List(ng); size_t sad = sizeof(BOA_t); - BOA_t* T = (BOA_t*)Standard::Allocate(sng * sad); + BOA_t* T = static_cast(Standard::Allocate(sng * sad)); TopOpeBRepDS_Kind K; int G, j = 0; for (tki.Init(); tki.More(); tki.Next(), j++) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_1.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_1.cxx index 8894db4e7ed..c7983e216d8 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_1.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_1.cxx @@ -966,7 +966,7 @@ void TopOpeBRepBuild_Builder1::SplitEdge( { NCollection_List::Iterator it(anOriList); it.Next(); - anOr1 = (TopAbs_Orientation)it.Value(); + anOr1 = static_cast(it.Value()); } anOriList.RemoveFirst(); anOriList.RemoveFirst(); @@ -992,7 +992,7 @@ void TopOpeBRepBuild_Builder1::SplitEdge( { NCollection_List::Iterator it(anOriList); it.Next(); - anOr2 = (TopAbs_Orientation)it.Value(); + anOr2 = static_cast(it.Value()); } } } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON2d.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON2d.cxx index 45da5292858..a9ef105a272 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON2d.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_BuilderON2d.cxx @@ -77,7 +77,7 @@ void TopOpeBRepBuild_BuilderON::Perform2d(const TopOpeBRepBuild_PBuilder& PB const TopOpeBRepDS_DataStructure& BDS = myPB->DataStructure()->DS(); if (GLOBAL_DS2d == nullptr) - GLOBAL_DS2d = (TopOpeBRepDS_PDataStructure) new TopOpeBRepDS_DataStructure(); + GLOBAL_DS2d = static_cast(new TopOpeBRepDS_DataStructure()); const NCollection_List>& lFEI = GLOBAL_DS2d->ShapeInterferences(FOR); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx index 1e6dc6aaa9f..2049846436f 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx @@ -79,7 +79,7 @@ void TopOpeBRepBuild_CorrectFace2d::SetMapOfTrans2dInfo( NCollection_IndexedDataMap& TopOpeBRepBuild_CorrectFace2d::MapOfTrans2dInfo() { - return *(NCollection_IndexedDataMap*)myMap; + return *static_cast*>(myMap); } //================================================================================================= @@ -124,7 +124,7 @@ void TopOpeBRepBuild_CorrectFace2d::BuildCopyData( BRep_Builder BB; NCollection_IndexedDataMap* pMap = - (NCollection_IndexedDataMap*)myMap; + static_cast*>(myMap); // // 1. Copy myFace =>> myCopyFace TopoDS_Shape aLocalShape = aFace.EmptyCopied(); @@ -948,7 +948,7 @@ void TopOpeBRepBuild_CorrectFace2d::MoveWires2d(TopoDS_Wire& anOuterWire) B2dOuterWire.Get(OuterU1, OuterV1, OuterU2, OuterV2); a = .5 * (OuterU1 + OuterU2); - b = int(-a / TwoPI); + b = static_cast(-a / TwoPI); k = (a < 0.) ? 1 : 0; x = (b + k) * TwoPI; // @@ -975,7 +975,7 @@ void TopOpeBRepBuild_CorrectFace2d::MoveWires2d(TopoDS_Wire& anOuterWire) { // printf(" Need to Move\n" ); a = u1 - OuterU1; - b = int(-a / TwoPI); + b = static_cast(-a / TwoPI); k = (a < 0.) ? 1 : 0; x = (b + k) * TwoPI; aTrV.SetCoord(x, 0.); @@ -995,7 +995,7 @@ void TopOpeBRepBuild_CorrectFace2d::UpdateEdge(const TopoDS_Edge& BRep_Builder BB; NCollection_IndexedDataMap* pMap = - (NCollection_IndexedDataMap*)myMap; + static_cast*>(myMap); // E is the Original Edge from Original Face. if (myEdMapInversed.Contains(ECopy)) @@ -1041,7 +1041,7 @@ void TopOpeBRepBuild_CorrectFace2d::UpdateEdge(const TopoDS_Edge& BRep_Builder BB; NCollection_IndexedDataMap* pMap = - (NCollection_IndexedDataMap*)myMap; + static_cast*>(myMap); // E is the Original Edge from Original Face. if (myEdMapInversed.Contains(ECopy)) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx index 2d26d31a90a..bee52c6a354 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx @@ -274,7 +274,7 @@ void TopOpeBRepBuild_GTopo::DumpSSB(Standard_OStream& OS, void TopOpeBRepBuild_GTopo::Dump(Standard_OStream& OS, void* const a) const { - char* s = (char*)a; + char* s = static_cast(a); DumpType(OS); OS << " "; diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_GridFF.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_GridFF.cxx index 6d21c25b163..f178916dcbe 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_GridFF.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_GridFF.cxx @@ -321,7 +321,7 @@ void TopOpeBRepBuild_Builder::GMergeFaces(const NCollection_List& if (LF1.IsEmpty()) return; if (GLOBAL_DS2d == nullptr) - GLOBAL_DS2d = (TopOpeBRepDS_PDataStructure) new TopOpeBRepDS_DataStructure(); + GLOBAL_DS2d = static_cast(new TopOpeBRepDS_DataStructure()); GLOBAL_DS2d->Init(); TopAbs_State TB1, TB2; diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Griddump.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Griddump.cxx index 48a5274dd10..4d1babca88b 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Griddump.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Griddump.cxx @@ -320,7 +320,7 @@ void TopOpeBRepBuild_Builder::GdumpSAMDOM(const NCollection_List& void* const astr) const { TopOpeBRepDS_Dumper Dumper(myDataStructure); - std::cout << Dumper.SPrintShapeRefOri(L, (char*)astr) << std::endl; + std::cout << Dumper.SPrintShapeRefOri(L, static_cast(astr)) << std::endl; std::cout.flush(); } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_HBuilder.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_HBuilder.cxx index 2af142e9adb..d603faed25d 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_HBuilder.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_HBuilder.cxx @@ -301,7 +301,7 @@ void TopOpeBRepBuild_HBuilder::MakeEdgeAncestorMap() re = DS.AncestorRank(ShaSpl); if (!re) continue; - TopOpeBRepDS_ListOfShapeOn1State& losos1s = (*(TopOpeBRepDS_ListOfShapeOn1State*)&it.Value()); + TopOpeBRepDS_ListOfShapeOn1State& losos1s = (*const_cast(&it.Value())); NCollection_List& los = losos1s.ChangeListOnState(); its.Initialize(los); if (re == 1) @@ -441,7 +441,7 @@ void TopOpeBRepBuild_HBuilder::MakeCurveAncestorMap() itloe.Initialize(LOS); for (; itloe.More(); itloe.Next()) { - TopoDS_Shape& E = *((TopoDS_Shape*)(&itloe.Value())); + TopoDS_Shape& E = *(static_cast(&itloe.Value())); mySectEdgeDSCurve.Bind(E, ic); } } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx index 41ee22ea9c3..51f3993da19 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_KPart.cxx @@ -812,10 +812,10 @@ void TopOpeBRepBuild_Builder::MergeKPartisdisj() TopExp_Explorer anExp(myShape1, TopAbs_SHELL, TopAbs_SOLID); for (int i = TopAbs_SHELL; i <= TopAbs_VERTEX && !hasnotsol1 && !hasnotsol2; i++) { - anExp.Init(myShape1, (TopAbs_ShapeEnum)i, TopAbs_SOLID); + anExp.Init(myShape1, static_cast(i), TopAbs_SOLID); if (anExp.More()) hasnotsol1 = true; - anExp.Init(myShape2, (TopAbs_ShapeEnum)i, TopAbs_SOLID); + anExp.Init(myShape2, static_cast(i), TopAbs_SOLID); if (anExp.More()) hasnotsol2 = true; } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_fctwes.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_fctwes.cxx index fb71282bad3..cd1e622a224 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_fctwes.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_fctwes.cxx @@ -150,8 +150,8 @@ void TopOpeBRepBuild_Builder::GFillCurveTopologyWES(const TopOpeBRepDS_CurveIter // else if (TB1 == TopAbs_IN ) TB = TopAbs_OUT; } - TopoDS_Face& WESF = *((TopoDS_Face*)((void*)&WES.Face())); - TopoDS_Face& FTF = *((TopoDS_Face*)((void*)&myFaceToFill)); + TopoDS_Face& WESF = *(static_cast((void*)&WES.Face())); + TopoDS_Face& FTF = *(static_cast((void*)&myFaceToFill)); #ifdef OCCT_DEBUG // bool FTFeqWESF = myFaceReference.IsEqual(WESF); #endif diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx index ed7b646821c..1b2179d4284 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx @@ -326,7 +326,7 @@ void TopOpeBRepBuild_Builder::GFillFaceSFS(const TopoDS_Shape& if (GLOBAL_lfrtoprocess) { if (GLOBAL_lfr1 == nullptr) - GLOBAL_lfr1 = (NCollection_List*)new NCollection_List(); + GLOBAL_lfr1 = static_cast*>(new NCollection_List()); GLOBAL_lfr1->Clear(); } } @@ -336,10 +336,10 @@ void TopOpeBRepBuild_Builder::GFillFaceSFS(const TopoDS_Shape& // . fanc hsdm is the unique ancestor face if (GLOBAL_SplitAnc == nullptr) GLOBAL_SplitAnc = - (NCollection_DataMap*)new NCollection_DataMap< + static_cast*>(new NCollection_DataMap< TopoDS_Shape, int, - TopTools_ShapeMapHasher>(); + TopTools_ShapeMapHasher>()); GLOBAL_SplitAnc->Clear(); NCollection_List LFSO, LFDO, LFSO1, LFDO1, LFSO2, LFDO2; @@ -404,7 +404,7 @@ void TopOpeBRepBuild_Builder::GFillFaceSFS(const TopoDS_Shape& // ici : GLOBAL_lfrtoprocess = t // clang-format off - if (GLOBAL_lfr1==nullptr) GLOBAL_lfr1=(NCollection_List*)new NCollection_List(); //flo150998 + if (GLOBAL_lfr1==nullptr) GLOBAL_lfr1=static_cast*>(new NCollection_List()); //flo150998 // clang-format on GLOBAL_lfr1->Clear(); GSplitFaceSFS(FOR, LSO2, GM, SFS); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_kpkole.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_kpkole.cxx index 84386a803d6..ab5f6871b07 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_kpkole.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_kpkole.cxx @@ -129,7 +129,7 @@ void TopOpeBRepBuild_Builder::MergeKPartiskole() if (!emp) { if (plfIN == nullptr) - plfIN = (NCollection_List*)&itm1.Value(); + plfIN = const_cast*>(&itm1.Value()); if (pfOU == nullptr) pfOU = &itm1.Key(); if (pfIN == nullptr) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_on.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_on.cxx index a94df81101c..d807248b0a9 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_on.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_on.cxx @@ -34,13 +34,13 @@ void TopOpeBRepBuild_Builder::GFillONPartsWES(const TopoDS_Shape& if (GLOBAL_faces2d) BON.Perform2d(this, FOR, - (TopOpeBRepBuild_PGTopo)&G, - (TopOpeBRepTool_Plos)&LSclass, - (TopOpeBRepBuild_PWireEdgeSet)&WES); + const_cast(&G), + const_cast(&LSclass), + static_cast(&WES)); else BON.Perform(this, FOR, - (TopOpeBRepBuild_PGTopo)&G, - (TopOpeBRepTool_Plos)&LSclass, - (TopOpeBRepBuild_PWireEdgeSet)&WES); + const_cast(&G), + const_cast(&LSclass), + static_cast(&WES)); } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx index 2b9901247d3..1674aa8b1bd 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx @@ -744,14 +744,14 @@ void TopOpeBRepDS_BuildTool::PutPCurves(const TopOpeBRepDS_Curve& newC, const bool comppc2) const { - TopoDS_Face& F1 = *((TopoDS_Face*)(void*)&(TopoDS::Face(newC.Shape1()))); + TopoDS_Face& F1 = *(static_cast((void*)&(TopoDS::Face(newC.Shape1())))); const occ::handle& PC1 = newC.Curve1(); if (!PC1.IsNull() && comppc1) { PCurve(F1, E, PC1); } - TopoDS_Face& F2 = *((TopoDS_Face*)(void*)&(TopoDS::Face(newC.Shape2()))); + TopoDS_Face& F2 = *(static_cast((void*)&(TopoDS::Face(newC.Shape2())))); const occ::handle& PC2 = newC.Curve2(); if (!PC2.IsNull() && comppc2) { diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Check.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Check.cxx index a668bbe9f65..75a184901eb 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Check.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Check.cxx @@ -398,7 +398,7 @@ bool CheckEdgeParameter(const occ::handle& myHDS) occ::down_cast(I1); if (!EVI.IsNull()) { - int Param = (int)EVI->Parameter(); + int Param = static_cast(EVI->Parameter()); if (Param > 1.e50) { IsOK = false; @@ -421,7 +421,7 @@ bool CheckEdgeParameter(const occ::handle& myHDS) occ::down_cast(I1)); if (!CPI.IsNull()) { - int Param = (int)TopOpeBRepDS_InterferenceTool::Parameter(CPI); + int Param = static_cast(TopOpeBRepDS_InterferenceTool::Parameter(CPI)); if (Param > 1.e50) { IsOK = false; diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_CurveExplorer.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_CurveExplorer.cxx index 343b50b7551..8fd5f271fa7 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_CurveExplorer.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_CurveExplorer.cxx @@ -44,7 +44,7 @@ TopOpeBRepDS_CurveExplorer::TopOpeBRepDS_CurveExplorer(const TopOpeBRepDS_DataSt void TopOpeBRepDS_CurveExplorer::Init(const TopOpeBRepDS_DataStructure& DS, const bool FindKeep) { - myDS = (TopOpeBRepDS_DataStructure*)&DS; + myDS = const_cast(&DS); myIndex = 1; myMax = DS.NbCurves(); myFindKeep = FindKeep; diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_DataStructure.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_DataStructure.cxx index 5f4b2e7bbb6..d77d93aa3eb 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_DataStructure.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_DataStructure.cxx @@ -118,7 +118,7 @@ int TopOpeBRepDS_DataStructure::AddCurve(const TopOpeBRepDS_Curve& C) myNbCurves++; // NYI : modifier const & sur Curve dans le CDL NYI - TopOpeBRepDS_Curve* PC = (TopOpeBRepDS_Curve*)(void*)&C; + TopOpeBRepDS_Curve* PC = static_cast((void*)&C); PC->ChangeDSIndex(myNbCurves); TopOpeBRepDS_CurveData CD(C); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx index 4c3dccbc2b4..643f5982752 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Dumper.cxx @@ -92,13 +92,13 @@ TCollection_AsciiString TopOpeBRepDS_Dumper::SPrintShape(const TopoDS_Shape& S) const char* s2; if (BDS.KeepShape(IS)) { - s1 = (const char*)((rankIS == 1) ? "*" : ""); - s2 = (const char*)((rankIS == 2) ? "*" : ""); + s1 = ((rankIS == 1) ? "*" : ""); + s2 = ((rankIS == 2) ? "*" : ""); } else { - s1 = (const char*)((rankIS == 1) ? "~" : ""); - s2 = (const char*)((rankIS == 2) ? "~" : ""); + s1 = ((rankIS == 1) ? "~" : ""); + s2 = ((rankIS == 2) ? "~" : ""); } TCollection_AsciiString sse = TopOpeBRepDS::SPrint(TopOpeBRepDS::ShapeToKind(S.ShapeType()), IS, s1, s2); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx index 30f574484b9..247556e21b8 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_FIR.cxx @@ -188,7 +188,7 @@ void FUN_reduceEDGEgeometry1(NCollection_List((void*)&BDS); TopOpeBRepDS_FaceInterferenceTool FITool(pbds); gp_Pnt Pok; bool isPok = false; diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Marker.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Marker.cxx index 3e343abbab2..f65f4e99dae 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Marker.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Marker.cxx @@ -43,7 +43,7 @@ void TopOpeBRepDS_Marker::Set(const int ie, const bool b) void TopOpeBRepDS_Marker::Set(const bool b, const int na, void* const aa) { - char** a = (char**)aa; + char** a = static_cast(aa); // int ia,ie; int ia; if (!na) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_PointExplorer.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_PointExplorer.cxx index c9535867201..44ec306e4b7 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_PointExplorer.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_PointExplorer.cxx @@ -45,7 +45,7 @@ void TopOpeBRepDS_PointExplorer::Init(const TopOpeBRepDS_DataStructure& DS, cons { myIndex = 1; myMax = DS.NbPoints(); - myDS = (TopOpeBRepDS_DataStructure*)&DS; + myDS = const_cast(&DS); myFindKeep = FindKeep; Find(); } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_SurfaceExplorer.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_SurfaceExplorer.cxx index 4ee74e3287b..e9fcfe097c1 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_SurfaceExplorer.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_SurfaceExplorer.cxx @@ -44,7 +44,7 @@ void TopOpeBRepDS_SurfaceExplorer::Init(const TopOpeBRepDS_DataStructure& DS, co { myIndex = 1; myMax = DS.NbSurfaces(); - myDS = (TopOpeBRepDS_DataStructure*)&DS; + myDS = const_cast(&DS); myFindKeep = FindKeep; Find(); } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_TKI.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_TKI.cxx index 20933b182a8..f7b69c88b19 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_TKI.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_TKI.cxx @@ -43,8 +43,8 @@ TopOpeBRepDS_TKI::TopOpeBRepDS_TKI() void TopOpeBRepDS_TKI::Reset() { - int ip = (int)TopOpeBRepDS_POINT; - int is = (int)TopOpeBRepDS_SOLID; + int ip = static_cast(TopOpeBRepDS_POINT); + int is = static_cast(TopOpeBRepDS_SOLID); if (ip > is) { throw Standard_ProgramError("TopOpeBRepDS_TKI : enumeration badly ordered"); @@ -353,7 +353,7 @@ void TopOpeBRepDS_TKI::Find() int TopOpeBRepDS_TKI::KindToTableIndex(const TopOpeBRepDS_Kind K) const { // K(Kind) + mydelta = TI(integer) = index in myT - int TI = (int)K + mydelta; + int TI = static_cast(K) + mydelta; return TI; } @@ -362,7 +362,7 @@ int TopOpeBRepDS_TKI::KindToTableIndex(const TopOpeBRepDS_Kind K) const TopOpeBRepDS_Kind TopOpeBRepDS_TKI::TableIndexToKind(const int TI) const { // K(Kind) + mydelta = TI(integer) = index in myT - TopOpeBRepDS_Kind K = (TopOpeBRepDS_Kind)(TI - mydelta); + TopOpeBRepDS_Kind K = static_cast(TI - mydelta); return K; } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_connex.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_connex.cxx index a0f4b7edfb7..55ce83f19de 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_connex.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_connex.cxx @@ -123,28 +123,28 @@ Standard_EXPORT void FDSCNX_Prepare(const TopoDS_Shape& /*S1*/, } const TopOpeBRepDS_DataStructure& BDS = HDS->DS(); if (GLOBAL_elf1 == nullptr) - GLOBAL_elf1 = (NCollection_DataMap< + GLOBAL_elf1 = static_cast, - TopTools_ShapeMapHasher>*)new NCollection_DataMap*>(new NCollection_DataMap, - TopTools_ShapeMapHasher>(); + TopTools_ShapeMapHasher>()); if (GLOBAL_elf2 == nullptr) - GLOBAL_elf2 = (NCollection_DataMap< + GLOBAL_elf2 = static_cast, - TopTools_ShapeMapHasher>*)new NCollection_DataMap*>(new NCollection_DataMap, - TopTools_ShapeMapHasher>(); + TopTools_ShapeMapHasher>()); if (GLOBAL_fle == nullptr) - GLOBAL_fle = (NCollection_DataMap< + GLOBAL_fle = static_cast, - TopTools_ShapeMapHasher>*)new NCollection_DataMap*>(new NCollection_DataMap, - TopTools_ShapeMapHasher>(); + TopTools_ShapeMapHasher>()); if (GLOBAL_los == nullptr) - GLOBAL_los = (NCollection_List*)new NCollection_List(); + GLOBAL_los = static_cast*>(new NCollection_List()); GLOBAL_elf1->Clear(); GLOBAL_elf2->Clear(); GLOBAL_fle->Clear(); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_samdom.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_samdom.cxx index d2461ab820d..95e18b47b87 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_samdom.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_samdom.cxx @@ -51,26 +51,26 @@ Standard_EXPORT void FDSSDM_prepare(const occ::handle, - TopTools_ShapeMapHasher>*)new NCollection_IndexedDataMap*>(new NCollection_IndexedDataMap, - TopTools_ShapeMapHasher>(); + TopTools_ShapeMapHasher>()); } if (Gps2 == nullptr) { - Gps2 = (NCollection_IndexedDataMap< + Gps2 = static_cast, - TopTools_ShapeMapHasher>*)new NCollection_IndexedDataMap*>(new NCollection_IndexedDataMap, - TopTools_ShapeMapHasher>(); + TopTools_ShapeMapHasher>()); } // modified by NIZNHY-PKV Sun Dec 15 17:58:28 2002 f // Ghds = HDS; void* anAddr = (void*)&HDS; - Ghds = (occ::handle*)anAddr; + Ghds = static_cast*>(anAddr); // modified by NIZNHY-PKV Sun Dec 15 17:58:31 2002 t Gps1->Clear(); Gps2->Clear(); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_2d.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_2d.cxx index fe3dc1702cc..210b18b6978 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_2d.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_2d.cxx @@ -177,7 +177,7 @@ static TopOpeBRepTool_C2DF* FC2D_PNewCurveOnSurface(const TopoDS_Edge& E, const bool isf = c2df.IsFace(F); if (isf) { - pc2df = (TopOpeBRepTool_C2DF*)&c2df; + pc2df = const_cast(&c2df); break; } } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_BoxSort.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_BoxSort.cxx index a605981b95a..54cc17b84f5 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_BoxSort.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_BoxSort.cxx @@ -317,7 +317,7 @@ const Bnd_Box& TopOpeBRepTool_BoxSort::Box(const TopoDS_Shape& S) const { if (myHBT.IsNull()) { - *((MTOhbt*)&myHBT) = new TopOpeBRepTool_HBoxTool(); + *(const_cast(&myHBT)) = new TopOpeBRepTool_HBoxTool(); } if (myHBT->HasBox(S)) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx index f69e84a9808..f8b60467547 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_CLASSI.cxx @@ -431,7 +431,7 @@ bool TopOpeBRepTool_CLASSI::Classilist( if (nw <= 1) return true; - int nite = 0, nitemax = int(nw * (nw - 1) / 2); + int nite = 0, nitemax = (nw * (nw - 1) / 2); while (nite <= nitemax) { nw = lw.Extent(); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx index acad1a7c256..b7426c95418 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx @@ -188,7 +188,7 @@ static bool CheckPCurve(const occ::handle& aPC, const TopoDS_Face& if (aSurf->IsUPeriodic()) { double aPer = aSurf->UPeriod(); - int nshift = (int)((u - umin) / aPer); + int nshift = static_cast((u - umin) / aPer); if (u < umin + aPer * nshift) nshift--; umin += aPer * nshift; @@ -197,7 +197,7 @@ static bool CheckPCurve(const occ::handle& aPC, const TopoDS_Face& if (aSurf->IsVPeriodic()) { double aPer = aSurf->VPeriod(); - int nshift = (int)((v - vmin) / aPer); + int nshift = static_cast((v - vmin) / aPer); if (v < vmin + aPer * nshift) nshift--; vmin += aPer * nshift; @@ -331,8 +331,8 @@ bool TopOpeBRepTool_CurveTool::MakeCurves(const double parmi //*/ //--------------------------------------------- - int iparmin = (int)parmin; - int iparmax = (int)parmax; + int iparmin = static_cast(parmin); + int iparmax = static_cast(parmax); occ::handle HC3D(occ::down_cast(C3D)); occ::handle HPC1(occ::down_cast(PC1)); @@ -853,7 +853,7 @@ occ::handle TopOpeBRepTool_CurveTool::MakeBSpline1fromPnt( // take point index as parameter : JYL 01/AUG/94 for (i = 1; i <= nbknots; i++) - knots(i) = (double)i; + knots(i) = static_cast(i); occ::handle C = new Geom_BSplineCurve(Points, knots, mults, Degree); return C; } @@ -890,7 +890,7 @@ occ::handle TopOpeBRepTool_CurveTool::MakeBSpline1fromPnt2d( // take point index as parameter : JYL 01/AUG/94 for (i = 1; i <= nbknots; i++) - knots(i) = (double)i; + knots(i) = static_cast(i); occ::handle C = new Geom2d_BSplineCurve(Points, knots, mults, Degree); return C; } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_RegularizeW.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_RegularizeW.cxx index 91cb9a51afc..e6a6b314328 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_RegularizeW.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_RegularizeW.cxx @@ -680,7 +680,7 @@ Standard_EXPORT bool FUN_tool_ClassifW( NCollection_Map mapdone; int nOw = noldW; - int nite = 0, nitemax = int(nOw * (nOw - 1) / 2); + int nite = 0, nitemax = (nOw * (nOw - 1) / 2); while (nite <= nitemax) { nOw = lOws.Extent(); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_ShapeClassifier.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_ShapeClassifier.cxx index 4f0d1cd0d0b..9d1258a8228 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_ShapeClassifier.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_ShapeClassifier.cxx @@ -177,7 +177,7 @@ TopAbs_State TopOpeBRepTool_ShapeClassifier::StateShapeShape( ClearCurrent(); myS = S; myAvS.Nullify(); - myPAvLS = (NCollection_List*)&AvLS; + myPAvLS = const_cast*>(&AvLS); myRef = SRef; Perform(); return myState; @@ -203,7 +203,7 @@ TopAbs_State TopOpeBRepTool_ShapeClassifier::StateShapeReference( { myS = S; myAvS.Nullify(); - myPAvLS = (NCollection_List*)&AvLS; + myPAvLS = const_cast*>(&AvLS); Perform(); return myState; } diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_SolidClassifier.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_SolidClassifier.cxx index c9b59c57861..1bb861eae9c 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_SolidClassifier.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_SolidClassifier.cxx @@ -36,7 +36,7 @@ TopOpeBRepTool_SolidClassifier::~TopOpeBRepTool_SolidClassifier() for (i = 1; i <= aNb; ++i) { void* anAddr = myShapeClassifierMap(i); - BRepClass3d_SolidClassifier* pClsf = (BRepClass3d_SolidClassifier*)anAddr; + BRepClass3d_SolidClassifier* pClsf = static_cast(anAddr); delete pClsf; } myShapeClassifierMap.Clear(); @@ -55,7 +55,7 @@ void TopOpeBRepTool_SolidClassifier::LoadSolid(const TopoDS_Solid& SOL) } else { - myPClassifier = (BRepClass3d_SolidClassifier*)myShapeClassifierMap.ChangeFromKey(SOL); + myPClassifier = static_cast(myShapeClassifierMap.ChangeFromKey(SOL)); } } @@ -74,7 +74,7 @@ void TopOpeBRepTool_SolidClassifier::LoadShell(const TopoDS_Shell& SHE) } else { - myPClassifier = (BRepClass3d_SolidClassifier*)myShapeClassifierMap.ChangeFromKey(SHE); + myPClassifier = static_cast(myShapeClassifierMap.ChangeFromKey(SHE)); } } diff --git a/src/ModelingAlgorithms/TKExpress/ExprIntrp/lex.ExprIntrp.c b/src/ModelingAlgorithms/TKExpress/ExprIntrp/lex.ExprIntrp.c index 0bd3db536e7..b0e7cff2388 100644 --- a/src/ModelingAlgorithms/TKExpress/ExprIntrp/lex.ExprIntrp.c +++ b/src/ModelingAlgorithms/TKExpress/ExprIntrp/lex.ExprIntrp.c @@ -761,7 +761,7 @@ static YY_BUFFER_STATE ExprIntrp_bufstring; void ExprIntrp_start_string(const char* str) { // depending on configuration and generator, yyconst may be defined as const or empty - ExprIntrp_bufstring = ExprIntrp_scan_string((yyconst char*)str); + ExprIntrp_bufstring = ExprIntrp_scan_string(str); } void ExprIntrp_stop_string() @@ -1449,7 +1449,7 @@ static int yy_get_next_buffer (void) if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1544,7 +1544,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); diff --git a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat.cxx b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat.cxx index ffad9a1e5d6..d7e9adaa616 100644 --- a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat.cxx +++ b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat.cxx @@ -107,7 +107,7 @@ void BRepFeat::Barycenter(const TopoDS_Shape& S, gp_Pnt& B) } } - Bar.Divide((double)nbp); + Bar.Divide(static_cast(nbp)); B.SetXYZ(Bar); } @@ -190,7 +190,7 @@ double BRepFeat::ParametricBarycenter(const TopoDS_Shape& S, const occ::handle(nbp)); return parbar; } @@ -376,11 +376,11 @@ static void PutInBoundsU(double umin, double du = 0.; if (minC < umin - eps) { - du = (int((umin - minC) / period) + 1) * period; + du = (static_cast((umin - minC) / period) + 1) * period; } if (minC > umax + eps) { - du = -(int((minC - umax) / period) + 1) * period; + du = -(static_cast((minC - umax) / period) + 1) * period; } if (du != 0) { @@ -430,11 +430,11 @@ static void PutInBoundsV(double vmin, double dv = 0.; if (minC < vmin - eps) { - dv = (int((vmin - minC) / period) + 1) * period; + dv = (static_cast((vmin - minC) / period) + 1) * period; } if (minC > vmax + eps) { - dv = -(int((minC - vmax) / period) + 1) * period; + dv = -(static_cast((minC - vmax) / period) + 1) * period; } if (dv != 0) { diff --git a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_Form.cxx b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_Form.cxx index 4ac9941ce4b..d25c03f524f 100644 --- a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_Form.cxx +++ b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_Form.cxx @@ -1511,7 +1511,7 @@ void BRepFeat_Form::UpdateDescendants(const BRepAlgoAPI_BooleanOperation& aBOP, } if (!exp.More()) { - BRepAlgoAPI_BooleanOperation* pBOP = (BRepAlgoAPI_BooleanOperation*)&aBOP; + BRepAlgoAPI_BooleanOperation* pBOP = const_cast(&aBOP); const NCollection_List& aLM = pBOP->Modified(fdsc); it2.Initialize(aLM); for (; it2.More(); it2.Next()) diff --git a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_MakeCylindricalHole.cxx b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_MakeCylindricalHole.cxx index 4dd6109fab3..122f4bea752 100644 --- a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_MakeCylindricalHole.cxx +++ b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_MakeCylindricalHole.cxx @@ -712,7 +712,7 @@ void Baryc(const TopoDS_Shape& S, gp_Pnt& B) } } } - Bar.Divide((double)nbp); + Bar.Divide(static_cast(nbp)); B.SetXYZ(Bar); } diff --git a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_RibSlot.cxx b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_RibSlot.cxx index 98f63778d1c..9686fa561bc 100644 --- a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_RibSlot.cxx +++ b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_RibSlot.cxx @@ -2570,7 +2570,7 @@ void BRepFeat_RibSlot::UpdateDescendants(const BRepAlgoAPI_BooleanOperation& aBO } if (!exp.More()) { - BRepAlgoAPI_BooleanOperation* pBOP = (BRepAlgoAPI_BooleanOperation*)&aBOP; + BRepAlgoAPI_BooleanOperation* pBOP = const_cast(&aBOP); const NCollection_List& aLM = pBOP->Modified(fdsc); it2.Initialize(aLM); for (; it2.More(); it2.Next()) diff --git a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_SplitShape.cxx b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_SplitShape.cxx index 9bd647e7170..35af4f554cf 100644 --- a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_SplitShape.cxx +++ b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_SplitShape.cxx @@ -73,7 +73,7 @@ const NCollection_List& BRepFeat_SplitShape::Right() const bool BRepFeat_SplitShape::IsDeleted(const TopoDS_Shape& F) { - NCollection_List::Iterator itl(((LocOpe_Spliter*)&mySShape)->DescendantShapes(F)); + NCollection_List::Iterator itl((&mySShape)->DescendantShapes(F)); // all that to swindle the constant return (!itl.More()); // a priori impossible diff --git a/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_CSIntersector.cxx b/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_CSIntersector.cxx index 90a5ab570b1..6b8c83aadf4 100644 --- a/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_CSIntersector.cxx +++ b/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_CSIntersector.cxx @@ -59,7 +59,7 @@ void LocOpe_CSIntersector::Init(const TopoDS_Shape& S) { myDone = false; myShape = S; - delete[] (NCollection_Sequence*)myPoints; + delete[] static_cast*>(myPoints); myPoints = nullptr; myNbelem = 0; } @@ -75,9 +75,9 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence& Slin) myDone = false; myNbelem = Slin.Length(); - delete[] (NCollection_Sequence*)myPoints; + delete[] static_cast*>(myPoints); myPoints = - (NCollection_Sequence*)new NCollection_Sequence[myNbelem]; + static_cast*>(new NCollection_Sequence[myNbelem]); constexpr double binf = RealFirst(); constexpr double bsup = RealLast(); @@ -91,7 +91,7 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence& Slin) theInt.Perform(Slin(i), binf, bsup); if (theInt.IsDone()) { - AddPoints(theInt, (((NCollection_Sequence*)myPoints)[i - 1]), theface); + AddPoints(theInt, ((static_cast*>(myPoints))[i - 1]), theface); } } } @@ -109,9 +109,9 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence& Scir) myDone = false; myNbelem = Scir.Length(); - delete[] (NCollection_Sequence*)myPoints; + delete[] static_cast*>(myPoints); myPoints = - (NCollection_Sequence*)new NCollection_Sequence[myNbelem]; + static_cast*>(new NCollection_Sequence[myNbelem]); TopExp_Explorer exp(myShape, TopAbs_FACE); occ::handle HC = new GeomAdaptor_Curve(); @@ -129,7 +129,7 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence& Scir) theInt.Perform(HC, binf, bsup); if (theInt.IsDone()) { - AddPoints(theInt, (((NCollection_Sequence*)myPoints)[i - 1]), theface); + AddPoints(theInt, ((static_cast*>(myPoints))[i - 1]), theface); } } } @@ -147,9 +147,9 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence*)myPoints; + delete[] static_cast*>(myPoints); myPoints = - (NCollection_Sequence*)new NCollection_Sequence[myNbelem]; + static_cast*>(new NCollection_Sequence[myNbelem]); TopExp_Explorer exp(myShape, TopAbs_FACE); occ::handle HC = new GeomAdaptor_Curve(); @@ -169,7 +169,7 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence*)myPoints)[i - 1]), theface); + AddPoints(theInt, ((static_cast*>(myPoints))[i - 1]), theface); } } } @@ -188,7 +188,7 @@ int LocOpe_CSIntersector::NbPoints(const int I) const { throw Standard_OutOfRange(); } - return ((NCollection_Sequence*)myPoints)[I - 1].Length(); + return (static_cast*>(myPoints))[I - 1].Length(); } //================================================================================================= @@ -203,14 +203,14 @@ const LocOpe_PntFace& LocOpe_CSIntersector::Point(const int I, const int Index) { throw Standard_OutOfRange(); } - return ((NCollection_Sequence*)myPoints)[I - 1](Index); + return (static_cast*>(myPoints))[I - 1](Index); } //================================================================================================= void LocOpe_CSIntersector::Destroy() { - delete[] (NCollection_Sequence*)myPoints; + delete[] static_cast*>(myPoints); myPoints = nullptr; } @@ -231,7 +231,7 @@ bool LocOpe_CSIntersector::LocalizeAfter(const int I, { throw Standard_OutOfRange(); } - return LocAfter((((NCollection_Sequence*)myPoints)[I - 1]), + return LocAfter(((static_cast*>(myPoints))[I - 1]), From, Tol, Or, @@ -256,7 +256,7 @@ bool LocOpe_CSIntersector::LocalizeBefore(const int I, { throw Standard_OutOfRange(); } - return LocBefore(((NCollection_Sequence*)myPoints)[I - 1], + return LocBefore((static_cast*>(myPoints))[I - 1], From, Tol, Or, @@ -281,7 +281,7 @@ bool LocOpe_CSIntersector::LocalizeAfter(const int I, { throw Standard_OutOfRange(); } - return LocAfter(((NCollection_Sequence*)myPoints)[I - 1], + return LocAfter((static_cast*>(myPoints))[I - 1], FromInd, Tol, Or, @@ -306,7 +306,7 @@ bool LocOpe_CSIntersector::LocalizeBefore(const int I, { throw Standard_OutOfRange(); } - return LocBefore(((NCollection_Sequence*)myPoints)[I - 1], + return LocBefore((static_cast*>(myPoints))[I - 1], FromInd, Tol, Or, diff --git a/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_AppFuncRoot.cxx b/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_AppFuncRoot.cxx index 5e1673a1330..5f2535f18d8 100644 --- a/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_AppFuncRoot.cxx +++ b/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_AppFuncRoot.cxx @@ -96,7 +96,7 @@ bool BRepBlend_AppFuncRoot::D0(const double Param, NCollection_Array1& Weigths) { bool Ok = true; - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Ok = SearchPoint(*Func, Param, myPnt); if (Ok) @@ -120,7 +120,7 @@ bool BRepBlend_AppFuncRoot::D1(const double Param, NCollection_Array1& DWeigths) { bool Ok = true; - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Ok = SearchPoint(*Func, Param, myPnt); @@ -152,7 +152,7 @@ bool BRepBlend_AppFuncRoot::D2(const double Param, NCollection_Array1& D2Weigths) { bool Ok = true; - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Ok = SearchPoint(*Func, Param, myPnt); if (Ok) @@ -173,7 +173,7 @@ bool BRepBlend_AppFuncRoot::D2(const double Param, int BRepBlend_AppFuncRoot::Nb2dCurves() const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); int i, j, k, nbpol2d; (*Func).GetShape(i, j, k, nbpol2d); return nbpol2d; @@ -181,44 +181,44 @@ int BRepBlend_AppFuncRoot::Nb2dCurves() const void BRepBlend_AppFuncRoot::SectionShape(int& NbPoles, int& NbKnots, int& Degree) const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); int ii; (*Func).GetShape(NbPoles, NbKnots, Degree, ii); } void BRepBlend_AppFuncRoot::Knots(NCollection_Array1& TKnots) const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Func->Knots(TKnots); } void BRepBlend_AppFuncRoot::Mults(NCollection_Array1& TMults) const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Func->Mults(TMults); } bool BRepBlend_AppFuncRoot::IsRational() const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); return (*Func).IsRational(); } int BRepBlend_AppFuncRoot::NbIntervals(const GeomAbs_Shape S) const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); return Func->NbIntervals(S); } void BRepBlend_AppFuncRoot::Intervals(NCollection_Array1& T, const GeomAbs_Shape S) const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Func->Intervals(T, S); } void BRepBlend_AppFuncRoot::SetInterval(const double First, const double Last) { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Func->Set(First, Last); } @@ -227,7 +227,7 @@ void BRepBlend_AppFuncRoot::Resolution(const int Index, double& TolU, double& TolV) const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Func->Resolution(Index, Tol, TolU, TolV); } @@ -238,7 +238,7 @@ void BRepBlend_AppFuncRoot::GetTolerance(const double BoundTol, { int ii; math_Vector V3d(1, Tol3d.Length()), V1d(1, Tol3d.Length()); - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Func->GetTolerance(BoundTol, SurfTol, AngleTol, V3d, V1d); for (ii = 1; ii <= Tol3d.Length(); ii++) @@ -247,7 +247,7 @@ void BRepBlend_AppFuncRoot::GetTolerance(const double BoundTol, void BRepBlend_AppFuncRoot::SetTolerance(const double Tol3d, const double Tol2d) { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); int ii, dim = Func->NbVariables(); Func->GetTolerance(myTolerance, Tol3d); for (ii = 1; ii <= dim; ii++) @@ -267,13 +267,13 @@ gp_Pnt BRepBlend_AppFuncRoot::BarycentreOfSurf() const double BRepBlend_AppFuncRoot::MaximalSection() const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); return Func->GetSectionSize(); } void BRepBlend_AppFuncRoot::GetMinimalWeight(NCollection_Array1& Weigths) const { - Blend_AppFunction* Func = (Blend_AppFunction*)myFunc; + Blend_AppFunction* Func = static_cast(myFunc); Func->GetMinimalWeight(Weigths); } diff --git a/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_HCurve2dTool.cxx b/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_HCurve2dTool.cxx index 8d9d48a0751..b9d55b62211 100644 --- a/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_HCurve2dTool.cxx +++ b/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_HCurve2dTool.cxx @@ -46,5 +46,5 @@ int BRepBlend_HCurve2dTool::NbSamples(const occ::handle& C, } if (nbs > 50) nbs = 50; - return ((int)nbs); + return (static_cast(nbs)); } diff --git a/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_HCurveTool.cxx b/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_HCurveTool.cxx index 7f493a620a7..55bc4368c16 100644 --- a/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_HCurveTool.cxx +++ b/src/ModelingAlgorithms/TKFillet/BRepBlend/BRepBlend_HCurveTool.cxx @@ -46,5 +46,5 @@ int BRepBlend_HCurveTool::NbSamples(const occ::handle& C, } if (nbs > 50) nbs = 50; - return ((int)nbs); + return (static_cast(nbs)); } diff --git a/src/ModelingAlgorithms/TKFillet/BRepFilletAPI/BRepFilletAPI_MakeFillet.cxx b/src/ModelingAlgorithms/TKFillet/BRepFilletAPI/BRepFilletAPI_MakeFillet.cxx index d4c5c0aea44..ade3f83bdb9 100644 --- a/src/ModelingAlgorithms/TKFillet/BRepFilletAPI/BRepFilletAPI_MakeFillet.cxx +++ b/src/ModelingAlgorithms/TKFillet/BRepFilletAPI/BRepFilletAPI_MakeFillet.cxx @@ -391,7 +391,7 @@ int BRepFilletAPI_MakeFillet::NbSurfaces() const const NCollection_List& BRepFilletAPI_MakeFillet::NewFaces(const int I) { - return (*(NCollection_List*)&(myBuilder.Builder()->NewFaces(I))); + return (*const_cast*>(&(myBuilder.Builder()->NewFaces(I)))); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc.cxx b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc.cxx index 6fc49a83c4b..0c6c918acea 100644 --- a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc.cxx +++ b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc.cxx @@ -47,7 +47,7 @@ void BlendFunc::GetShape(const BlendFunc_SectionShape SShape, switch (SShape) { case BlendFunc_Rational: { - int NbSpan = (int)(std::ceil(3. * std::abs(MaxAng) / 2. / M_PI)); + int NbSpan = static_cast(std::ceil(3. * std::abs(MaxAng) / 2. / M_PI)); NbPoles = 2 * NbSpan + 1; NbKnots = NbSpan + 1; Degree = 2; @@ -184,7 +184,7 @@ bool BlendFunc::ComputeNormal(const occ::handle& Surf, const double Vmax = Surf->LastVParameter(); // szv: was FirstVParameter! CSLib::Normal(MaxOrder, DerNUV, - double(1.e-9), + (1.e-9), U, V, Umin, @@ -238,7 +238,7 @@ bool BlendFunc::ComputeDNormal(const occ::handle& Surf, const double Vmax = Surf->LastVParameter(); // szv: was FirstVParameter! CSLib::Normal(MaxOrder, DerNUV, - double(1.e-9), + (1.e-9), U, V, Umin, diff --git a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_CSCircular.cxx b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_CSCircular.cxx index 02f137837df..33e6a5d4c8f 100644 --- a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_CSCircular.cxx +++ b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_CSCircular.cxx @@ -675,7 +675,7 @@ bool BlendFunc_CSCircular::GetSection(const double Param, for (i = 2; i <= NbPoint - 1; i++) { - lambda = (double)(i - 1) / (double)(NbPoint - 1); + lambda = static_cast(i - 1) / static_cast(NbPoint - 1); Cosa = std::cos(lambda * Angle); Sina = std::sin(lambda * Angle); tabP(lowp + i - 1) diff --git a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_CSConstRad.cxx b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_CSConstRad.cxx index 975cd456f40..cb8782e46ee 100644 --- a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_CSConstRad.cxx +++ b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_CSConstRad.cxx @@ -643,7 +643,7 @@ bool BlendFunc_CSConstRad::GetSection(const double Param, for (i = 2; i <= NbPoint - 1; i++) { - lambda = (double)(i - 1) / (double)(NbPoint - 1); + lambda = static_cast(i - 1) / static_cast(NbPoint - 1); Cosa = std::cos(lambda * Angle); Sina = std::sin(lambda * Angle); tabP(lowp + i - 1) diff --git a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_ConstRad.cxx b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_ConstRad.cxx index 2847db25601..298c2eda32c 100644 --- a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_ConstRad.cxx +++ b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_ConstRad.cxx @@ -190,14 +190,14 @@ bool BlendFunc_ConstRad::ComputeValues(const math_Vector& X, case 1: { tcurv->D2(T, ptgui, d1gui, d2gui); nplan = d1gui.Normalized(); - invnormtg = ((double)1) / d1gui.Magnitude(); + invnormtg = (static_cast(1)) / d1gui.Magnitude(); dnplan.SetLinearForm(invnormtg, d2gui, -invnormtg * (nplan.Dot(d2gui)), nplan); break; } case 2: { tcurv->D3(T, ptgui, d1gui, d2gui, d3gui); nplan = d1gui.Normalized(); - invnormtg = ((double)1) / d1gui.Magnitude(); + invnormtg = (static_cast(1)) / d1gui.Magnitude(); dnplan.SetLinearForm(invnormtg, d2gui, -invnormtg * (nplan.Dot(d2gui)), nplan); dinvnormtg = -nplan.Dot(d2gui) * invnormtg * invnormtg; d2nplan.SetLinearForm(invnormtg, d3gui, dinvnormtg, d2gui); @@ -290,7 +290,7 @@ bool BlendFunc_ConstRad::ComputeValues(const math_Vector& X, invnorm2 = ncrossns2.Magnitude(); if (invnorm1 > Eps) - invnorm1 = ((double)1) / invnorm1; + invnorm1 = (static_cast(1)) / invnorm1; else { invnorm1 = 1; // Unsatisfactory, but it is not necessary to crash @@ -299,7 +299,7 @@ bool BlendFunc_ConstRad::ComputeValues(const math_Vector& X, #endif } if (invnorm2 > Eps) - invnorm2 = ((double)1) / invnorm2; + invnorm2 = (static_cast(1)) / invnorm2; else { invnorm2 = 1; // Unsatisfactory, but it is not necessary to crash diff --git a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_EvolRad.cxx b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_EvolRad.cxx index 2c91d365f52..9efb70a6d85 100644 --- a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_EvolRad.cxx +++ b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_EvolRad.cxx @@ -250,7 +250,7 @@ bool BlendFunc_EvolRad::ComputeValues(const math_Vector& X, case 1: { tcurv->D2(T, ptgui, d1gui, d2gui); nplan = d1gui.Normalized(); - invnormtg = ((double)1) / d1gui.Magnitude(); + invnormtg = (static_cast(1)) / d1gui.Magnitude(); dnplan.SetLinearForm(invnormtg, d2gui, -invnormtg * (nplan.Dot(d2gui)), nplan); tevol->D1(T, ray, dray); @@ -259,7 +259,7 @@ bool BlendFunc_EvolRad::ComputeValues(const math_Vector& X, case 2: { tcurv->D3(T, ptgui, d1gui, d2gui, d3gui); nplan = d1gui.Normalized(); - invnormtg = ((double)1) / d1gui.Magnitude(); + invnormtg = (static_cast(1)) / d1gui.Magnitude(); dnplan.SetLinearForm(invnormtg, d2gui, -invnormtg * (nplan.Dot(d2gui)), nplan); dinvnormtg = -nplan.Dot(d2gui) * invnormtg * invnormtg; d2nplan.SetLinearForm(invnormtg, d3gui, dinvnormtg, d2gui); @@ -352,7 +352,7 @@ bool BlendFunc_EvolRad::ComputeValues(const math_Vector& X, invnorm2 = ncrossns2.Magnitude(); if (invnorm1 > Eps) - invnorm1 = ((double)1) / invnorm1; + invnorm1 = (static_cast(1)) / invnorm1; else { invnorm1 = 1; // Unsatisfactory, but it is not necessary to stop @@ -361,7 +361,7 @@ bool BlendFunc_EvolRad::ComputeValues(const math_Vector& X, #endif } if (invnorm2 > Eps) - invnorm2 = ((double)1) / invnorm2; + invnorm2 = (static_cast(1)) / invnorm2; else { invnorm2 = 1; // Unsatisfactory, but it is not necessary to stop diff --git a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_Ruled.cxx b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_Ruled.cxx index 3c9571e93d6..66bae259474 100644 --- a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_Ruled.cxx +++ b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_Ruled.cxx @@ -550,7 +550,7 @@ bool BlendFunc_Ruled::GetSection(const double Param, for (i = 2; i <= NbPoint - 1; i++) { - lambda = (double)(i - 1) / (double)(NbPoint - 1); + lambda = static_cast(i - 1) / static_cast(NbPoint - 1); tabP(lowp + i - 1).SetXYZ((1. - lambda) * pts1.XYZ() + lambda * pts2.XYZ()); tabV(lowv + i - 1).SetLinearForm(1. - lambda, tg1, lambda, tg2); } diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder.cxx index e2c2e9f80c3..085b266243c 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder.cxx @@ -383,7 +383,7 @@ void ChFi3d_Builder::Compute() TopOpeBRepDS_CurveExplorer cex(DStr); for (; cex.More(); cex.Next()) { - TopOpeBRepDS_Curve& c = *((TopOpeBRepDS_Curve*)(void*)&(cex.Curve())); + TopOpeBRepDS_Curve& c = *(static_cast((void*)&(cex.Curve()))); double tolc = 0.; bool degen = c.Curve().IsNull(); if (!degen) diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_6.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_6.cxx index 6df0cb9c5d2..e6d98ca96b9 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_6.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_6.cxx @@ -616,7 +616,7 @@ bool ChFi3d_Builder::StoreData(occ::handle& Data, const NCollection_Array1& ku = approx.SurfUKnots(); const NCollection_Array1& kv = approx.SurfVKnots(); double larg = (kv(kv.Upper()) - kv(kv.Lower())); - NCollection_Array1& kku = *((NCollection_Array1*)((void*)&ku)); + NCollection_Array1& kku = *(static_cast*>((void*)&ku)); BSplCLib::Reparametrize(0., larg, kku); occ::handle Surf = new Geom_BSplineSurface(approx.SurfPoles(), approx.SurfWeights(), diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx index 7eccb116613..2dd273bf3f6 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_CnCrn.cxx @@ -316,13 +316,13 @@ static void CurveHermite(const TopOpeBRepDS_DataStructure& DStr, NCollection_Array1 Cont(1, size); PLib::HermiteCoefficients(0, 1, 1, 1, MatCoefs); double L1 = p01.Distance(p02); - double lambda = ((double)1) / std::max(d11.Magnitude() / L1, 1.e-6); + double lambda = (static_cast(1)) / std::max(d11.Magnitude() / L1, 1.e-6); Cont(1) = p01.XYZ(); if (sensicmoins == 1) Cont(2) = d11.XYZ() * (-lambda); else Cont(2) = d11.XYZ() * (lambda); - lambda = ((double)1) / std::max(d12.Magnitude() / L1, 1.e-6); + lambda = (static_cast(1)) / std::max(d12.Magnitude() / L1, 1.e-6); Cont(3) = p02.XYZ(); if (sensicplus == 1) Cont(4) = d12.XYZ() * (lambda); diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx index ccf67ecda64..0f3e018dc8f 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx @@ -549,9 +549,9 @@ static bool Tri(const Geom2dHatch_Hatcher& H, #endif return false; } - HatchGen_Domain* Dom = ((HatchGen_Domain*)(void*)&H.Domain(iH, Ind(iSansFirst))); + HatchGen_Domain* Dom = (static_cast((void*)&H.Domain(iH, Ind(iSansFirst)))); HatchGen_PointOnHatching* PH = - ((HatchGen_PointOnHatching*)(void*)&H.Domain(iH, Ind(iSansLast)).FirstPoint()); + (static_cast((void*)&H.Domain(iH, Ind(iSansLast)).FirstPoint())); double NewPar = H.HatchingCurve(iH).FirstParameter() - period + H.Domain(iH, Ind(iSansLast)).FirstPoint().Parameter(); PH->SetParameter(NewPar); diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_ChBuilder.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_ChBuilder.cxx index 0a908d9eca8..d38e31041af 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_ChBuilder.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_ChBuilder.cxx @@ -673,7 +673,7 @@ void ChFi3d_ChBuilder::SimulKPart(const occ::handle& SD) const double ang = (u2 - u1); gp_Cone Co = AS.Cone(); double rad = Co.RefRadius(), sang = Co.SemiAngle(); - int n = (int)(36. * ang / M_PI + 1); + int n = static_cast(36. * ang / M_PI + 1); if (n < 2) n = 2; sec = new NCollection_HArray1(1, n); diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_FilBuilder.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_FilBuilder.cxx index a6dfda06108..2f6ca26762b 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_FilBuilder.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_FilBuilder.cxx @@ -501,7 +501,7 @@ void ChFi3d_FilBuilder::SimulKPart(const occ::handle& SD) const double ang = (u2 - u1); gp_Torus To = AS.Torus(); double majr = To.MajorRadius(), minr = To.MinorRadius(); - int n = (int)(36. * ang / M_PI + 1); + int n = static_cast(36. * ang / M_PI + 1); if (n < 2) n = 2; sec = new NCollection_HArray1(1, n); @@ -521,7 +521,7 @@ void ChFi3d_FilBuilder::SimulKPart(const occ::handle& SD) const double ang = (u2 - u1); gp_Sphere Sp = AS.Sphere(); double rad = Sp.Radius(); - int n = (int)(36. * ang / M_PI + 1); + int n = static_cast(36. * ang / M_PI + 1); if (n < 2) n = 2; sec = new NCollection_HArray1(1, n); diff --git a/src/ModelingAlgorithms/TKFillet/ChFiDS/ChFiDS_Spine.cxx b/src/ModelingAlgorithms/TKFillet/ChFiDS/ChFiDS_Spine.cxx index e2809667d78..790c8fd8d55 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFiDS/ChFiDS_Spine.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFiDS/ChFiDS_Spine.cxx @@ -501,8 +501,8 @@ double ChFiDS_Spine::Absc(const double U, const int I) if (indexofcurve != I) { void* p = (void*)this; - ((ChFiDS_Spine*)p)->indexofcurve = I; - ((ChFiDS_Spine*)p)->myCurve.Initialize(TopoDS::Edge(spine.Value(I))); + (static_cast(p))->indexofcurve = I; + (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(I))); } double L = FirstParameter(I); if (spine.Value(I).Orientation() == TopAbs_REVERSED) @@ -537,8 +537,8 @@ void ChFiDS_Spine::Parameter(const int Index, const double AbsC, double& U, cons if (Index != indexofcurve) { void* p = (void*)this; - ((ChFiDS_Spine*)p)->indexofcurve = Index; - ((ChFiDS_Spine*)p)->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); + (static_cast(p))->indexofcurve = Index; + (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); } double L; TopAbs_Orientation Or = spine.Value(Index).Orientation(); @@ -671,8 +671,8 @@ gp_Pnt ChFiDS_Spine::Value(const double AbsC) if (Index != indexofcurve) { void* p = (void*)this; - ((ChFiDS_Spine*)p)->indexofcurve = Index; - ((ChFiDS_Spine*)p)->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); + (static_cast(p))->indexofcurve = Index; + (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); } double t = L / Length(Index); double uapp = (1. - t) * myCurve.FirstParameter() + t * myCurve.LastParameter(); @@ -719,8 +719,8 @@ void ChFiDS_Spine::D1(const double AbsC, gp_Pnt& P, gp_Vec& V1) if (Index != indexofcurve) { void* p = (void*)this; - ((ChFiDS_Spine*)p)->indexofcurve = Index; - ((ChFiDS_Spine*)p)->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); + (static_cast(p))->indexofcurve = Index; + (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); } double t = L / Length(Index); double uapp = (1. - t) * myCurve.FirstParameter() + t * myCurve.LastParameter(); @@ -768,8 +768,8 @@ void ChFiDS_Spine::D2(const double AbsC, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) if (Index != indexofcurve) { void* p = (void*)this; - ((ChFiDS_Spine*)p)->indexofcurve = Index; - ((ChFiDS_Spine*)p)->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); + (static_cast(p))->indexofcurve = Index; + (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); } double t = L / Length(Index); double uapp = (1. - t) * myCurve.FirstParameter() + t * myCurve.LastParameter(); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx b/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx index 65671e15f39..220ce2e0fd3 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx @@ -156,7 +156,7 @@ void ApproxInt_Approx::Parameters(const ApproxInt_TheMultiLine& Line, { for (i = firstP; i <= lastP; i++) { - TheParameters(i) = (double(i) - firstP) / (double(lastP) - double(firstP)); + TheParameters(i) = (static_cast(i) - firstP) / (static_cast(lastP) - static_cast(firstP)); } } } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_MultiLine.gxx b/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_MultiLine.gxx index e391ba8bca6..0906bb2e3a2 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_MultiLine.gxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_MultiLine.gxx @@ -230,7 +230,7 @@ bool ApproxInt_MultiLine::Tangency(const int Index, NCollection_Array1& double u1 = 0.0, u2 = 0.0, v1 = 0.0, v2 = 0.0; POn2S.Parameters(u1, v1, u2, v2); - bool ret = ((TheSvSurfaces*)PtrOnmySvSurfaces)->Tangency(u1, v1, u2, v2, TabVec(1)); + bool ret = (static_cast(PtrOnmySvSurfaces))->Tangency(u1, v1, u2, v2, TabVec(1)); if (!ret) { TabVec(1).SetCoord(0.0, 0.0, 0.0); @@ -255,23 +255,23 @@ bool ApproxInt_MultiLine::Tangency(const int Index, NCollection_Array1 { if (p2donfirst) { - ret = ((TheSvSurfaces*)PtrOnmySvSurfaces)->TangencyOnSurf1(u1, v1, u2, v2, TabVec2d(1)); + ret = (static_cast(PtrOnmySvSurfaces))->TangencyOnSurf1(u1, v1, u2, v2, TabVec2d(1)); } else { - ret = ((TheSvSurfaces*)PtrOnmySvSurfaces)->TangencyOnSurf2(u1, v1, u2, v2, TabVec2d(1)); + ret = (static_cast(PtrOnmySvSurfaces))->TangencyOnSurf2(u1, v1, u2, v2, TabVec2d(1)); } } else { - ret = ((TheSvSurfaces*)PtrOnmySvSurfaces)->TangencyOnSurf1(u1, v1, u2, v2, TabVec2d(1)); + ret = (static_cast(PtrOnmySvSurfaces))->TangencyOnSurf1(u1, v1, u2, v2, TabVec2d(1)); if (ret) { if (TabVec2d.Length() >= 2) { ret = (ret - && ((TheSvSurfaces*)PtrOnmySvSurfaces)->TangencyOnSurf2(u1, v1, u2, v2, TabVec2d(2))); + && (static_cast(PtrOnmySvSurfaces))->TangencyOnSurf2(u1, v1, u2, v2, TabVec2d(2))); } } } @@ -327,10 +327,10 @@ ApproxInt_MultiLine ApproxInt_MultiLine::MakeMLBetween(const int Low, //-- return(*this); } - bool aSaveUseSolver = ((TheSvSurfaces*)PtrOnmySvSurfaces)->GetUseSolver(); + bool aSaveUseSolver = (static_cast(PtrOnmySvSurfaces))->GetUseSolver(); if (!aSaveUseSolver) { - ((TheSvSurfaces*)PtrOnmySvSurfaces)->SetUseSolver(true); + (static_cast(PtrOnmySvSurfaces))->SetUseSolver(true); } int NbPntsToInsert = aNbPntsToInsert; if (NbPntsToInsert < (High - Low)) @@ -458,7 +458,7 @@ ApproxInt_MultiLine ApproxInt_MultiLine::MakeMLBetween(const int Low, u2 = (U2(Indice) * b + U2(Indice + 1) * a) * nab; v2 = (V2(Indice) * b + V2(Indice + 1) * a) * nab; - if (((TheSvSurfaces*)PtrOnmySvSurfaces)->Compute(u1, v1, u2, v2, P, T, TS1, TS2)) + if ((static_cast(PtrOnmySvSurfaces))->Compute(u1, v1, u2, v2, P, T, TS1, TS2)) { StartPOn2S.SetValue(P, u1, v1, u2, v2); //-- cout<<" Insertion du point calcule : "<NbPnts() >= NbPntsToInsert + High - Low + 1) && (CodeErreur == 0)) { - ((TheSvSurfaces*)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver); + (static_cast(PtrOnmySvSurfaces))->SetUseSolver(aSaveUseSolver); return (ApproxInt_MultiLine(temp, (High - Low > 10) ? PtrOnmySvSurfaces : NULL, nbp3d, @@ -604,7 +604,7 @@ ApproxInt_MultiLine ApproxInt_MultiLine::MakeMLBetween(const int Low, { //-- cout<<" ApproxInt_MultiLine "<()); + printf("*OnS1* par=%+10.20f arc1=%10p", prm1, (void*)arcS1.operator->()); if (vtxonS1) printf(" *Vtx1* vtx1=%10p", (void*)vS1.operator->()); if (onS1 || vtxonS1) printf("\n"); if (onS2) - printf("*OnS2* par=%+10.20f arc2=%10p", (double)prm2, (void*)arcS2.operator->()); + printf("*OnS2* par=%+10.20f arc2=%10p", prm2, (void*)arcS2.operator->()); if (vtxonS2) printf(" *Vtx2* vtx2=%10p", (void*)vS2.operator->()); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_Polyhedron.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_Polyhedron.cxx index 7deb8f51b7e..84df707e7d0 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_Polyhedron.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_Polyhedron.cxx @@ -56,11 +56,11 @@ static int NbPOnV(const occ::handle& S) void IntPatch_Polyhedron::Destroy() { - gp_Pnt* CMyPnts = (gp_Pnt*)C_MyPnts; + gp_Pnt* CMyPnts = static_cast(C_MyPnts); delete[] CMyPnts; - double* CMyU = (double*)C_MyU; + double* CMyU = static_cast(C_MyU); delete[] CMyU; - double* CMyV = (double*)C_MyV; + double* CMyV = static_cast(C_MyV); delete[] CMyV; C_MyPnts = C_MyU = C_MyV = nullptr; } @@ -95,8 +95,8 @@ IntPatch_Polyhedron::IntPatch_Polyhedron(const occ::handle& S // Build UV parameter arrays NCollection_Array1 aUParams(0, nbdeltaU); NCollection_Array1 aVParams(0, nbdeltaV); - const double U1mU0sNbdeltaU = (u1 - u0) / (double)nbdeltaU; - const double V1mV0sNbdeltaV = (v1 - v0) / (double)nbdeltaV; + const double U1mU0sNbdeltaU = (u1 - u0) / static_cast(nbdeltaU); + const double V1mV0sNbdeltaV = (v1 - v0) / static_cast(nbdeltaV); for (int i = 0; i <= nbdeltaU; ++i) { @@ -165,8 +165,8 @@ IntPatch_Polyhedron::IntPatch_Polyhedron(const occ::handle& S // Build UV parameter arrays NCollection_Array1 aUParams(0, nbdeltaU); NCollection_Array1 aVParams(0, nbdeltaV); - const double U1mU0sNbdeltaU = (u1 - u0) / (double)nbdeltaU; - const double V1mV0sNbdeltaV = (v1 - v0) / (double)nbdeltaV; + const double U1mU0sNbdeltaU = (u1 - u0) / static_cast(nbdeltaU); + const double V1mV0sNbdeltaV = (v1 - v0) / static_cast(nbdeltaV); for (int i = 0; i <= nbdeltaU; ++i) { @@ -207,8 +207,8 @@ IntPatch_Polyhedron::IntPatch_Polyhedron(const occ::handle& S void IntPatch_Polyhedron::Parameters(const int Index, double& U, double& V) const { - U = ((double*)C_MyU)[Index]; - V = ((double*)C_MyV)[Index]; + U = (static_cast(C_MyU))[Index]; + V = (static_cast(C_MyV))[Index]; } //================================================================================================= @@ -657,9 +657,9 @@ void IntPatch_Polyhedron::Triangle(const int Index, int& P1, int& P2, int& P3) c //======================================================================= const gp_Pnt& IntPatch_Polyhedron::Point(const int Index, double& U, double& V) const { - gp_Pnt* CMyPnts = (gp_Pnt*)C_MyPnts; - double* CMyU = (double*)C_MyU; - double* CMyV = (double*)C_MyV; + gp_Pnt* CMyPnts = static_cast(C_MyPnts); + double* CMyU = static_cast(C_MyU); + double* CMyV = static_cast(C_MyV); U = CMyU[Index]; V = CMyV[Index]; return CMyPnts[Index]; @@ -670,7 +670,7 @@ const gp_Pnt& IntPatch_Polyhedron::Point(const int Index, double& U, double& V) //======================================================================= const gp_Pnt& IntPatch_Polyhedron::Point(const int Index) const { - gp_Pnt* CMyPnts = (gp_Pnt*)C_MyPnts; + gp_Pnt* CMyPnts = static_cast(C_MyPnts); return CMyPnts[Index]; } @@ -691,7 +691,7 @@ void IntPatch_Polyhedron::Point(const gp_Pnt& /*p*/, //======================================================================= void IntPatch_Polyhedron::Point(const int Index, gp_Pnt& P) const { - gp_Pnt* CMyPnts = (gp_Pnt*)C_MyPnts; + gp_Pnt* CMyPnts = static_cast(C_MyPnts); P = CMyPnts[Index]; } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection.cxx index b894a32e121..117f81a74ab 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection.cxx @@ -134,8 +134,8 @@ static void SeveralWlinesProcessing(const occ::handle& theSur { const occ::handle& aSLine = theSLin.Value(WLDMin); const occ::handle aWLine = occ::down_cast(aSLine); - int tiVpar = (int)aWLine->Vertex(VDMin).ParameterOnLine(); - int ciVpar = (int)theWLline->Vertex(ciV).ParameterOnLine(); + int tiVpar = static_cast(aWLine->Vertex(VDMin).ParameterOnLine()); + int ciVpar = static_cast(theWLline->Vertex(ciV).ParameterOnLine()); double u11 = 0., u12 = 0., v11 = 0., v12 = 0.; double u21 = 0., u22 = 0., v21 = 0., v22 = 0.; theWLline->Point(ciVpar).Parameters(u11, v11, u12, v12); @@ -150,7 +150,7 @@ static void SeveralWlinesProcessing(const occ::handle& theSur for (iPo = 1; iPo <= cnbV; iPo++) { double Po = theWLline->Vertex(iPo).ParameterOnLine(); - int IPo = (int)Po; + int IPo = static_cast(Po); VPold.Append(IPo); } @@ -3227,12 +3227,12 @@ class IntPatch_InfoPD //---------------------------------------- D-tor ~IntPatch_InfoPD() { - delete[] (char*)myP1DS2; - delete[] (char*)myP2DS1; - delete[] (int*)myIP1; - delete[] (int*)myIP2; - delete[] (gp_Pnt*)myP1; - delete[] (gp_Pnt*)myP2; + delete[] myP1DS2; + delete[] myP2DS1; + delete[] myIP1; + delete[] myIP2; + delete[] myP1; + delete[] myP2; }; //---------------------------------------- Index @@ -3472,14 +3472,14 @@ void IntPatch_PrmPrmIntersection::PointDepart(occ::handle& { aIPD.xIP1(i, j) = -1; const gp_Pnt& P = aIPD.xP1(i, j); - aIPD.xP1DS2(i, j) = (char)CodeReject(x20, y20, z20, x21, y21, z21, P.X(), P.Y(), P.Z()); - int ix = (int)((P.X() - x0 + dx2) / dx); + aIPD.xP1DS2(i, j) = static_cast(CodeReject(x20, y20, z20, x21, y21, z21, P.X(), P.Y(), P.Z())); + int ix = static_cast((P.X() - x0 + dx2) / dx); if (DansGrille(ix)) { - int iy = (int)((P.Y() - y0 + dy2) / dy); + int iy = static_cast((P.Y() - y0 + dy2) / dy); if (DansGrille(iy)) { - int iz = (int)((P.Z() - z0 + dz2) / dz); + int iz = static_cast((P.Z() - z0 + dz2) / dz); if (DansGrille(iz)) { aIPD.xIP1(i, j) = GrilleInteger(ix, iy, iz); @@ -3495,14 +3495,14 @@ void IntPatch_PrmPrmIntersection::PointDepart(occ::handle& { aIPD.xIP2(i, j) = -1; const gp_Pnt& P = aIPD.xP2(i, j); - aIPD.xP2DS1(i, j) = (char)CodeReject(x10, y10, z10, x11, y11, z11, P.X(), P.Y(), P.Z()); - int ix = (int)((P.X() - x0 + dx2) / dx); + aIPD.xP2DS1(i, j) = static_cast(CodeReject(x10, y10, z10, x11, y11, z11, P.X(), P.Y(), P.Z())); + int ix = static_cast((P.X() - x0 + dx2) / dx); if (DansGrille(ix)) { - int iy = (int)((P.Y() - y0 + dy2) / dy); + int iy = static_cast((P.Y() - y0 + dy2) / dy); if (DansGrille(iy)) { - int iz = (int)((P.Z() - z0 + dz2) / dz); + int iz = static_cast((P.Z() - z0 + dz2) / dz); if (DansGrille(iz)) { aIPD.xIP2(i, j) = GrilleInteger(ix, iy, iz); @@ -3608,7 +3608,7 @@ void IntPatch_PrmPrmIntersection::PointDepart(occ::handle& { for (nv = 0; nu1 < 0 && nv < SV1; nv++) { - if (aIPD.xIP1(nu, nv) == (int)newind) + if (aIPD.xIP1(nu, nv) == newind) { aIPD.xIP1(nu, nv) = indicepointtraite; nu1 = nu; @@ -3622,7 +3622,7 @@ void IntPatch_PrmPrmIntersection::PointDepart(occ::handle& { for (nv = 0; nu2 < 0 && nv < SV2; nv++) { - if (aIPD.xIP2(nu, nv) == (int)newind) + if (aIPD.xIP2(nu, nv) == newind) { aIPD.xIP2(nu, nv) = indicepointtraite; nu2 = nu; diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.hxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.hxx index 58a879545a1..53aa140cd01 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.hxx @@ -30,11 +30,11 @@ public: Standard_EXPORT ~IntPatch_PrmPrmIntersection_T3Bits(); - void Add(const int t) { p[t >> 5] |= (1 << (((unsigned int)t) & 31)); } + void Add(const int t) { p[t >> 5] |= (1 << ((static_cast(t)) & 31)); } - int Val(const int t) const { return (p[t >> 5] & (1 << (((unsigned int)t) & 31))); } + int Val(const int t) const { return (p[t >> 5] & (1 << ((static_cast(t)) & 31))); } - void Raz(const int t) { p[t >> 5] &= ~(1 << (((unsigned int)t) & 31)); } + void Raz(const int t) { p[t >> 5] &= ~(1 << ((static_cast(t)) & 31)); } Standard_EXPORT void ResetAnd(); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_RstInt.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_RstInt.cxx index 4071f7531d5..c8693b4e228 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_RstInt.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_RstInt.cxx @@ -209,7 +209,7 @@ static void GetLinePoint2d(const occ::handle& L, int Nbptlin = (typL == IntPatch_Walking ? wlin->NbPnts() : rlin->NbPnts()); double par = std::trunc(param); - int Irang = int(par); + int Irang = static_cast(par); if (Irang == Nbptlin) { Irang--; @@ -367,7 +367,7 @@ static bool FindParameter(const occ::handle& L, norm2 = v2.SquareMagnitude(); if (v1.Dot(v2) < 0.) { - Param = (double)(i - 1) + 1. / (1. + std::sqrt(norm2 / norm1)); + Param = static_cast(i - 1) + 1. / (1. + std::sqrt(norm2 / norm1)); Tgl = gp_Vec(p1, p2); found = true; } @@ -382,7 +382,7 @@ static bool FindParameter(const occ::handle& L, } if (!found && ibest) { - Param = (double)ibest; + Param = static_cast(ibest); found = true; } } @@ -593,7 +593,7 @@ void IntPatch_RstInt::PutVertexOnLine(const occ::handle& L, // arc->FirstParameter())/(PLast-PFirst); const double nbs = (arc->NbKnots() * arc->Degree()) * (PLast - PFirst) / (arc->LastParameter() - arc->FirstParameter()); - NbEchant = (nbs < 2.0 ? 2 : (int)nbs); + NbEchant = (nbs < 2.0 ? 2 : static_cast(nbs)); if (NbEchant < 10) NbEchant = 10; else if (NbEchant > 50) @@ -672,7 +672,7 @@ void IntPatch_RstInt::PutVertexOnLine(const occ::handle& L, GetLinePoint2d(L, aW1 + 1, !OnFirst, U, V); double par = std::trunc(aW2); - int Irang = int(par) + 1; + int Irang = static_cast(par) + 1; if (Irang == Brise.NbPoints()) { Irang--; @@ -736,7 +736,7 @@ void IntPatch_RstInt::PutVertexOnLine(const occ::handle& L, if (!duplicate) { - int ParamApproxOnLine = int(aW1) + 1; + int ParamApproxOnLine = static_cast(aW1) + 1; arc->D1(paramarc, p2d, d2d); U1 = p2d.X(); @@ -876,7 +876,7 @@ void IntPatch_RstInt::PutVertexOnLine(const occ::handle& L, } if (typL == IntPatch_Walking) - VerifyTgline(wlin, (int)paramline, edgeTol, tgline); + VerifyTgline(wlin, static_cast(paramline), edgeTol, tgline); Surf->D1(U1, V1, ptbid, d1u, d1v); tgrst.SetLinearForm(d2d.X(), d1u, d2d.Y(), d1v); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_WLine.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_WLine.cxx index 286a1e90522..d369cbbead7 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_WLine.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_WLine.cxx @@ -625,7 +625,7 @@ void IntPatch_WLine::ComputeVertexParameters(const double RTol) double vTol = svtx.Value(i).Tolerance(); indicevertex = svtx.Value(i).ParameterOnLine(); - indicevertexonline = (int)indicevertex; + indicevertexonline = static_cast(indicevertex); //-------------------------------------------------- //-- On Compare le vertex avec les points de la ligne //-- d indice indicevertexOnLine-1 @@ -810,7 +810,7 @@ void IntPatch_WLine::ComputeVertexParameters(const double RTol) if (j != i) { double t = svtx.Value(j).ParameterOnLine(); - if (t > (double)indicevertexonline) + if (t > static_cast(indicevertexonline)) { svtx.ChangeValue(j).SetParameter(t + 1.0); } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_WLineTool.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_WLineTool.cxx index e4d6e53c432..4de2ab0f40f 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_WLineTool.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_WLineTool.cxx @@ -82,7 +82,7 @@ static void FillPointsHash(const occ::handle& theWLine, for (v = 1; v <= theWLine->NbVertex(); v++) { IntPatch_Point aVertex = theWLine->Vertex(v); - int avertexindex = (int)aVertex.ParameterOnLine(); + int avertexindex = static_cast(aVertex.ParameterOnLine()); thePointsHash.SetValue(avertexindex, -1); } } @@ -579,7 +579,7 @@ static occ::handle DeleteByTube(const occ::handleNbPnts() / 9); + int aHashIdx = (anIdx * theWLine->NbPnts() / 9); // Vertex must be stored as VERTEX (HASH = -1) if (aNewPointsHash(aHashIdx) != -1) @@ -1455,7 +1455,7 @@ occ::handle IntPatch_WLineTool::ComputePurgedWLine( for (v = 1; v <= aTmpWLine->NbVertex(); v++) { IntPatch_Point aVertex = aTmpWLine->Vertex(v); - int avertexindex = (int)aVertex.ParameterOnLine(); + int avertexindex = static_cast(aVertex.ParameterOnLine()); if (avertexindex >= k) { @@ -1751,7 +1751,7 @@ static bool IsNeedSkipWL(const occ::handle& theWL, aLastp = theWL->Vertex(i + 1).ParameterOnLine(); double aU1, aV1, aU2, aV2; - const int pmid = (int)((aFirstp + aLastp) / 2); + const int pmid = static_cast((aFirstp + aLastp) / 2); const IntSurf_PntOn2S& aPmid = theWL->Point(pmid); aPmid.Parameters(aU1, aV1, aU2, aV2); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPolyh/IntPolyh_MaillageAffinage.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPolyh/IntPolyh_MaillageAffinage.cxx index 6745e2eea2a..9b473d7b62a 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPolyh/IntPolyh_MaillageAffinage.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPolyh/IntPolyh_MaillageAffinage.cxx @@ -1250,7 +1250,7 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() y0 -= y1; z0 -= z1; diag1 = x0 * x0 + y0 * y0 + z0 * z0; - const double NbSamplesUV1 = double(NbSamplesU1) * double(NbSamplesV1); + const double NbSamplesUV1 = static_cast(NbSamplesU1) * static_cast(NbSamplesV1); diag1 /= NbSamplesUV1; MyBox2.Get(x0, y0, z0, x1, y1, z1); @@ -1258,7 +1258,7 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() y0 -= y1; z0 -= z1; diag2 = x0 * x0 + y0 * y0 + z0 * z0; - const double NbSamplesUV2 = double(NbSamplesU2) * double(NbSamplesV2); + const double NbSamplesUV2 = static_cast(NbSamplesU2) * static_cast(NbSamplesV2); diag2 /= NbSamplesUV2; // The surface with the greatest bounding box is "discretized" diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPolyh/IntPolyh_Tools.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPolyh/IntPolyh_Tools.cxx index 20bf69cb14b..b694861f98c 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPolyh/IntPolyh_Tools.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPolyh/IntPolyh_Tools.cxx @@ -110,9 +110,9 @@ void IntPolyh_Tools::MakeSampling(const occ::handle& theSurf, int aNbSamplesV1 = theNbSV - 1; // U step - double dU = (u1 - u0) / double(aNbSamplesU1); + double dU = (u1 - u0) / static_cast(aNbSamplesU1); // V step - double dV = (v1 - v0) / double(aNbSamplesV1); + double dV = (v1 - v0) / static_cast(aNbSamplesV1); // Fill arrays for (int i = 0; i < theNbSU; ++i) diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntStart/IntStart_SearchInside.gxx b/src/ModelingAlgorithms/TKGeomAlgo/IntStart/IntStart_SearchInside.gxx index 547d8fcfc83..024f9a17b48 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntStart/IntStart_SearchInside.gxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntStart/IntStart_SearchInside.gxx @@ -65,8 +65,8 @@ void IntStart_SearchInside::Perform(TheFunction& Func, double du = Bsup(1) - Binf(1); double dv = Bsup(2) - Binf(2); - du /= (double)NbsampleU * 0.5; - dv /= (double)NbsampleV * 0.5; + du /= static_cast(NbsampleU) * 0.5; + dv /= static_cast(NbsampleV) * 0.5; double toler1 = toler(1) = ThePSurfaceTool::UResolution(PS, Precision::Confusion()); double toler2 = toler(2) = ThePSurfaceTool::VResolution(PS, Precision::Confusion()); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntStart/IntStart_SearchOnBoundaries.gxx b/src/ModelingAlgorithms/TKGeomAlgo/IntStart/IntStart_SearchOnBoundaries.gxx index a6bc1066703..0465dfcf025 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntStart/IntStart_SearchOnBoundaries.gxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntStart/IntStart_SearchOnBoundaries.gxx @@ -1010,7 +1010,7 @@ bool IsRegularity(const TheArc& /*A*/, const occ::handle& aDomain) return false; } - TopoDS_Edge* anE = (TopoDS_Edge*)anEAddress; + TopoDS_Edge* anE = static_cast(anEAddress); return (BRep_Tool::HasContinuity(*anE)); } @@ -1031,7 +1031,7 @@ int TreatLC(const TheArc& A, return anExitCode; } - TopoDS_Edge* anE = (TopoDS_Edge*)anEAddress; + TopoDS_Edge* anE = static_cast(anEAddress); if (BRep_Tool::Degenerated(*anE)) { diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntWalk/IntWalk_IWalking.gxx b/src/ModelingAlgorithms/TKGeomAlgo/IntWalk/IntWalk_IWalking.gxx index 595778a775e..63702786183 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntWalk/IntWalk_IWalking.gxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntWalk/IntWalk_IWalking.gxx @@ -708,7 +708,7 @@ bool IntWalk_IWalking::TestArretPassage(const NCollection_Sequence& Umul if (((Dup * UV1mUtest + Dvp * UV2mVtest) < 0) || (std::abs(UV1mUtest) < tolu && std::abs(UV2mVtest) < tolv)) { - i_candidates.Append((int)i); + i_candidates.Append(static_cast(i)); SqDist_candidates.Append(Dup * Dup + Dvp * Dvp); /* Irang=i; @@ -729,7 +729,7 @@ bool IntWalk_IWalking::TestArretPassage(const NCollection_Sequence& Umul if (((Up - Umult(j)) * (UV(1) - Umult(j)) + (Vp - Vmult(j)) * (UV(2) - Vmult(j)) < 0) || (std::abs(UV(1) - Umult(j)) < tolu && std::abs(UV(2) - Vmult(j)) < tolv)) { - Irang = (int)i; + Irang = static_cast(i); Arrive = true; UV(1) = Utest; UV(2) = Vtest; @@ -830,7 +830,7 @@ bool IntWalk_IWalking::TestArretPassage(const NCollection_Sequence& Umul double tolv2 = tolv + tolv; double dPreviousCurrent = (Up - UV1) * (Up - UV1) + (Vp - UV2) * (Vp - UV2); - for (k = 1; k < (int)wd2.size(); k++) + for (k = 1; k < static_cast(wd2.size()); k++) { if (wd2[k].etat > 0) { @@ -919,7 +919,7 @@ bool IntWalk_IWalking::TestArretPassage(const NCollection_Sequence& Umul // crossing test on crossing points. Irang = 0; - for (i = 1; i < (int)wd1.size(); i++) + for (i = 1; i < static_cast(wd1.size()); i++) { if (wd1[i].etat > 0 && wd1[i].etat < 11) { // test of crossing points @@ -1191,7 +1191,7 @@ void IntWalk_IWalking::TestArretCadre(const NCollection_Sequence& Umul bool Found = false; Irang = 0; - for (int i = 1; i < (int)wd1.size(); i++) + for (int i = 1; i < static_cast(wd1.size()); i++) { if (wd1[i].etat < 0) { @@ -1930,7 +1930,7 @@ static bool TestPassedSolutionWithNegativeState(const IntWalk_VectorOfWalkingDat double tolu = tolerance(1); double tolv = tolerance(2); int i, j, k, N; - for (i = 1; i < (int)wd.size(); i++) + for (i = 1; i < static_cast(wd.size()); i++) { if (wd[i].etat < -11) { diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntWalk/IntWalk_PWalking.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntWalk/IntWalk_PWalking.cxx index 9dd63c97a81..76f39343712 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntWalk/IntWalk_PWalking.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntWalk/IntWalk_PWalking.cxx @@ -863,7 +863,7 @@ void IntWalk_PWalking::Perform(const NCollection_Array1& ParDep, dP3 = sensCheminement * pasuv[2] * previousd2.X() / f; dP4 = sensCheminement * pasuv[3] * previousd2.Y() / f; // - aIncKey = 5. * (double)IncKey; + aIncKey = 5. * static_cast(IncKey); aEps = 1.e-7; if (ChoixIso == IntImp_UIsoparametricOnCaro1 && std::abs(dP1) < aEps) { @@ -1835,13 +1835,13 @@ bool IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsoparametric th double dP4 = sensCheminement * pasuv[3] * previousd2.Y() / f; if (theChoixIso == IntImp_UIsoparametricOnCaro1 && std::abs(dP1) < 1.e-7) - dP1 *= (5. * (double)dIncKey); + dP1 *= (5. * static_cast(dIncKey)); if (theChoixIso == IntImp_VIsoparametricOnCaro1 && std::abs(dP2) < 1.e-7) - dP2 *= (5. * (double)dIncKey); + dP2 *= (5. * static_cast(dIncKey)); if (theChoixIso == IntImp_UIsoparametricOnCaro2 && std::abs(dP3) < 1.e-7) - dP3 *= (5. * (double)dIncKey); + dP3 *= (5. * static_cast(dIncKey)); if (theChoixIso == IntImp_VIsoparametricOnCaro2 && std::abs(dP4) < 1.e-7) - dP4 *= (5. * (double)dIncKey); + dP4 *= (5. * static_cast(dIncKey)); Param(1) += dP1; Param(2) += dP2; diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Intf/Intf_TangentZone.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Intf/Intf_TangentZone.cxx index 3ca14a56c2e..74480c49d95 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Intf/Intf_TangentZone.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Intf/Intf_TangentZone.cxx @@ -235,10 +235,10 @@ bool Intf_TangentZone::Contains(const Intf_SectionPoint& ThePI) const void Intf_TangentZone::InfoFirst(int& segMin, double& paraMin, int& segMax, double& paraMax) const { ParamOnFirst(paraMin, paraMax); - segMin = (int)(std::trunc(paraMin)); - paraMin = paraMin - (double)segMin; - segMax = (int)(std::trunc(paraMax)); - paraMax = paraMax - (double)segMax; + segMin = static_cast(std::trunc(paraMin)); + paraMin = paraMin - static_cast(segMin); + segMax = static_cast(std::trunc(paraMax)); + paraMax = paraMax - static_cast(segMax); } //================================================================================================= @@ -246,10 +246,10 @@ void Intf_TangentZone::InfoFirst(int& segMin, double& paraMin, int& segMax, doub void Intf_TangentZone::InfoSecond(int& segMin, double& paraMin, int& segMax, double& paraMax) const { ParamOnSecond(paraMin, paraMax); - segMin = (int)(std::trunc(paraMin)); - paraMin = paraMin - (double)segMin; - segMax = (int)(std::trunc(paraMax)); - paraMax = paraMax - (double)segMax; + segMin = static_cast(std::trunc(paraMin)); + paraMin = paraMin - static_cast(segMin); + segMax = static_cast(std::trunc(paraMax)); + paraMax = paraMax - static_cast(segMax); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Intf/Intf_Tool.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Intf/Intf_Tool.cxx index de3832b918c..1a68cb84353 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Intf/Intf_Tool.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Intf/Intf_Tool.cxx @@ -272,13 +272,13 @@ void Intf_Tool::Hypr2dBox(const gp_Hypr2d& theHypr2d, const Bnd_Box2d& domain, B if (beginOnCurve[nbSeg - 1] < -10.) ipmin = -10; else - ipmin = (int)(beginOnCurve[nbSeg - 1]); + ipmin = static_cast(beginOnCurve[nbSeg - 1]); int ipmax; if (endOnCurve[nbSeg - 1] > 10.) ipmax = 10; else - ipmax = (int)(endOnCurve[nbSeg - 1]); + ipmax = static_cast(endOnCurve[nbSeg - 1]); // int ipmin=Max((int)(beginOnCurve[nbSeg-1]), // -10); @@ -289,7 +289,7 @@ void Intf_Tool::Hypr2dBox(const gp_Hypr2d& theHypr2d, const Bnd_Box2d& domain, B int ip, pas = 1; for (ip = ipmin; ip <= ipmax; ip += pas) { - boxHypr2d.Add(ElCLib::Value(double(ip) / 10., theHypr2d)); + boxHypr2d.Add(ElCLib::Value(static_cast(ip) / 10., theHypr2d)); if (std::abs(ip) <= 10) pas = 1; else @@ -521,13 +521,13 @@ void Intf_Tool::Parab2dBox(const gp_Parab2d& theParab2d, if (beginOnCurve[nbSeg - 1] < -10.) ipmin = -10; else - ipmin = (int)(beginOnCurve[nbSeg - 1]); + ipmin = static_cast(beginOnCurve[nbSeg - 1]); int ipmax; if (endOnCurve[nbSeg - 1] > 10.) ipmax = 10; else - ipmax = (int)(endOnCurve[nbSeg - 1]); + ipmax = static_cast(endOnCurve[nbSeg - 1]); // int ipmin=Max((int)(beginOnCurve[nbSeg-1]), // -10); @@ -538,7 +538,7 @@ void Intf_Tool::Parab2dBox(const gp_Parab2d& theParab2d, int ip, pas = 1; for (ip = ipmin; ip <= ipmax; ip += pas) { - boxParab2d.Add(ElCLib::Value(double(ip) / 10., theParab2d)); + boxParab2d.Add(ElCLib::Value(static_cast(ip) / 10., theParab2d)); if (std::abs(ip) <= 10) pas = 1; else @@ -1445,20 +1445,20 @@ void Intf_Tool::ParabBox(const gp_Parab& theParab, const Bnd_Box& domain, Bnd_Bo if (beginOnCurve[nbSeg - 1] < -10.) ipmin = -10; else - ipmin = (int)(beginOnCurve[nbSeg - 1]); + ipmin = static_cast(beginOnCurve[nbSeg - 1]); int ipmax; if (endOnCurve[nbSeg - 1] > 10.) ipmax = 10; else - ipmax = (int)(endOnCurve[nbSeg - 1]); + ipmax = static_cast(endOnCurve[nbSeg - 1]); ipmin = ipmin * 10 + 1; ipmax = ipmax * 10 - 1; int ip, pas = 1; for (ip = ipmin; ip <= ipmax; ip += pas) { - boxParab.Add(ElCLib::Value(double(ip) / 10., theParab)); + boxParab.Add(ElCLib::Value(static_cast(ip) / 10., theParab)); if (std::abs(ip) <= 10) pas = 1; else diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Law/Law_BSpline.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Law/Law_BSpline.cxx index bc899b1c570..1c78d2ee550 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Law/Law_BSpline.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Law/Law_BSpline.cxx @@ -1617,8 +1617,8 @@ void Law_BSpline::MovePointAndTangent(const double U, delta = P - delta; delta_derivative = Tangent - delta_derivative; - poles_array = (double*)&poles->Array1()(1); - new_poles_array = (double*)&new_poles(1); + poles_array = const_cast(&poles->Array1()(1)); + new_poles_array = static_cast(&new_poles(1)); BSplCLib::MovePointAndTangent(U, dimension, delta, @@ -1643,7 +1643,7 @@ void Law_BSpline::MovePointAndTangent(const double U, void Law_BSpline::Resolution(const double Tolerance3D, double& UTolerance) const { void* bid = (void*)(&(poles->Value(1))); - double* bidr = (double*)bid; + double* bidr = static_cast(bid); if (rational) { BSplCLib::Resolution(*bidr, diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Law/Law_Interpolate.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Law/Law_Interpolate.cxx index 9c19adcf353..6fc3f651f73 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Law/Law_Interpolate.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Law/Law_Interpolate.cxx @@ -129,8 +129,8 @@ static void BuildTangents(const NCollection_Array1& PointsArray, } if (!TangentFlags.Value(1)) { - point_array = (double*)&PointsArray.Value(PointsArray.Lower()); - parameter_array = (double*)&ParametersArray.Value(1); + point_array = const_cast(&PointsArray.Value(PointsArray.Lower())); + parameter_array = const_cast(&ParametersArray.Value(1)); TangentFlags.SetValue(1, true); PLib::EvalLagrange(ParametersArray.Value(1), 1, @@ -143,10 +143,10 @@ static void BuildTangents(const NCollection_Array1& PointsArray, } if (!TangentFlags.Value(TangentFlags.Upper())) { - point_array = (double*)&PointsArray.Value(PointsArray.Upper() - degree); + point_array = const_cast(&PointsArray.Value(PointsArray.Upper() - degree)); TangentFlags.SetValue(TangentFlags.Upper(), true); int iup = ParametersArray.Upper() - degree; - parameter_array = (double*)&ParametersArray.Value(iup); + parameter_array = const_cast(&ParametersArray.Value(iup)); PLib::EvalLagrange(ParametersArray.Value(ParametersArray.Upper()), 1, degree, diff --git a/src/ModelingAlgorithms/TKGeomAlgo/NLPlate/NLPlate_NLPlate.cxx b/src/ModelingAlgorithms/TKGeomAlgo/NLPlate/NLPlate_NLPlate.cxx index a609c0abc2e..d143b8f93cb 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/NLPlate/NLPlate_NLPlate.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/NLPlate/NLPlate_NLPlate.cxx @@ -105,7 +105,7 @@ void NLPlate_NLPlate::IncrementalSolve(const int ord, for (int increment = 0; increment < NbIncrements; increment++) { - IncrementalLoad = 1. / double(NbIncrements - increment); + IncrementalLoad = 1. / static_cast(NbIncrements - increment); // for(int iterOrder=InitialConsraintOrder;iterOrder<=maxOrder;iterOrder++) int iterOrder = maxOrder; { diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.cxx index 7f40c976623..5b045e55ca2 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.cxx @@ -334,18 +334,18 @@ void Plate_Plate::SolveTI1(const int IterationNumber, const Message_ProgressRang n_dim = n_el + order * (order + 1) / 2; math_Matrix mat(0, n_dim - 1, 0, n_dim - 1, 0.); - delete[] (gp_XY*)points; + delete[] static_cast(points); points = new gp_XY[n_el]; int i; for (i = 0; i < n_el; i++) Points(i) = myConstraints(i + 1).Pnt2d(); - delete[] (int*)deru; + delete[] static_cast(deru); deru = new int[n_el]; for (i = 0; i < n_el; i++) Deru(i) = myConstraints(i + 1).Idu(); - delete[] (int*)derv; + delete[] static_cast(derv); derv = new int[n_el]; for (i = 0; i < n_el; i++) Derv(i) = myConstraints(i + 1).Idv(); @@ -425,7 +425,7 @@ void Plate_Plate::SolveTI1(const int IterationNumber, const Message_ProgressRang math_Vector sec_member(0, n_dim - 1, 0.); math_Vector sol(0, n_dim - 1); - delete[] (gp_XYZ*)solution; + delete[] static_cast(solution); solution = new gp_XYZ[n_dim]; for (int icoor = 1; icoor <= 3; icoor++) @@ -474,11 +474,11 @@ void Plate_Plate::SolveTI2(const int IterationNumber, const Message_ProgressRang int n_dimat = nCC1 + nCC2 + order * (order + 1) / 2; - delete[] (gp_XY*)points; + delete[] static_cast(points); points = new gp_XY[n_el]; - delete[] (int*)deru; + delete[] static_cast(deru); deru = new int[n_el]; - delete[] (int*)derv; + delete[] static_cast(derv); derv = new int[n_el]; for (i = 0; i < nCC1; i++) @@ -540,7 +540,7 @@ void Plate_Plate::SolveTI2(const int IterationNumber, const Message_ProgressRang math_Vector sec_member(0, n_dimat - 1, 0.); math_Vector sol(0, n_dimat - 1); - delete[] (gp_XYZ*)solution; + delete[] static_cast(solution); n_dim = n_el + order * (order + 1) / 2; solution = new gp_XYZ[n_dim]; @@ -628,11 +628,11 @@ void Plate_Plate::SolveTI3(const int IterationNumber, const Message_ProgressRang int n_dimsousmat = nCC1 + nCC2 + nbm; int n_dimat = 3 * n_dimsousmat + nCC3; - delete[] (gp_XY*)points; + delete[] static_cast(points); points = new gp_XY[n_el]; - delete[] (int*)deru; + delete[] static_cast(deru); deru = new int[n_el]; - delete[] (int*)derv; + delete[] static_cast(derv); derv = new int[n_el]; for (i = 0; i < nCC1; i++) @@ -851,7 +851,7 @@ void Plate_Plate::SolveTI3(const int IterationNumber, const Message_ProgressRang math_Vector sec_member(0, n_dimat - 1, 0.); math_Vector sol(0, n_dimat - 1); - delete[] (gp_XYZ*)solution; + delete[] static_cast(solution); n_dim = n_el + order * (order + 1) / 2; solution = new gp_XYZ[n_dim]; @@ -1094,16 +1094,16 @@ void Plate_Plate::Init() myLXYZConstraints.Clear(); myLScalarConstraints.Clear(); - delete[] (gp_XYZ*)solution; + delete[] static_cast(solution); solution = nullptr; - delete[] (gp_XY*)points; + delete[] static_cast(points); points = nullptr; - delete[] (int*)deru; + delete[] static_cast(deru); deru = nullptr; - delete[] (int*)derv; + delete[] static_cast(derv); derv = nullptr; order = 0; diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.lxx b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.lxx index ab14eba0635..083e2beb888 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.lxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.lxx @@ -56,20 +56,20 @@ inline double Plate_Plate::Polm(const gp_XY& point2d, inline int& Plate_Plate::Deru(const int index) const { - return ((int*)deru)[index]; + return (static_cast(deru))[index]; } inline int& Plate_Plate::Derv(const int index) const { - return ((int*)derv)[index]; + return (static_cast(derv))[index]; } inline gp_XYZ& Plate_Plate::Solution(const int index) const { - return ((gp_XYZ*)solution)[index]; + return (static_cast(solution))[index]; } inline gp_XY& Plate_Plate::Points(const int index) const { - return ((gp_XY*)points)[index]; + return (static_cast(points))[index]; } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_SampledCurveConstraint.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_SampledCurveConstraint.cxx index ef8be9c901c..a9b59ddf86f 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_SampledCurveConstraint.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_SampledCurveConstraint.cxx @@ -42,7 +42,7 @@ Plate_SampledCurveConstraint::Plate_SampledCurveConstraint( for (int index = 1; index <= m; index++) myLXYZC.SetPPC(index, SOPPC(index)); - double ratio = double(n + 1) / double(m + 1); + double ratio = static_cast(n + 1) / static_cast(m + 1); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { diff --git a/src/ModelingAlgorithms/TKGeomAlgo/TopTrans/TopTrans_SurfaceTransition.cxx b/src/ModelingAlgorithms/TKGeomAlgo/TopTrans/TopTrans_SurfaceTransition.cxx index 4c452a01848..8efb1626b43 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/TopTrans/TopTrans_SurfaceTransition.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/TopTrans/TopTrans_SurfaceTransition.cxx @@ -124,7 +124,7 @@ static int FUN_refnearest(const double Angref, if (TopAbs::Complement(Ori) == Oriref) return M_Ointernal; else - return (int)M_Unknown; // nyi FUN_RAISE + return M_Unknown; // nyi FUN_RAISE } int updateref = (dcos > 0.) ? M_noupdate : M_updateREF; return updateref; @@ -191,7 +191,7 @@ static int FUN_refnearest(const int i, if (TopAbs::Complement(Ori) == Oriref) return M_Ointernal; else - return (int)M_Unknown; // nyi FUN_RAISE + return M_Unknown; // nyi FUN_RAISE } bool noupdate = false; diff --git a/src/ModelingAlgorithms/TKHLR/Contap/Contap_ArcFunction.cxx b/src/ModelingAlgorithms/TKHLR/Contap/Contap_ArcFunction.cxx index 91773d76391..62b49492f0d 100644 --- a/src/ModelingAlgorithms/TKHLR/Contap/Contap_ArcFunction.cxx +++ b/src/ModelingAlgorithms/TKHLR/Contap/Contap_ArcFunction.cxx @@ -48,7 +48,7 @@ void Contap_ArcFunction::Set(const occ::handle& S) Contap_SurfProps::Normale(S, U, V, solpt, norm); myMean = myMean + norm.Magnitude(); } - myMean = myMean / ((double)nbs); + myMean = myMean / (static_cast(nbs)); } } diff --git a/src/ModelingAlgorithms/TKHLR/Contap/Contap_Contour.cxx b/src/ModelingAlgorithms/TKHLR/Contap/Contap_Contour.cxx index e92d66af4f4..b321d8a4ce4 100644 --- a/src/ModelingAlgorithms/TKHLR/Contap/Contap_Contour.cxx +++ b/src/ModelingAlgorithms/TKHLR/Contap/Contap_Contour.cxx @@ -298,8 +298,8 @@ static void LineConstructor(NCollection_Sequence& slin, //-- std::cout<<" WLine -> "<(L.Vertex(i).ParameterOnLine()); + int lastp = static_cast(L.Vertex(i + 1).ParameterOnLine()); if (firstp != lastp) { int pmid = (firstp + lastp) / 2; //-- entiers @@ -1774,7 +1774,7 @@ void Contap_Contour::Perform(const occ::handle& Domain) { PPoint.Parameters(themult, U, V); ptfin.SetValue(PPoint.Value(), U, V); - ptfin.SetParameter((double)(Nbpts)); + ptfin.SetParameter(static_cast(Nbpts)); const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i); const occ::handle& currentarc = PStart.Arc(); currentparam = PStart.Parameter(); @@ -1814,7 +1814,7 @@ void Contap_Contour::Perform(const occ::handle& Domain) { iwline->Value(Nbpts).ParametersOnS2(U, V); ptfin.SetValue(theline.Point(Nbpts).Value(), U, V); - ptfin.SetParameter((double)(Nbpts)); + ptfin.SetParameter(static_cast(Nbpts)); theline.Add(ptfin); } @@ -1916,7 +1916,7 @@ void Contap_Contour::Perform(const occ::handle& Domain) tgtrst = d2d.X() * d1u; tgtrst.Add(d2d.Y() * d1v); - int Paraml = (int)ptvt.ParameterOnLine(); + int Paraml = static_cast(ptvt.ParameterOnLine()); if (Paraml == theli.NbPnts()) { diff --git a/src/ModelingAlgorithms/TKHLR/Contap/Contap_HContTool.cxx b/src/ModelingAlgorithms/TKHLR/Contap/Contap_HContTool.cxx index d4fc1f48672..2fd6aee0909 100644 --- a/src/ModelingAlgorithms/TKHLR/Contap/Contap_HContTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/Contap/Contap_HContTool.cxx @@ -182,8 +182,8 @@ void Contap_HContTool::SamplePoint(const occ::handle& S, int indU = (Index - 1) / nbIntU; //---- 0 --> nbIntV int indV = (Index - 1) - indU * nbIntU; //---- 0 --> nbIntU - U = uinf + ((usup - uinf) / ((double)(nbIntU + 1))) * (double)(indU + 1); - V = vinf + ((vsup - vinf) / ((double)(nbIntV + 2))) * (double)(indV + 1); + U = uinf + ((usup - uinf) / (static_cast(nbIntU + 1))) * static_cast(indU + 1); + V = vinf + ((vsup - vinf) / (static_cast(nbIntV + 2))) * static_cast(indV + 1); //-- std::cout<<"Index :"<& A) default: nbsOnC = 10; } - return (int)(nbsOnC); + return static_cast(nbsOnC); } void Contap_HContTool::Bounds(const occ::handle& A, diff --git a/src/ModelingAlgorithms/TKHLR/Contap/Contap_HCurve2dTool.cxx b/src/ModelingAlgorithms/TKHLR/Contap/Contap_HCurve2dTool.cxx index 06f329ff46a..b8188b2d462 100644 --- a/src/ModelingAlgorithms/TKHLR/Contap/Contap_HCurve2dTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/Contap/Contap_HCurve2dTool.cxx @@ -44,5 +44,5 @@ int Contap_HCurve2dTool::NbSamples(const occ::handle& C, } if (nbs > 50.) nbs = 50.; - return ((int)nbs); + return (static_cast(nbs)); } diff --git a/src/ModelingAlgorithms/TKHLR/Contap/Contap_SurfFunction.cxx b/src/ModelingAlgorithms/TKHLR/Contap/Contap_SurfFunction.cxx index c8699fd333e..578202b1d6a 100644 --- a/src/ModelingAlgorithms/TKHLR/Contap/Contap_SurfFunction.cxx +++ b/src/ModelingAlgorithms/TKHLR/Contap/Contap_SurfFunction.cxx @@ -62,7 +62,7 @@ void Contap_SurfFunction::Set(const occ::handle& S) Contap_SurfProps::Normale(S, U, V, solpt, norm); myMean = myMean + norm.Magnitude(); } - myMean = myMean / ((double)nbs); + myMean = myMean / (static_cast(nbs)); } computed = false; derived = false; diff --git a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.cxx b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.cxx index 48cea615419..7a767684d8f 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.cxx @@ -43,18 +43,18 @@ void HLRAlgo_EdgeIterator::InitHidden(HLRAlgo_EdgeStatus& status) { EHid = &status; iHid = 1; - if (((HLRAlgo_EdgeStatus*)EHid)->AllHidden()) + if ((EHid)->AllHidden()) { - ((HLRAlgo_EdgeStatus*)EHid)->Bounds(myHidStart, myHidTolStart, myHidEnd, myHidTolEnd); + (EHid)->Bounds(myHidStart, myHidTolStart, myHidEnd, myHidTolEnd); myNbHid = 0; } else { - myNbHid = ((HLRAlgo_EdgeStatus*)EHid)->NbVisiblePart(); + myNbHid = (EHid)->NbVisiblePart(); double B1; float B2; - ((HLRAlgo_EdgeStatus*)EHid)->Bounds(myHidStart, myHidTolStart, B1, B2); - ((HLRAlgo_EdgeStatus*)EHid)->VisiblePart(iHid, myHidEnd, myHidTolEnd, B1, B2); + (EHid)->Bounds(myHidStart, myHidTolStart, B1, B2); + (EHid)->VisiblePart(iHid, myHidEnd, myHidTolEnd, B1, B2); } if (myHidStart + myHidTolStart >= myHidEnd - myHidTolEnd && myHidEnd + myHidTolEnd >= myHidStart - myHidTolStart) @@ -71,16 +71,16 @@ void HLRAlgo_EdgeIterator::NextHidden() { double B1; float B2; - ((HLRAlgo_EdgeStatus*)EHid)->VisiblePart(iHid, B1, B2, myHidStart, myHidTolStart); + (EHid)->VisiblePart(iHid, B1, B2, myHidStart, myHidTolStart); iHid++; if (iHid == myNbHid + 1) { - ((HLRAlgo_EdgeStatus*)EHid)->Bounds(B1, B2, myHidEnd, myHidTolEnd); + (EHid)->Bounds(B1, B2, myHidEnd, myHidTolEnd); if (myHidStart + myHidTolStart >= myHidEnd - myHidTolEnd && myHidEnd + myHidTolEnd >= myHidStart - myHidTolStart) iHid++; } else - ((HLRAlgo_EdgeStatus*)EHid)->VisiblePart(iHid, myHidEnd, myHidTolEnd, B1, B2); + (EHid)->VisiblePart(iHid, myHidEnd, myHidTolEnd, B1, B2); } } diff --git a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.lxx b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.lxx index 6175f8eec51..399b5118e23 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.lxx +++ b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgeIterator.lxx @@ -42,7 +42,7 @@ inline void HLRAlgo_EdgeIterator::InitVisible(HLRAlgo_EdgeStatus& status) { EVis = &status; iVis = 1; - myNbVis = ((HLRAlgo_EdgeStatus*)EVis)->NbVisiblePart(); + myNbVis = (EVis)->NbVisiblePart(); } //================================================================================================= @@ -66,5 +66,5 @@ inline void HLRAlgo_EdgeIterator::Visible(double& Start, double& End, float& TolEnd) { - ((HLRAlgo_EdgeStatus*)EVis)->VisiblePart(iVis, Start, TolStart, End, TolEnd); + (EVis)->VisiblePart(iVis, Start, TolStart, End, TolEnd); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgesBlock.hxx b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgesBlock.hxx index 5083e56a674..e19e4cb2130 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgesBlock.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_EdgesBlock.hxx @@ -91,12 +91,12 @@ public: void Orientation(const int I, const TopAbs_Orientation Or) { myFlags(I) &= ~EMaskOrient; - myFlags(I) |= ((int)Or & (int)EMaskOrient); + myFlags(I) |= (static_cast(Or) & static_cast(EMaskOrient)); } TopAbs_Orientation Orientation(const int I) const { - return ((TopAbs_Orientation)(myFlags(I) & EMaskOrient)); + return (static_cast(myFlags(I) & EMaskOrient)); } bool OutLine(const int I) const { return (myFlags(I) & EMaskOutLine) != 0; } diff --git a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyAlgo.cxx b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyAlgo.cxx index 10ce92c8124..5f7449bd16a 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyAlgo.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyAlgo.cxx @@ -141,12 +141,12 @@ void HLRAlgo_PolyAlgo::Update() zSegmnMin = aPoints.PntP2.Z(); zSegmnMax = aPoints.PntP1.Z(); } - nxMin = (int)((DecaX + xSegmnMin) * SurDX); - nyMin = (int)((DecaY + ySegmnMin) * SurDY); - nzMin = (int)((DecaZ + zSegmnMin) * SurDZ); - nxMax = (int)((DecaX + xSegmnMax) * SurDX); - nyMax = (int)((DecaY + ySegmnMax) * SurDY); - nzMax = (int)((DecaZ + zSegmnMax) * SurDZ); + nxMin = static_cast((DecaX + xSegmnMin) * SurDX); + nyMin = static_cast((DecaY + ySegmnMin) * SurDY); + nzMin = static_cast((DecaZ + zSegmnMin) * SurDZ); + nxMax = static_cast((DecaX + xSegmnMax) * SurDX); + nyMax = static_cast((DecaY + ySegmnMax) * SurDY); + nzMax = static_cast((DecaZ + zSegmnMax) * SurDZ); theIndices.MinSeg = nyMin + (nxMin << 11); theIndices.MinSeg <<= 10; theIndices.MinSeg += nzMin; @@ -236,12 +236,12 @@ void HLRAlgo_PolyAlgo::Update() zTrianMin = Z3; else if (zTrianMax < Z3) zTrianMax = Z3; - nxMin = (int)((DecaX + xTrianMin) * SurDX); - nyMin = (int)((DecaY + yTrianMin) * SurDY); - nzMin = (int)((DecaZ + zTrianMin) * SurDZ); - nxMax = (int)((DecaX + xTrianMax) * SurDX); - nyMax = (int)((DecaY + yTrianMax) * SurDY); - nzMax = (int)((DecaZ + zTrianMax) * SurDZ); + nxMin = static_cast((DecaX + xTrianMin) * SurDX); + nyMin = static_cast((DecaY + yTrianMin) * SurDY); + nzMin = static_cast((DecaZ + zTrianMin) * SurDZ); + nxMax = static_cast((DecaX + xTrianMax) * SurDX); + nyMax = static_cast((DecaY + yTrianMax) * SurDY); + nzMax = static_cast((DecaZ + zTrianMax) * SurDZ); int MinTrian, MaxTrian; MinTrian = nyMin + (nxMin << 11); MinTrian <<= 10; @@ -314,12 +314,12 @@ void HLRAlgo_PolyAlgo::Update() zPolyTMax = zTrianMax; } } - nxMin = (int)((DecaX + xPolyTMin) * SurDX); - nyMin = (int)((DecaY + yPolyTMin) * SurDY); - nzMin = (int)((DecaZ + zPolyTMin) * SurDZ); - nxMax = (int)((DecaX + xPolyTMax) * SurDX); - nyMax = (int)((DecaY + yPolyTMax) * SurDY); - nzMax = (int)((DecaZ + zPolyTMax) * SurDZ); + nxMin = static_cast((DecaX + xPolyTMin) * SurDX); + nyMin = static_cast((DecaY + yPolyTMin) * SurDY); + nzMin = static_cast((DecaZ + zPolyTMin) * SurDZ); + nxMax = static_cast((DecaX + xPolyTMax) * SurDX); + nyMax = static_cast((DecaY + yPolyTMax) * SurDY); + nzMax = static_cast((DecaZ + zPolyTMax) * SurDZ); PolyTIndices.Min = nyMin + (nxMin << 11); PolyTIndices.Min <<= 10; PolyTIndices.Min += nzMin - 0x00000200; @@ -342,12 +342,12 @@ void HLRAlgo_PolyAlgo::Update() } if (nbFaHi > 0) { - nxMin = (int)((DecaX + xShellMin) * SurDX); - nyMin = (int)((DecaY + yShellMin) * SurDY); - nzMin = (int)((DecaZ + zShellMin) * SurDZ); - nxMax = (int)((DecaX + xShellMax) * SurDX); - nyMax = (int)((DecaY + yShellMax) * SurDY); - nzMax = (int)((DecaZ + zShellMax) * SurDZ); + nxMin = static_cast((DecaX + xShellMin) * SurDX); + nyMin = static_cast((DecaY + yShellMin) * SurDY); + nzMin = static_cast((DecaZ + zShellMin) * SurDZ); + nxMax = static_cast((DecaX + xShellMax) * SurDX); + nyMax = static_cast((DecaY + yShellMax) * SurDY); + nzMax = static_cast((DecaZ + zShellMax) * SurDZ); aShellIndices.Min = nyMin + (nxMin << 11); aShellIndices.Min <<= 10; aShellIndices.Min += nzMin - 0x00000200; @@ -418,7 +418,7 @@ HLRAlgo_BiPoint::PointsT& HLRAlgo_PolyAlgo::Hide(HLRAlgo_EdgeStatus& theStatus, HLRAlgo_BiPoint& aBP = mySegListIt.ChangeValue(); HLRAlgo_BiPoint::PointsT& aPoints = aBP.Points(); HLRAlgo_BiPoint::IndicesT& anIndices = aBP.Indices(); - theStatus = HLRAlgo_EdgeStatus(0.0, (float)myTriangle.TolParam, 1.0, (float)myTriangle.TolParam); + theStatus = HLRAlgo_EdgeStatus(0.0, static_cast(myTriangle.TolParam), 1.0, static_cast(myTriangle.TolParam)); theIndex = anIndices.ShapeIndex; theReg1 = aBP.Rg1Line(); theRegn = aBP.RgNLine(); diff --git a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx index 561d2f8a88a..b8a3f4366d1 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx @@ -904,5 +904,5 @@ void HLRAlgo_PolyData::hideByOneTriangle(const HLRAlgo_BiPoint::PointsT& thePoin if (total) status.HideAll(); else - status.Hide(psta, (float)theTriangle.TolParam, pend, (float)theTriangle.TolParam, false, false); + status.Hide(psta, static_cast(theTriangle.TolParam), pend, static_cast(theTriangle.TolParam), false, false); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_WiresBlock.hxx b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_WiresBlock.hxx index 72ca830de61..be0bb6481ae 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_WiresBlock.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_WiresBlock.hxx @@ -47,7 +47,7 @@ public: occ::handle& Wire(const int I) { - return *((occ::handle*)&myWires(I)); + return *(reinterpret_cast*>(&myWires(I))); } void UpdateMinMax(const HLRAlgo_EdgesBlock::MinMaxIndices& theMinMaxes) diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_BCurveTool.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_BCurveTool.cxx index 60ec718f447..a209e8e41d7 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_BCurveTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_BCurveTool.cxx @@ -43,7 +43,7 @@ int HLRBRep_BCurveTool::NbSamples(const BRepAdaptor_Curve& C, const double U0, c } if (nbs > 50) nbs = 50; - return ((int)nbs); + return (static_cast(nbs)); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_BSurfaceTool.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_BSurfaceTool.cxx index aa06d6f1738..75e755e5be5 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_BSurfaceTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_BSurfaceTool.cxx @@ -112,7 +112,7 @@ int HLRBRep_BSurfaceTool::NbSamplesU(const BRepAdaptor_Surface& S, const double { double uf = FirstUParameter(S); double ul = LastUParameter(S); - n *= (int)((u2 - u1) / (uf - ul)); + n *= static_cast((u2 - u1) / (uf - ul)); if (n > nbs) n = nbs; if (n < 5) @@ -131,7 +131,7 @@ int HLRBRep_BSurfaceTool::NbSamplesV(const BRepAdaptor_Surface& S, const double { double vf = FirstVParameter(S); double vl = LastVParameter(S); - n *= (int)((v2 - v1) / (vf - vl)); + n *= static_cast((v2 - v1) / (vf - vl)); if (n > nbs) n = nbs; if (n < 5) diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Curve.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Curve.cxx index f1aba2006e5..d0a9fa60252 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Curve.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Curve.cxx @@ -58,7 +58,7 @@ double HLRBRep_Curve::Parameter2d(const double P3d) const switch (myType) { case GeomAbs_Line: - if (((HLRAlgo_Projector*)myProj)->Perspective()) + if ((const_cast(myProj))->Perspective()) { const double FmOZ = myOF - myOZ; return myOF * P3d * (myVX * FmOZ + myOX * myVZ) / (FmOZ * (FmOZ - P3d * myVZ)); @@ -87,7 +87,7 @@ double HLRBRep_Curve::Parameter3d(const double P2d) const if (myType == GeomAbs_Line) { - if (((HLRAlgo_Projector*)myProj)->Perspective()) + if ((const_cast(myProj))->Perspective()) { const double FmOZ = myOF - myOZ; return P2d * FmOZ * FmOZ / (FmOZ * (myOF * myVX + P2d * myVZ) + myOF * myOX * myVZ); @@ -118,10 +118,10 @@ double HLRBRep_Curve::Update(double TotMin[16], double TotMax[16]) break; case GeomAbs_Circle: - if (!((HLRAlgo_Projector*)myProj)->Perspective()) + if (!(const_cast(myProj))->Perspective()) { gp_Dir D1 = HLRBRep_BCurveTool::Circle(myCurve).Axis().Direction(); - D1.Transform(((HLRAlgo_Projector*)myProj)->Transformation()); + D1.Transform((const_cast(myProj))->Transformation()); if (D1.IsParallel(gp::DZ(), Precision::Angular())) myType = GeomAbs_Circle; else if (std::abs(D1.Dot(gp::DZ())) @@ -134,17 +134,17 @@ double HLRBRep_Curve::Update(double TotMin[16], double TotMax[16]) // compute the angle offset gp_Dir D3 = D1.Crossed(gp::DZ()); gp_Dir D2 = HLRBRep_BCurveTool::Circle(myCurve).XAxis().Direction(); - D2.Transform(((HLRAlgo_Projector*)myProj)->Transformation()); + D2.Transform((const_cast(myProj))->Transformation()); myOX = D3.AngleWithRef(D2, D1); } } break; case GeomAbs_Ellipse: - if (!((HLRAlgo_Projector*)myProj)->Perspective()) + if (!(const_cast(myProj))->Perspective()) { gp_Dir D1 = HLRBRep_BCurveTool::Ellipse(myCurve).Axis().Direction(); - D1.Transform(((HLRAlgo_Projector*)myProj)->Transformation()); + D1.Transform((const_cast(myProj))->Transformation()); if (D1.IsParallel(gp::DZ(), Precision::Angular())) { myOX = 0.; // no offset on the angle @@ -156,12 +156,12 @@ double HLRBRep_Curve::Update(double TotMin[16], double TotMax[16]) case GeomAbs_BezierCurve: if (HLRBRep_BCurveTool::Degree(myCurve) == 1) myType = GeomAbs_Line; - else if (!((HLRAlgo_Projector*)myProj)->Perspective()) + else if (!(const_cast(myProj))->Perspective()) myType = typ; break; case GeomAbs_BSplineCurve: - if (!((HLRAlgo_Projector*)myProj)->Perspective()) + if (!(const_cast(myProj))->Perspective()) myType = typ; break; @@ -188,9 +188,9 @@ double HLRBRep_Curve::Update(double TotMin[16], double TotMax[16]) } gp_Pnt P = L.Location(); gp_Vec V = L.Direction(); - P.Transform(((HLRAlgo_Projector*)myProj)->Transformation()); - V.Transform(((HLRAlgo_Projector*)myProj)->Transformation()); - if (((HLRAlgo_Projector*)myProj)->Perspective()) + P.Transform((const_cast(myProj))->Transformation()); + V.Transform((const_cast(myProj))->Transformation()); + if ((const_cast(myProj))->Perspective()) { gp_Pnt2d F; gp_Vec2d VFX; @@ -200,7 +200,7 @@ double HLRBRep_Curve::Update(double TotMin[16], double TotMax[16]) double l = -(VFX.X() * F.X() + VFX.Y() * F.Y()); F.SetCoord(F.X() + VFX.X() * l, F.Y() + VFX.Y() * l); myOX = VFX.X() * (P.X() - F.X()) + VFX.Y() * (P.Y() - F.Y()); - gp_Vec VFZ(-F.X(), -F.Y(), ((HLRAlgo_Projector*)myProj)->Focus()); + gp_Vec VFZ(-F.X(), -F.Y(), (const_cast(myProj))->Focus()); myOF = VFZ.Magnitude(); VFZ /= myOF; myVZ = VFZ * V; @@ -220,7 +220,7 @@ double HLRBRep_Curve::UpdateMinMax(double TotMin[16], double TotMax[16]) double a = HLRBRep_BCurveTool::FirstParameter(myCurve); double b = HLRBRep_BCurveTool::LastParameter(myCurve); double x, y, z, tolMinMax = 0; - ((HLRAlgo_Projector*)myProj)->Project(Value3D(a), x, y, z); + (const_cast(myProj))->Project(Value3D(a), x, y, z); HLRAlgo::UpdateMinMax(x, y, z, TotMin, TotMax); if (myType != GeomAbs_Line) @@ -241,7 +241,7 @@ double HLRBRep_Curve::UpdateMinMax(double TotMin[16], double TotMax[16]) xb = x; yb = y; zb = z; - ((HLRAlgo_Projector*)myProj)->Project(Value3D(a), x, y, z); + (const_cast(myProj))->Project(Value3D(a), x, y, z); HLRAlgo::UpdateMinMax(x, y, z, TotMin, TotMax); if (i >= 2) { @@ -269,7 +269,7 @@ double HLRBRep_Curve::UpdateMinMax(double TotMin[16], double TotMax[16]) } } } - ((HLRAlgo_Projector*)myProj)->Project(Value3D(b), x, y, z); + (const_cast(myProj))->Project(Value3D(b), x, y, z); HLRAlgo::UpdateMinMax(x, y, z, TotMin, TotMax); return tolMinMax; } @@ -280,7 +280,7 @@ double HLRBRep_Curve::Z(const double U) const { gp_Pnt P3d; HLRBRep_BCurveTool::D0(myCurve, U, P3d); - P3d.Transform(((HLRAlgo_Projector*)myProj)->Transformation()); + P3d.Transform((const_cast(myProj))->Transformation()); return P3d.Z(); } @@ -314,7 +314,7 @@ void HLRBRep_Curve::D0(const double U, gp_Pnt2d& P) const else P.SetCoord(P3d.X(),P3d.Y()); */ gp_Pnt P3d; HLRBRep_BCurveTool::D0(myCurve, U, P3d); - ((HLRAlgo_Projector*)myProj)->Project(P3d, P); + (const_cast(myProj))->Project(P3d, P); } //================================================================================================= @@ -502,7 +502,7 @@ void HLRBRep_Curve::Poles(const occ::handle& aCurve, for (int i = i1; i <= i2; i++) { - ((HLRAlgo_Projector*)myProj)->Transform(TP3(i)); + (const_cast(myProj))->Transform(TP3(i)); TP(i).SetCoord(TP3(i).X(), TP3(i).Y()); } } @@ -539,7 +539,7 @@ void HLRBRep_Curve::PolesAndWeights(NCollection_Array1& TP, } for (int i = i1; i <= i2; i++) { - ((HLRAlgo_Projector*)myProj)->Transform(TP3(i)); + (const_cast(myProj))->Transform(TP3(i)); TP(i).SetCoord(TP3(i).X(), TP3(i).Y()); } } @@ -564,7 +564,7 @@ void HLRBRep_Curve::PolesAndWeights(const occ::handle& aCurve for (int i = i1; i <= i2; i++) { - ((HLRAlgo_Projector*)myProj)->Transform(TP3(i)); + (const_cast(myProj))->Transform(TP3(i)); TP(i).SetCoord(TP3(i).X(), TP3(i).Y()); } } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CurveTool.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CurveTool.cxx index 816d49b56ee..dc8e8d084b3 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CurveTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CurveTool.cxx @@ -20,48 +20,48 @@ int HLRBRep_CurveTool::NbSamples(const HLRBRep_CurvePtr C) { - GeomAbs_CurveType typC = ((HLRBRep_Curve*)C)->GetType(); + GeomAbs_CurveType typC = (static_cast(C))->GetType(); static double nbsOther = 10.0; double nbs = nbsOther; if (typC == GeomAbs_Line) nbs = 2; else if (typC == GeomAbs_BezierCurve) - nbs = 3 + ((HLRBRep_Curve*)C)->NbPoles(); + nbs = 3 + (static_cast(C))->NbPoles(); else if (typC == GeomAbs_BSplineCurve) { - nbs = ((HLRBRep_Curve*)C)->NbKnots(); - nbs *= ((HLRBRep_Curve*)C)->Degree(); + nbs = (static_cast(C))->NbKnots(); + nbs *= (static_cast(C))->Degree(); if (nbs < 2.0) nbs = 2; } if (nbs > 50) nbs = 50; - return ((int)nbs); + return (static_cast(nbs)); } //================================================================================================= int HLRBRep_CurveTool::NbSamples(const HLRBRep_CurvePtr C, const double u1, const double u2) { - GeomAbs_CurveType typC = ((HLRBRep_Curve*)C)->GetType(); + GeomAbs_CurveType typC = (static_cast(C))->GetType(); static double nbsOther = 10.0; double nbs = nbsOther; if (typC == GeomAbs_Line) nbs = 2; else if (typC == GeomAbs_BezierCurve) - nbs = 3 + ((HLRBRep_Curve*)C)->NbPoles(); + nbs = 3 + (static_cast(C))->NbPoles(); else if (typC == GeomAbs_BSplineCurve) { - occ::handle aCurve = ((HLRBRep_Curve*)C)->Curve().Curve().Curve(); + occ::handle aCurve = (static_cast(C))->Curve().Curve().Curve(); GeomAdaptor_Curve GAcurve(aCurve, u1, u2); nbs = GAcurve.NbIntervals(GeomAbs_CN) + 1; - nbs *= ((HLRBRep_Curve*)C)->Degree(); + nbs *= (static_cast(C))->Degree(); if (nbs < 2.0) nbs = 2; } if (nbs > 50) nbs = 50; - return ((int)nbs); + return (static_cast(nbs)); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CurveTool.lxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CurveTool.lxx index 099de4ab720..2d38e86b2b4 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CurveTool.lxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_CurveTool.lxx @@ -33,21 +33,21 @@ inline double HLRBRep_CurveTool::FirstParameter(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->FirstParameter()); + return ((static_cast(C))->FirstParameter()); } //================================================================================================= inline double HLRBRep_CurveTool::LastParameter(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->LastParameter()); + return ((static_cast(C))->LastParameter()); } //================================================================================================= inline GeomAbs_Shape HLRBRep_CurveTool::Continuity(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->Continuity()); + return ((static_cast(C))->Continuity()); } //================================================================================================= @@ -57,7 +57,7 @@ inline int HLRBRep_CurveTool::NbIntervals(const HLRBRep_CurvePtr C) #if IS_C2_COMPOSITE return (((HLRBRep_Curve*)C)->NbIntervals(GeomAbs_C2)); #else - return (((HLRBRep_Curve*)C)->NbIntervals(GeomAbs_C1)); + return ((static_cast(C))->NbIntervals(GeomAbs_C1)); #endif } @@ -68,7 +68,7 @@ inline void HLRBRep_CurveTool::Intervals(const HLRBRep_CurvePtr C, NCollection_A #if IS_C2_COMPOSITE ((HLRBRep_Curve*)C)->Intervals(Tab, GeomAbs_C2); #else - ((HLRBRep_Curve*)C)->Intervals(Tab, GeomAbs_C1); + (static_cast(C))->Intervals(Tab, GeomAbs_C1); #endif } @@ -88,35 +88,35 @@ inline void HLRBRep_CurveTool::GetInterval(const HLRBRep_CurvePtr /*C*/, inline bool HLRBRep_CurveTool::IsClosed(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->IsClosed()); + return ((static_cast(C))->IsClosed()); } //================================================================================================= inline bool HLRBRep_CurveTool::IsPeriodic(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->IsPeriodic()); + return ((static_cast(C))->IsPeriodic()); } //================================================================================================= inline double HLRBRep_CurveTool::Period(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->Period()); + return ((static_cast(C))->Period()); } //================================================================================================= inline gp_Pnt2d HLRBRep_CurveTool::Value(const HLRBRep_CurvePtr C, const double U) { - return (((HLRBRep_Curve*)C)->Value(U)); + return ((static_cast(C))->Value(U)); } //================================================================================================= inline void HLRBRep_CurveTool::D0(const HLRBRep_CurvePtr C, const double U, gp_Pnt2d& P) { - ((HLRBRep_Curve*)C)->D0(U, P); + (static_cast(C))->D0(U, P); } //================================================================================================= @@ -126,7 +126,7 @@ inline void HLRBRep_CurveTool::D1(const HLRBRep_CurvePtr C, gp_Pnt2d& P, gp_Vec2d& T) { - ((HLRBRep_Curve*)C)->D1(U, P, T); + (static_cast(C))->D1(U, P, T); } //================================================================================================= @@ -137,7 +137,7 @@ inline void HLRBRep_CurveTool::D2(const HLRBRep_CurvePtr C, gp_Vec2d& T, gp_Vec2d& N) { - ((HLRBRep_Curve*)C)->D2(U, P, T, N); + (static_cast(C))->D2(U, P, T, N); } //================================================================================================= @@ -149,70 +149,70 @@ inline void HLRBRep_CurveTool::D3(const HLRBRep_CurvePtr C, gp_Vec2d& V2, gp_Vec2d& V3) { - ((HLRBRep_Curve*)C)->D3(U, P, V1, V2, V3); + (static_cast(C))->D3(U, P, V1, V2, V3); } //================================================================================================= inline gp_Vec2d HLRBRep_CurveTool::DN(const HLRBRep_CurvePtr C, const double U, const int N) { - return (((HLRBRep_Curve*)C)->DN(U, N)); + return ((static_cast(C))->DN(U, N)); } //================================================================================================= inline double HLRBRep_CurveTool::Resolution(const HLRBRep_CurvePtr C, const double R3d) { - return (((HLRBRep_Curve*)C)->Resolution(R3d)); + return ((static_cast(C))->Resolution(R3d)); } //================================================================================================= inline GeomAbs_CurveType HLRBRep_CurveTool::GetType(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->GetType()); + return ((static_cast(C))->GetType()); } //================================================================================================= inline GeomAbs_CurveType HLRBRep_CurveTool::TheType(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->GetType()); + return ((static_cast(C))->GetType()); } //================================================================================================= inline gp_Lin2d HLRBRep_CurveTool::Line(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->Line()); + return ((static_cast(C))->Line()); } //================================================================================================= inline gp_Circ2d HLRBRep_CurveTool::Circle(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->Circle()); + return ((static_cast(C))->Circle()); } //================================================================================================= inline gp_Elips2d HLRBRep_CurveTool::Ellipse(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->Ellipse()); + return ((static_cast(C))->Ellipse()); } //================================================================================================= inline gp_Parab2d HLRBRep_CurveTool::Parabola(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->Parabola()); + return ((static_cast(C))->Parabola()); } //================================================================================================= inline gp_Hypr2d HLRBRep_CurveTool::Hyperbola(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->Hyperbola()); + return ((static_cast(C))->Hyperbola()); } //================================================================================================= @@ -248,5 +248,5 @@ inline double HLRBRep_CurveTool::EpsX(const HLRBRep_CurvePtr /*C*/) inline int HLRBRep_CurveTool::Degree(const HLRBRep_CurvePtr C) { - return (((HLRBRep_Curve*)C)->Degree()); + return ((static_cast(C))->Degree()); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx index 638e11816e8..6141fa22e68 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx @@ -122,18 +122,18 @@ class TableauRejection StNbLect = StNbEcr = StNbMax = StNbMoy = 0; #endif N = n; - UV = (double**)malloc(N * sizeof(double*)); - IndUV = (int**)malloc(N * sizeof(int*)); - nbUV = (int*)malloc(N * sizeof(int)); + UV = static_cast(malloc(N * sizeof(double*))); + IndUV = static_cast(malloc(N * sizeof(int*))); + nbUV = static_cast(malloc(N * sizeof(int))); // for(int i=0;i(malloc(SIZEUV * sizeof(double))); } for (i = 0; i < N; i++) { - IndUV[i] = (int*)malloc(SIZEUV * sizeof(int)); + IndUV[i] = static_cast(malloc(SIZEUV * sizeof(int))); for (int k = 0; k < SIZEUV; k++) { IndUV[i][k] = -1; @@ -264,8 +264,8 @@ class TableauRejection //-- std::cout<<" \n alloc nbUV["<(malloc((nbUV[i0] + SIZEUV) * sizeof(double))); + int* NvLigneInd = static_cast(malloc((nbUV[i0] + SIZEUV) * sizeof(int))); //-- //-- Recopie des anciennes valeurs ds la nouvelle ligne //-- @@ -388,13 +388,13 @@ class TableauRejection { ResetTabBit(nTabBit); } - TabBit = (long unsigned**)malloc((nbedgs) * sizeof(long unsigned*)); + TabBit = static_cast(malloc((nbedgs) * sizeof(long unsigned*))); nTabBit = nbedgs; int n = 1 + (nbedgs >> 5); for (int i = 0; i < nbedgs; i++) { - TabBit[i] = (long unsigned*)malloc(n * sizeof(long unsigned)); + TabBit[i] = static_cast(malloc(n * sizeof(long unsigned))); for (int j = 0; j < n; j++) { TabBit[i][j] = 0; @@ -506,21 +506,21 @@ HLRBRep_Data::HLRBRep_Data(const int NV, const int NE, const int NF) myEData(0, NE), myFData(0, NF), myEdgeIndices(0, NE), - myToler((float)1e-5), + myToler(static_cast(1e-5)), myLLProps(2, Epsilon(1.)), myFLProps(2, Epsilon(1.)), mySLProps(2, Epsilon(1.)), myHideCount(0) { myReject = new TableauRejection(); - ((TableauRejection*)myReject)->SetDim(myNbEdges); + (myReject)->SetDim(myNbEdges); } void HLRBRep_Data::Destroy() { //-- std::cout<<"\n HLRBRep_Data::~HLRBRep_Data()"<Destroy(); - delete ((TableauRejection*)myReject); + (myReject)->Destroy(); + delete (myReject); } //================================================================================================= @@ -648,45 +648,45 @@ void HLRBRep_Data::Update(const HLRAlgo_Projector& P) HLRBRep_Curve& EC = ed.ChangeGeometry(); HLRAlgo::InitMinMax(Precision::Infinite(), TotMin, TotMax); tolMinMax = EC.UpdateMinMax(TotMin, TotMax); - tol = (double)(ed.Tolerance()); + tol = static_cast(ed.Tolerance()); ed.Vertical(TotMax[0] - TotMin[0] < tol && TotMax[1] - TotMin[1] < tol && TotMax[2] - TotMin[2] < tol && TotMax[3] - TotMin[3] < tol && TotMax[4] - TotMin[4] < tol && TotMax[5] - TotMin[5] < tol && TotMax[6] - TotMin[6] < tol); HLRAlgo::EnlargeMinMax(tolMinMax, TotMin, TotMax); // Linux warning : assignment to `int' from `double'. Cast has been added. - EdgeMin.Min[0] = (int)((myDeca[0] + TotMin[0]) * mySurD[0]); - EdgeMax.Min[0] = (int)((myDeca[0] + TotMax[0]) * mySurD[0]); - EdgeMin.Min[1] = (int)((myDeca[1] + TotMin[1]) * mySurD[1]); - EdgeMax.Min[1] = (int)((myDeca[1] + TotMax[1]) * mySurD[1]); - EdgeMin.Min[2] = (int)((myDeca[2] + TotMin[2]) * mySurD[2]); - EdgeMax.Min[2] = (int)((myDeca[2] + TotMax[2]) * mySurD[2]); - EdgeMin.Min[3] = (int)((myDeca[3] + TotMin[3]) * mySurD[3]); - EdgeMax.Min[3] = (int)((myDeca[3] + TotMax[3]) * mySurD[3]); - EdgeMin.Min[4] = (int)((myDeca[4] + TotMin[4]) * mySurD[4]); - EdgeMax.Min[4] = (int)((myDeca[4] + TotMax[4]) * mySurD[4]); - EdgeMin.Min[5] = (int)((myDeca[5] + TotMin[5]) * mySurD[5]); - EdgeMax.Min[5] = (int)((myDeca[5] + TotMax[5]) * mySurD[5]); - EdgeMin.Min[6] = (int)((myDeca[6] + TotMin[6]) * mySurD[6]); - EdgeMax.Min[6] = (int)((myDeca[6] + TotMax[6]) * mySurD[6]); - EdgeMin.Min[7] = (int)((myDeca[7] + TotMin[7]) * mySurD[7]); - EdgeMax.Min[7] = (int)((myDeca[7] + TotMax[7]) * mySurD[7]); - EdgeMin.Max[0] = (int)((myDeca[8] + TotMin[8]) * mySurD[8]); - EdgeMax.Max[0] = (int)((myDeca[8] + TotMax[8]) * mySurD[8]); - EdgeMin.Max[1] = (int)((myDeca[9] + TotMin[9]) * mySurD[9]); - EdgeMax.Max[1] = (int)((myDeca[9] + TotMax[9]) * mySurD[9]); - EdgeMin.Max[2] = (int)((myDeca[10] + TotMin[10]) * mySurD[10]); - EdgeMax.Max[2] = (int)((myDeca[10] + TotMax[10]) * mySurD[10]); - EdgeMin.Max[3] = (int)((myDeca[11] + TotMin[11]) * mySurD[11]); - EdgeMax.Max[3] = (int)((myDeca[11] + TotMax[11]) * mySurD[11]); - EdgeMin.Max[4] = (int)((myDeca[12] + TotMin[12]) * mySurD[12]); - EdgeMax.Max[4] = (int)((myDeca[12] + TotMax[12]) * mySurD[12]); - EdgeMin.Max[5] = (int)((myDeca[13] + TotMin[13]) * mySurD[13]); - EdgeMax.Max[5] = (int)((myDeca[13] + TotMax[13]) * mySurD[13]); - EdgeMin.Max[6] = (int)((myDeca[14] + TotMin[14]) * mySurD[14]); - EdgeMax.Max[6] = (int)((myDeca[14] + TotMax[14]) * mySurD[14]); - EdgeMin.Max[7] = (int)((myDeca[15] + TotMin[15]) * mySurD[15]); - EdgeMax.Max[7] = (int)((myDeca[15] + TotMax[15]) * mySurD[15]); + EdgeMin.Min[0] = static_cast((myDeca[0] + TotMin[0]) * mySurD[0]); + EdgeMax.Min[0] = static_cast((myDeca[0] + TotMax[0]) * mySurD[0]); + EdgeMin.Min[1] = static_cast((myDeca[1] + TotMin[1]) * mySurD[1]); + EdgeMax.Min[1] = static_cast((myDeca[1] + TotMax[1]) * mySurD[1]); + EdgeMin.Min[2] = static_cast((myDeca[2] + TotMin[2]) * mySurD[2]); + EdgeMax.Min[2] = static_cast((myDeca[2] + TotMax[2]) * mySurD[2]); + EdgeMin.Min[3] = static_cast((myDeca[3] + TotMin[3]) * mySurD[3]); + EdgeMax.Min[3] = static_cast((myDeca[3] + TotMax[3]) * mySurD[3]); + EdgeMin.Min[4] = static_cast((myDeca[4] + TotMin[4]) * mySurD[4]); + EdgeMax.Min[4] = static_cast((myDeca[4] + TotMax[4]) * mySurD[4]); + EdgeMin.Min[5] = static_cast((myDeca[5] + TotMin[5]) * mySurD[5]); + EdgeMax.Min[5] = static_cast((myDeca[5] + TotMax[5]) * mySurD[5]); + EdgeMin.Min[6] = static_cast((myDeca[6] + TotMin[6]) * mySurD[6]); + EdgeMax.Min[6] = static_cast((myDeca[6] + TotMax[6]) * mySurD[6]); + EdgeMin.Min[7] = static_cast((myDeca[7] + TotMin[7]) * mySurD[7]); + EdgeMax.Min[7] = static_cast((myDeca[7] + TotMax[7]) * mySurD[7]); + EdgeMin.Max[0] = static_cast((myDeca[8] + TotMin[8]) * mySurD[8]); + EdgeMax.Max[0] = static_cast((myDeca[8] + TotMax[8]) * mySurD[8]); + EdgeMin.Max[1] = static_cast((myDeca[9] + TotMin[9]) * mySurD[9]); + EdgeMax.Max[1] = static_cast((myDeca[9] + TotMax[9]) * mySurD[9]); + EdgeMin.Max[2] = static_cast((myDeca[10] + TotMin[10]) * mySurD[10]); + EdgeMax.Max[2] = static_cast((myDeca[10] + TotMax[10]) * mySurD[10]); + EdgeMin.Max[3] = static_cast((myDeca[11] + TotMin[11]) * mySurD[11]); + EdgeMax.Max[3] = static_cast((myDeca[11] + TotMax[11]) * mySurD[11]); + EdgeMin.Max[4] = static_cast((myDeca[12] + TotMin[12]) * mySurD[12]); + EdgeMax.Max[4] = static_cast((myDeca[12] + TotMax[12]) * mySurD[12]); + EdgeMin.Max[5] = static_cast((myDeca[13] + TotMin[13]) * mySurD[13]); + EdgeMax.Max[5] = static_cast((myDeca[13] + TotMax[13]) * mySurD[13]); + EdgeMin.Max[6] = static_cast((myDeca[14] + TotMin[14]) * mySurD[14]); + EdgeMax.Max[6] = static_cast((myDeca[14] + TotMax[14]) * mySurD[14]); + EdgeMin.Max[7] = static_cast((myDeca[15] + TotMin[15]) * mySurD[15]); + EdgeMax.Max[7] = static_cast((myDeca[15] + TotMax[15]) * mySurD[15]); HLRAlgo::EncodeMinMax(EdgeMin, EdgeMax, MinMaxEdge); ed.UpdateMinMax(MinMaxEdge); @@ -795,7 +795,7 @@ void HLRBRep_Data::Update(const HLRAlgo_Projector& P) fd.Cone(iFaceType == GeomAbs_Cone); fd.Sphere(iFaceType == GeomAbs_Sphere); fd.Torus(iFaceType == GeomAbs_Torus); - tol = (double)(fd.Tolerance()); + tol = static_cast(fd.Tolerance()); fd.Side(FS.IsSide(tol, myToler * 10)); bool inverted = false; if (fd.WithOutL() && !fd.Side()) @@ -1081,10 +1081,10 @@ void HLRBRep_Data::NextEdge(const bool skip) myLEMinMax = &myLEData->MinMax(); myLETol = myLEData->Tolerance(); myLEType = myLEGeom->GetType(); - if (((HLRBRep_EdgeData*)myLEData)->Vertical() - || (myLEDouble && ((HLRBRep_EdgeData*)myLEData)->HideCount() == myHideCount - 1)) + if ((myLEData)->Vertical() + || (myLEDouble && (myLEData)->HideCount() == myHideCount - 1)) NextEdge(); - ((HLRBRep_EdgeData*)myLEData)->HideCount(myHideCount - 1); + (myLEData)->HideCount(myHideCount - 1); return; } else @@ -1100,17 +1100,17 @@ void HLRBRep_Data::NextEdge(const bool skip) myLETol = myLEData->Tolerance(); myLEType = myLEGeom->GetType(); } - if (((HLRBRep_EdgeData*)myLEData)->Vertical()) + if ((myLEData)->Vertical()) { NextEdge(); return; } - if (((HLRBRep_EdgeData*)myLEData)->HideCount() > myHideCount - 2) + if ((myLEData)->HideCount() > myHideCount - 2) { NextEdge(); return; } - if (((HLRBRep_EdgeData*)myLEData)->Status().AllHidden()) + if ((myLEData)->Status().AllHidden()) { NextEdge(); return; @@ -1134,7 +1134,7 @@ void HLRBRep_Data::NextEdge(const bool skip) NextEdge(); return; } - if (iFaceGeom->IsAbove(iFaceBack, myLEGeom, (double)myLETol)) + if (iFaceGeom->IsAbove(iFaceBack, myLEGeom, static_cast(myLETol))) { NextEdge(); return; @@ -1157,7 +1157,7 @@ int HLRBRep_Data::Edge() const void HLRBRep_Data::InitInterference() { myLLProps.SetCurve(myLEGeom); - myFaceItr1.InitEdge(*((HLRBRep_FaceData*)iFaceData)); + myFaceItr1.InitEdge(*(iFaceData)); myNbPoints = myNbSegments = iInterf = 0; NextInterference(); } @@ -1204,17 +1204,17 @@ void HLRBRep_Data::NextInterference() myFEInternal = myFaceItr1.Internal(); myFEDouble = myFaceItr1.Double(); myFEData = &myEData(myFE); - myFEGeom = &(((HLRBRep_EdgeData*)myFEData)->ChangeGeometry()); - myFETol = ((HLRBRep_EdgeData*)myFEData)->Tolerance(); - myFEType = ((HLRBRep_Curve*)myFEGeom)->GetType(); + myFEGeom = &((myFEData)->ChangeGeometry()); + myFETol = (myFEData)->Tolerance(); + myFEType = (myFEGeom)->GetType(); if (myFEOri == TopAbs_FORWARD || myFEOri == TopAbs_REVERSED) { // Edge from the boundary - if (!((HLRBRep_EdgeData*)myFEData)->Vertical() && (!myFEDouble || myFEOutLine)) + if (!(myFEData)->Vertical() && (!myFEDouble || myFEOutLine)) { // not a vertical edge and not a double Edge - HLRAlgo_EdgesBlock::MinMaxIndices* MinMaxFEdg = &((HLRBRep_EdgeData*)myFEData)->MinMax(); + HLRAlgo_EdgesBlock::MinMaxIndices* MinMaxFEdg = &(myFEData)->MinMax(); //-- ----------------------------------------------------------------------- //-- Max - Min doit etre positif pour toutes les directions //-- @@ -1228,7 +1228,7 @@ void HLRBRep_Data::NextInterference() //-- LE Min .... LE Max //-- ---------------------------------------------------------------------- - if (!((TableauRejection*)myReject)->NoIntersection(myLE, myFE)) + if (!(myReject)->NoIntersection(myLE, myFE)) { if (((MinMaxFEdg->Max[0] - myLEMinMax->Min[0]) & 0x80008000) == 0 @@ -1251,10 +1251,10 @@ void HLRBRep_Data::NextInterference() bool rej = false; if (myLE == myFE) { // test if an auto-intersection is not useful - if (((HLRBRep_EdgeData*)myLEData)->AutoIntersectionDone()) + if ((myLEData)->AutoIntersectionDone()) { - ((HLRBRep_EdgeData*)myLEData)->AutoIntersectionDone(true); - if (((HLRBRep_EdgeData*)myLEData)->Simple()) + (myLEData)->AutoIntersectionDone(true); + if ((myLEData)->Simple()) { rej = true; } @@ -1334,7 +1334,7 @@ void HLRBRep_Data::NextInterference() else { double su, sv; - ((TableauRejection*)myReject)->GetSingleIntersection(myLE, myFE, su, sv); + (myReject)->GetSingleIntersection(myLE, myFE, su, sv); if (su != RealLast()) { myIntersector.SimulateOnePoint(myLEData, su, myFEData, sv); @@ -1348,7 +1348,7 @@ void HLRBRep_Data::NextInterference() { if (myIntersector.NbPoints() == 1 && myIntersector.NbSegments() == 0) { - ((TableauRejection*)myReject) + (myReject) ->SetIntersection(myLE, myFE, myIntersector.Point(1)); } } @@ -1371,7 +1371,7 @@ void HLRBRep_Data::NextInterference() } else { - ((TableauRejection*)myReject)->SetNoIntersection(myLE, myFE); + (myReject)->SetNoIntersection(myLE, myFE); } } else @@ -1422,9 +1422,9 @@ bool HLRBRep_Data::RejectedInterference() int nseg = n >> 1; if (firstPoint) nseg++; - double pf = ((HLRBRep_Curve*)myLEGeom) + double pf = (const_cast(myLEGeom)) ->Parameter3d(myIntersector.Segment(nseg).FirstPoint().ParamOnFirst()); - double pl = ((HLRBRep_Curve*)myLEGeom) + double pl = (const_cast(myLEGeom)) ->Parameter3d(myIntersector.Segment(nseg).LastPoint().ParamOnFirst()); if (pf > pl) firstPoint = !firstPoint; @@ -1506,7 +1506,7 @@ void HLRBRep_Data::EdgeState(const double p1, gp_Pnt Pbid; gp_Vec TngEdge; - ((HLRBRep_Curve*)myLEGeom)->D1(p1, Pbid, TngEdge); + (const_cast(myLEGeom))->D1(p1, Pbid, TngEdge); const gp_Trsf& TI = myProj.InvertedTransformation(); gp_Dir V; @@ -1836,38 +1836,38 @@ static void REJECT1(const double theDeca[], HLRAlgo_EdgesBlock::MinMaxIndices& theVertMin, HLRAlgo_EdgesBlock::MinMaxIndices& theVertMax) { - theVertMin.Min[0] = (int)((theDeca[0] + theTotMin[0]) * theSurD[0]); - theVertMax.Min[0] = (int)((theDeca[0] + theTotMax[0]) * theSurD[0]); - theVertMin.Min[1] = (int)((theDeca[1] + theTotMin[1]) * theSurD[1]); - theVertMax.Min[1] = (int)((theDeca[1] + theTotMax[1]) * theSurD[1]); - theVertMin.Min[2] = (int)((theDeca[2] + theTotMin[2]) * theSurD[2]); - theVertMax.Min[2] = (int)((theDeca[2] + theTotMax[2]) * theSurD[2]); - theVertMin.Min[3] = (int)((theDeca[3] + theTotMin[3]) * theSurD[3]); - theVertMax.Min[3] = (int)((theDeca[3] + theTotMax[3]) * theSurD[3]); - theVertMin.Min[4] = (int)((theDeca[4] + theTotMin[4]) * theSurD[4]); - theVertMax.Min[4] = (int)((theDeca[4] + theTotMax[4]) * theSurD[4]); - theVertMin.Min[5] = (int)((theDeca[5] + theTotMin[5]) * theSurD[5]); - theVertMax.Min[5] = (int)((theDeca[5] + theTotMax[5]) * theSurD[5]); - theVertMin.Min[6] = (int)((theDeca[6] + theTotMin[6]) * theSurD[6]); - theVertMax.Min[6] = (int)((theDeca[6] + theTotMax[6]) * theSurD[6]); - theVertMin.Min[7] = (int)((theDeca[7] + theTotMin[7]) * theSurD[7]); - theVertMax.Min[7] = (int)((theDeca[7] + theTotMax[7]) * theSurD[7]); - theVertMin.Max[0] = (int)((theDeca[8] + theTotMin[8]) * theSurD[8]); - theVertMax.Max[0] = (int)((theDeca[8] + theTotMax[8]) * theSurD[8]); - theVertMin.Max[1] = (int)((theDeca[9] + theTotMin[9]) * theSurD[9]); - theVertMax.Max[1] = (int)((theDeca[9] + theTotMax[9]) * theSurD[9]); - theVertMin.Max[2] = (int)((theDeca[10] + theTotMin[10]) * theSurD[10]); - theVertMax.Max[2] = (int)((theDeca[10] + theTotMax[10]) * theSurD[10]); - theVertMin.Max[3] = (int)((theDeca[11] + theTotMin[11]) * theSurD[11]); - theVertMax.Max[3] = (int)((theDeca[11] + theTotMax[11]) * theSurD[11]); - theVertMin.Max[4] = (int)((theDeca[12] + theTotMin[12]) * theSurD[12]); - theVertMax.Max[4] = (int)((theDeca[12] + theTotMax[12]) * theSurD[12]); - theVertMin.Max[5] = (int)((theDeca[13] + theTotMin[13]) * theSurD[13]); - theVertMax.Max[5] = (int)((theDeca[13] + theTotMax[13]) * theSurD[13]); - theVertMin.Max[6] = (int)((theDeca[14] + theTotMin[14]) * theSurD[14]); - theVertMax.Max[6] = (int)((theDeca[14] + theTotMax[14]) * theSurD[14]); - theVertMin.Max[7] = (int)((theDeca[15] + theTotMin[15]) * theSurD[15]); - theVertMax.Max[7] = (int)((theDeca[15] + theTotMax[15]) * theSurD[15]); + theVertMin.Min[0] = static_cast((theDeca[0] + theTotMin[0]) * theSurD[0]); + theVertMax.Min[0] = static_cast((theDeca[0] + theTotMax[0]) * theSurD[0]); + theVertMin.Min[1] = static_cast((theDeca[1] + theTotMin[1]) * theSurD[1]); + theVertMax.Min[1] = static_cast((theDeca[1] + theTotMax[1]) * theSurD[1]); + theVertMin.Min[2] = static_cast((theDeca[2] + theTotMin[2]) * theSurD[2]); + theVertMax.Min[2] = static_cast((theDeca[2] + theTotMax[2]) * theSurD[2]); + theVertMin.Min[3] = static_cast((theDeca[3] + theTotMin[3]) * theSurD[3]); + theVertMax.Min[3] = static_cast((theDeca[3] + theTotMax[3]) * theSurD[3]); + theVertMin.Min[4] = static_cast((theDeca[4] + theTotMin[4]) * theSurD[4]); + theVertMax.Min[4] = static_cast((theDeca[4] + theTotMax[4]) * theSurD[4]); + theVertMin.Min[5] = static_cast((theDeca[5] + theTotMin[5]) * theSurD[5]); + theVertMax.Min[5] = static_cast((theDeca[5] + theTotMax[5]) * theSurD[5]); + theVertMin.Min[6] = static_cast((theDeca[6] + theTotMin[6]) * theSurD[6]); + theVertMax.Min[6] = static_cast((theDeca[6] + theTotMax[6]) * theSurD[6]); + theVertMin.Min[7] = static_cast((theDeca[7] + theTotMin[7]) * theSurD[7]); + theVertMax.Min[7] = static_cast((theDeca[7] + theTotMax[7]) * theSurD[7]); + theVertMin.Max[0] = static_cast((theDeca[8] + theTotMin[8]) * theSurD[8]); + theVertMax.Max[0] = static_cast((theDeca[8] + theTotMax[8]) * theSurD[8]); + theVertMin.Max[1] = static_cast((theDeca[9] + theTotMin[9]) * theSurD[9]); + theVertMax.Max[1] = static_cast((theDeca[9] + theTotMax[9]) * theSurD[9]); + theVertMin.Max[2] = static_cast((theDeca[10] + theTotMin[10]) * theSurD[10]); + theVertMax.Max[2] = static_cast((theDeca[10] + theTotMax[10]) * theSurD[10]); + theVertMin.Max[3] = static_cast((theDeca[11] + theTotMin[11]) * theSurD[11]); + theVertMax.Max[3] = static_cast((theDeca[11] + theTotMax[11]) * theSurD[11]); + theVertMin.Max[4] = static_cast((theDeca[12] + theTotMin[12]) * theSurD[12]); + theVertMax.Max[4] = static_cast((theDeca[12] + theTotMax[12]) * theSurD[12]); + theVertMin.Max[5] = static_cast((theDeca[13] + theTotMin[13]) * theSurD[13]); + theVertMax.Max[5] = static_cast((theDeca[13] + theTotMax[13]) * theSurD[13]); + theVertMin.Max[6] = static_cast((theDeca[14] + theTotMin[14]) * theSurD[14]); + theVertMax.Max[6] = static_cast((theDeca[14] + theTotMax[14]) * theSurD[14]); + theVertMin.Max[7] = static_cast((theDeca[15] + theTotMin[15]) * theSurD[15]); + theVertMax.Max[7] = static_cast((theDeca[15] + theTotMax[15]) * theSurD[15]); } } // namespace @@ -1890,7 +1890,7 @@ TopAbs_State HLRBRep_Data::Classify(const int E, // bool rej = false; const HLRBRep_Curve& EC = ED.Geometry(); double sta, xsta, ysta, zsta, end, xend, yend, zend; - double tol = (double)(ED.Tolerance()); + double tol = static_cast(ED.Tolerance()); if (LevelFlag) { @@ -2154,7 +2154,7 @@ TopAbs_State HLRBRep_Data::SimplClassify(const int /*E*/, // bool rej = false; const HLRBRep_Curve& EC = ED.Geometry(); double sta, xsta, ysta, zsta, dp; - double tol = (double)(ED.Tolerance()); + double tol = static_cast(ED.Tolerance()); dp = (p2 - p1) / (Nbp + 1); @@ -2213,9 +2213,9 @@ bool HLRBRep_Data::RejectedPoint(const IntRes2d_IntersectionPoint& PInter, const IntRes2d_Transition* Tr2; double TolZ = myBigSize * 0.00001; - p1 = ((HLRBRep_Curve*)myLEGeom)->Parameter3d(PInter.ParamOnFirst()); - p2 = ((HLRBRep_Curve*)myFEGeom)->Parameter3d(PInter.ParamOnSecond()); - dz = ((HLRBRep_Curve*)myLEGeom)->Z(p1) - ((HLRBRep_Curve*)myFEGeom)->Z(p2); + p1 = (const_cast(myLEGeom))->Parameter3d(PInter.ParamOnFirst()); + p2 = (myFEGeom)->Parameter3d(PInter.ParamOnSecond()); + dz = (const_cast(myLEGeom))->Z(p1) - (myFEGeom)->Z(p2); if (myLE == myFE) { // auto intersection can be inverted @@ -2253,7 +2253,7 @@ bool HLRBRep_Data::RejectedPoint(const IntRes2d_IntersectionPoint& PInter, if (myLE == myFE) { if (st == TopAbs_IN) - ((HLRBRep_EdgeData*)myLEData)->Simple(false); + (myLEData)->Simple(false); } else { @@ -2323,32 +2323,32 @@ bool HLRBRep_Data::RejectedPoint(const IntRes2d_IntersectionPoint& PInter, gp_Vec2d Tgsav, Nmsav; if (Tr2->PositionOnCurve() == IntRes2d_Head) { - Ind = ((HLRBRep_EdgeData*)myFEData)->VSta(); + Ind = (myFEData)->VSta(); Or2 = TopAbs_FORWARD; - AdjustParameter((HLRBRep_EdgeData*)myFEData, true, p2, t2); - if (((HLRBRep_EdgeData*)myFEData)->VerAtSta()) + AdjustParameter(myFEData, true, p2, t2); + if ((myFEData)->VerAtSta()) { douteux = true; - ((HLRBRep_Curve*)myFEGeom)->D2(psav, Ptsav, Tgsav, Nmsav); + (myFEGeom)->D2(psav, Ptsav, Tgsav, Nmsav); if (Tgsav.SquareMagnitude() <= DERIVEE_PREMIERE_NULLE) Tgsav = Nmsav; } } else { - Ind = ((HLRBRep_EdgeData*)myFEData)->VEnd(); + Ind = (myFEData)->VEnd(); Or2 = TopAbs_REVERSED; - AdjustParameter((HLRBRep_EdgeData*)myFEData, false, p2, t2); - if (((HLRBRep_EdgeData*)myFEData)->VerAtEnd()) + AdjustParameter(myFEData, false, p2, t2); + if ((myFEData)->VerAtEnd()) { douteux = true; - ((HLRBRep_Curve*)myFEGeom)->D2(psav, Ptsav, Tgsav, Nmsav); + (myFEGeom)->D2(psav, Ptsav, Tgsav, Nmsav); if (Tgsav.SquareMagnitude() <= DERIVEE_PREMIERE_NULLE) Tgsav = Nmsav; } } gp_Vec2d TgFE; - ((HLRBRep_Curve*)myFEGeom)->D1(p2, Ptsav, TgFE); + (myFEGeom)->D1(p2, Ptsav, TgFE); if (douteux) { if (TgFE.XY().Dot(Tgsav.XY()) < 0.0) @@ -2369,22 +2369,22 @@ bool HLRBRep_Data::RejectedPoint(const IntRes2d_IntersectionPoint& PInter, gp_Vec2d Tgsav, Nmsav; if (Ori == TopAbs_FORWARD) { - AdjustParameter((HLRBRep_EdgeData*)myLEData, true, p1, t1); - if (((HLRBRep_EdgeData*)myLEData)->VerAtSta()) + AdjustParameter(myLEData, true, p1, t1); + if ((myLEData)->VerAtSta()) { douteux = true; - ((HLRBRep_Curve*)myLEGeom)->D2(psav, Ptsav, Tgsav, Nmsav); + (const_cast(myLEGeom))->D2(psav, Ptsav, Tgsav, Nmsav); if (Tgsav.SquareMagnitude() <= DERIVEE_PREMIERE_NULLE) Tgsav = Nmsav; } } else { - AdjustParameter((HLRBRep_EdgeData*)myLEData, false, p1, t1); - if (((HLRBRep_EdgeData*)myLEData)->VerAtEnd()) + AdjustParameter(myLEData, false, p1, t1); + if ((myLEData)->VerAtEnd()) { douteux = true; - ((HLRBRep_Curve*)myLEGeom)->D2(psav, Ptsav, Tgsav, Nmsav); + (const_cast(myLEGeom))->D2(psav, Ptsav, Tgsav, Nmsav); if (Tgsav.SquareMagnitude() <= DERIVEE_PREMIERE_NULLE) Tgsav = Nmsav; } @@ -2392,7 +2392,7 @@ bool HLRBRep_Data::RejectedPoint(const IntRes2d_IntersectionPoint& PInter, if (douteux) { gp_Vec2d TgLE; - ((HLRBRep_Curve*)myLEGeom)->D1(p1, Ptsav, TgLE); + (const_cast(myLEGeom))->D1(p1, Ptsav, TgLE); if (TgLE.XY().Dot(Tgsav.XY()) < 0.0) { if (Orie == TopAbs_FORWARD) @@ -2441,13 +2441,13 @@ bool HLRBRep_Data::SameVertex(const bool h1, const bool h2) { int v1, v2; if (h1) - v1 = ((HLRBRep_EdgeData*)myLEData)->VSta(); + v1 = (myLEData)->VSta(); else - v1 = ((HLRBRep_EdgeData*)myLEData)->VEnd(); + v1 = (myLEData)->VEnd(); if (h2) - v2 = ((HLRBRep_EdgeData*)myFEData)->VSta(); + v2 = (myFEData)->VSta(); else - v2 = ((HLRBRep_EdgeData*)myFEData)->VEnd(); + v2 = (myFEData)->VEnd(); bool SameV = v1 == v2; if (SameV) { @@ -2458,8 +2458,8 @@ bool HLRBRep_Data::SameVertex(const bool h1, const bool h2) bool otherCase = true; - if ((h1 && ((HLRBRep_EdgeData*)myLEData)->OutLVSta()) - || (!h1 && ((HLRBRep_EdgeData*)myLEData)->OutLVEnd())) + if ((h1 && (myLEData)->OutLVSta()) + || (!h1 && (myLEData)->OutLVEnd())) { if (iFaceTest || myLEInternal) otherCase = false; @@ -2469,8 +2469,8 @@ bool HLRBRep_Data::SameVertex(const bool h1, const bool h2) if (otherCase) { - if ((h1 && ((HLRBRep_EdgeData*)myLEData)->CutAtSta()) - || (!h1 && ((HLRBRep_EdgeData*)myLEData)->CutAtEnd())) + if ((h1 && (myLEData)->CutAtSta()) + || (!h1 && (myLEData)->CutAtEnd())) { myIntersected = false; // two connected OutLines do not } // intersect themselves. diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeData.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeData.cxx index fad2f64f308..56816d1c72c 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeData.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeData.cxx @@ -38,7 +38,7 @@ void HLRBRep_EdgeData::Set(const bool Rg1L, RgNLine(RgNL); Used(false); ChangeGeometry().Curve(EG); - myTolerance = (float)(BRep_Tool::Tolerance(EG)); + myTolerance = static_cast(BRep_Tool::Tolerance(EG)); VSta(V1); VEnd(V2); OutLVSta(Out1); @@ -46,7 +46,7 @@ void HLRBRep_EdgeData::Set(const bool Rg1L, CutAtSta(Cut1); CutAtEnd(Cut2); Status().Initialize(Start, - (float)(ChangeGeometry().Curve().Resolution((double)TolStart)), + static_cast(ChangeGeometry().Curve().Resolution(static_cast(TolStart))), End, - (float)(ChangeGeometry().Curve().Resolution((double)TolEnd))); + static_cast(ChangeGeometry().Curve().Resolution(static_cast(TolEnd)))); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeFaceTool.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeFaceTool.cxx index ebf66c1f479..661150e754e 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeFaceTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeFaceTool.cxx @@ -33,7 +33,7 @@ double HLRBRep_EdgeFaceTool::CurvatureValue(const HLRBRep_SurfacePtr F, { gp_Pnt P; gp_Vec D1U, D1V, D2U, D2V, D2UV; - ((HLRBRep_Surface*)F)->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV); + (static_cast(F))->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV); double d1ut = D1U * Tg; double d1vt = D1V * Tg; double d1ud1v = D1U * D1V; @@ -65,14 +65,14 @@ bool HLRBRep_EdgeFaceTool::UVPoint(const double Par, double& V) { double pfbid, plbid; - if (BRep_Tool::CurveOnSurface(((HLRBRep_Curve*)E)->Curve().Edge(), - ((HLRBRep_Surface*)F)->Surface().Face(), + if (BRep_Tool::CurveOnSurface((static_cast(E))->Curve().Edge(), + (static_cast(F))->Surface().Face(), pfbid, plbid) .IsNull()) { - BRepExtrema_ExtPF proj(BRepLib_MakeVertex(((HLRBRep_Curve*)E)->Value3D(Par)), - ((HLRBRep_Surface*)F)->Surface().Face()); + BRepExtrema_ExtPF proj(BRepLib_MakeVertex((static_cast(E))->Value3D(Par)), + (static_cast(F))->Surface().Face()); int i, index = 0; double dist2 = RealLast(); const int n = proj.NbExt(); @@ -92,8 +92,8 @@ bool HLRBRep_EdgeFaceTool::UVPoint(const double Par, } else { - BRepAdaptor_Curve2d PC(((HLRBRep_Curve*)E)->Curve().Edge(), - ((HLRBRep_Surface*)F)->Surface().Face()); + BRepAdaptor_Curve2d PC((static_cast(E))->Curve().Edge(), + (static_cast(F))->Surface().Face()); gp_Pnt2d P2d; PC.D0(Par, P2d); U = P2d.X(); diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_FaceData.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_FaceData.cxx index 23f7b529042..5056d4ffdf7 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_FaceData.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_FaceData.cxx @@ -38,7 +38,7 @@ void HLRBRep_FaceData::Set(const TopoDS_Face& FG, { Closed(Cl); Geometry().Surface(FG); - myTolerance = (float)(BRep_Tool::Tolerance(FG)); + myTolerance = static_cast(BRep_Tool::Tolerance(FG)); Orientation(Or); Wires() = new HLRAlgo_WiresBlock(NW); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_FaceData.lxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_FaceData.lxx index 9227041a00d..ec952f18bd6 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_FaceData.lxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_FaceData.lxx @@ -18,7 +18,7 @@ inline bool HLRBRep_FaceData::Selected() const { - return (myFlags & (int)FMaskSelected) != 0; + return (myFlags & static_cast(FMaskSelected)) != 0; } //================================================================================================= @@ -26,16 +26,16 @@ inline bool HLRBRep_FaceData::Selected() const inline void HLRBRep_FaceData::Selected(const bool B) { if (B) - myFlags |= (int)FMaskSelected; + myFlags |= static_cast(FMaskSelected); else - myFlags &= ~((int)FMaskSelected); + myFlags &= ~(static_cast(FMaskSelected)); } //================================================================================================= inline bool HLRBRep_FaceData::Back() const { - return (myFlags & (int)FMaskBack) != 0; + return (myFlags & static_cast(FMaskBack)) != 0; } //================================================================================================= @@ -43,16 +43,16 @@ inline bool HLRBRep_FaceData::Back() const inline void HLRBRep_FaceData::Back(const bool B) { if (B) - myFlags |= (int)FMaskBack; + myFlags |= static_cast(FMaskBack); else - myFlags &= ~((int)FMaskBack); + myFlags &= ~(static_cast(FMaskBack)); } //================================================================================================= inline bool HLRBRep_FaceData::Side() const { - return (myFlags & (int)FMaskSide) != 0; + return (myFlags & static_cast(FMaskSide)) != 0; } //================================================================================================= @@ -60,16 +60,16 @@ inline bool HLRBRep_FaceData::Side() const inline void HLRBRep_FaceData::Side(const bool B) { if (B) - myFlags |= (int)FMaskSide; + myFlags |= static_cast(FMaskSide); else - myFlags &= ~((int)FMaskSide); + myFlags &= ~(static_cast(FMaskSide)); } //================================================================================================= inline bool HLRBRep_FaceData::Closed() const { - return (myFlags & (int)FMaskClosed) != 0; + return (myFlags & static_cast(FMaskClosed)) != 0; } //================================================================================================= @@ -77,16 +77,16 @@ inline bool HLRBRep_FaceData::Closed() const inline void HLRBRep_FaceData::Closed(const bool B) { if (B) - myFlags |= (int)FMaskClosed; + myFlags |= static_cast(FMaskClosed); else - myFlags &= ~((int)FMaskClosed); + myFlags &= ~(static_cast(FMaskClosed)); } //================================================================================================= inline bool HLRBRep_FaceData::Hiding() const { - return (myFlags & (int)FMaskHiding) != 0; + return (myFlags & static_cast(FMaskHiding)) != 0; } //================================================================================================= @@ -94,16 +94,16 @@ inline bool HLRBRep_FaceData::Hiding() const inline void HLRBRep_FaceData::Hiding(const bool B) { if (B) - myFlags |= (int)FMaskHiding; + myFlags |= static_cast(FMaskHiding); else - myFlags &= ~((int)FMaskHiding); + myFlags &= ~(static_cast(FMaskHiding)); } //================================================================================================= inline bool HLRBRep_FaceData::Simple() const { - return (myFlags & (int)FMaskSimple) != 0; + return (myFlags & static_cast(FMaskSimple)) != 0; } //================================================================================================= @@ -111,16 +111,16 @@ inline bool HLRBRep_FaceData::Simple() const inline void HLRBRep_FaceData::Simple(const bool B) { if (B) - myFlags |= (int)FMaskSimple; + myFlags |= static_cast(FMaskSimple); else - myFlags &= ~((int)FMaskSimple); + myFlags &= ~(static_cast(FMaskSimple)); } //================================================================================================= inline bool HLRBRep_FaceData::Cut() const { - return (myFlags & (int)FMaskCut) != 0; + return (myFlags & static_cast(FMaskCut)) != 0; } //================================================================================================= @@ -128,16 +128,16 @@ inline bool HLRBRep_FaceData::Cut() const inline void HLRBRep_FaceData::Cut(const bool B) { if (B) - myFlags |= (int)FMaskCut; + myFlags |= static_cast(FMaskCut); else - myFlags &= ~((int)FMaskCut); + myFlags &= ~(static_cast(FMaskCut)); } //================================================================================================= inline bool HLRBRep_FaceData::WithOutL() const { - return (myFlags & (int)FMaskWithOutL) != 0; + return (myFlags & static_cast(FMaskWithOutL)) != 0; } //================================================================================================= @@ -145,16 +145,16 @@ inline bool HLRBRep_FaceData::WithOutL() const inline void HLRBRep_FaceData::WithOutL(const bool B) { if (B) - myFlags |= (int)FMaskWithOutL; + myFlags |= static_cast(FMaskWithOutL); else - myFlags &= ~((int)FMaskWithOutL); + myFlags &= ~(static_cast(FMaskWithOutL)); } //================================================================================================= inline bool HLRBRep_FaceData::Plane() const { - return (myFlags & (int)FMaskPlane) != 0; + return (myFlags & static_cast(FMaskPlane)) != 0; } //================================================================================================= @@ -162,16 +162,16 @@ inline bool HLRBRep_FaceData::Plane() const inline void HLRBRep_FaceData::Plane(const bool B) { if (B) - myFlags |= (int)FMaskPlane; + myFlags |= static_cast(FMaskPlane); else - myFlags &= ~((int)FMaskPlane); + myFlags &= ~(static_cast(FMaskPlane)); } //================================================================================================= inline bool HLRBRep_FaceData::Cylinder() const { - return (myFlags & (int)FMaskCylinder) != 0; + return (myFlags & static_cast(FMaskCylinder)) != 0; } //================================================================================================= @@ -179,16 +179,16 @@ inline bool HLRBRep_FaceData::Cylinder() const inline void HLRBRep_FaceData::Cylinder(const bool B) { if (B) - myFlags |= (int)FMaskCylinder; + myFlags |= static_cast(FMaskCylinder); else - myFlags &= ~((int)FMaskCylinder); + myFlags &= ~(static_cast(FMaskCylinder)); } //================================================================================================= inline bool HLRBRep_FaceData::Cone() const { - return (myFlags & (int)FMaskCone) != 0; + return (myFlags & static_cast(FMaskCone)) != 0; } //================================================================================================= @@ -196,16 +196,16 @@ inline bool HLRBRep_FaceData::Cone() const inline void HLRBRep_FaceData::Cone(const bool B) { if (B) - myFlags |= (int)FMaskCone; + myFlags |= static_cast(FMaskCone); else - myFlags &= ~((int)FMaskCone); + myFlags &= ~(static_cast(FMaskCone)); } //================================================================================================= inline bool HLRBRep_FaceData::Sphere() const { - return (myFlags & (int)FMaskSphere) != 0; + return (myFlags & static_cast(FMaskSphere)) != 0; } //================================================================================================= @@ -213,16 +213,16 @@ inline bool HLRBRep_FaceData::Sphere() const inline void HLRBRep_FaceData::Sphere(const bool B) { if (B) - myFlags |= (int)FMaskSphere; + myFlags |= static_cast(FMaskSphere); else - myFlags &= ~((int)FMaskSphere); + myFlags &= ~(static_cast(FMaskSphere)); } //================================================================================================= inline bool HLRBRep_FaceData::Torus() const { - return (myFlags & (int)FMaskTorus) != 0; + return (myFlags & static_cast(FMaskTorus)) != 0; } //================================================================================================= @@ -230,9 +230,9 @@ inline bool HLRBRep_FaceData::Torus() const inline void HLRBRep_FaceData::Torus(const bool B) { if (B) - myFlags |= (int)FMaskTorus; + myFlags |= static_cast(FMaskTorus); else - myFlags &= ~((int)FMaskTorus); + myFlags &= ~(static_cast(FMaskTorus)); } //================================================================================================= @@ -253,15 +253,15 @@ inline void HLRBRep_FaceData::Size(const double S) inline TopAbs_Orientation HLRBRep_FaceData::Orientation() const { - return ((TopAbs_Orientation)(myFlags & (int)EMaskOrient)); + return (static_cast(myFlags & static_cast(EMaskOrient))); } //================================================================================================= inline void HLRBRep_FaceData::Orientation(const TopAbs_Orientation O) { - myFlags &= ~(int)EMaskOrient; - myFlags |= ((int)O & (int)EMaskOrient); + myFlags &= ~static_cast(EMaskOrient); + myFlags |= (static_cast(O) & static_cast(EMaskOrient)); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx index cdcc2885d75..c95abd8661a 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx @@ -115,7 +115,7 @@ void HLRBRep_Intersector::Perform(HLRBRep_EdgeData* theEdge1, myC1->D0(b, pb); a = myC1->Parameter2d(a); b = myC1->Parameter2d(b); - IntRes2d_Domain D1(pa, a, (double)ta, pb, b, (double)tb); + IntRes2d_Domain D1(pa, a, static_cast(ta), pb, b, static_cast(tb)); // modified by jgv, 18.04.2016 for OCC27341 // tol = (double)(((HLRBRep_EdgeData*) A1)->Tolerance()); @@ -252,11 +252,11 @@ void HLRBRep_Intersector::Perform(const int /*theNA*/, } if (ta > tol) - ta = (float)tol; + ta = static_cast(tol); if (tb > tol) - tb = (float)tol; + tb = static_cast(tol); - IntRes2d_Domain D1(pa1, a1, (double)ta, pb1, b1, (double)tb); + IntRes2d_Domain D1(pa1, a1, static_cast(ta), pb1, b1, static_cast(tb)); theEdge2->Status().Bounds(a2, ta, b2, tb); mtol = tol; @@ -335,11 +335,11 @@ void HLRBRep_Intersector::Perform(const int /*theNA*/, } if (ta > tol) - ta = (float)tol; + ta = static_cast(tol); if (tb > tol) - tb = (float)tol; + tb = static_cast(tol); - IntRes2d_Domain D2(pa2, a2, (double)ta, pb2, b2, (double)tb); + IntRes2d_Domain D2(pa2, a2, static_cast(ta), pb2, b2, static_cast(tb)); if (theEnBout) { @@ -577,7 +577,7 @@ void HLRBRep_Intersector::Perform(const gp_Lin& L, const double P) myCSIntersector.Perform(L, Polygon, mySurface, - *((HLRBRep_ThePolyhedronOfInterCSurf*)myPolyhedron)); + *(myPolyhedron)); break; } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter_0.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter_0.cxx index 68be4f7d39d..0c5da1b1418 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter_0.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter_0.cxx @@ -33,7 +33,7 @@ bool HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter::Value(const double& ApproxDistance) { ApproxDistance = - TheImpTool.Distance(HLRBRep_CurveTool::Value((*((HLRBRep_CurvePtr*)(TheParCurve))), Param)); + TheImpTool.Distance(HLRBRep_CurveTool::Value((*(static_cast(TheParCurve))), Param)); return (true); } @@ -44,8 +44,8 @@ bool HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter::Derivative( gp_Pnt2d Pt; gp_Vec2d TanParCurve; gp_Vec2d Grad = - TheImpTool.GradDistance(HLRBRep_CurveTool::Value((*((HLRBRep_CurvePtr*)(TheParCurve))), Param)); - HLRBRep_CurveTool::D1((*((HLRBRep_CurvePtr*)(TheParCurve))), Param, Pt, TanParCurve); + TheImpTool.GradDistance(HLRBRep_CurveTool::Value((*(static_cast(TheParCurve))), Param)); + HLRBRep_CurveTool::D1((*(static_cast(TheParCurve))), Param, Pt, TanParCurve); D_ApproxDistance_DV = Grad.Dot(TanParCurve); return (true); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLPropsATool.lxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLPropsATool.lxx index af63c783c03..b97c76a33cd 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLPropsATool.lxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SLPropsATool.lxx @@ -25,7 +25,7 @@ inline void HLRBRep_SLPropsATool::Value(const HLRBRep_SurfacePtr A, const double V, gp_Pnt& P) { - P = ((HLRBRep_Surface*)A)->Value(U, V); + P = (static_cast(A))->Value(U, V); } //================================================================================================= @@ -37,7 +37,7 @@ inline void HLRBRep_SLPropsATool::D1(const HLRBRep_SurfacePtr A, gp_Vec& D1U, gp_Vec& D1V) { - ((HLRBRep_Surface*)A)->D1(U, V, P, D1U, D1V); + (static_cast(A))->D1(U, V, P, D1U, D1V); } //================================================================================================= @@ -52,7 +52,7 @@ inline void HLRBRep_SLPropsATool::D2(const HLRBRep_SurfacePtr A, gp_Vec& D2V, gp_Vec& DUV) { - ((HLRBRep_Surface*)A)->D2(U, V, P, D1U, D1V, D2U, D2V, DUV); + (static_cast(A))->D2(U, V, P, D1U, D1V, D2U, D2V, DUV); } //================================================================================================= @@ -63,7 +63,7 @@ inline gp_Vec HLRBRep_SLPropsATool::DN(const HLRBRep_SurfacePtr A, const int Nu, const int Nv) { - return ((HLRBRep_Surface*)A)->DN(U, V, Nu, Nv); + return (static_cast(A))->DN(U, V, Nu, Nv); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ShapeToHLR.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ShapeToHLR.cxx index dc89fc0674b..2eb026fe769 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ShapeToHLR.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_ShapeToHLR.cxx @@ -130,14 +130,14 @@ occ::handle HLRBRep_ShapeToHLR::Load( o1 = false; c1 = false; pf = RealFirst(); - tf = (float)Epsilon(pf); + tf = static_cast(Epsilon(pf)); } else { i1 = VerticesToEdges.FindIndex(VF); o1 = TopDS.IsOutV(VF); c1 = TopDS.IsIntV(VF); - tf = (float)BRep_Tool::Tolerance(VF); + tf = static_cast(BRep_Tool::Tolerance(VF)); } if (VL.IsNull()) @@ -146,14 +146,14 @@ occ::handle HLRBRep_ShapeToHLR::Load( o2 = false; c2 = false; pl = RealLast(); - tl = (float)Epsilon(pl); + tl = static_cast(Epsilon(pl)); } else { i2 = VerticesToEdges.FindIndex(VL); o2 = TopDS.IsOutV(VL); c2 = TopDS.IsIntV(VL); - tl = (float)BRep_Tool::Tolerance(VL); + tl = static_cast(BRep_Tool::Tolerance(VL)); } ed->Set(reg1, regn, Edg, i1, i2, o1, o2, c1, c2, pf, tf, pl, tl); diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.cxx index 36b89b49649..af2e3bb42b6 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Surface.cxx @@ -75,7 +75,7 @@ bool HLRBRep_Surface::SideRowsOfPoles(const double tol, int iu, iv; double x0, y0, x, y, z; bool result; - double tole = (double)tol; + double tole = tol; const gp_Trsf& T = myProj->Transformation(); for (iu = 1; iu <= nbuPoles; iu++) diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx index e35c034feb9..a7dd2d553e4 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_SurfaceTool.cxx @@ -114,7 +114,7 @@ int HLRBRep_SurfaceTool::NbSamplesU(const HLRBRep_Surface* theSurf, { const double uf = FirstUParameter(theSurf); const double ul = LastUParameter(theSurf); - n *= (int)((theU2 - theU1) / (uf - ul)); + n *= static_cast((theU2 - theU1) / (uf - ul)); if (n > nbs) n = nbs; if (n < 5) @@ -135,7 +135,7 @@ int HLRBRep_SurfaceTool::NbSamplesV(const HLRBRep_Surface* theSurf, { const double vf = FirstVParameter(theSurf); const double vl = LastVParameter(theSurf); - n *= (int)((theV2 - theV1) / (vf - vl)); + n *= static_cast((theV2 - theV1) / (vf - vl)); if (n > nbs) n = nbs; if (n < 5) diff --git a/src/ModelingAlgorithms/TKHLR/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx b/src/ModelingAlgorithms/TKHLR/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx index d08b7f3c520..96f93fe7e07 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx @@ -229,8 +229,8 @@ void HLRTopoBRep_DSFiller::InsertFace(const int /*FI*/, case Contap_Walking: { // copy the points - int ipF = int(parF); - int ipL = int(parL); + int ipF = static_cast(parF); + int ipL = static_cast(parL); if (ipL - ipF < 1) { @@ -319,7 +319,7 @@ void HLRTopoBRep_DSFiller::InsertFace(const int /*FI*/, for (int i = 1; i <= nbp; i++) { - knots.SetValue(i, (double)i); + knots.SetValue(i, static_cast(i)); mults.SetValue(i, 1); Points.SetValue(i, Line.Point(i + ipF - 1).Value()); } @@ -354,7 +354,7 @@ void HLRTopoBRep_DSFiller::InsertFace(const int /*FI*/, for (int i = 1; i <= nbp; i++) { - knots.SetValue(i, (double)i); + knots.SetValue(i, static_cast(i)); mults.SetValue(i, 1); const gp_Pnt& P = Line.Point(i + ipF - 1).Value(); if (P.X() < Minx) diff --git a/src/ModelingAlgorithms/TKHLR/HLRTopoBRep/HLRTopoBRep_FaceIsoLiner.cxx b/src/ModelingAlgorithms/TKHLR/HLRTopoBRep/HLRTopoBRep_FaceIsoLiner.cxx index c304b713cce..e3784761e49 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRTopoBRep/HLRTopoBRep_FaceIsoLiner.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRTopoBRep/HLRTopoBRep_FaceIsoLiner.cxx @@ -178,7 +178,7 @@ void HLRTopoBRep_FaceIsoLiner::Perform(const int FI, // Courbes Iso U. //----------------------------------------------------------------------- - double StepU = DeltaU / (double)nbIsos; + double StepU = DeltaU / static_cast(nbIsos); if (StepU > Confusion) { double UPrm = UMin + StepU / 2.; @@ -281,7 +281,7 @@ void HLRTopoBRep_FaceIsoLiner::Perform(const int FI, // Courbes Iso V. //----------------------------------------------------------------------- - double StepV = DeltaV / (double)nbIsos; + double StepV = DeltaV / static_cast(nbIsos); if (StepV > Confusion) { double VPrm = VMin + StepV / 2.; diff --git a/src/ModelingAlgorithms/TKHLR/Intrv/Intrv_Interval.cxx b/src/ModelingAlgorithms/TKHLR/Intrv/Intrv_Interval.cxx index 3f080d1d0de..497793e2dbf 100644 --- a/src/ModelingAlgorithms/TKHLR/Intrv/Intrv_Interval.cxx +++ b/src/ModelingAlgorithms/TKHLR/Intrv/Intrv_Interval.cxx @@ -36,8 +36,8 @@ Intrv_Interval::Intrv_Interval() : myStart(RealFirst()), myEnd(RealLast()) { - myTolStart = (float)Epsilon(RealFirst()); - myTolEnd = (float)Epsilon(RealLast()); + myTolStart = static_cast(Epsilon(RealFirst())); + myTolEnd = static_cast(Epsilon(RealLast())); } //================================================================================================= @@ -46,8 +46,8 @@ Intrv_Interval::Intrv_Interval(const double Start, const double End) : myStart(Start), myEnd(End) { - myTolStart = (float)Epsilon(myStart); - myTolEnd = (float)Epsilon(myEnd); + myTolStart = static_cast(Epsilon(myStart)); + myTolEnd = static_cast(Epsilon(myEnd)); } //================================================================================================= @@ -61,8 +61,8 @@ Intrv_Interval::Intrv_Interval(const double Start, myTolStart(TolStart), myTolEnd(TolEnd) { - float epsStart = (float)Epsilon(myStart); - float epsEnd = (float)Epsilon(myEnd); + float epsStart = static_cast(Epsilon(myStart)); + float epsEnd = static_cast(Epsilon(myEnd)); if (myTolStart < epsStart) myTolStart = epsStart; if (myTolEnd < epsEnd) diff --git a/src/ModelingAlgorithms/TKHLR/Intrv/Intrv_Interval.lxx b/src/ModelingAlgorithms/TKHLR/Intrv/Intrv_Interval.lxx index ba6250af611..10352544de6 100644 --- a/src/ModelingAlgorithms/TKHLR/Intrv/Intrv_Interval.lxx +++ b/src/ModelingAlgorithms/TKHLR/Intrv/Intrv_Interval.lxx @@ -92,7 +92,7 @@ inline void Intrv_Interval::FuseAtStart(const double Start, const float TolStart double a = std::min(myStart - myTolStart, Start - TolStart); double b = std::min(myStart + myTolStart, Start + TolStart); myStart = (a + b) / 2; - myTolStart = (float)(b - a) / 2; + myTolStart = static_cast(b - a) / 2; } } @@ -113,7 +113,7 @@ inline void Intrv_Interval::CutAtStart(const double Start, const float TolStart) double a = std::max(myStart - myTolStart, Start - TolStart); double b = std::max(myStart + myTolStart, Start + TolStart); myStart = (a + b) / 2; - myTolStart = (float)(b - a) / 2; + myTolStart = static_cast(b - a) / 2; } } @@ -142,7 +142,7 @@ inline void Intrv_Interval::FuseAtEnd(const double End, const float TolEnd) double a = std::max(myEnd - myTolEnd, End - TolEnd); double b = std::max(myEnd + myTolEnd, End + TolEnd); myEnd = (a + b) / 2; - myTolEnd = (float)(b - a) / 2; + myTolEnd = static_cast(b - a) / 2; } } @@ -163,7 +163,7 @@ inline void Intrv_Interval::CutAtEnd(const double End, const float TolEnd) double a = std::min(myEnd - myTolEnd, End - TolEnd); double b = std::min(myEnd + myTolEnd, End + TolEnd); myEnd = (a + b) / 2; - myTolEnd = (float)(b - a) / 2; + myTolEnd = static_cast(b - a) / 2; } } diff --git a/src/ModelingAlgorithms/TKHelix/HelixGeom/HelixGeom_BuilderHelix.cxx b/src/ModelingAlgorithms/TKHelix/HelixGeom/HelixGeom_BuilderHelix.cxx index edb3f92a0a5..9c915d9830c 100644 --- a/src/ModelingAlgorithms/TKHelix/HelixGeom/HelixGeom_BuilderHelix.cxx +++ b/src/ModelingAlgorithms/TKHelix/HelixGeom/HelixGeom_BuilderHelix.cxx @@ -64,7 +64,7 @@ void HelixGeom_BuilderHelix::Perform() // Determine number of full turns for segmentation dT = myT2 - myT1; - aN = (int)(dT / aTwoPI); + aN = static_cast(dT / aTwoPI); if (!aN) { aBHC.SetCurveParameters(myT1, myT2, myPitch, myRStart, myTaperAngle, myIsClockWise); diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_ConeRangeSplitter.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_ConeRangeSplitter.cxx index 23c5a57ccb1..b8cc79a8733 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_ConeRangeSplitter.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_ConeRangeSplitter.cxx @@ -42,8 +42,8 @@ std::pair BRepMesh_ConeRangeSplitter::GetSplitSteps( const double aDiffV = aRangeV.second - aRangeV.first; const double aScale = (Du * aRadius); const double aRatio = std::max(1., std::log(aDiffV / aScale)); - const int nbU = (int)(aDiffU / Du); - const int nbV = (int)(aDiffV / aScale / aRatio); + const int nbU = static_cast(aDiffU / Du); + const int nbV = static_cast(aDiffV / aScale / aRatio); Du = aDiffU / (nbU + 1); Dv = aDiffV / (nbV + static_cast(aRatio)); diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_CylinderRangeSplitter.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_CylinderRangeSplitter.cxx index 1a0e20418c8..7ba7a7bd04e 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_CylinderRangeSplitter.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_CylinderRangeSplitter.cxx @@ -50,7 +50,7 @@ Handle(IMeshData::ListOfPnt2d) BRepMesh_CylinderRangeSplitter::GenerateSurfaceNo if (aArcLen > GetDFace()->GetDeflection()) { // Calculate parameters for iteration in U direction - nbU = (int)(su / myDu); + nbU = static_cast(su / myDu); /* // Calculate parameters for iteration in V direction diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx index fd92ccde07b..bb3113ac951 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx @@ -122,7 +122,7 @@ bool BRepMesh_DataStructureOfDelaun::SubstituteLink(const int theInde void BRepMesh_DataStructureOfDelaun::RemoveLink(const int theIndex, const bool isForce) { - BRepMesh_Edge& aLink = (BRepMesh_Edge&)GetLink(theIndex); + BRepMesh_Edge& aLink = const_cast(GetLink(theIndex)); if (aLink.Movability() == BRepMesh_Deleted || (!isForce && aLink.Movability() != BRepMesh_Free) || ElementsConnectedTo(theIndex).Extent() != 0) { @@ -176,7 +176,7 @@ int BRepMesh_DataStructureOfDelaun::AddElement(const BRepMesh_Triangle& theEleme void BRepMesh_DataStructureOfDelaun::RemoveElement(const int theIndex) { - BRepMesh_Triangle& aElement = (BRepMesh_Triangle&)GetElement(theIndex); + BRepMesh_Triangle& aElement = const_cast(GetElement(theIndex)); if (aElement.Movability() == BRepMesh_Deleted) return; @@ -272,7 +272,7 @@ void BRepMesh_DataStructureOfDelaun::ClearDomain() for (; aElementIt.More(); aElementIt.Next()) { const int aElementId = aElementIt.Key(); - BRepMesh_Triangle& aElement = (BRepMesh_Triangle&)GetElement(aElementId); + BRepMesh_Triangle& aElement = const_cast(GetElement(aElementId)); const int (&e)[3] = aElement.myEdges; @@ -364,7 +364,7 @@ void BRepMesh_DataStructureOfDelaun::clearDeletedLinks() void BRepMesh_DataStructureOfDelaun::clearDeletedNodes() { - IMeshData::ListOfInteger& aDelNodes = (IMeshData::ListOfInteger&)myNodes->GetListOfDelNodes(); + IMeshData::ListOfInteger& aDelNodes = const_cast(myNodes->GetListOfDelNodes()); int aLastLiveItem = NbNodes(); while (!aDelNodes.IsEmpty()) @@ -444,7 +444,7 @@ const char* BRepMesh_Dump(void* theMeshHandlePtr, const char* theFileNameStr) } occ::handle aMeshData = - *(occ::handle*)theMeshHandlePtr; + *static_cast*>(theMeshHandlePtr); if (aMeshData.IsNull()) return "Error: mesh data is empty"; diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx index 80254bcc1e6..56317c1a504 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.hxx @@ -194,7 +194,7 @@ private: //! @return list of links attached to the node. IMeshData::ListOfInteger& linksConnectedTo(const int theIndex) const { - return (IMeshData::ListOfInteger&)myNodeLinks.Find(theIndex); + return const_cast(myNodeLinks.Find(theIndex)); } //! Substitutes deleted links by the last one from corresponding map diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx index 63e626a870c..013aeda3359 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx @@ -40,15 +40,15 @@ static int logDelabella2Occ(void* theStream, const char* theFormat, ...) va_end(anArgList); Message_Gravity aGravity = Message_Warning; - switch ((int)theFormat[1]) + switch (static_cast(theFormat[1])) { - case int('E'): + case static_cast('E'): aGravity = Message_Fail; break; // [ERR] - case int('W'): + case static_cast('W'): aGravity = Message_Trace; break; // [WRN] - case int('N'): + case static_cast('N'): aGravity = Message_Trace; break; // [NFO] } diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_GeomTool.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_GeomTool.cxx index 003923f3663..3d7c043498a 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_GeomTool.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_GeomTool.cxx @@ -99,11 +99,11 @@ void AdjustCellsCounts(const occ::handle& theFace, double aSqNbVert = theNbVertices; if (aType == GeomAbs_Plane) { - theCellsCountU = theCellsCountV = (int)std::ceil(std::pow(2, std::log10(aSqNbVert))); + theCellsCountU = theCellsCountV = static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); } else if (aType == GeomAbs_Cylinder || aType == GeomAbs_Cone) { - theCellsCountV = (int)std::ceil(std::pow(2, std::log10(aSqNbVert))); + theCellsCountV = static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); } else if (aType == GeomAbs_SurfaceOfExtrusion || aType == GeomAbs_SurfaceOfRevolution) { @@ -113,25 +113,25 @@ void AdjustCellsCounts(const occ::handle& theFace, { // planar, cylindrical, conical cases if (aType == GeomAbs_SurfaceOfExtrusion) - theCellsCountU = (int)std::ceil(std::pow(2, std::log10(aSqNbVert))); + theCellsCountU = static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); else - theCellsCountV = (int)std::ceil(std::pow(2, std::log10(aSqNbVert))); + theCellsCountV = static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); } if (aType == GeomAbs_SurfaceOfExtrusion) { // V is always a line - theCellsCountV = (int)std::ceil(std::pow(2, std::log10(aSqNbVert))); + theCellsCountV = static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); } } else if (aType == GeomAbs_BezierSurface || aType == GeomAbs_BSplineSurface) { if (theFace->UDegree() < 2) { - theCellsCountU = (int)std::ceil(std::pow(2, std::log10(aSqNbVert))); + theCellsCountU = static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); } if (theFace->VDegree() < 2) { - theCellsCountV = (int)std::ceil(std::pow(2, std::log10(aSqNbVert))); + theCellsCountV = static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); } } @@ -442,25 +442,25 @@ std::pair BRepMesh_GeomTool::CellsCount( if (aType == GeomAbs_Torus) { aCellsCountU = - (int)std::ceil(std::pow(2, std::log10((aRangeU.second - aRangeU.first) / aDelta.first))); + static_cast(std::ceil(std::pow(2, std::log10((aRangeU.second - aRangeU.first) / aDelta.first)))); aCellsCountV = - (int)std::ceil(std::pow(2, std::log10((aRangeV.second - aRangeV.first) / aDelta.second))); + static_cast(std::ceil(std::pow(2, std::log10((aRangeV.second - aRangeV.first) / aDelta.second)))); } else if (aType == GeomAbs_Cylinder) { aCellsCountU = - (int)std::ceil(std::pow(2, + static_cast(std::ceil(std::pow(2, std::log10((aRangeU.second - aRangeU.first) / aDelta.first - / (aRangeV.second - aRangeV.first)))); + / (aRangeV.second - aRangeV.first))))); aCellsCountV = - (int)std::ceil(std::pow(2, std::log10((aRangeV.second - aRangeV.first) / anErrFactorV))); + static_cast(std::ceil(std::pow(2, std::log10((aRangeV.second - aRangeV.first) / anErrFactorV)))); } else { - aCellsCountU = (int)std::ceil( - std::pow(2, std::log10((aRangeU.second - aRangeU.first) / aDelta.first / anErrFactorU))); - aCellsCountV = (int)std::ceil( - std::pow(2, std::log10((aRangeV.second - aRangeV.first) / aDelta.second / anErrFactorV))); + aCellsCountU = static_cast(std::ceil( + std::pow(2, std::log10((aRangeU.second - aRangeU.first) / aDelta.first / anErrFactorU)))); + aCellsCountV = static_cast(std::ceil( + std::pow(2, std::log10((aRangeV.second - aRangeV.first) / aDelta.second / anErrFactorV)))); } AdjustCellsCounts(theSurface, theVerticesNb, aCellsCountU, aCellsCountV); diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_MeshTool.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_MeshTool.cxx index 6833baed064..32f0295e887 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_MeshTool.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_MeshTool.cxx @@ -207,7 +207,7 @@ void BRepMesh_MeshTool::EraseFreeLinks() { if (myStructure->ElementsConnectedTo(i).IsEmpty()) { - BRepMesh_Edge& anEdge = (BRepMesh_Edge&)myStructure->GetLink(i); + BRepMesh_Edge& anEdge = const_cast(myStructure->GetLink(i)); if (anEdge.Movability() == BRepMesh_Deleted) { continue; diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_SphereRangeSplitter.hxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_SphereRangeSplitter.hxx index 9a82f813419..482299e175e 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_SphereRangeSplitter.hxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_SphereRangeSplitter.hxx @@ -41,7 +41,7 @@ private: std::pair& theStepAndOffset) const { const double aDiff = theRange.second - theRange.first; - theStepAndOffset.first = aDiff / ((int)(aDiff / theDefaultStep) + 1); + theStepAndOffset.first = aDiff / (static_cast(aDiff / theDefaultStep) + 1); theStepAndOffset.second = theRange.second - Precision::PConfusion(); } }; diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_TorusRangeSplitter.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_TorusRangeSplitter.cxx index df18eb731f6..d8078165ef4 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_TorusRangeSplitter.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_TorusRangeSplitter.cxx @@ -39,7 +39,7 @@ Handle(IMeshData::ListOfPnt2d) BRepMesh_TorusRangeSplitter::GenerateSurfaceNodes double Dv = 0.9 * oldDv; // TWOTHIRD * oldDv; Dv = oldDv; - const int nbV = std::max((int)(aDiffV / Dv), 2); + const int nbV = std::max(static_cast(aDiffV / Dv), 2); Dv = aDiffV / (nbV + 1); double Du; @@ -64,8 +64,8 @@ Handle(IMeshData::ListOfPnt2d) BRepMesh_TorusRangeSplitter::GenerateSurfaceNodes Du = Dv; } - int nbU = std::max((int)(aDiffU / Du), 2); - nbU = std::max(nbU, (int)(nbV * aDiffU * R / (aDiffV * r) / 5.)); + int nbU = std::max(static_cast(aDiffU / Du), 2); + nbU = std::max(nbU, static_cast(nbV * aDiffU * R / (aDiffV * r) / 5.)); Du = aDiffU / (nbU + 1); const occ::handle aTmpAlloc = @@ -146,9 +146,9 @@ Handle(IMeshData::SequenceOfReal) BRepMesh_TorusRangeSplitter::fillParams( // Calculate DU, leave array of parameters const double aDiff = std::abs(theRange.second - theRange.first); double aStep = FUN_CalcAverageDUV(aParamArray, aLength); - aStep = std::max(aStep, aDiff / (double)theStepsNb / 2.); + aStep = std::max(aStep, aDiff / static_cast(theStepsNb) / 2.); - double aStdStep = aDiff / (double)aLength; + double aStdStep = aDiff / static_cast(aLength); if (aStep > aStdStep) { aStdStep = aStep; @@ -207,5 +207,5 @@ double BRepMesh_TorusRangeSplitter::FUN_CalcAverageDUV(NCollection_Array1(n)) : -1.); } diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.cpp b/src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.cpp index 654cbf57d1d..82eb8a1f29a 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.cpp +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.cpp @@ -71,7 +71,7 @@ typedef int64_t Signed62; // 4xBITS + 6 dot(vect,norm) static Unsigned28 s14sqr(const Signed14& s) { - return (Unsigned28)((Signed29)s * s); + return static_cast(static_cast(s) * s); } struct Norm @@ -89,9 +89,9 @@ struct Vect Norm cross(const Vect& v) const // cross prod { Norm n; - n.x = (Signed45)y * v.z - (Signed45)z * v.y; - n.y = (Signed45)z * v.x - (Signed45)x * v.z; - n.z = (Signed29)x * v.y - (Signed29)y * v.x; + n.x = static_cast(y) * v.z - static_cast(z) * v.y; + n.y = static_cast(z) * v.x - static_cast(x) * v.z; + n.z = static_cast(x) * v.y - static_cast(y) * v.x; return n; } }; @@ -108,9 +108,9 @@ struct CDelaBella : IDelaBella Vect operator-(const Vert& v) const // diff { Vect d; - d.x = (Signed15)x - (Signed15)v.x; - d.y = (Signed15)y - (Signed15)v.y; - d.z = (Signed29)z - (Signed29)v.z; + d.x = static_cast(x) - static_cast(v.x); + d.y = static_cast(y) - static_cast(v.y); + d.z = static_cast(z) - static_cast(v.z); return d; } @@ -176,7 +176,7 @@ struct CDelaBella : IDelaBella Signed62 dot(const Vert& p) const // dot { Vect d = p - *(Vert*)v[0]; - return (Signed62)n.x * d.x + (Signed62)n.y * d.y + (Signed62)n.z * d.z; + return static_cast(n.x) * d.x + static_cast(n.y) * d.y + static_cast(n.z) * d.z; } Norm cross() const // cross of diffs @@ -269,7 +269,7 @@ struct CDelaBella : IDelaBella if (max_faces) free(face_alloc); max_faces = 0; - face_alloc = (Face*)malloc(sizeof(Face) * hull_faces); + face_alloc = static_cast(malloc(sizeof(Face) * hull_faces)); if (face_alloc) max_faces = hull_faces; else @@ -744,13 +744,13 @@ struct CDelaBella : IDelaBella if (_f->n.z < 0) { *prev_dela = _f; - prev_dela = (Face**)&_f->next; + prev_dela = reinterpret_cast(&_f->next); i++; } else { *prev_hull = _f; - prev_hull = (Face**)&_f->next; + prev_hull = reinterpret_cast(&_f->next); if (((Face*)_f->f[0])->n.z < 0) { _f->v[1]->next = _f->v[2]; @@ -798,7 +798,7 @@ struct CDelaBella : IDelaBella max_verts = 0; } - vert_alloc = (Vert*)malloc(sizeof(Vert) * points); + vert_alloc = static_cast(malloc(sizeof(Vert) * points)); if (vert_alloc) max_verts = points; else @@ -833,8 +833,8 @@ struct CDelaBella : IDelaBella { Vert* v = vert_alloc + i; v->i = i; - v->x = (Signed14) * (const float*)((const char*)x + i * advance_bytes); - v->y = (Signed14) * (const float*)((const char*)y + i * advance_bytes); + v->x = static_cast(* reinterpret_cast(reinterpret_cast(x) + i * advance_bytes)); + v->y = static_cast(* reinterpret_cast(reinterpret_cast(y) + i * advance_bytes)); v->z = s14sqr(v->x) + s14sqr(v->y); } @@ -860,8 +860,8 @@ struct CDelaBella : IDelaBella { Vert* v = vert_alloc + i; v->i = i; - v->x = (Signed14) * (const double*)((const char*)x + i * advance_bytes); - v->y = (Signed14) * (const double*)((const char*)y + i * advance_bytes); + v->x = static_cast(* reinterpret_cast(reinterpret_cast(x) + i * advance_bytes)); + v->y = static_cast(* reinterpret_cast(reinterpret_cast(y) + i * advance_bytes)); v->z = s14sqr(v->x) + s14sqr(v->y); } @@ -928,47 +928,47 @@ void* DelaBella_Create() void DelaBella_Destroy(void* db) { - ((IDelaBella*)db)->Destroy(); + (static_cast(db))->Destroy(); } void DelaBella_SetErrLog(void* db, int (*proc)(void* stream, const char* fmt, ...), void* stream) { - ((IDelaBella*)db)->SetErrLog(proc, stream); + (static_cast(db))->SetErrLog(proc, stream); } int DelaBella_TriangulateFloat(void* db, int points, float* x, float* y, int advance_bytes) { - return ((IDelaBella*)db)->Triangulate(points, x, y, advance_bytes); + return (static_cast(db))->Triangulate(points, x, y, advance_bytes); } int DelaBella_TriangulateDouble(void* db, int points, double* x, double* y, int advance_bytes) { - return ((IDelaBella*)db)->Triangulate(points, x, y, advance_bytes); + return (static_cast(db))->Triangulate(points, x, y, advance_bytes); } int DelaBella_GetNumInputPoints(void* db) { - return ((IDelaBella*)db)->GetNumInputPoints(); + return (static_cast(db))->GetNumInputPoints(); } int DelaBella_GetNumOutputVerts(void* db) { - return ((IDelaBella*)db)->GetNumOutputVerts(); + return (static_cast(db))->GetNumOutputVerts(); } const DelaBella_Triangle* GetFirstDelaunayTriangle(void* db) { - return ((IDelaBella*)db)->GetFirstDelaunayTriangle(); + return (static_cast(db))->GetFirstDelaunayTriangle(); } const DelaBella_Triangle* GetFirstHullTriangle(void* db) { - return ((IDelaBella*)db)->GetFirstHullTriangle(); + return (static_cast(db))->GetFirstHullTriangle(); } const DelaBella_Vertex* GetFirstHullVertex(void* db) { - return ((IDelaBella*)db)->GetFirstHullVertex(); + return (static_cast(db))->GetFirstHullVertex(); } // depreciated! diff --git a/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Inter2d.cxx b/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Inter2d.cxx index ee324202457..18bda863c4a 100644 --- a/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Inter2d.cxx +++ b/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Inter2d.cxx @@ -1013,7 +1013,7 @@ static int evaluateMaxSegment(const Adaptor3d_CurveOnSurface& aCurveOnSurface) { aNbC2dKnots = aCurv2d->NbKnots(); } - int aReturn = (int)(30 + std::max(aNbSKnots, aNbC2dKnots)); + int aReturn = static_cast(30 + std::max(aNbSKnots, aNbC2dKnots)); return aReturn; } diff --git a/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.cxx b/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.cxx index 2f1d0e2139d..cb41d419c8c 100644 --- a/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.cxx +++ b/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.cxx @@ -225,11 +225,11 @@ static void PutInBounds(const TopoDS_Face& F, const TopoDS_Edge& E, occ::handle< double du = 0.; if (minC < umin - eps) { - du = (int((umin - minC) / period) + 1) * period; + du = (static_cast((umin - minC) / period) + 1) * period; } if (minC > umax + eps) { - du = -(int((minC - umax) / period) + 1) * period; + du = -(static_cast((minC - umax) / period) + 1) * period; } if (du != 0) { @@ -269,11 +269,11 @@ static void PutInBounds(const TopoDS_Face& F, const TopoDS_Edge& E, occ::handle< double dv = 0.; if (minC < vmin - eps) { - dv = (int((vmin - minC) / period) + 1) * period; + dv = (static_cast((vmin - minC) / period) + 1) * period; } if (minC > vmax + eps) { - dv = -(int((minC - vmax) / period) + 1) * period; + dv = -(static_cast((minC - vmax) / period) + 1) * period; } if (dv != 0) { diff --git a/src/ModelingAlgorithms/TKOffset/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx b/src/ModelingAlgorithms/TKOffset/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx index bae84c9388c..2dddd03a7c9 100644 --- a/src/ModelingAlgorithms/TKOffset/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx +++ b/src/ModelingAlgorithms/TKOffset/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx @@ -193,7 +193,7 @@ void BRepOffsetAPI_MakePipeShell::SetForceApproxC1(const bool ForceApproxC1) void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode) { - myPipe->SetTransition((BRepFill_TransitionStyle)Mode); + myPipe->SetTransition(static_cast(Mode)); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKPrim/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx b/src/ModelingAlgorithms/TKPrim/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx index 9ba5ea75d2e..03fd1241bd5 100644 --- a/src/ModelingAlgorithms/TKPrim/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx +++ b/src/ModelingAlgorithms/TKPrim/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx @@ -35,7 +35,7 @@ void BRepPreviewAPI_MakeBox::Build(const Message_ProgressRange& /*theRange*/) bool aThinOnY = std::abs(aFirstPoint.Y() - aSecondPoint.Y()) < Precision::Confusion(); bool aThinOnZ = std::abs(aFirstPoint.Z() - aSecondPoint.Z()) < Precision::Confusion(); - int aPreviewType = (int)aThinOnX + (int)aThinOnY + (int)aThinOnZ; + int aPreviewType = static_cast(aThinOnX) + static_cast(aThinOnY) + static_cast(aThinOnZ); if (aPreviewType == 3) // thin box in all directions is a point { diff --git a/src/ModelingAlgorithms/TKPrim/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx b/src/ModelingAlgorithms/TKPrim/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx index 52b6f408c81..3f747742455 100644 --- a/src/ModelingAlgorithms/TKPrim/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx +++ b/src/ModelingAlgorithms/TKPrim/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx @@ -26,7 +26,7 @@ const TopoDS_Face& BRepPrimAPI_MakeOneAxis::Face() { Build(); - return ((BRepPrim_OneAxis*)OneAxis())->LateralFace(); + return (static_cast(OneAxis()))->LateralFace(); } //================================================================================================= @@ -34,7 +34,7 @@ const TopoDS_Face& BRepPrimAPI_MakeOneAxis::Face() const TopoDS_Shell& BRepPrimAPI_MakeOneAxis::Shell() { Build(); - return ((BRepPrim_OneAxis*)OneAxis())->Shell(); + return (static_cast(OneAxis()))->Shell(); } //================================================================================================= @@ -43,7 +43,7 @@ void BRepPrimAPI_MakeOneAxis::Build(const Message_ProgressRange& /*theRange*/) { BRep_Builder B; B.MakeSolid(TopoDS::Solid(myShape)); - B.Add(myShape, ((BRepPrim_OneAxis*)OneAxis())->Shell()); + B.Add(myShape, (static_cast(OneAxis()))->Shell()); Done(); } diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Curve.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Curve.cxx index 49eded27248..155c21f5829 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Curve.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Curve.cxx @@ -1184,7 +1184,7 @@ bool ShapeAnalysis_Curve::GetSamplePoints(const occ::handle& curve, if (!adelta) return false; - int aK = (int)ceil((last - first) / adelta); + int aK = static_cast(ceil((last - first) / adelta)); int nbp = 100 * aK; if (curve->IsKind(STANDARD_TYPE(Geom_Line))) nbp = 2; @@ -1216,7 +1216,7 @@ bool ShapeAnalysis_Curve::GetSamplePoints(const occ::handle& curve, } GeomAdaptor_Curve GAC(curve); - double step = (last - first) / (double)(nbp - 1); + double step = (last - first) / static_cast(nbp - 1); for (int i = 0; i < nbp - 1; ++i) seq.Append(GAC.Value(first + step * i)); seq.Append(GAC.Value(last)); @@ -1237,7 +1237,7 @@ bool ShapeAnalysis_Curve::GetSamplePoints(const occ::handle& curve //-- Attention aux bsplines rationnelles de degree 3. (bouts de cercles entre autres) if (nbs > 2) nbs *= 4; - double step = (last - first) / (double)(nbs - 1); + double step = (last - first) / static_cast(nbs - 1); for (int i = 0; i < nbs - 1; ++i) seq.Append(C.Value(first + step * i)); seq.Append(C.Value(last)); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeBuild/ShapeBuild_Edge.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeBuild/ShapeBuild_Edge.cxx index f8329338b75..768e4f07c10 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeBuild/ShapeBuild_Edge.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeBuild/ShapeBuild_Edge.cxx @@ -142,7 +142,7 @@ static double AdjustByPeriod(const double Val, const double ToVal, const double return 0.; if (P < 1e-100) return diff; - return (diff > 0 ? -P : P) * (int)(D / P + 0.5); + return (diff > 0 ? -P : P) * static_cast(D / P + 0.5); } static bool IsPeriodic(const occ::handle& theCurve) diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeConstruct/ShapeConstruct.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeConstruct/ShapeConstruct.cxx index 3eb9a546e67..33b37956dd0 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeConstruct/ShapeConstruct.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeConstruct/ShapeConstruct.cxx @@ -247,7 +247,7 @@ occ::handle ShapeConstruct::ConvertSurfaceToBSpline( try { OCC_CATCH_SIGNALS - GeomAbs_Shape aCont = (GeomAbs_Shape)cnt; + GeomAbs_Shape aCont = static_cast(cnt); GeomConvert_ApproxSurface anApprox(aSurface, Tol3d / 2, aCont, aCont, MaxDegree, MaxDegree, MaxSegments, 0); bool Done = anApprox.IsDone(); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx index d127d4e415d..0cb07c193c1 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx @@ -450,7 +450,7 @@ bool isBSplineCurveInvalid(const occ::handle& theCurve, (aLastParam - aFirstParam) / (theBSpline->Knot(anIdx) - theBSpline->Knot(anIdx - 1)); if (aLenRatio < aLenThres) { - aNbIntPnts = int(aLenRatio / aLenThres * aNbIntPnts); + aNbIntPnts = static_cast(aLenRatio / aLenThres * aNbIntPnts); if (aNbIntPnts < 2) aNbIntPnts = 2; } diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_ComposeShell.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_ComposeShell.cxx index 36d411ee2ef..d9acba59c21 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_ComposeShell.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_ComposeShell.cxx @@ -446,7 +446,7 @@ static int GetPatchIndex(const double Param, i--; double ish = shift / period; - int ishift = (int)(ish < 0 ? ish - 0.5 : ish + 0.5); + int ishift = static_cast(ish < 0 ? ish - 0.5 : ish + 0.5); return i - ishift * (NP - 1); } @@ -1401,7 +1401,7 @@ bool ShapeFix_ComposeShell::SplitByLine(ShapeFix_WireSegment& wire } double dUmax = umax + shift - x; shiftNext.SetX(dUmax > 0 ? -myUPeriod : myUPeriod); - nbIter = (int)(1 + std::abs(dUmax) / myUPeriod); + nbIter = static_cast(1 + std::abs(dUmax) / myUPeriod); shift = ShapeAnalysis::AdjustByPeriod(posf.X(), x, myUPeriod); posf.SetX(posf.X() + shift); shift = ShapeAnalysis::AdjustByPeriod(posl.X(), x, myUPeriod); @@ -1421,7 +1421,7 @@ bool ShapeFix_ComposeShell::SplitByLine(ShapeFix_WireSegment& wire } double dVmax = vmax + shift - y; shiftNext.SetY(dVmax > 0 ? -myVPeriod : myVPeriod); - nbIter = (int)(1 + std::abs(dVmax) / myVPeriod); + nbIter = static_cast(1 + std::abs(dVmax) / myVPeriod); shift = ShapeAnalysis::AdjustByPeriod(posf.Y(), y, myVPeriod); posf.SetY(posf.Y() + shift); shift = ShapeAnalysis::AdjustByPeriod(posl.Y(), y, myVPeriod); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_FixSmallSolid.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_FixSmallSolid.cxx index 166d750013f..55d473782b8 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_FixSmallSolid.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_FixSmallSolid.cxx @@ -468,7 +468,7 @@ TopoDS_Shape ShapeFix_FixSmallSolid::Merge(const TopoDS_Shape& // and corresponding small solids' shells const TopoDS_Shape& aBaseShell = aShellIter.Key(); NCollection_List& aShellsToBeMerged = - (NCollection_List&)aShellIter.Value(); + const_cast&>(aShellIter.Value()); NCollection_List* aShellsToBeAddedPtr = aShellsToAdd.ChangeSeek(aBaseShell); // merge needed shells diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess_Context.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess_Context.cxx index 59384e0208b..00768acde26 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess_Context.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess_Context.cxx @@ -95,12 +95,12 @@ occ::handle ShapeProcess_Context::LoadResourceManager(const ch if (!aPath.IsEmpty()) { stat(aPath.ToCString(), &buf); - aMtime = (std::time_t)buf.st_mtime; + aMtime = static_cast(buf.st_mtime); } if (!aUserPath.IsEmpty()) { stat(aUserPath.ToCString(), &buf); - aUMtime = (std::time_t)buf.st_mtime; + aUMtime = static_cast(buf.st_mtime); } bool isFileModified = false; diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess_ShapeContext.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess_ShapeContext.cxx index 7ce0a5f92c8..ef01428c7df 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess_ShapeContext.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess_ShapeContext.cxx @@ -268,7 +268,7 @@ static void RecModif(const TopoDS_Shape& // resulting shapes, recursive procedure should be applied else if (r.ShapeType() < S.ShapeType()) { - res = repl->Apply(r, (TopAbs_ShapeEnum)((int)S.ShapeType() + 1)); + res = repl->Apply(r, static_cast(static_cast(S.ShapeType()) + 1)); if (res != r) map.Bind(aS, res); } @@ -475,9 +475,9 @@ void ShapeProcess_ShapeContext::PrintStatistics() const Message_Msg PMSG200("PrResult.Print.MSG200"); // Preparation ratio: Messenger()->Send(PMSG200, Message_Info); Message_Msg PMSG205("PrResult.Print.MSG205"); // Shells: %d per cent - PMSG205.Arg((int)(100. * SPR)); + PMSG205.Arg(static_cast(100. * SPR)); Messenger()->Send(PMSG205, Message_Info); Message_Msg PMSG210("PrResult.Print.MSG210"); // Faces : %d per cent - PMSG210.Arg((int)(100. * FPR)); + PMSG210.Arg(static_cast(100. * FPR)); Messenger()->Send(PMSG210, Message_Info); } diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cxx index 0d1d80d4b08..0989c6b9f73 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cxx @@ -152,9 +152,9 @@ void ShapeProcessAPI_ApplySequence::PrintPreparationResult() const Message_Msg PMSG200("PrResult.Print.MSG200"); // Preparation ratio: aMessenger->Send(PMSG200, Message_Info); Message_Msg PMSG205("PrResult.Print.MSG205"); // Shells: %d per cent - PMSG205.Arg((int)(100 * SPR)); + PMSG205.Arg(static_cast(100 * SPR)); aMessenger->Send(PMSG205, Message_Info); Message_Msg PMSG210("PrResult.Print.MSG210"); // Faces : %d per cent - PMSG210.Arg((int)(100 * FPR)); + PMSG210.Arg(static_cast(100 * FPR)); aMessenger->Send(PMSG210, Message_Info); } diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_FixSmallBezierCurves.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_FixSmallBezierCurves.cxx index 6156852500c..9c12732f6dc 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_FixSmallBezierCurves.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_FixSmallBezierCurves.cxx @@ -62,7 +62,7 @@ bool ShapeUpgrade_FixSmallBezierCurves::Approx(occ::handle& Curve3 if (Last > l) Last = l; occ::handle trc = new Geom_TrimmedCurve(c3d, First, Last); - GeomAbs_Shape aCont = (GeomAbs_Shape)trc->Continuity(); + GeomAbs_Shape aCont = trc->Continuity(); if (aCont == GeomAbs_C3 || aCont == GeomAbs_CN) aCont = GeomAbs_C2; try @@ -110,7 +110,7 @@ bool ShapeUpgrade_FixSmallBezierCurves::Approx(occ::handle& Curve3 if (Last > l) Last = l; occ::handle trc2d = new Geom2d_TrimmedCurve(c2d, First, Last); - GeomAbs_Shape aCont = (GeomAbs_Shape)trc2d->Continuity(); + GeomAbs_Shape aCont = trc2d->Continuity(); try { OCC_CATCH_SIGNALS diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_RemoveLocations.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_RemoveLocations.cxx index 1e0929d65f8..9f39c43221a 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_RemoveLocations.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_RemoveLocations.cxx @@ -50,7 +50,7 @@ bool ShapeUpgrade_RemoveLocations::Remove(const TopoDS_Shape& theShape) myShape = aShape; TopAbs_ShapeEnum shtype = theShape.ShapeType(); bool isRemoveLoc = ((shtype != TopAbs_COMPOUND && myLevelRemoving == TopAbs_SHAPE) - || ((int)myLevelRemoving <= ((int)shtype))); + || (static_cast(myLevelRemoving) <= (static_cast(shtype)))); TopoDS_Shape S; bool isDone = MakeNewShape(theShape, S, myShape, isRemoveLoc); @@ -195,7 +195,7 @@ bool ShapeUpgrade_RemoveLocations::MakeNewShape(const TopoDS_Shape& theShape, if (!theRemoveLoc) { isRemoveLoc = ((shtype != TopAbs_COMPOUND && myLevelRemoving == TopAbs_SHAPE) - || ((int)myLevelRemoving <= ((int)shtype))); + || (static_cast(myLevelRemoving) <= (static_cast(shtype)))); } bool aRebuild = false; diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_RemoveLocations.lxx b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_RemoveLocations.lxx index 055c7d6efbd..17034879cd1 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_RemoveLocations.lxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_RemoveLocations.lxx @@ -23,7 +23,7 @@ inline TopoDS_Shape ShapeUpgrade_RemoveLocations::GetResult() const inline void ShapeUpgrade_RemoveLocations::SetRemoveLevel(const TopAbs_ShapeEnum theLevel) { - if ((int)theLevel > TopAbs_FACE) + if (static_cast(theLevel) > TopAbs_FACE) myLevelRemoving = TopAbs_FACE; else myLevelRemoving = theLevel; diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceAngle.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceAngle.cxx index c18967a2bd9..18b1497b906 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceAngle.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceAngle.cxx @@ -86,7 +86,7 @@ void ShapeUpgrade_SplitSurfaceAngle::Compute(const bool /*Segment*/) double ULast = myUSplitValues->Sequence().Last(); double maxAngle = myMaxAngle; // maximal u length of segment double uLength = ULast - UFirst; - int nbSegments = int((uLength - Precision::Angular()) / maxAngle) + 1; + int nbSegments = static_cast((uLength - Precision::Angular()) / maxAngle) + 1; if (nbSegments == 1) if (!isRect || !(uLength < maxAngle) || !((U2 - U1) < maxAngle)) myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE2); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceArea.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceArea.cxx index 956f6d3fddd..ee6d3d6e8c4 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceArea.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceArea.cxx @@ -65,8 +65,8 @@ void ShapeUpgrade_SplitSurfaceArea::Compute(const bool /*Segment*/) if (!anIsFixedUVnbSplits) //(myUnbSplit <= 0 || myVnbSplit <= 0) { double aSquareSize = std::sqrt(myArea / myNbParts); - myUnbSplit = (int)(myUsize / aSquareSize); - myVnbSplit = (int)(myVsize / aSquareSize); + myUnbSplit = static_cast(myUsize / aSquareSize); + myVnbSplit = static_cast(myVsize / aSquareSize); if (myUnbSplit == 0) myUnbSplit = 1; if (myVnbSplit == 0) @@ -87,7 +87,7 @@ void ShapeUpgrade_SplitSurfaceArea::Compute(const bool /*Segment*/) else { nbSplitF = (aNbUV >= myNbParts ? myNbParts : RealToInt(ceil(sqrt(myNbParts * ceil(aNbUV))))); - nbSplitS = (aNbUV >= myNbParts ? 0 : RealToInt(ceil((double)myNbParts / (double)nbSplitF))); + nbSplitS = (aNbUV >= myNbParts ? 0 : RealToInt(ceil(static_cast(myNbParts) / static_cast(nbSplitF)))); } if (nbSplitS == 1 && !anIsFixedUVnbSplits) nbSplitS++; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_FastSewing.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_FastSewing.hxx index a66476f9e6d..4868dc6ed48 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_FastSewing.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_FastSewing.hxx @@ -109,7 +109,7 @@ protected: //! Sets status. Returns numeric value of the status set FS_VARStatuses SetStatus(FS_Statuses theStatus) { - const FS_VARStatuses aStatusID = (FS_VARStatuses)(theStatus); + const FS_VARStatuses aStatusID = static_cast(theStatus); myStatusList |= aStatusID; return aStatusID; } diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx index 6e0fd95fdf4..0a686dba25c 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx @@ -32,7 +32,7 @@ const TopoDS_Shape& BRepBuilderAPI_MakeShape::Shape() if (!IsDone()) { // the following is const cast away - ((BRepBuilderAPI_MakeShape*)(void*)this)->Build(); + (static_cast((void*)this))->Build(); Check(); } return myShape; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_MakeShapeOnMesh.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_MakeShapeOnMesh.cxx index ccfa821972a..822308e226a 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_MakeShapeOnMesh.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_MakeShapeOnMesh.cxx @@ -89,7 +89,7 @@ void BRepBuilderAPI_MakeShapeOnMesh::Build(const Message_ProgressRange& theRange // over triangles of input mesh. Message_ProgressScope aPS(theRange, "Per-facet shape construction", - double(aNbNodes + 2 * aNbTriangles)); + static_cast(aNbNodes + 2 * aNbTriangles)); // Build shared vertices. NCollection_IndexedDataMap aPnt2VertexMap; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx index cb0d2608d1d..f4390127b5f 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx @@ -1135,7 +1135,7 @@ void BRepBuilderAPI_Sewing::EvaluateAngulars(NCollection_Sequence& } if (nbComputedAngle) - tabAng(i) = cumulateAngular / ((double)nbComputedAngle); + tabAng(i) = cumulateAngular / (static_cast(nbComputedAngle)); } } diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Analyzer.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Analyzer.cxx index 5f915b4bfec..11b39de1546 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Analyzer.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Analyzer.cxx @@ -424,11 +424,11 @@ void BRepCheck_Analyzer::Perform() const occ::handle& aThreadPool = OSD_ThreadPool::DefaultPool(); const int aNbThreads = aThreadPool->NbThreads(); int aNbTasks = aNbThreads * 10; - int aTaskSize = (int)std::ceil((double)aMapSize / aNbTasks); + int aTaskSize = static_cast(std::ceil(static_cast(aMapSize) / aNbTasks)); if (aTaskSize < aMinTaskSize) { aTaskSize = aMinTaskSize; - aNbTasks = (int)std::ceil((double)aMapSize / aTaskSize); + aNbTasks = static_cast(std::ceil(static_cast(aMapSize) / aTaskSize)); } NCollection_Array1> aArrayOfArray(0, aNbTasks - 1); diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx index ee16c7125f7..be5b61423ae 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Edge.cxx @@ -673,7 +673,7 @@ double BRepCheck_Edge::Tolerance() { prm = ((NCONTROL - 1 - i) * First + i * Last) / (NCONTROL - 1); tol2 = dist2 = 0.; - center = (*(occ::handle*)&theRep(1))->Value(prm); + center = (*reinterpret_cast*>(&theRep(1)))->Value(prm); if (Precision::IsInfinite(center.X()) || Precision::IsInfinite(center.Y()) || Precision::IsInfinite(center.Z())) { @@ -681,7 +681,7 @@ double BRepCheck_Edge::Tolerance() } for (iRep = 2; iRep <= nbRep; iRep++) { - othP = (*(occ::handle*)&theRep(iRep))->Value(prm); + othP = (*reinterpret_cast*>(&theRep(iRep)))->Value(prm); if (Precision::IsInfinite(othP.X()) || Precision::IsInfinite(othP.Y()) || Precision::IsInfinite(othP.Z())) { diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Shell.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Shell.cxx index 594a6eacce0..6cc433d6fad 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Shell.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Shell.cxx @@ -483,7 +483,7 @@ BRepCheck_Status BRepCheck_Shell::Orientation(const bool Update) for (exp.Init(myShape, TopAbs_FACE); exp.More(); exp.Next()) { - if (!MapOfShapeOrientation.Bind(exp.Current(), (int)(exp.Current().Orientation()))) + if (!MapOfShapeOrientation.Bind(exp.Current(), static_cast(exp.Current().Orientation()))) { myOstat = BRepCheck_RedundantFace; if (Update) @@ -549,7 +549,7 @@ BRepCheck_Status BRepCheck_Shell::Orientation(const bool Update) { // JR/Hp : int iorf = MapOfShapeOrientation.Find(Fref); - orf = (TopAbs_Orientation)iorf; + orf = static_cast(iorf); // orf = (TopAbs_Orientation)MapOfShapeOrientation.Find(Fref); Fref.Orientation(orf); @@ -578,7 +578,7 @@ BRepCheck_Status BRepCheck_Shell::Orientation(const bool Update) // JR/Hp : int anOriFCur = MapOfShapeOrientation.Find(Fcur); - orf = (TopAbs_Orientation)anOriFCur; + orf = static_cast(anOriFCur); // orf = (TopAbs_Orientation)MapOfShapeOrientation.Find(Fcur); Fcur.Orientation(orf); @@ -642,7 +642,7 @@ BRepCheck_Status BRepCheck_Shell::Orientation(const bool Update) } int iorf = MapOfShapeOrientation.Find(Fcur); - orf = (TopAbs_Orientation)iorf; + orf = static_cast(iorf); // orf = (TopAbs_Orientation)MapOfShapeOrientation.Find(Fcur); Fcur.Orientation(orf); @@ -720,7 +720,7 @@ BRepCheck_Status BRepCheck_Shell::Orientation(const bool Update) } // JR/Hp : int iorf = MapOfShapeOrientation.Find(Fref); - orf = (TopAbs_Orientation)iorf; + orf = static_cast(iorf); // orf = (TopAbs_Orientation)MapOfShapeOrientation.Find(Fref); Fref.Orientation(orf); @@ -770,7 +770,7 @@ BRepCheck_Status BRepCheck_Shell::Orientation(const bool Update) // JR/Hp : int anOriFCur = MapOfShapeOrientation.Find(Fcur); - orf = (TopAbs_Orientation)anOriFCur; + orf = static_cast(anOriFCur); // orf = (TopAbs_Orientation)MapOfShapeOrientation.Find(Fcur); Fcur.Orientation(orf); diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx index f3771c3a474..7acd0e78c76 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx @@ -254,7 +254,7 @@ bool BRepClass3d_SolidExplorer::PointInTheFace(const TopoDS_Face& int NbPntCalc = 0; if (myMapOfInter.IsBound(Face)) { - void* ptr = (void*)(myMapOfInter.Find(Face)); + void* ptr = static_cast(myMapOfInter.Find(Face)); bool IsInside = true; if (IsNotUper) { @@ -266,7 +266,7 @@ bool BRepClass3d_SolidExplorer::PointInTheFace(const TopoDS_Face& } if (ptr) { - const IntCurvesFace_Intersector& TheIntersector = (*((IntCurvesFace_Intersector*)ptr)); + const IntCurvesFace_Intersector& TheIntersector = (*(static_cast(ptr))); // Check if the point is already in the face if (IsInside && (ClassifyUVPoint(TheIntersector, surf, gp_Pnt2d(u_, v_)) == TopAbs_IN)) { @@ -835,7 +835,7 @@ void BRepClass3d_SolidExplorer::Destroy() for (; iter.More(); iter.Next()) { void*& aPtr = iter.ChangeValue(); - delete (IntCurvesFace_Intersector*)aPtr; + delete static_cast(aPtr); aPtr = nullptr; } myMapOfInter.Clear(); @@ -857,7 +857,7 @@ void BRepClass3d_SolidExplorer::InitShape(const TopoDS_Shape& S) for (; iter.More(); iter.Next()) { void*& aPtr = iter.ChangeValue(); - delete (IntCurvesFace_Intersector*)aPtr; + delete static_cast(aPtr); aPtr = nullptr; } @@ -1052,8 +1052,8 @@ int BRepClass3d_SolidExplorer::Segment(const gp_Pnt& P, gp_Lin& L, double& Par) IntCurvesFace_Intersector& BRepClass3d_SolidExplorer::Intersector(const TopoDS_Face& F) const { - void* ptr = (void*)(myMapOfInter.Find(F)); - IntCurvesFace_Intersector& curr = (*((IntCurvesFace_Intersector*)ptr)); + void* ptr = static_cast(myMapOfInter.Find(F)); + IntCurvesFace_Intersector& curr = (*(static_cast(ptr))); return curr; } diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistShapeShape.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistShapeShape.cxx index 6722622fa6f..1992c35cbd4 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistShapeShape.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistShapeShape.cxx @@ -171,7 +171,7 @@ struct VertexFunctor const int aLast = BandArray->Value(theIndex).Last; Solution.Dist[theIndex] = StartDist; - Message_ProgressScope aScope(Ranges[theIndex], nullptr, (double)aLast - aFirst); + Message_ProgressScope aScope(Ranges[theIndex], nullptr, static_cast(aLast) - aFirst); for (int anIdx1 = aFirst; anIdx1 <= aLast; ++anIdx1) { @@ -240,11 +240,11 @@ bool BRepExtrema_DistShapeShape::DistanceVertVert( const occ::handle& aThreadPool = OSD_ThreadPool::DefaultPool(); const int aNbThreads = aThreadPool->NbThreads(); int aNbTasks = aNbThreads; - int aTaskSize = (int)std::ceil((double)aCount1 / aNbTasks); + int aTaskSize = static_cast(std::ceil(static_cast(aCount1) / aNbTasks)); if (aTaskSize < aMinTaskSize) { aTaskSize = aMinTaskSize; - aNbTasks = (int)std::ceil((double)aCount1 / aTaskSize); + aNbTasks = static_cast(std::ceil(static_cast(aCount1) / aTaskSize)); } int aFirstIndex(1); @@ -412,7 +412,7 @@ struct DistancePairFunctor const int aFirst = BandArray->Value(theIndex).First; const int aLast = BandArray->Value(theIndex).Last; - Message_ProgressScope aScope(Ranges[theIndex], nullptr, (double)aLast - aFirst); + Message_ProgressScope aScope(Ranges[theIndex], nullptr, static_cast(aLast) - aFirst); for (int anIdx1 = aFirst; anIdx1 <= aLast; ++anIdx1) { @@ -483,11 +483,11 @@ bool BRepExtrema_DistShapeShape::DistanceMapMap( const int aNbThreads = aThreadPool->NbThreads(); const int aMinPairTaskSize = aCount1 < 10 ? aCount1 : 10; int aNbPairTasks = aNbThreads; - int aPairTaskSize = (int)std::ceil((double)aCount1 / aNbPairTasks); + int aPairTaskSize = static_cast(std::ceil(static_cast(aCount1) / aNbPairTasks)); if (aPairTaskSize < aMinPairTaskSize) { aPairTaskSize = aMinPairTaskSize; - aNbPairTasks = (int)std::ceil((double)aCount1 / aPairTaskSize); + aNbPairTasks = static_cast(std::ceil(static_cast(aCount1) / aPairTaskSize)); } int aFirstIndex(1); @@ -535,7 +535,7 @@ bool BRepExtrema_DistShapeShape::DistanceMapMap( const int aMapSize = aPairList.Size(); int aNbTasks = aMapSize < aNbThreads ? aMapSize : aNbThreads; - int aTaskSize = (int)std::ceil((double)aMapSize / aNbTasks); + int aTaskSize = static_cast(std::ceil(static_cast(aMapSize) / aNbTasks)); NCollection_Array1> anArrayOfArray(0, aNbTasks - 1); // Since aPairList is sorted in ascending order of distances between Bnd_Boxes, @@ -767,11 +767,11 @@ bool BRepExtrema_DistShapeShape::SolidTreatment( const occ::handle& aThreadPool = OSD_ThreadPool::DefaultPool(); const int aNbThreads = aThreadPool->NbThreads(); int aNbTasks = aNbThreads * 10; - int aTaskSize = (int)std::ceil((double)aMapSize / aNbTasks); + int aTaskSize = static_cast(std::ceil(static_cast(aMapSize) / aNbTasks)); if (aTaskSize < aMinTaskSize) { aTaskSize = aMinTaskSize; - aNbTasks = (int)std::ceil((double)aMapSize / aTaskSize); + aNbTasks = static_cast(std::ceil(static_cast(aMapSize) / aTaskSize)); } NCollection_Array1> anArrayOfArray(0, aNbTasks - 1); @@ -1090,9 +1090,9 @@ void BRepExtrema_DistShapeShape::Dump(Standard_OStream& o) const for (i = 1; i <= NbSolution(); i++) { o << "solution number " << i << ": " << std::endl; - o << "the type of the solution on the first shape is " << int(SupportTypeShape1(i)) + o << "the type of the solution on the first shape is " << static_cast(SupportTypeShape1(i)) << std::endl; - o << "the type of the solution on the second shape is " << int(SupportTypeShape2(i)) + o << "the type of the solution on the second shape is " << static_cast(SupportTypeShape2(i)) << std::endl; o << "the coordinates of the point on the first shape are: " << std::endl; o << "X=" << PointOnShape1(i).X() << " Y=" << PointOnShape1(i).Y() diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_ProximityDistTool.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_ProximityDistTool.cxx index a1ed0fd7c8c..41b1fa2b171 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_ProximityDistTool.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_ProximityDistTool.cxx @@ -104,7 +104,7 @@ void BRepExtrema_ProximityDistTool::LoadAdditionalPointsFirstSet( void BRepExtrema_ProximityDistTool::goThroughtSet1(const BVH_Array3d& theVertices1, const bool theIsAdditionalSet) { - int aVtxSize = (int)theVertices1.size(); + int aVtxSize = static_cast(theVertices1.size()); int aVtxStep = std::max(myNbSamples1 <= 0 ? 1 : aVtxSize / myNbSamples1, 1); for (int aVtxIdx = 0; aVtxIdx < aVtxSize; aVtxIdx += aVtxStep) { @@ -373,7 +373,7 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt1() if (myShapeList1(aFaceID1).ShapeType() == TopAbs_EDGE) { const BVH_Array3d& aVertices1 = mySet1->GetVertices(); - int aVtxSize = (int)aVertices1.size(); + int aVtxSize = static_cast(aVertices1.size()); int aLastIdx = aVtxSize - 1; if ((aVertices1[0] - aVertices1[aLastIdx]).Modulus() < Precision::Confusion()) // if closed @@ -428,7 +428,7 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt2() else { const BVH_Array3d& aVertices2 = mySet2->GetVertices(); - int aVtxSize = (int)aVertices2.size(); + int aVtxSize = static_cast(aVertices2.size()); int aLastIdx = aVtxSize - 1; if ((aVertices2[0] - aVertices2[aLastIdx]).Modulus() < Precision::Confusion()) // if closed diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_ProximityValueTool.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_ProximityValueTool.cxx index 1a4c1ea68ad..956749716f7 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_ProximityValueTool.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_ProximityValueTool.cxx @@ -86,7 +86,7 @@ static double calcEdgeRefinementStep(const TopoDS_Edge& theEdge, const int theNb BRepAdaptor_Curve aBAC(theEdge); double aLen = GCPnts_AbscissaPoint::Length(aBAC); - return aLen / (double)(theNbNodes - 1); + return aLen / static_cast(theNbNodes - 1); } //======================================================================= @@ -102,7 +102,7 @@ static double calcFaceRefinementStep(const TopoDS_Face& theFace, const int theNb GProp_GProps props; BRepGProp::SurfaceProperties(theFace, props); double aArea = props.Mass(); - return 2 * (aArea / (double)theNbTrg); + return 2 * (aArea / static_cast(theNbTrg)); } //======================================================================= @@ -245,7 +245,7 @@ bool BRepExtrema_ProximityValueTool::getEdgeAdditionalVertices( } double aLen = GCPnts_AbscissaPoint::Length(aBAC); - int aNbSamplePoints = (int)(aLen / theStep) + 1; + int aNbSamplePoints = static_cast(aLen / theStep) + 1; GCPnts_QuasiUniformAbscissa aGCPnts(aBAC, std::max(3, aNbSamplePoints)); diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_EdgeTool.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_EdgeTool.cxx index b75902b1950..e57c17e9df8 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_EdgeTool.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_EdgeTool.cxx @@ -78,14 +78,14 @@ void BRepGProp_EdgeTool::D1(const BRepAdaptor_Curve& C, const double U, gp_Pnt& int BRepGProp_EdgeTool::NbIntervals(const BRepAdaptor_Curve& C, const GeomAbs_Shape S) { // clang-format off - BRepAdaptor_Curve* pC = (BRepAdaptor_Curve*) &C; // at the moment actually NbIntervals() does not modify the + BRepAdaptor_Curve* pC = const_cast(&C); // at the moment actually NbIntervals() does not modify the // object "C". So it is safe to do such a cast. return pC->NbIntervals(S); } void BRepGProp_EdgeTool::Intervals(const BRepAdaptor_Curve& C,NCollection_Array1& T,const GeomAbs_Shape S) { - BRepAdaptor_Curve* pC = (BRepAdaptor_Curve*) &C; // at the moment actually Intervals() does not modify the + BRepAdaptor_Curve* pC = const_cast(&C); // at the moment actually Intervals() does not modify the // object "C". So it is safe to do such a cast. // clang-format on pC->Intervals(T, S); diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_VinertGK.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_VinertGK.cxx index c21dffba592..a4ba3e3132c 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_VinertGK.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_VinertGK.cxx @@ -274,7 +274,7 @@ double BRepGProp_VinertGK::PrivatePerform(BRepGProp_Face& theSurface, aNbCurves = 1; else { - aPDomain = (BRepGProp_Domain*)thePtrDomain; + aPDomain = static_cast(thePtrDomain); for (aPDomain->Init(); aPDomain->More(); aPDomain->Next()) aNbCurves++; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib.cxx index f946628b6da..fea1dd6fc67 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib.cxx @@ -288,7 +288,7 @@ static int evaluateMaxSegment(const int aMaxSegment, { aNbC2dKnots = aCurv2d->NbKnots(); } - int aReturn = (int)(30 + std::max(aNbSKnots, aNbC2dKnots)); + int aReturn = static_cast(30 + std::max(aNbSKnots, aNbC2dKnots)); return aReturn; } @@ -2890,7 +2890,7 @@ void BRepLib::BoundingVertex(const NCollection_List& theLV, { aXYZ += aPoints(i).XYZ(); } - aXYZ.Divide((double)aNb); + aXYZ.Divide(static_cast(aNb)); // gp_Pnt aP(aXYZ); // diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib_MakeShape.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib_MakeShape.cxx index 87fd48f4f8e..4fb59eb633b 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib_MakeShape.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib_MakeShape.cxx @@ -33,7 +33,7 @@ const TopoDS_Shape& BRepLib_MakeShape::Shape() if (!IsDone()) { // the following is const cast away - ((BRepLib_MakeShape*)(void*)this)->Build(); + (static_cast((void*)this))->Build(); Check(); } return myShape; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib_PointCloudShape.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib_PointCloudShape.cxx index c901bd1ff61..895f7cd8c56 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib_PointCloudShape.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepLib/BRepLib_PointCloudShape.cxx @@ -60,7 +60,7 @@ int BRepLib_PointCloudShape::NbPointsByDensity(const double theDensity) { double anArea = faceArea(aExpF.Current()); - int aNbPnts = std::max((int)std::ceil(anArea / theDensity), 1); + int aNbPnts = std::max(static_cast(std::ceil(anArea / theDensity)), 1); myFacePoints.Bind(aExpF.Current(), aNbPnts); aNbPoints += aNbPnts; } diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx index 1d285434e2a..3d9f094ab0f 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_FClass2d.cxx @@ -175,7 +175,7 @@ BRepTopAdaptor_FClass2d::BRepTopAdaptor_FClass2d(const TopoDS_Face& aFace, const //-- Attention to rational bsplines of degree 3. (ends of circles among others) if (nbs > 2) nbs *= 4; - double du = (plbid - pfbid) / (double)(nbs - 1); + double du = (plbid - pfbid) / static_cast(nbs - 1); double u = 0.0; if (Or == TopAbs_FORWARD) u = pfbid; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx index fae969e65b2..ee3f6ef8b1a 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx @@ -78,7 +78,7 @@ void BRepTopAdaptor_TopolTool::Initialize(const occ::handle& TopoDS_Shape s_wnt = brhs->Face(); s_wnt.Orientation(TopAbs_FORWARD); myFace = TopoDS::Face(s_wnt); - delete (BRepTopAdaptor_FClass2d*)myFClass2d; + delete static_cast(myFClass2d); myFClass2d = nullptr; myNbSamplesU = -1; myS = S; @@ -181,7 +181,7 @@ TopAbs_State BRepTopAdaptor_TopolTool::Classify(const gp_Pnt2d& P, { myFClass2d = (void*)new BRepTopAdaptor_FClass2d(myFace, Tol); } - return (((BRepTopAdaptor_FClass2d*)myFClass2d)->Perform(P, RecadreOnPeriodic)); + return ((static_cast(myFClass2d))->Perform(P, RecadreOnPeriodic)); } //================================================================================================= @@ -195,14 +195,14 @@ bool BRepTopAdaptor_TopolTool::IsThePointOn(const gp_Pnt2d& P, myFClass2d = (void*)new BRepTopAdaptor_FClass2d(myFace, Tol); } return (TopAbs_ON - == ((BRepTopAdaptor_FClass2d*)myFClass2d)->TestOnRestriction(P, Tol, RecadreOnPeriodic)); + == (static_cast(myFClass2d))->TestOnRestriction(P, Tol, RecadreOnPeriodic)); } //================================================================================================= void BRepTopAdaptor_TopolTool::Destroy() { - delete (BRepTopAdaptor_FClass2d*)myFClass2d; + delete static_cast(myFClass2d); myFClass2d = nullptr; } @@ -416,8 +416,8 @@ void BRepTopAdaptor_TopolTool::ComputeSamplePoints() case GeomAbs_Torus: { //-- Set 15 for 2pi //-- Not enough ->25 for 2pi - nbsu = (int)(8 * (usup - uinf)); - nbsv = (int)(7 * (vsup - vinf)); + nbsu = static_cast(8 * (usup - uinf)); + nbsv = static_cast(7 * (vsup - vinf)); if (nbsu < 5) nbsu = 5; if (nbsv < 5) diff --git a/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecCC.cxx b/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecCC.cxx index d34f53f6352..88654bd1754 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecCC.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_BisecCC.cxx @@ -1892,7 +1892,7 @@ static bool DiscretPar(const double DU, if (Eps < EpsMin) { Eps = EpsMin; - Nb = int(DU / EpsMin); + Nb = static_cast(DU / EpsMin); } else { diff --git a/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_PolyBis.cxx b/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_PolyBis.cxx index 6a713a672e8..adcdcbf342a 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_PolyBis.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/Bisector/Bisector_PolyBis.cxx @@ -88,7 +88,7 @@ int Bisector_PolyBis::Interval(const double U) const if (dU <= gp::Resolution()) return 1; - int IntU = int(std::abs(U - First().ParamOnBis()) / dU); + int IntU = static_cast(std::abs(U - First().ParamOnBis()) / dU); IntU++; if (thePoints[IntU].ParamOnBis() >= U) diff --git a/src/ModelingAlgorithms/TKTopAlgo/IntCurvesFace/IntCurvesFace_Intersector.cxx b/src/ModelingAlgorithms/TKTopAlgo/IntCurvesFace/IntCurvesFace_Intersector.cxx index 459de635190..27637dbbc89 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/IntCurvesFace/IntCurvesFace_Intersector.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/IntCurvesFace/IntCurvesFace_Intersector.cxx @@ -177,7 +177,7 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face, if (std::max(dU, dV) > std::min(dU, dV) * aTresh) { aMinSamples = 10; - nbsu = (int)(std::sqrt(dU / dV) * aMaxSamples); + nbsu = static_cast(std::sqrt(dU / dV) * aMaxSamples); if (nbsu < aMinSamples) nbsu = aMinSamples; nbsv = aMaxSamples2 / nbsu; diff --git a/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_Arc.cxx b/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_Arc.cxx index 36c74ae1951..5e3cdeb1b35 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_Arc.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_Arc.cxx @@ -128,16 +128,16 @@ occ::handle MAT_Arc::Neighbour(const occ::handle& aNode, if (aSide == MAT_Left) { if (aNode == FirstNode()) - return (MAT_Arc*)firstArcLeft; + return static_cast(firstArcLeft); if (aNode == SecondNode()) - return (MAT_Arc*)secondArcLeft; + return static_cast(secondArcLeft); } else { if (aNode == FirstNode()) - return (MAT_Arc*)firstArcRight; + return static_cast(firstArcRight); if (aNode == SecondNode()) - return (MAT_Arc*)secondArcRight; + return static_cast(secondArcRight); } throw Standard_DomainError("MAT_Arc::Neighbour"); } diff --git a/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_BasicElt.cxx b/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_BasicElt.cxx index a730f43f37f..b7137c95a8b 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_BasicElt.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_BasicElt.cxx @@ -36,14 +36,14 @@ MAT_BasicElt::MAT_BasicElt(const int anInteger) occ::handle MAT_BasicElt::StartArc() const { - return (MAT_Arc*)startLeftArc; + return static_cast(startLeftArc); } //================================================================================================= occ::handle MAT_BasicElt::EndArc() const { - return (MAT_Arc*)endLeftArc; + return static_cast(endLeftArc); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_Node.cxx b/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_Node.cxx index 391b420a53b..4b31eeef915 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_Node.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/MAT/MAT_Node.cxx @@ -52,7 +52,7 @@ void MAT_Node::LinkedArcs(NCollection_Sequence>& S) const { S.Clear(); occ::handle Me = this; - occ::handle LA((MAT_Arc*)aLinkedArc); + occ::handle LA(static_cast(aLinkedArc)); S.Append(LA); @@ -74,7 +74,7 @@ void MAT_Node::NearElts(NCollection_Sequence>& S) cons S.Clear(); occ::handle Me = this; - occ::handle LA((MAT_Arc*)aLinkedArc); + occ::handle LA(static_cast(aLinkedArc)); S.Append(LA->FirstElement()); S.Append(LA->SecondElement()); @@ -118,7 +118,7 @@ double MAT_Node::Distance() const bool MAT_Node::PendingNode() const { occ::handle Me = this; - return (!((MAT_Arc*)aLinkedArc)->HasNeighbour(Me, MAT_Left)); + return (!(static_cast(aLinkedArc))->HasNeighbour(Me, MAT_Left)); } //================================================================================================= diff --git a/src/ModelingData/TKBRep/BRep/BRep_Tool.cxx b/src/ModelingData/TKBRep/BRep/BRep_Tool.cxx index 50cd9f3735b..aead876c516 100644 --- a/src/ModelingData/TKBRep/BRep/BRep_Tool.cxx +++ b/src/ModelingData/TKBRep/BRep/BRep_Tool.cxx @@ -1214,7 +1214,7 @@ GeomAbs_Shape BRep_Tool::MaxContinuity(const TopoDS_Edge& theEdge) if (aRepr->IsRegularity()) { const GeomAbs_Shape aCont = aRepr->Continuity(); - if ((int)aCont > (int)aMaxCont) + if (static_cast(aCont) > static_cast(aMaxCont)) { aMaxCont = aCont; } diff --git a/src/ModelingData/TKBRep/BRepAdaptor/BRepAdaptor_CompCurve.cxx b/src/ModelingData/TKBRep/BRepAdaptor/BRepAdaptor_CompCurve.cxx index c3f74102d5d..1e5b3668f62 100644 --- a/src/ModelingData/TKBRep/BRepAdaptor/BRepAdaptor_CompCurve.cxx +++ b/src/ModelingData/TKBRep/BRepAdaptor/BRepAdaptor_CompCurve.cxx @@ -134,7 +134,7 @@ void BRepAdaptor_CompCurve::Initialize(const TopoDS_Wire& W, const bool AC) myKnots->ChangeValue(ii + 1) += GCPnts_AbscissaPoint::Length(myCurves->ChangeValue(ii)); } else - myKnots->SetValue(ii + 1, (double)ii); + myKnots->SetValue(ii + 1, static_cast(ii)); } } diff --git a/src/ModelingData/TKBRep/BRepTools/BRepTools.cxx b/src/ModelingData/TKBRep/BRepTools/BRepTools.cxx index c565db79515..3f3baa76616 100644 --- a/src/ModelingData/TKBRep/BRepTools/BRepTools.cxx +++ b/src/ModelingData/TKBRep/BRepTools/BRepTools.cxx @@ -1393,7 +1393,7 @@ static bool removeInternals( } else { - if (removeInternals(*(TopoDS_Shape*)&aSS, theShapesToKeep)) + if (removeInternals(*const_cast(&aSS), theShapesToKeep)) aLRemove.Append(aSS); } } diff --git a/src/ModelingData/TKBRep/BRepTools/BRepTools_Debug.cxx b/src/ModelingData/TKBRep/BRepTools/BRepTools_Debug.cxx index 074ee061f84..55a6f0e9ac3 100644 --- a/src/ModelingData/TKBRep/BRepTools/BRepTools_Debug.cxx +++ b/src/ModelingData/TKBRep/BRepTools/BRepTools_Debug.cxx @@ -32,7 +32,7 @@ const char* BRepTools_Write(const char* theFileStr, void* theShapePtr) try { OCC_CATCH_SIGNALS - if (BRepTools::Write(*(TopoDS_Shape*)theShapePtr, theFileStr)) + if (BRepTools::Write(*static_cast(theShapePtr), theFileStr)) return theFileStr; else return "Error: write failed"; @@ -55,7 +55,7 @@ const char* BRepTools_Dump(void* theShapePtr) OCC_CATCH_SIGNALS std::cout << "\n\n"; - BRepTools::Dump(*(TopoDS_Shape*)theShapePtr, std::cout); + BRepTools::Dump(*static_cast(theShapePtr), std::cout); std::cout << std::endl; return "Shape dumped to std::cout"; @@ -79,7 +79,7 @@ const char* BRepTools_DumpLoc(void* theLocationPtr) std::cout << "\n\n"; TopTools_LocationSet LS; - LS.Add(*(TopLoc_Location*)theLocationPtr); + LS.Add(*static_cast(theLocationPtr)); LS.Dump(std::cout); std::cout << std::endl; diff --git a/src/ModelingData/TKBRep/BRepTools/BRepTools_GTrsfModification.cxx b/src/ModelingData/TKBRep/BRepTools/BRepTools_GTrsfModification.cxx index 4763935664e..541fc9e0afc 100644 --- a/src/ModelingData/TKBRep/BRepTools/BRepTools_GTrsfModification.cxx +++ b/src/ModelingData/TKBRep/BRepTools/BRepTools_GTrsfModification.cxx @@ -288,7 +288,7 @@ bool BRepTools_GTrsfModification::NewTriangulation( aMat.SetDiagonal(1., 1., 1.); gp_Trsf aTrsf; aTrsf.SetForm(gp_Rotation); - (gp_Mat&)aTrsf.HVectorialPart() = aMat; + const_cast(aTrsf.HVectorialPart()) = aMat; aNormal.Transform(aTrsf); theTriangulation->SetNormal(anInd, aNormal); } diff --git a/src/ModelingData/TKBRep/BinTools/BinTools.cxx b/src/ModelingData/TKBRep/BinTools/BinTools.cxx index 687ec441c58..3155d8659f9 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools.cxx @@ -23,7 +23,7 @@ Standard_OStream& BinTools::PutBool(Standard_OStream& OS, const bool aValue) { - OS.put((uint8_t)(aValue ? 1 : 0)); + OS.put(static_cast(aValue ? 1 : 0)); return OS; } @@ -35,7 +35,7 @@ Standard_OStream& BinTools::PutInteger(Standard_OStream& OS, const int aValue) #ifdef DO_INVERSE anIntValue = InverseInt(aValue); #endif - OS.write((char*)&anIntValue, sizeof(int)); + OS.write(reinterpret_cast(&anIntValue), sizeof(int)); return OS; } @@ -73,7 +73,7 @@ Standard_OStream& BinTools::PutExtChar(Standard_OStream& OS, const char16_t aVal #ifdef DO_INVERSE aSValue = InverseExtChar(aValue); #endif - OS.write((char*)&aSValue, sizeof(char16_t)); + OS.write(reinterpret_cast(&aSValue), sizeof(char16_t)); return OS; } @@ -81,7 +81,7 @@ Standard_OStream& BinTools::PutExtChar(Standard_OStream& OS, const char16_t aVal Standard_IStream& BinTools::GetReal(Standard_IStream& theIS, double& theValue) { - if (!theIS.read((char*)&theValue, sizeof(double))) + if (!theIS.read(reinterpret_cast(&theValue), sizeof(double))) { throw Storage_StreamTypeMismatchError(); } @@ -95,7 +95,7 @@ Standard_IStream& BinTools::GetReal(Standard_IStream& theIS, double& theValue) Standard_IStream& BinTools::GetShortReal(Standard_IStream& theIS, float& theValue) { - if (!theIS.read((char*)&theValue, sizeof(float))) + if (!theIS.read(reinterpret_cast(&theValue), sizeof(float))) { throw Storage_StreamTypeMismatchError(); } @@ -109,7 +109,7 @@ Standard_IStream& BinTools::GetShortReal(Standard_IStream& theIS, float& theValu Standard_IStream& BinTools::GetInteger(Standard_IStream& IS, int& aValue) { - if (!IS.read((char*)&aValue, sizeof(int))) + if (!IS.read(reinterpret_cast(&aValue), sizeof(int))) throw Storage_StreamTypeMismatchError(); #ifdef DO_INVERSE aValue = InverseInt(aValue); @@ -121,7 +121,7 @@ Standard_IStream& BinTools::GetInteger(Standard_IStream& IS, int& aValue) Standard_IStream& BinTools::GetExtChar(Standard_IStream& IS, char16_t& theValue) { - if (!IS.read((char*)&theValue, sizeof(char16_t))) + if (!IS.read(reinterpret_cast(&theValue), sizeof(char16_t))) throw Storage_StreamTypeMismatchError(); #ifdef DO_INVERSE theValue = InverseExtChar(theValue); diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_Curve2dSet.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_Curve2dSet.cxx index f04393ae6d9..113c233fecf 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_Curve2dSet.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_Curve2dSet.cxx @@ -91,7 +91,7 @@ int BinTools_Curve2dSet::Index(const occ::handle& S) const static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& L) { - OS << (uint8_t)LINE; + OS << static_cast(LINE); gp_Lin2d C2d = L->Lin2d(); OS << C2d.Location(); // Pnt2d OS << C2d.Direction(); // Dir2d @@ -105,7 +105,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& C) { - OS << (uint8_t)CIRCLE; + OS << static_cast(CIRCLE); gp_Circ2d C2d = C->Circ2d(); OS << C2d.Location(); OS << C2d.XAxis().Direction(); @@ -121,7 +121,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& E) { - OS << (uint8_t)ELLIPSE; + OS << static_cast(ELLIPSE); gp_Elips2d C2d = E->Elips2d(); OS << C2d.Location(); OS << C2d.XAxis().Direction(); @@ -138,7 +138,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& P) { - OS << (uint8_t)PARABOLA; + OS << static_cast(PARABOLA); gp_Parab2d C2d = P->Parab2d(); OS << C2d.Location(); // Loc OS << C2d.Axis().XAxis().Direction(); // XDir @@ -154,7 +154,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& H) { - OS << (uint8_t)HYPERBOLA; + OS << static_cast(HYPERBOLA); gp_Hypr2d C2d = H->Hypr2d(); OS << C2d.Location(); // Loc OS << C2d.XAxis().Direction(); // XDir @@ -171,12 +171,12 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& B) { - OS << (uint8_t)BEZIER; + OS << static_cast(BEZIER); bool aRational = B->IsRational(); OS << aRational; // rational // poles and weights int i, aDegree = B->Degree(); - OS << (char16_t)aDegree; // Degree + OS << static_cast(aDegree); // Degree for (i = 1; i <= aDegree + 1; i++) { OS << B->Pole(i); // Pnt2d @@ -193,7 +193,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& B) { - OS << (uint8_t)BSPLINE; + OS << static_cast(BSPLINE); bool aRational = B->IsRational(); OS << aRational; // rational bool aPeriodic = B->IsPeriodic(); @@ -203,7 +203,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handleDegree(); aNbPoles = B->NbPoles(); aNbKnots = B->NbKnots(); - OS << (char16_t)aDegree; + OS << static_cast(aDegree); OS << aNbPoles; OS << aNbKnots; for (i = 1; i <= aNbPoles; i++) @@ -229,7 +229,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& C) { - OS << (uint8_t)TRIMMED; + OS << static_cast(TRIMMED); OS << C->FirstParameter(); OS << C->LastParameter(); BinTools_Curve2dSet::WriteCurve2d(C->BasisCurve(), OS); @@ -243,7 +243,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& C) { - OS << (uint8_t)OFFSET; + OS << static_cast(OFFSET); OS << C->Offset(); // Offset BinTools_Curve2dSet::WriteCurve2d(C->BasisCurve(), OS); return OS; @@ -420,7 +420,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS, occ::handle(aVal); NCollection_Array1 poles(1, degree + 1); NCollection_Array1 weights(1, degree + 1); @@ -453,7 +453,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS, occ::handle(aVal); BinTools::GetInteger(IS, nbpoles); @@ -519,7 +519,7 @@ Standard_IStream& BinTools_Curve2dSet::ReadCurve2d(Standard_IStream& IS try { OCC_CATCH_SIGNALS - const uint8_t ctype = (uint8_t)IS.get(); + const uint8_t ctype = static_cast(IS.get()); switch (ctype) { diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_CurveSet.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_CurveSet.cxx index d0640d382d2..328b0d3a89e 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_CurveSet.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_CurveSet.cxx @@ -92,7 +92,7 @@ int BinTools_CurveSet::Index(const occ::handle& S) const static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& L) { - OS << (uint8_t)LINE; + OS << static_cast(LINE); gp_Lin C = L->Lin(); OS << C.Location(); // Pnt OS << C.Direction(); // Dir @@ -106,7 +106,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& CC) { - OS << (uint8_t)CIRCLE; + OS << static_cast(CIRCLE); gp_Circ C = CC->Circ(); OS << C.Location(); OS << C.Axis().Direction(); @@ -123,7 +123,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& E) { - OS << (uint8_t)ELLIPSE; + OS << static_cast(ELLIPSE); gp_Elips C = E->Elips(); OS << C.Location(); OS << C.Axis().Direction(); @@ -141,7 +141,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& P) { - OS << (uint8_t)PARABOLA; + OS << static_cast(PARABOLA); gp_Parab C = P->Parab(); OS << C.Location(); OS << C.Axis().Direction(); @@ -158,7 +158,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& H) { - OS << (uint8_t)HYPERBOLA; + OS << static_cast(HYPERBOLA); gp_Hypr C = H->Hypr(); OS << C.Location(); OS << C.Axis().Direction(); @@ -176,12 +176,12 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& B) { - OS << (uint8_t)BEZIER; + OS << static_cast(BEZIER); bool aRational = B->IsRational(); OS << aRational; // rational // poles and weights int i, aDegree = B->Degree(); - OS << (char16_t)aDegree; //<< Degree + OS << static_cast(aDegree); //<< Degree for (i = 1; i <= aDegree + 1; i++) { OS << B->Pole(i); // Pnt @@ -198,7 +198,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& B) { - OS << (uint8_t)BSPLINE; + OS << static_cast(BSPLINE); bool aRational = B->IsRational(); OS << aRational; // rational bool aPeriodic = B->IsPeriodic(); @@ -208,7 +208,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handleDegree(); aNbPoles = B->NbPoles(); aNbKnots = B->NbKnots(); - OS << (char16_t)aDegree; + OS << static_cast(aDegree); OS << aNbPoles; OS << aNbKnots; for (i = 1; i <= aNbPoles; i++) @@ -233,7 +233,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& C) { - OS << (uint8_t)TRIMMED; + OS << static_cast(TRIMMED); OS << C->FirstParameter(); OS << C->LastParameter(); BinTools_CurveSet::WriteCurve(C->BasisCurve(), OS); @@ -247,7 +247,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& C) { - OS << (uint8_t)OFFSET; + OS << static_cast(OFFSET); OS << C->Offset(); // Offset OS << C->Direction(); BinTools_CurveSet::WriteCurve(C->BasisCurve(), OS); @@ -427,7 +427,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS, occ::handle(aVal); NCollection_Array1 poles(1, degree + 1); NCollection_Array1 weights(1, degree + 1); @@ -461,7 +461,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS, occ::handle(aVal); BinTools::GetInteger(IS, nbpoles); @@ -528,7 +528,7 @@ Standard_IStream& BinTools_CurveSet::ReadCurve(Standard_IStream& IS, occ::handle try { OCC_CATCH_SIGNALS - const uint8_t ctype = (uint8_t)IS.get(); + const uint8_t ctype = static_cast(IS.get()); switch (ctype) { diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_IStream.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_IStream.cxx index 7daca9349e5..1cfbe3d05ec 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_IStream.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_IStream.cxx @@ -51,32 +51,32 @@ uint64_t BinTools_IStream::ReadReference() switch (myLastType) { case BinTools_ObjectType_Reference8: - aDelta = uint64_t(myStream->get()); + aDelta = static_cast(myStream->get()); myPosition++; break; case BinTools_ObjectType_Reference16: { uint16_t aDelta16 = 0; - myStream->read((char*)&aDelta16, sizeof(uint16_t)); + myStream->read(reinterpret_cast(&aDelta16), sizeof(uint16_t)); myPosition += 2; #if DO_INVERSE aDelta16 = (0 | ((aDelta16 & 0x00FF) << 8) | ((aDelta16 & 0xFF00) >> 8)); #endif - aDelta = uint64_t(aDelta16); + aDelta = static_cast(aDelta16); break; } case BinTools_ObjectType_Reference32: { uint32_t aDelta32 = 0; - myStream->read((char*)&aDelta32, sizeof(uint32_t)); + myStream->read(reinterpret_cast(&aDelta32), sizeof(uint32_t)); myPosition += 4; #if DO_INVERSE aDelta32 = (0 | ((aDelta32 & 0x000000ff) << 24) | ((aDelta32 & 0x0000ff00) << 8) | ((aDelta32 & 0x00ff0000) >> 8) | ((aDelta32 >> 24) & 0x000000ff)); #endif - aDelta = uint64_t(aDelta32); + aDelta = static_cast(aDelta32); break; } case BinTools_ObjectType_Reference64: - myStream->read((char*)&aDelta, sizeof(uint64_t)); + myStream->read(reinterpret_cast(&aDelta), sizeof(uint64_t)); myPosition += 8; #if DO_INVERSE aDelta = InverseUint64(aDelta); @@ -88,7 +88,7 @@ uint64_t BinTools_IStream::ReadReference() if (aDelta == 0) { Standard_SStream aMsg; - aMsg << "BinTools_IStream::ReadReference: invalid reference " << (char)myLastType << std::endl; + aMsg << "BinTools_IStream::ReadReference: invalid reference " << static_cast(myLastType) << std::endl; throw Standard_Failure(aMsg.str().c_str()); } return aCurrentPos - aDelta - 1; // add a type-byte @@ -131,7 +131,7 @@ BinTools_IStream::operator bool() const BinTools_IStream& BinTools_IStream::operator>>(double& theValue) { - if (!myStream->read((char*)&theValue, sizeof(double))) + if (!myStream->read(reinterpret_cast(&theValue), sizeof(double))) throw Storage_StreamTypeMismatchError(); myPosition += sizeof(double); #if DO_INVERSE @@ -144,7 +144,7 @@ BinTools_IStream& BinTools_IStream::operator>>(double& theValue) BinTools_IStream& BinTools_IStream::operator>>(int& theValue) { - if (!myStream->read((char*)&theValue, sizeof(int))) + if (!myStream->read(reinterpret_cast(&theValue), sizeof(int))) throw Storage_StreamTypeMismatchError(); myPosition += sizeof(int); #if DO_INVERSE @@ -160,7 +160,7 @@ BinTools_IStream& BinTools_IStream::operator>>(gp_Pnt& theValue) double aValue; for (int aCoord = 1; aCoord <= 3; aCoord++) { - if (!myStream->read((char*)&aValue, sizeof(double))) + if (!myStream->read(reinterpret_cast(&aValue), sizeof(double))) throw Storage_StreamTypeMismatchError(); #if DO_INVERSE aValue = InverseReal(aValue); @@ -175,7 +175,7 @@ BinTools_IStream& BinTools_IStream::operator>>(gp_Pnt& theValue) BinTools_IStream& BinTools_IStream::operator>>(uint8_t& theValue) { - myStream->read((char*)&theValue, sizeof(uint8_t)); + myStream->read(reinterpret_cast(&theValue), sizeof(uint8_t)); myPosition += sizeof(uint8_t); return *this; } @@ -184,7 +184,7 @@ BinTools_IStream& BinTools_IStream::operator>>(uint8_t& theValue) BinTools_IStream& BinTools_IStream::operator>>(float& theValue) { - myStream->read((char*)&theValue, sizeof(float)); + myStream->read(reinterpret_cast(&theValue), sizeof(float)); myPosition += sizeof(float); return *this; } diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_LocationSet.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_LocationSet.cxx index bb67d67c0ce..83fb518cfed 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_LocationSet.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_LocationSet.cxx @@ -152,12 +152,12 @@ void BinTools_LocationSet::Write(Standard_OStream& OS) const if (elementary) { - OS.put((uint8_t)1); // 1 + OS.put(static_cast(1)); // 1 OS << L.Transformation(); } else { - OS.put((uint8_t)2); // 2 + OS.put(static_cast(2)); // 2 BinTools::PutInteger(OS, myMap.FindIndex(L1)); BinTools::PutInteger(OS, p); while (!L2.IsIdentity()) @@ -212,7 +212,7 @@ void BinTools_LocationSet::Read(Standard_IStream& IS) for (i = 1; i <= nbLoc; i++) { - const uint8_t aTypLoc = (uint8_t)IS.get(); + const uint8_t aTypLoc = static_cast(IS.get()); if (aTypLoc == 1) { IS >> T; diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_OStream.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_OStream.cxx index 002f7f4e644..9b5d4a6ab36 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_OStream.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_OStream.cxx @@ -32,38 +32,38 @@ void BinTools_OStream::WriteReference(const uint64_t& thePosition) uint64_t aDelta = myPosition - thePosition; if (aDelta <= 0xFF) { - *myStream << (uint8_t)BinTools_ObjectType_Reference8; - *myStream << (uint8_t)aDelta; + *myStream << static_cast(BinTools_ObjectType_Reference8); + *myStream << static_cast(aDelta); myPosition += sizeof(uint8_t) * 2; } else if (aDelta <= 0xFFFF) { - *myStream << (uint8_t)BinTools_ObjectType_Reference16; - uint16_t aDelta16 = uint16_t(aDelta); + *myStream << static_cast(BinTools_ObjectType_Reference16); + uint16_t aDelta16 = static_cast(aDelta); #if DO_INVERSE aDelta16 = (0 | ((aDelta16 & 0x00FF) << 8) | ((aDelta16 & 0xFF00) >> 8)); #endif - myStream->write((char*)&aDelta16, sizeof(uint16_t)); + myStream->write(reinterpret_cast(&aDelta16), sizeof(uint16_t)); myPosition += sizeof(uint8_t) + sizeof(uint16_t); } else if (aDelta <= 0xFFFFFFFF) { - *myStream << (uint8_t)BinTools_ObjectType_Reference32; - uint32_t aDelta32 = uint32_t(aDelta); + *myStream << static_cast(BinTools_ObjectType_Reference32); + uint32_t aDelta32 = static_cast(aDelta); #if DO_INVERSE aDelta32 = (0 | ((aDelta32 & 0x000000ff) << 24) | ((aDelta32 & 0x0000ff00) << 8) | ((aDelta32 & 0x00ff0000) >> 8) | ((aDelta32 >> 24) & 0x000000ff)); #endif - myStream->write((char*)&aDelta32, sizeof(uint32_t)); + myStream->write(reinterpret_cast(&aDelta32), sizeof(uint32_t)); myPosition += sizeof(uint8_t) + sizeof(uint32_t); } else { - *myStream << (uint8_t)BinTools_ObjectType_Reference64; + *myStream << static_cast(BinTools_ObjectType_Reference64); #if DO_INVERSE aDelta = FSD_BinaryFile::InverseUint64(aDelta); #endif - myStream->write((char*)&aDelta, sizeof(uint64_t)); + myStream->write(reinterpret_cast(&aDelta), sizeof(uint64_t)); myPosition += sizeof(uint8_t) + sizeof(uint64_t); } } @@ -77,7 +77,7 @@ void BinTools_OStream::WriteShape(const TopAbs_ShapeEnum& theType, + // taking into account that orientation <= 3 (static_cast(theType) << 2) + static_cast(theOrientation); // and type <= 8 - myStream->put((uint8_t)aType); + myStream->put(aType); myPosition += sizeof(uint8_t); } @@ -85,7 +85,7 @@ void BinTools_OStream::WriteShape(const TopAbs_ShapeEnum& theType, BinTools_OStream& BinTools_OStream::operator<<(const BinTools_ObjectType& theType) { - myStream->put((uint8_t)theType); + myStream->put(static_cast(theType)); myPosition += sizeof(uint8_t); return *this; } @@ -117,7 +117,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const double& theValue) BinTools_OStream& BinTools_OStream::operator<<(const bool& theValue) { - myStream->put((uint8_t)(theValue ? 1 : 0)); + myStream->put(static_cast(theValue ? 1 : 0)); myPosition += sizeof(uint8_t); return *this; } @@ -163,7 +163,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const gp_Pnt& theValue) myRealBuf[1] = theValue.Y(); myRealBuf[2] = theValue.Z(); #endif - myStream->write((char*)myRealBuf, sizeof(double) * 3); + myStream->write(reinterpret_cast(myRealBuf), sizeof(double) * 3); myPosition += sizeof(double) * 3; return *this; } @@ -181,7 +181,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const gp_Dir& theValue) myRealBuf[1] = theValue.Y(); myRealBuf[2] = theValue.Z(); #endif - myStream->write((char*)myRealBuf, sizeof(double) * 3); + myStream->write(reinterpret_cast(myRealBuf), sizeof(double) * 3); myPosition += sizeof(double) * 3; return *this; } @@ -197,7 +197,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const gp_Pnt2d& theValue) myRealBuf[0] = theValue.X(); myRealBuf[1] = theValue.Y(); #endif - myStream->write((char*)myRealBuf, sizeof(double) * 2); + myStream->write(reinterpret_cast(myRealBuf), sizeof(double) * 2); myPosition += sizeof(double) * 2; return *this; } @@ -213,7 +213,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const gp_Dir2d& theValue) myRealBuf[0] = theValue.X(); myRealBuf[1] = theValue.Y(); #endif - myStream->write((char*)myRealBuf, sizeof(double) * 2); + myStream->write(reinterpret_cast(myRealBuf), sizeof(double) * 2); myPosition += sizeof(double) * 2; return *this; } @@ -251,7 +251,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const gp_Trsf& theValue) myRealBuf[10] = aMat(3, 3); myRealBuf[11] = aTr.Coord(3); #endif - myStream->write((char*)myRealBuf, sizeof(double) * 12); + myStream->write(reinterpret_cast(myRealBuf), sizeof(double) * 12); myPosition += sizeof(double) * 12; return *this; } @@ -270,7 +270,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const Poly_Triangle& theValue) myIntBuf[1] = theValue.Value(2); myIntBuf[2] = theValue.Value(3); #endif - myStream->write((char*)myIntBuf, sizeof(int) * 3); + myStream->write(reinterpret_cast(myIntBuf), sizeof(int) * 3); myPosition += sizeof(int) * 3; return *this; } @@ -288,7 +288,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const NCollection_Vec3& th myFloatBuf[1] = theValue.y(); myFloatBuf[2] = theValue.z(); #endif - myStream->write((char*)myFloatBuf, sizeof(float) * 3); + myStream->write(reinterpret_cast(myFloatBuf), sizeof(float) * 3); myPosition += sizeof(float) * 3; return *this; } @@ -298,7 +298,7 @@ BinTools_OStream& BinTools_OStream::operator<<(const NCollection_Vec3& th void BinTools_OStream::PutBools(const bool theValue1, const bool theValue2, const bool theValue3) { uint8_t aValue = (theValue1 ? 1 : 0) | (theValue2 ? 2 : 0) | (theValue3 ? 4 : 0); - myStream->write((char*)&aValue, sizeof(uint8_t)); + myStream->write(reinterpret_cast(&aValue), sizeof(uint8_t)); myPosition += sizeof(uint8_t); } @@ -315,6 +315,6 @@ void BinTools_OStream::PutBools(const bool theValue1, uint8_t aValue = (theValue1 ? 1 : 0) | (theValue2 ? 2 : 0) | (theValue3 ? 4 : 0) | (theValue4 ? 8 : 0) | (theValue5 ? 16 : 0) | (theValue6 ? 32 : 0) | (theValue7 ? 64 : 0); - myStream->write((char*)&aValue, sizeof(uint8_t)); + myStream->write(reinterpret_cast(&aValue), sizeof(uint8_t)); myPosition += sizeof(uint8_t); } diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_ShapeReader.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_ShapeReader.cxx index 617eea21e69..942778cf914 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_ShapeReader.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_ShapeReader.cxx @@ -188,7 +188,7 @@ TopoDS_Shape BinTools_ShapeReader::ReadShape(BinTools_IStream& theStream) if (aClosed) { aCurve2d_2 = ReadCurve2d(theStream); - aReg = (GeomAbs_Shape)theStream.ReadByte(); + aReg = static_cast(theStream.ReadByte()); } occ::handle aSurface = ReadSurface(theStream); const TopLoc_Location* aLoc = ReadLocation(theStream); @@ -210,7 +210,7 @@ TopoDS_Shape BinTools_ShapeReader::ReadShape(BinTools_IStream& theStream) } case 4: // -4- Regularity { - GeomAbs_Shape aReg = (GeomAbs_Shape)theStream.ReadByte(); + GeomAbs_Shape aReg = static_cast(theStream.ReadByte()); occ::handle aSurface1 = ReadSurface(theStream); const TopLoc_Location* aLoc1 = ReadLocation(theStream); occ::handle aSurface2 = ReadSurface(theStream); diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_ShapeSet.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_ShapeSet.cxx index 94b52b917a4..1cdae9702f6 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_ShapeSet.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_ShapeSet.cxx @@ -314,7 +314,7 @@ void BinTools_ShapeSet::Write(Standard_OStream& OS, const Message_ProgressRange& const TopoDS_Shape& S = myShapes(i); // Type - OS << (uint8_t)S.ShapeType(); + OS << static_cast(S.ShapeType()); // Geometry WriteShape(S, OS); @@ -413,7 +413,7 @@ void BinTools_ShapeSet::Read(Standard_IStream& IS, const Message_ProgressRange& for (int i = 1; i <= nbShapes && aPSinner.More(); i++, aPSinner.Next()) { TopoDS_Shape S; - TopAbs_ShapeEnum T = (TopAbs_ShapeEnum)IS.get(); + TopAbs_ShapeEnum T = static_cast(IS.get()); ReadShape(T, IS, S); ReadFlagsAndSubs(S, T, IS, nbShapes); myShapes.Add(S); @@ -430,7 +430,7 @@ void BinTools_ShapeSet::Write(const TopoDS_Shape& S, Standard_OStream& OS) else { // {TopAbs_FORWARD, TopAbs_REVERSED, TopAbs_INTERNAL, TopAbs_EXTERNAL} - OS << (uint8_t)S.Orientation(); + OS << static_cast(S.Orientation()); BinTools::PutInteger(OS, myShapes.Extent() - myShapes.FindIndex(S.Located(TopLoc_Location())) + 1); BinTools::PutInteger(OS, Locations().Index(S.Location())); @@ -495,7 +495,7 @@ void BinTools_ShapeSet::ReadSubs(TopoDS_Shape& S, Standard_IStream& IS, const in else { TopAbs_Orientation anOrient; - anOrient = (TopAbs_Orientation)aChar; + anOrient = static_cast(aChar); int anIndx; BinTools::GetInteger(IS, anIndx); S = Shape(nbshapes - anIndx + 1); @@ -566,7 +566,7 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) #ifdef OCCT_DEBUG_POS aPos = OS.tellp(); #endif - OS << (uint8_t)1; // 1 + OS << static_cast(1); // 1 BinTools::PutReal(OS, PR->Parameter()); BinTools::PutInteger(OS, myCurves.Index(PR->Curve())); } @@ -576,7 +576,7 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) #ifdef OCCT_DEBUG_POS aPos = OS.tellp(); #endif - OS << (uint8_t)2; // 2 + OS << static_cast(2); // 2 BinTools::PutReal(OS, PR->Parameter()); BinTools::PutInteger(OS, myCurves2d.Index(PR->PCurve())); BinTools::PutInteger(OS, mySurfaces.Index(PR->Surface())); @@ -587,7 +587,7 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) #ifdef OCCT_DEBUG_POS aPos = OS.tellp(); #endif - OS << (uint8_t)3; // 3 + OS << static_cast(3); // 3 BinTools::PutReal(OS, PR->Parameter2()); BinTools::PutReal(OS, PR->Parameter()); BinTools::PutInteger(OS, mySurfaces.Index(PR->Surface())); @@ -597,7 +597,7 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) } // OS << "0 0\n"; // end representations - OS.put((uint8_t)0); + OS.put(static_cast(0)); } else if (S.ShapeType() == TopAbs_EDGE) @@ -627,7 +627,7 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) { occ::handle GC = occ::down_cast(itrc.Value()); GC->Range(first, last); - OS << (uint8_t)1; // CURVE_3D; + OS << static_cast(1); // CURVE_3D; BinTools::PutInteger(OS, myCurves.Index(CR->Curve3D())); BinTools::PutInteger(OS, Locations().Index(CR->Location())); BinTools::PutReal(OS, first); @@ -640,15 +640,15 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) GC->Range(first, last); if (!CR->IsCurveOnClosedSurface()) // -2- Curve on surf - OS << (uint8_t)2; + OS << static_cast(2); else // -3- Curve on closed surf - OS << (uint8_t)3; + OS << static_cast(3); BinTools::PutInteger(OS, myCurves2d.Index(CR->PCurve())); if (CR->IsCurveOnClosedSurface()) { //+ int|char BinTools::PutInteger(OS, myCurves2d.Index(CR->PCurve2())); - OS << (uint8_t)CR->Continuity(); + OS << static_cast(CR->Continuity()); } BinTools::PutInteger(OS, mySurfaces.Index(CR->Surface())); BinTools::PutInteger(OS, Locations().Index(CR->Location())); @@ -680,8 +680,8 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) else if (CR->IsRegularity()) { // -4- Regularity - OS << (uint8_t)4; - OS << (uint8_t)CR->Continuity(); + OS << static_cast(4); + OS << static_cast(CR->Continuity()); BinTools::PutInteger(OS, mySurfaces.Index(CR->Surface())); BinTools::PutInteger(OS, Locations().Index(CR->Location())); BinTools::PutInteger(OS, mySurfaces.Index(CR->Surface2())); @@ -696,7 +696,7 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) if (!GC->Polygon3D().IsNull()) { // -5- Polygon3D - OS << (uint8_t)5; + OS << static_cast(5); BinTools::PutInteger(OS, myPolygons3D.FindIndex(CR->Polygon3D())); BinTools::PutInteger(OS, Locations().Index(CR->Location())); } @@ -707,10 +707,10 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) occ::down_cast(itrc.Value()); if (!CR->IsPolygonOnClosedTriangulation()) // -6- Polygon on triangulation - OS << (uint8_t)6; + OS << static_cast(6); else // -7- Polygon on closed triangulation - OS << (uint8_t)7; + OS << static_cast(7); BinTools::PutInteger(OS, myNodes.FindIndex(PT->PolygonOnTriangulation())); if (CR->IsPolygonOnClosedTriangulation()) @@ -726,7 +726,7 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) } // OS << "0\n"; // end of the list of representations - OS << (uint8_t)0; + OS << static_cast(0); } else if (S.ShapeType() == TopAbs_FACE) @@ -746,15 +746,15 @@ void BinTools_ShapeSet::WriteShape(const TopoDS_Shape& S, Standard_OStream& OS) { if (!(TF->Triangulation()).IsNull()) { - OS << (uint8_t)2; + OS << static_cast(2); // Write the triangulation BinTools::PutInteger(OS, myTriangulations.FindIndex(TF->Triangulation())); } else - OS << (uint8_t)1; + OS << static_cast(1); } else - OS << (uint8_t)0; // without triangulation + OS << static_cast(0); // without triangulation } } catch (Standard_Failure const& anException) @@ -806,7 +806,7 @@ void BinTools_ShapeSet::ReadShape(const TopAbs_ShapeEnum T, Standard_IStream& IS { if (FormatNb() == BinTools_FormatVersion_VERSION_3) { - val = (int)IS.get(); // case {0|1|2|3} + val = static_cast(IS.get()); // case {0|1|2|3} if (val > 0 && val <= 3) BinTools::GetReal(IS, p1); } @@ -814,14 +814,14 @@ void BinTools_ShapeSet::ReadShape(const TopAbs_ShapeEnum T, Standard_IStream& IS { std::streampos aPos = IS.tellg(); BinTools::GetReal(IS, p1); - val = (int)IS.get(); // case {0|1|2|3} + val = static_cast(IS.get()); // case {0|1|2|3} #ifdef OCCT_DEBUG std::cout << "\nVal = " << val << std::endl; #endif if (val != 1 && val != 2 && val != 3) { IS.seekg(aPos); - val = (int)IS.get(); + val = static_cast(IS.get()); if (val > 0 && val <= 3) BinTools::GetReal(IS, p1); } @@ -915,7 +915,7 @@ void BinTools_ShapeSet::ReadShape(const TopAbs_ShapeEnum T, Standard_IStream& IS do { - val = (int)IS.get(); //{0|1|2|3|4|5|6|7} + val = static_cast(IS.get()); //{0|1|2|3|4|5|6|7} // -0- no representation // -1- Curve 3D // -2- Curve on surf @@ -953,7 +953,7 @@ void BinTools_ShapeSet::ReadShape(const TopAbs_ShapeEnum T, Standard_IStream& IS if (closed) { BinTools::GetInteger(IS, pc2); - reg = (GeomAbs_Shape)IS.get(); + reg = static_cast(IS.get()); } // surface, location @@ -1037,7 +1037,7 @@ void BinTools_ShapeSet::ReadShape(const TopAbs_ShapeEnum T, Standard_IStream& IS break; case 4: // -4- Regularity - reg = (GeomAbs_Shape)IS.get(); + reg = static_cast(IS.get()); BinTools::GetInteger(IS, s); BinTools::GetInteger(IS, l); BinTools::GetInteger(IS, s2); @@ -1121,7 +1121,7 @@ void BinTools_ShapeSet::ReadShape(const TopAbs_ShapeEnum T, Standard_IStream& IS tol); myBuilder.NaturalRestriction(F, bval); - uint8_t aByte = (uint8_t)IS.get(); + uint8_t aByte = static_cast(IS.get()); // triangulation case if (aByte == 2) { diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_ShapeWriter.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_ShapeWriter.cxx index ed13d69856e..b1ea3b71061 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_ShapeWriter.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_ShapeWriter.cxx @@ -106,26 +106,26 @@ void BinTools_ShapeWriter::WriteShape(BinTools_OStream& theStream, const TopoDS_ const occ::handle& aPR = anIter.Value(); if (aPR->IsPointOnCurve()) { - theStream << (uint8_t)1; // 1 + theStream << static_cast(1); // 1 theStream << aPR->Parameter(); WriteCurve(theStream, aPR->Curve()); } else if (aPR->IsPointOnCurveOnSurface()) { - theStream << (uint8_t)2; // 2 + theStream << static_cast(2); // 2 theStream << aPR->Parameter(); WriteCurve(theStream, aPR->PCurve()); WriteSurface(theStream, aPR->Surface()); } else if (aPR->IsPointOnSurface()) { - theStream << (uint8_t)3; // 3 + theStream << static_cast(3); // 3 theStream << aPR->Parameter2() << aPR->Parameter(); WriteSurface(theStream, aPR->Surface()); } WriteLocation(theStream, aPR->Location()); } - theStream << (uint8_t)0; + theStream << static_cast(0); } break; case TopAbs_EDGE: { @@ -145,7 +145,7 @@ void BinTools_ShapeWriter::WriteShape(BinTools_OStream& theStream, const TopoDS_ { occ::handle aGC = occ::down_cast(aCR); aGC->Range(aFirst, aLast); - theStream << (uint8_t)1; // -1- CURVE_3D; + theStream << static_cast(1); // -1- CURVE_3D; WriteCurve(theStream, aCR->Curve3D()); WriteLocation(theStream, aCR->Location()); theStream << aFirst << aLast; @@ -156,15 +156,15 @@ void BinTools_ShapeWriter::WriteShape(BinTools_OStream& theStream, const TopoDS_ occ::handle GC = occ::down_cast(aCR); GC->Range(aFirst, aLast); if (!aCR->IsCurveOnClosedSurface()) - theStream << (uint8_t)2; // -2- Curve on surf + theStream << static_cast(2); // -2- Curve on surf else - theStream << (uint8_t)3; // -3- Curve on closed surf + theStream << static_cast(3); // -3- Curve on closed surf WriteCurve(theStream, aCR->PCurve()); if (aCR->IsCurveOnClosedSurface()) { //+ int|char WriteCurve(theStream, aCR->PCurve2()); - theStream << (uint8_t)aCR->Continuity(); + theStream << static_cast(aCR->Continuity()); } WriteSurface(theStream, aCR->Surface()); WriteLocation(theStream, aCR->Location()); @@ -172,8 +172,8 @@ void BinTools_ShapeWriter::WriteShape(BinTools_OStream& theStream, const TopoDS_ } else if (aCR->IsRegularity()) { - theStream << (uint8_t)4; // -4- Regularity - theStream << (uint8_t)aCR->Continuity(); + theStream << static_cast(4); // -4- Regularity + theStream << static_cast(aCR->Continuity()); WriteSurface(theStream, aCR->Surface()); WriteLocation(theStream, aCR->Location()); WriteSurface(theStream, aCR->Surface2()); @@ -186,7 +186,7 @@ void BinTools_ShapeWriter::WriteShape(BinTools_OStream& theStream, const TopoDS_ occ::handle aGC = occ::down_cast(aCR); if (!aGC->Polygon3D().IsNull()) { - theStream << (uint8_t)5; // -5- Polygon3D + theStream << static_cast(5); // -5- Polygon3D WritePolygon(theStream, aCR->Polygon3D()); WriteLocation(theStream, aCR->Location()); } @@ -196,9 +196,9 @@ void BinTools_ShapeWriter::WriteShape(BinTools_OStream& theStream, const TopoDS_ occ::handle aPT = occ::down_cast(aCR); if (!aCR->IsPolygonOnClosedTriangulation()) - theStream << (uint8_t)6; // -6- Polygon on triangulation + theStream << static_cast(6); // -6- Polygon on triangulation else - theStream << (uint8_t)7; // -7- Polygon on closed triangulation + theStream << static_cast(7); // -7- Polygon on closed triangulation WritePolygon(theStream, aPT->PolygonOnTriangulation()); if (aCR->IsPolygonOnClosedTriangulation()) @@ -209,7 +209,7 @@ void BinTools_ShapeWriter::WriteShape(BinTools_OStream& theStream, const TopoDS_ } } } - theStream << (uint8_t)0; + theStream << static_cast(0); } break; case TopAbs_FACE: { @@ -226,17 +226,17 @@ void BinTools_ShapeWriter::WriteShape(BinTools_OStream& theStream, const TopoDS_ { if (!(aTF->Triangulation()).IsNull()) { - theStream << (uint8_t)2; + theStream << static_cast(2); WriteTriangulation(theStream, aTF->Triangulation(), aTF->Triangulation()->HasNormals() && (IsWithNormals() || aTF->Surface().IsNull())); } else - theStream << (uint8_t)1; + theStream << static_cast(1); } else - theStream << (uint8_t)0; // without triangulation + theStream << static_cast(0); // without triangulation } break; default: { diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_SurfaceSet.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_SurfaceSet.cxx index 54ee6358ace..aa876c96f40 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_SurfaceSet.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_SurfaceSet.cxx @@ -91,7 +91,7 @@ int BinTools_SurfaceSet::Index(const occ::handle& S) const static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)PLANE; + OS << static_cast(PLANE); gp_Pln P = S->Pln(); OS << P.Location(); // Pnt OS << P.Axis().Direction(); @@ -108,7 +108,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)CYLINDER; + OS << static_cast(CYLINDER); gp_Cylinder P = S->Cylinder(); OS << P.Location(); // Pnt OS << P.Axis().Direction(); @@ -125,7 +125,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)CONE; + OS << static_cast(CONE); gp_Cone P = S->Cone(); OS << P.Location(); // Pnt OS << P.Axis().Direction(); @@ -144,7 +144,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)SPHERE; + OS << static_cast(SPHERE); gp_Sphere P = S->Sphere(); OS << P.Location(); // Pnt OS << P.Position().Axis().Direction(); @@ -162,7 +162,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)TORUS; + OS << static_cast(TORUS); gp_Torus P = S->Torus(); OS << P.Location(); // Pnt OS << P.Axis().Direction(); @@ -181,7 +181,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)LINEAREXTRUSION; + OS << static_cast(LINEAREXTRUSION); OS << S->Direction(); BinTools_CurveSet::WriteCurve(S->BasisCurve(), OS); return OS; @@ -195,7 +195,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)REVOLUTION; + OS << static_cast(REVOLUTION); OS << S->Location(); OS << S->Direction(); BinTools_CurveSet::WriteCurve(S->BasisCurve(), OS); @@ -209,7 +209,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)BEZIER; + OS << static_cast(BEZIER); bool urational = S->IsURational(); bool vrational = S->IsVRational(); OS << urational; // rational @@ -219,8 +219,8 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handleUDegree(); vdegree = S->VDegree(); - OS << (char16_t)udegree; - OS << (char16_t)vdegree; + OS << static_cast(udegree); + OS << static_cast(vdegree); for (i = 1; i <= udegree + 1; i++) { for (j = 1; j <= vdegree + 1; j++) @@ -242,7 +242,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)BSPLINE; + OS << static_cast(BSPLINE); bool urational = S->IsURational(); bool vrational = S->IsVRational(); bool uperiodic = S->IsUPeriodic(); @@ -260,8 +260,8 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handleNbVPoles(); nbuknots = S->NbUKnots(); nbvknots = S->NbVKnots(); - OS << (char16_t)udegree; - OS << (char16_t)vdegree; + OS << static_cast(udegree); + OS << static_cast(vdegree); OS << nbupoles; OS << nbvpoles; OS << nbuknots; @@ -298,7 +298,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)RECTANGULAR; + OS << static_cast(RECTANGULAR); double U1, U2, V1, V2; S->Bounds(U1, U2, V1, V2); OS << U1 << U2 << V1 << V2; @@ -313,7 +313,7 @@ static BinTools_OStream& operator<<(BinTools_OStream& static BinTools_OStream& operator<<(BinTools_OStream& OS, const occ::handle& S) { - OS << (uint8_t)OFFSET; + OS << static_cast(OFFSET); OS << S->Offset(); BinTools_SurfaceSet::WriteSurface(S->BasisSurface(), OS); return OS; @@ -538,9 +538,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS, occ::handle(aVal); BinTools::GetExtChar(IS, aVal); - vdegree = (int)aVal; + vdegree = static_cast(aVal); // std::cout << "\ttudegree = " << udegree << ", vdegree = " << vdegree << std::endl; NCollection_Array2 poles(1, udegree + 1, 1, vdegree + 1); @@ -579,9 +579,9 @@ static Standard_IStream& operator>>(Standard_IStream& IS, occ::handle(aVal); BinTools::GetExtChar(IS, aVal); - vdegree = (int)aVal; + vdegree = static_cast(aVal); BinTools::GetInteger(IS, nbupoles); BinTools::GetInteger(IS, nbvpoles); BinTools::GetInteger(IS, nbuknots); @@ -677,7 +677,7 @@ Standard_IStream& BinTools_SurfaceSet::ReadSurface(Standard_IStream& IS try { OCC_CATCH_SIGNALS - const uint8_t stype = (uint8_t)IS.get(); + const uint8_t stype = static_cast(IS.get()); switch (stype) { diff --git a/src/ModelingData/TKBRep/TopoDS/TopoDS.hxx b/src/ModelingData/TKBRep/TopoDS/TopoDS.hxx index 4342548db14..41358bccdcb 100644 --- a/src/ModelingData/TKBRep/TopoDS/TopoDS.hxx +++ b/src/ModelingData/TKBRep/TopoDS/TopoDS.hxx @@ -82,7 +82,7 @@ inline TopoDS_Vertex& Vertex(TopoDS_Shape& theShape) { Standard_TypeMismatch_Raise_if(theShape.IsNull() ? false : theShape.ShapeType() != TopAbs_VERTEX, "TopoDS::Vertex"); - return *(TopoDS_Vertex*)&theShape; + return *reinterpret_cast(&theShape); } //! Casts shape theShape to the more specialized return type, Edge. @@ -104,7 +104,7 @@ inline TopoDS_Edge& Edge(TopoDS_Shape& theShape) { Standard_TypeMismatch_Raise_if(theShape.IsNull() ? false : theShape.ShapeType() != TopAbs_EDGE, "TopoDS::Edge"); - return *(TopoDS_Edge*)&theShape; + return *reinterpret_cast(&theShape); } //! Casts shape theShape to the more specialized return type, Wire. @@ -126,7 +126,7 @@ inline TopoDS_Wire& Wire(TopoDS_Shape& theShape) { Standard_TypeMismatch_Raise_if(theShape.IsNull() ? false : theShape.ShapeType() != TopAbs_WIRE, "TopoDS::Wire"); - return *(TopoDS_Wire*)&theShape; + return *reinterpret_cast(&theShape); } //! Casts shape theShape to the more specialized return type, Face. @@ -148,7 +148,7 @@ inline TopoDS_Face& Face(TopoDS_Shape& theShape) { Standard_TypeMismatch_Raise_if(theShape.IsNull() ? false : theShape.ShapeType() != TopAbs_FACE, "TopoDS::Face"); - return *(TopoDS_Face*)&theShape; + return *reinterpret_cast(&theShape); } //! Casts shape theShape to the more specialized return type, Shell. @@ -170,7 +170,7 @@ inline TopoDS_Shell& Shell(TopoDS_Shape& theShape) { Standard_TypeMismatch_Raise_if(theShape.IsNull() ? false : theShape.ShapeType() != TopAbs_SHELL, "TopoDS::Shell"); - return *(TopoDS_Shell*)&theShape; + return *reinterpret_cast(&theShape); } //! Casts shape theShape to the more specialized return type, Solid. @@ -192,7 +192,7 @@ inline TopoDS_Solid& Solid(TopoDS_Shape& theShape) { Standard_TypeMismatch_Raise_if(theShape.IsNull() ? false : theShape.ShapeType() != TopAbs_SOLID, "TopoDS::Solid"); - return *(TopoDS_Solid*)&theShape; + return *reinterpret_cast(&theShape); } //! Casts shape theShape to the more specialized return type, CompSolid. @@ -216,7 +216,7 @@ inline TopoDS_CompSolid& CompSolid(TopoDS_Shape& theShape) Standard_TypeMismatch_Raise_if(theShape.IsNull() ? false : theShape.ShapeType() != TopAbs_COMPSOLID, "TopoDS::CompSolid"); - return *(TopoDS_CompSolid*)&theShape; + return *reinterpret_cast(&theShape); } //! Casts shape theShape to the more specialized return type, Compound. @@ -240,7 +240,7 @@ inline TopoDS_Compound& Compound(TopoDS_Shape& theShape) Standard_TypeMismatch_Raise_if(theShape.IsNull() ? false : theShape.ShapeType() != TopAbs_COMPOUND, "TopoDS::Compound"); - return *(TopoDS_Compound*)&theShape; + return *reinterpret_cast(&theShape); } } // namespace TopoDS diff --git a/src/ModelingData/TKBRep/TopoDS/TopoDS_Builder.cxx b/src/ModelingData/TKBRep/TopoDS/TopoDS_Builder.cxx index c88a4abe3c0..849d3e433d3 100644 --- a/src/ModelingData/TKBRep/TopoDS/TopoDS_Builder.cxx +++ b/src/ModelingData/TKBRep/TopoDS/TopoDS_Builder.cxx @@ -46,28 +46,28 @@ void TopoDS_Builder::Add(TopoDS_Shape& aShape, const TopoDS_Shape& aComponent) c { static const unsigned int aTb[9] = { // COMPOUND to: - (1 << ((unsigned int)TopAbs_COMPOUND)), + (1 << (static_cast(TopAbs_COMPOUND))), // COMPSOLID to: - (1 << ((unsigned int)TopAbs_COMPOUND)), + (1 << (static_cast(TopAbs_COMPOUND))), // SOLID to: - (1 << ((unsigned int)TopAbs_COMPOUND)) | (1 << ((unsigned int)TopAbs_COMPSOLID)), + (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_COMPSOLID))), // SHELL to: - (1 << ((unsigned int)TopAbs_COMPOUND)) | (1 << ((unsigned int)TopAbs_SOLID)), + (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_SOLID))), // FACE to: - (1 << ((unsigned int)TopAbs_COMPOUND)) | (1 << ((unsigned int)TopAbs_SHELL)), + (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_SHELL))), // WIRE to: - (1 << ((unsigned int)TopAbs_COMPOUND)) | (1 << ((unsigned int)TopAbs_FACE)), + (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_FACE))), // EDGE to: - (1 << ((unsigned int)TopAbs_COMPOUND)) | (1 << ((unsigned int)TopAbs_SOLID)) - | (1 << ((unsigned int)TopAbs_WIRE)), + (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_SOLID))) + | (1 << (static_cast(TopAbs_WIRE))), // VERTEX to: - (1 << ((unsigned int)TopAbs_COMPOUND)) | (1 << ((unsigned int)TopAbs_SOLID)) - | (1 << ((unsigned int)TopAbs_FACE)) | (1 << ((unsigned int)TopAbs_EDGE)), + (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_SOLID))) + | (1 << (static_cast(TopAbs_FACE))) | (1 << (static_cast(TopAbs_EDGE))), // SHAPE to: 0}; - const unsigned int iC = (unsigned int)aComponent.ShapeType(); - const unsigned int iS = (unsigned int)aShape.ShapeType(); + const unsigned int iC = static_cast(aComponent.ShapeType()); + const unsigned int iS = static_cast(aShape.ShapeType()); if ((aTb[iC] & (1 << iS)) != 0) { diff --git a/src/ModelingData/TKG2d/Adaptor2d/Adaptor2d_OffsetCurve.cxx b/src/ModelingData/TKG2d/Adaptor2d/Adaptor2d_OffsetCurve.cxx index b46ba095a99..6574ea7a8f2 100644 --- a/src/ModelingData/TKG2d/Adaptor2d/Adaptor2d_OffsetCurve.cxx +++ b/src/ModelingData/TKG2d/Adaptor2d/Adaptor2d_OffsetCurve.cxx @@ -154,7 +154,7 @@ int Adaptor2d_OffsetCurve::NbIntervals(const GeomAbs_Shape S) const if (S >= GeomAbs_C2) Sh = GeomAbs_CN; else - Sh = (GeomAbs_Shape)((int)S + 2); + Sh = static_cast(static_cast(S) + 2); int nbInter = myCurve->NbIntervals(Sh); @@ -182,7 +182,7 @@ void Adaptor2d_OffsetCurve::Intervals(NCollection_Array1& TI, const Geom if (S >= GeomAbs_C2) Sh = GeomAbs_CN; else - Sh = (GeomAbs_Shape)((int)S + 2); + Sh = static_cast(static_cast(S) + 2); int nbInter = myCurve->NbIntervals(Sh); diff --git a/src/ModelingData/TKG2d/Geom2dEval/Geom2dEval_AHTBezierCurve.cxx b/src/ModelingData/TKG2d/Geom2dEval/Geom2dEval_AHTBezierCurve.cxx index 0ad50b10190..0aa40912421 100644 --- a/src/ModelingData/TKG2d/Geom2dEval/Geom2dEval_AHTBezierCurve.cxx +++ b/src/ModelingData/TKG2d/Geom2dEval/Geom2dEval_AHTBezierCurve.cxx @@ -56,7 +56,7 @@ double fallingFactorial(const int theN, const int theK) double aRes = 1.0; for (int i = 0; i < theK; ++i) { - aRes *= double(theN - i); + aRes *= static_cast(theN - i); } return aRes; } @@ -160,15 +160,15 @@ void evalMixedAHT(const NCollection_Array1& thePoles, double aB3 = 0.0; if constexpr (theMaxOrder >= 1) { - aB1 = (k >= 1) ? double(k) * aPowM1 : 0.0; + aB1 = (k >= 1) ? static_cast(k) * aPowM1 : 0.0; } if constexpr (theMaxOrder >= 2) { - aB2 = (k >= 2) ? double(k) * double(k - 1) * aPowM2 : 0.0; + aB2 = (k >= 2) ? static_cast(k) * static_cast(k - 1) * aPowM2 : 0.0; } if constexpr (theMaxOrder >= 3) { - aB3 = (k >= 3) ? double(k) * double(k - 1) * double(k - 2) * aPowM3 : 0.0; + aB3 = (k >= 3) ? static_cast(k) * static_cast(k - 1) * static_cast(k - 2) * aPowM3 : 0.0; } if constexpr (theIsRational) @@ -1047,7 +1047,7 @@ gp_Vec2d Geom2dEval_AHTBezierCurve::EvalDN(const double U, const int N) const double aBinom = 1.0; for (int j = 1; j <= d; ++j) { - aBinom = aBinom * double(d - j + 1) / double(j); + aBinom = aBinom * static_cast(d - j + 1) / static_cast(j); aSum -= aCDerivs[d - j] * (aBinom * aWDerivs[j]); } aCDerivs[d] = aSum * aInvW0; diff --git a/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_HSurfaceTool.cxx b/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_HSurfaceTool.cxx index 57cadf27e2a..40877c51fca 100644 --- a/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_HSurfaceTool.cxx +++ b/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_HSurfaceTool.cxx @@ -79,7 +79,7 @@ int Adaptor3d_HSurfaceTool::NbSamplesU(const occ::handle& S, { const double uf = FirstUParameter(S); const double ul = LastUParameter(S); - n *= (int)((u2 - u1) / (ul - uf)); + n *= static_cast((u2 - u1) / (ul - uf)); if (n > nbs || n > 50) n = nbs; if (n < 5) @@ -98,7 +98,7 @@ int Adaptor3d_HSurfaceTool::NbSamplesV(const occ::handle& S, { const double vf = FirstVParameter(S); const double vl = LastVParameter(S); - n *= (int)((v2 - v1) / (vl - vf)); + n *= static_cast((v2 - v1) / (vl - vf)); if (n > nbs || n > 50) n = nbs; if (n < 5) diff --git a/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx b/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx index 4bd49fcd13a..5792076cdda 100644 --- a/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx +++ b/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx @@ -1183,14 +1183,14 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const double theDefl, int aNb; if (nbsu < nbsv) { - aNb = (int)(nbsv * ((double)theNUmin) / ((double)nbsu)); + aNb = static_cast(nbsv * (static_cast(theNUmin)) / (static_cast(nbsu))); aNb = std::min(aNb, 30); bVuniform = (aNb > nbsv) ? true : bVuniform; nbsv = bVuniform ? aNb : nbsv; } else { - aNb = (int)(nbsu * ((double)theNVmin) / ((double)nbsv)); + aNb = static_cast(nbsu * (static_cast(theNVmin)) / (static_cast(nbsv))); aNb = std::min(aNb, 30); bUuniform = (aNb > nbsu) ? true : bUuniform; nbsu = bUuniform ? aNb : nbsu; diff --git a/src/ModelingData/TKG3d/AdvApprox/AdvApprox_ApproxAFunction.cxx b/src/ModelingData/TKG3d/AdvApprox/AdvApprox_ApproxAFunction.cxx index 9060359c925..2d003bf8b71 100644 --- a/src/ModelingData/TKG3d/AdvApprox/AdvApprox_ApproxAFunction.cxx +++ b/src/ModelingData/TKG3d/AdvApprox/AdvApprox_ApproxAFunction.cxx @@ -150,8 +150,8 @@ static void PrepareConvert(const int NumCurves, NCollection_Array1 Result(1, 2 * (ContinuityOrder + 1) * Dimension); NCollection_Array1 Prec(1, NbSpace), Suivant(1, NbSpace); - Res1 = (double*)&(Result.ChangeValue(1)); - Res2 = (double*)&(Result.ChangeValue((ContinuityOrder + 1) * Dimension + 1)); + Res1 = static_cast(&(Result.ChangeValue(1))); + Res2 = static_cast(&(Result.ChangeValue((ContinuityOrder + 1) * Dimension + 1))); // Init Continuity.Init(0); @@ -163,7 +163,7 @@ static void PrepareConvert(const int NumCurves, // Init and positioning at the node isCi = true; Coef1 = - (double*)&(Coefficients.Value((icurve - 1) * Dimension * RealDegree + Coefficients.Lower())); + const_cast(&(Coefficients.Value((icurve - 1) * Dimension * RealDegree + Coefficients.Lower()))); Coef2 = Coef1 + Dimension * RealDegree; int Deg1 = NumCoeffPerCurve(NumCoeffPerCurve.Lower() + icurve - 1) - 1; PLib::EvalPolynomial(PolynomialIntervals(icurve, 2), @@ -393,7 +393,7 @@ void AdvApprox_ApproxAFunction::Approximation( bool isCut = false; // Definition of C arrays - double* TABINT = (double*)&IntervalsArray(1); + double* TABINT = static_cast(&IntervalsArray(1)); ErrorCode = 0; CoefficientArray.Init(0); @@ -739,7 +739,7 @@ void AdvApprox_ApproxAFunction::Perform(const int Num1DSS, LocalDimension, myFirst, myLast, - *(AdvApprox_EvaluatorFunction*)myEvaluator, + *static_cast(myEvaluator), CutTool, ContinuityOrder, NumMaxCoeffs, @@ -831,7 +831,7 @@ void AdvApprox_ApproxAFunction::Perform(const int Num1DSS, local_index = (ii - 1) * TotalNumSS; error_value += AverageError(local_index + jj); } - error_value /= (double)NumCurves; + error_value /= static_cast(NumCurves); my1DAverageError->SetValue(jj, error_value); } index += myNumSubSpaces[0]; @@ -876,7 +876,7 @@ void AdvApprox_ApproxAFunction::Perform(const int Num1DSS, local_index = (ii - 1) * TotalNumSS + index; error_value += AverageError(local_index + jj); } - error_value /= (double)NumCurves; + error_value /= static_cast(NumCurves); my2DAverageError->SetValue(jj, error_value); } index += myNumSubSpaces[1]; @@ -921,7 +921,7 @@ void AdvApprox_ApproxAFunction::Perform(const int Num1DSS, local_index = (ii - 1) * TotalNumSS + index; error_value += AverageError(local_index + jj); } - error_value /= (double)NumCurves; + error_value /= static_cast(NumCurves); my3DAverageError->SetValue(jj, error_value); } } diff --git a/src/ModelingData/TKG3d/AdvApprox/AdvApprox_SimpleApprox.cxx b/src/ModelingData/TKG3d/AdvApprox/AdvApprox_SimpleApprox.cxx index 6a4d5305f7b..c1614a97f84 100644 --- a/src/ModelingData/TKG3d/AdvApprox/AdvApprox_SimpleApprox.cxx +++ b/src/ModelingData/TKG3d/AdvApprox/AdvApprox_SimpleApprox.cxx @@ -94,7 +94,7 @@ void AdvApprox_SimpleApprox::Perform(const NCollection_Array1& LocalDime int i, idim, k, numss; int Dimension = myTotalDimension; - AdvApprox_EvaluatorFunction& Evaluator = *(AdvApprox_EvaluatorFunction*)myEvaluator; + AdvApprox_EvaluatorFunction& Evaluator = *static_cast(myEvaluator); // ===== the computation of Rr(t) (the first part of Pp) ====== @@ -108,7 +108,7 @@ void AdvApprox_SimpleApprox::Perform(const NCollection_Array1& LocalDime math_Vector Result(1, myTotalDimension); int ErrorCode, derive, i_idim; double Fact = (Last - First) / 2; - double* pResult = (double*)&Result.Value(1); + double* pResult = static_cast(&Result.Value(1)); double param; for (param = First, derive = myNivConstr; derive >= 0; derive--) @@ -155,8 +155,8 @@ void AdvApprox_SimpleApprox::Perform(const NCollection_Array1& LocalDime math_Vector Fti(1, myTotalDimension); math_Vector Rpti(1, myTotalDimension); math_Vector Rmti(1, myTotalDimension); - double* pFti = (double*)&Fti.Value(1); - double* Coef1 = (double*)&(myCoeff->ChangeArray1().Value(0)); + double* pFti = static_cast(&Fti.Value(1)); + double* Coef1 = const_cast(&(myCoeff->ChangeArray1().Value(0))); derive = 0; double ti, tip, tin, alin = (Last - First) / 2, blin = (Last + First) / 2.; @@ -276,7 +276,7 @@ void AdvApprox_SimpleApprox::Perform(const NCollection_Array1& LocalDime RangCoeff = RangCoeff + myTotalDimension; } - double* JacSS = (double*)&JacCoeff.Value(RangJacCoeff); + double* JacSS = const_cast(&JacCoeff.Value(RangJacCoeff)); myJacPol.ReduceDegree(Dim, MaxDegree, LocalTolerancesArray(numss), JacSS[0], NewDegree, MaxErr); if (NewDegree > NewDegreeMax) NewDegreeMax = NewDegree; @@ -290,7 +290,7 @@ void AdvApprox_SimpleApprox::Perform(const NCollection_Array1& LocalDime { Dim = LocalDimension(numss); - double* JacSS = (double*)&JacCoeff.Value(RangJacCoeff); + double* JacSS = const_cast(&JacCoeff.Value(RangJacCoeff)); MaxErr = myJacPol.MaxError(LocalDimension(numss), JacSS[0], NewDegreeMax); myMaxError->SetValue(numss, MaxErr); AverageErr = myJacPol.AverageError(LocalDimension(numss), JacSS[0], NewDegreeMax); diff --git a/src/ModelingData/TKG3d/Geom/Geom_BSplineCurve_1.cxx b/src/ModelingData/TKG3d/Geom/Geom_BSplineCurve_1.cxx index 4f90e01d971..8453cfec0b6 100644 --- a/src/ModelingData/TKG3d/Geom/Geom_BSplineCurve_1.cxx +++ b/src/ModelingData/TKG3d/Geom/Geom_BSplineCurve_1.cxx @@ -787,7 +787,7 @@ bool Geom_BSplineCurve::IsEqual(const occ::handle& theOther, for (int aWeightIter = 1; aWeightIter <= myWeights.Length(); ++aWeightIter) { - if (fabs(double(myWeights(aWeightIter) - theOther->Weight(aWeightIter))) + if (fabs((myWeights(aWeightIter) - theOther->Weight(aWeightIter))) > Epsilon(myWeights(aWeightIter))) { return false; diff --git a/src/ModelingData/TKG3d/Geom/Geom_OsculatingSurface.cxx b/src/ModelingData/TKG3d/Geom/Geom_OsculatingSurface.cxx index 115ef855d4d..23f92db8051 100644 --- a/src/ModelingData/TKG3d/Geom/Geom_OsculatingSurface.cxx +++ b/src/ModelingData/TKG3d/Geom/Geom_OsculatingSurface.cxx @@ -507,8 +507,8 @@ bool Geom_OsculatingSurface::buildOsculatingSurface(double theParam, } else { - MinDegree = (int)std::min(udeg, vdeg); - MaxDegree = (int)std::max(udeg, vdeg); + MinDegree = static_cast(std::min(udeg, vdeg)); + MaxDegree = static_cast(std::max(udeg, vdeg)); NCollection_Array2 cachepoles(1, MaxDegree + 1, 1, MinDegree + 1); // end for cache @@ -525,8 +525,8 @@ bool Geom_OsculatingSurface::buildOsculatingSurface(double theParam, new NCollection_HArray1(1, 2); occ::handle> TrueUIntervals = new NCollection_HArray1(1, 2); occ::handle> TrueVIntervals = new NCollection_HArray1(1, 2); - MaxUDegree = (int)udeg; - MaxVDegree = (int)vdeg; + MaxUDegree = static_cast(udeg); + MaxVDegree = static_cast(vdeg); for (int i = 1; i <= 2; i++) { @@ -542,16 +542,16 @@ bool Geom_OsculatingSurface::buildOsculatingSurface(double theParam, #ifdef OCCT_DEBUG std::cout << ">>>>>>>>>>> AlongU" << std::endl; #endif - OscUNumCoeff = (int)udeg + 1; - OscVNumCoeff = (int)vdeg; + OscUNumCoeff = static_cast(udeg) + 1; + OscVNumCoeff = static_cast(vdeg); } if (IsAlongV()) { #ifdef OCCT_DEBUG std::cout << ">>>>>>>>>>> AlongV" << std::endl; #endif - OscUNumCoeff = (int)udeg; - OscVNumCoeff = (int)vdeg + 1; + OscUNumCoeff = static_cast(udeg); + OscVNumCoeff = static_cast(vdeg) + 1; } NumCoeffPerSurface->ChangeValue(1, 1) = OscUNumCoeff; NumCoeffPerSurface->ChangeValue(1, 2) = OscVNumCoeff; @@ -614,22 +614,22 @@ bool Geom_OsculatingSurface::buildOsculatingSurface(double theParam, { if (udeg > vdeg) { - for (n = 1; n <= (int)udeg + 1; n++) - for (m = 1; m <= (int)vdeg; m++) + for (n = 1; n <= static_cast(udeg) + 1; n++) + for (m = 1; m <= static_cast(vdeg); m++) OscCoeff(n, m) = cachepoles(n, m + 1); } else { - for (n = 1; n <= (int)udeg + 1; n++) - for (m = 1; m <= (int)vdeg; m++) + for (n = 1; n <= static_cast(udeg) + 1; n++) + for (m = 1; m <= static_cast(vdeg); m++) OscCoeff(n, m) = cachepoles(m + 1, n); } if (IsVNegative) PLib::VTrimming(-1, 0, OscCoeff, PLib::NoWeights2()); index = 1; - for (n = 1; n <= (int)udeg + 1; n++) - for (m = 1; m <= (int)vdeg; m++) + for (n = 1; n <= static_cast(udeg) + 1; n++) + for (m = 1; m <= static_cast(vdeg); m++) { Coefficients->ChangeValue(index++) = OscCoeff(n, m).X(); Coefficients->ChangeValue(index++) = OscCoeff(n, m).Y(); @@ -641,21 +641,21 @@ bool Geom_OsculatingSurface::buildOsculatingSurface(double theParam, { if (udeg > vdeg) { - for (n = 1; n <= (int)udeg; n++) - for (m = 1; m <= (int)vdeg + 1; m++) + for (n = 1; n <= static_cast(udeg); n++) + for (m = 1; m <= static_cast(vdeg) + 1; m++) OscCoeff(n, m) = cachepoles(n + 1, m); } else { - for (n = 1; n <= (int)udeg; n++) - for (m = 1; m <= (int)vdeg + 1; m++) + for (n = 1; n <= static_cast(udeg); n++) + for (m = 1; m <= static_cast(vdeg) + 1; m++) OscCoeff(n, m) = cachepoles(m, n + 1); } if (IsUNegative) PLib::UTrimming(-1, 0, OscCoeff, PLib::NoWeights2()); index = 1; - for (n = 1; n <= (int)udeg; n++) - for (m = 1; m <= (int)vdeg + 1; m++) + for (n = 1; n <= static_cast(udeg); n++) + for (m = 1; m <= static_cast(vdeg) + 1; m++) { Coefficients->ChangeValue(index++) = OscCoeff(n, m).X(); Coefficients->ChangeValue(index++) = OscCoeff(n, m).Y(); diff --git a/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierCurve.cxx b/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierCurve.cxx index 8345dd9456d..75eef3a7927 100644 --- a/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierCurve.cxx +++ b/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierCurve.cxx @@ -56,7 +56,7 @@ double fallingFactorial(const int theN, const int theK) double aRes = 1.0; for (int i = 0; i < theK; ++i) { - aRes *= double(theN - i); + aRes *= static_cast(theN - i); } return aRes; } @@ -156,15 +156,15 @@ void evalMixedAHT(const NCollection_Array1& thePoles, double aB3 = 0.0; if constexpr (theMaxOrder >= 1) { - aB1 = (k >= 1) ? double(k) * aPowM1 : 0.0; + aB1 = (k >= 1) ? static_cast(k) * aPowM1 : 0.0; } if constexpr (theMaxOrder >= 2) { - aB2 = (k >= 2) ? double(k) * double(k - 1) * aPowM2 : 0.0; + aB2 = (k >= 2) ? static_cast(k) * static_cast(k - 1) * aPowM2 : 0.0; } if constexpr (theMaxOrder >= 3) { - aB3 = (k >= 3) ? double(k) * double(k - 1) * double(k - 2) * aPowM3 : 0.0; + aB3 = (k >= 3) ? static_cast(k) * static_cast(k - 1) * static_cast(k - 2) * aPowM3 : 0.0; } if constexpr (theIsRational) @@ -956,7 +956,7 @@ gp_Vec GeomEval_AHTBezierCurve::EvalDN(const double U, const int N) const double aBinom = 1.0; for (int j = 1; j <= d; ++j) { - aBinom = aBinom * double(d - j + 1) / double(j); + aBinom = aBinom * static_cast(d - j + 1) / static_cast(j); aSum -= aCDerivs[d - j] * (aBinom * aWDerivs[j]); } aCDerivs[d] = aSum * aInvW0; diff --git a/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierSurface.cxx b/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierSurface.cxx index 30a6f313e08..9640d68f664 100644 --- a/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierSurface.cxx +++ b/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierSurface.cxx @@ -312,7 +312,7 @@ void evalAxisDerivs(const double theT, { if (k > 0) { - aFactK *= double(k); + aFactK *= static_cast(k); } for (int d = 0; d <= theMaxOrder; ++d) { @@ -333,7 +333,7 @@ void evalAxisDerivs(const double theT, axisVal(theDerivs, theDim, d, anIdx) = aVal; if (d < aMaxD) { - aVal *= double(k - d) / theT; + aVal *= static_cast(k - d) / theT; } } for (int d = aMaxD + 1; d <= theMaxOrder; ++d) @@ -481,7 +481,7 @@ void computeRationalDerivs(const gp_XYZ* theNDerivs, double aBinU = 1.0; for (int m = 0; m < p; ++m) { - aBinU = aBinU * double(du - m) / double(m + 1); + aBinU = aBinU * static_cast(du - m) / static_cast(m + 1); } for (int q = 0; q <= dv; ++q) { @@ -492,7 +492,7 @@ void computeRationalDerivs(const gp_XYZ* theNDerivs, double aBinV = 1.0; for (int m = 0; m < q; ++m) { - aBinV = aBinV * double(dv - m) / double(m + 1); + aBinV = aBinV * static_cast(dv - m) / static_cast(m + 1); } const double aCoeff = aBinU * aBinV * theWDerivs[tensorIdx(p, q, theMaxV)]; aSum -= theCDerivs[tensorIdx(du - p, dv - q, theMaxV)] * aCoeff; diff --git a/src/ModelingData/TKG3d/GeomEval/GeomEval_TBezierSurface.cxx b/src/ModelingData/TKG3d/GeomEval/GeomEval_TBezierSurface.cxx index ec67be3c5f6..bdb3a4cd4dc 100644 --- a/src/ModelingData/TKG3d/GeomEval/GeomEval_TBezierSurface.cxx +++ b/src/ModelingData/TKG3d/GeomEval/GeomEval_TBezierSurface.cxx @@ -94,7 +94,7 @@ void evalTrigAxisDerivs(const double theT, int aIdx = 1; for (int k = 1; k <= theOrder; ++k, aIdx += 2) { - const double aFreq = double(k) * theAlpha; + const double aFreq = static_cast(k) * theAlpha; const double anArg = aFreq * theT; const double aSin = std::sin(anArg); const double aCos = std::cos(anArg); @@ -133,7 +133,7 @@ void evalTrigAxisNthDeriv(const double theT, int aIdx = 1; for (int k = 1; k <= theOrder; ++k, aIdx += 2) { - const double anArg = double(k) * theAlpha * theT; + const double anArg = static_cast(k) * theAlpha * theT; theDerivs[aIdx] = std::sin(anArg); theDerivs[aIdx + 1] = std::cos(anArg); } @@ -144,7 +144,7 @@ void evalTrigAxisNthDeriv(const double theT, int aIdx = 1; for (int k = 1; k <= theOrder; ++k, aIdx += 2) { - const double aFreq = double(k) * theAlpha; + const double aFreq = static_cast(k) * theAlpha; const double anArg = aFreq * theT; const double aSin = std::sin(anArg); const double aCos = std::cos(anArg); diff --git a/src/ModelingData/TKG3d/TopAbs/TopAbs.cxx b/src/ModelingData/TKG3d/TopAbs/TopAbs.cxx index a9e5ba038bd..82db068cd61 100644 --- a/src/ModelingData/TKG3d/TopAbs/TopAbs.cxx +++ b/src/ModelingData/TKG3d/TopAbs/TopAbs.cxx @@ -88,5 +88,5 @@ bool TopAbs::ShapeOrientationFromString(const char* const theOrientationString Standard_OStream& TopAbs::Print(const TopAbs_State st, Standard_OStream& s) { static const char* const TopAbs_Table_PrintState[4] = {"ON", "IN", "OUT", "UNKNOWN"}; - return (s << TopAbs_Table_PrintState[(int)st]); + return (s << TopAbs_Table_PrintState[static_cast(st)]); } diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_ApproxAFunc2Var.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_ApproxAFunc2Var.cxx index 2806f8e5521..5e21e93325f 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_ApproxAFunc2Var.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_ApproxAFunc2Var.cxx @@ -812,7 +812,7 @@ void AdvApp2Var_ApproxAFunc2Var::Compute3DErrors() my3DMaxError->SetValue(iesp, error_max); my3DUFrontError->SetValue(iesp, std::max(error_U0, error_U1)); my3DVFrontError->SetValue(iesp, std::max(error_V0, error_V1)); - error_moy /= (double)myResult.NbPatch(); + error_moy /= static_cast(myResult.NbPatch()); my3DAverageError->SetValue(iesp, error_moy); if (error_max > Tol || error_U0 > F3Tol || error_U1 > F4Tol || error_V0 > F1Tol || error_V1 > F2Tol) diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx index 885a9a168ae..36d07730a51 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx @@ -7132,7 +7132,7 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(int* ndimen, AdvApp2Var_MathBase::mmapcmp_(ndimen, &ncfja, &ncoeff[ncb1], &wrkar[ipt5], &wrkar[ipt2]); */ - AdvApp2Var_MathBase::mmapcmp_((int*)ndimen, + AdvApp2Var_MathBase::mmapcmp_(ndimen, &ncfja, &ncoeff[ncb1], &wrkar_off[ipt4], diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Context.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Context.cxx index 77cc2fe781d..a1fee620007 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Context.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Context.cxx @@ -183,7 +183,7 @@ AdvApp2Var_Context::AdvApp2Var_Context(const int // myJMaxU int aSize = JDegU - 2 * iu - 1; occ::handle> JMaxU = new NCollection_HArray1(1, aSize); - double* JU_array = (double*)&JMaxU->ChangeArray1()(JMaxU->Lower()); + double* JU_array = static_cast(&JMaxU->ChangeArray1()(JMaxU->Lower())); AdvApp2Var_ApproxF2var::mma2jmx_(&JDegU, &anOrderU, JU_array); myJMaxU = JMaxU; @@ -203,15 +203,15 @@ AdvApp2Var_Context::AdvApp2Var_Context(const int // myJMaxV aSize = JDegV - 2 * iv - 1; occ::handle> JMaxV = new NCollection_HArray1(1, aSize); - double* JV_array = (double*)&JMaxV->ChangeArray1()(JMaxV->Lower()); + double* JV_array = static_cast(&JMaxV->ChangeArray1()(JMaxV->Lower())); AdvApp2Var_ApproxF2var::mma2jmx_(&JDegV, &anOrderV, JV_array); myJMaxV = JMaxV; // myURoots, myVRoots occ::handle> URoots = new NCollection_HArray1(1, myNbURoot); - double* U_array = (double*)&URoots->ChangeArray1()(URoots->Lower()); + double* U_array = static_cast(&URoots->ChangeArray1()(URoots->Lower())); occ::handle> VRoots = new NCollection_HArray1(1, myNbVRoot); - double* V_array = (double*)&VRoots->ChangeArray1()(VRoots->Lower()); + double* V_array = static_cast(&VRoots->ChangeArray1()(VRoots->Lower())); AdvApp2Var_ApproxF2var::mma2roo_(&NbPntU, &NbPntV, U_array, V_array); myURoots = URoots; myVRoots = VRoots; @@ -219,7 +219,7 @@ AdvApp2Var_Context::AdvApp2Var_Context(const int // myUGauss aSize = (NbPntU / 2 + 1) * (myJDegU - 2 * iu - 1); occ::handle> UGauss = new NCollection_HArray1(1, aSize); - double* UG_array = (double*)&UGauss->ChangeArray1()(UGauss->Lower()); + double* UG_array = static_cast(&UGauss->ChangeArray1()(UGauss->Lower())); AdvApp2Var_ApproxF2var::mmapptt_(&JDegU, &NbPntU, &anOrderU, UG_array, &anErrorCode); if (anErrorCode != 0) { @@ -230,7 +230,7 @@ AdvApp2Var_Context::AdvApp2Var_Context(const int // myVGauss aSize = (NbPntV / 2 + 1) * (myJDegV - 2 * iv - 1); occ::handle> VGauss = new NCollection_HArray1(1, aSize); - double* VG_array = (double*)&VGauss->ChangeArray1()(VGauss->Lower()); + double* VG_array = static_cast(&VGauss->ChangeArray1()(VGauss->Lower())); AdvApp2Var_ApproxF2var::mmapptt_(&JDegV, &NbPntV, &anOrderV, VG_array, &anErrorCode); if (anErrorCode != 0) { diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Main.pxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Main.pxx index b77cba05fd5..c308c659f38 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Main.pxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Main.pxx @@ -99,8 +99,8 @@ inline maovpar_1_& AdvApp2Var_Data::Getmaovpar() 1.797693134862315e307, 1.17549435e-38, 3.40282347e38, - (float)1.17549435e-38, - (float)3.40282347e38, + static_cast(1.17549435e-38), + static_cast(3.40282347e38), 8, 52, 8, diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mlgdrtl.pxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mlgdrtl.pxx index ace73d3850e..2c4043cd7b6 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mlgdrtl.pxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mlgdrtl.pxx @@ -1909,5 +1909,5 @@ inline mlgdrtl_1_& AdvApp2Var_Data::Getmlgdrtl() .0527980126219896053956592277024162, .0510811194407819869756124378422272}; - return *((mlgdrtl_1_*)&s_e_1); + return *(reinterpret_cast(&s_e_1)); } diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs0.pxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs0.pxx index f4ac4400066..588dc0a1f27 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs0.pxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs0.pxx @@ -2424,5 +2424,5 @@ inline mmapgs0_1_& AdvApp2Var_Data::Getmmapgs0() .0407697086207059105840935623547798, -.04076881293552215594303020204635, .0407680076017751906152705824117712, -.0407672808617546723713899270255496}; - return *((mmapgs0_1_*)&e_1); + return *(reinterpret_cast(&e_1)); } diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs1.pxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs1.pxx index fd8fcc99474..37affed0023 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs1.pxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs1.pxx @@ -2294,5 +2294,5 @@ inline mmapgs1_1_& AdvApp2Var_Data::Getmmapgs1() .0408152587495273910504897188971103, -.0408110362629651129056228039389189, .0408072559548467467327316895791484, -.0408038581210305247052197303800108, .0408007928122239588413962075706306}; - return *((mmapgs1_1_*)&e_1); + return *(reinterpret_cast(&e_1)); } diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs2.pxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs2.pxx index 553c7a3c771..2e795b2fe9c 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs2.pxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgs2.pxx @@ -2164,5 +2164,5 @@ inline mmapgs2_1_& AdvApp2Var_Data::Getmmapgs2() .0409009071190569001145472421041385, -.0408900531291930076869098937224986, .0408803838682284158000996245029333, -.0408717326200442487242948957884301, .0408639610525922021174682189163711, -.0408569535997322120997291328426552}; - return *((mmapgs2_1_*)&e_1); + return *(reinterpret_cast(&e_1)); } diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgss.pxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgss.pxx index 83290b9d1e1..78d3b4d15b1 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgss.pxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmapgss.pxx @@ -2553,5 +2553,5 @@ inline mmapgss_1_& AdvApp2Var_Data::Getmmapgss() .0407559125789117809958736429511507, -.0407559791343355533308832349551151, .0407560387497360615706493904044552, -.0407560923574459437941249560108404, .0407561407383435779483091365130057}; - return *((mmapgss_1_*)&e_1); + return *(reinterpret_cast(&e_1)); } diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmcmcnp.pxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmcmcnp.pxx index 835138538f2..bf4fcdcef8f 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmcmcnp.pxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmcmcnp.pxx @@ -3740,5 +3740,5 @@ inline mmcmcnp_1_& AdvApp2Var_Data::Getmmcmcnp() 1. }; - return *((mmcmcnp_1_*)&e_1); + return *(reinterpret_cast(&e_1)); } diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmjcobi.pxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmjcobi.pxx index 2485d541e4c..411f38e474c 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmjcobi.pxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Data_Mmjcobi.pxx @@ -7953,5 +7953,5 @@ inline mmjcobi_1_& AdvApp2Var_Data::Getmmjcobi() -4.1542868263572174450039872601437e-18, -6.3447289711637502796424532700377e-17, -1.0284250949746758839876395691897e-18}; - return *((mmjcobi_1_*)&s_e_1); + return *(reinterpret_cast(&s_e_1)); } diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Iso.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Iso.cxx index b3dff381b62..f32fcdb48cd 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Iso.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Iso.cxx @@ -148,7 +148,7 @@ void AdvApp2Var_Iso::MakeApprox(const AdvApp2Var_Context& Conditions, NBROOT = (Conditions.URoots())->Length(); if (myExtremOrder > -1) NBROOT -= 2; - ROOTLG = (double*)&HUROOT->ChangeArray1()(HUROOT->Lower()); + ROOTLG = static_cast(&HUROOT->ChangeArray1()(HUROOT->Lower())); NDGJAC = Conditions.UJacDeg(); NCFLIM = Conditions.ULimit(); break; @@ -161,7 +161,7 @@ void AdvApp2Var_Iso::MakeApprox(const AdvApp2Var_Context& Conditions, NBROOT = (Conditions.VRoots())->Length(); if (myExtremOrder > -1) NBROOT -= 2; - ROOTLG = (double*)&HVROOT->ChangeArray1()(HVROOT->Lower()); + ROOTLG = static_cast(&HVROOT->ChangeArray1()(HVROOT->Lower())); NDGJAC = Conditions.VJacDeg(); NCFLIM = Conditions.VLimit(); break; @@ -210,29 +210,29 @@ void AdvApp2Var_Iso::MakeApprox(const AdvApp2Var_Context& Conditions, } break; } - double* EPSAPR = (double*)&HEPSAPR->ChangeArray1()(HEPSAPR->Lower()); + double* EPSAPR = static_cast(&HEPSAPR->ChangeArray1()(HEPSAPR->Lower())); // the tables of approximations int SZCRB = NDIMEN * NCFLIM; occ::handle> HCOURBE = new NCollection_HArray1(1, SZCRB * (IDERIV + 1)); - double* COURBE = (double*)&HCOURBE->ChangeArray1()(HCOURBE->Lower()); + double* COURBE = static_cast(&HCOURBE->ChangeArray1()(HCOURBE->Lower())); double* CRBAPP = COURBE; int SZTAB = (1 + NBROOT / 2) * NDIMEN; occ::handle> HSOMTAB = new NCollection_HArray1(1, SZTAB * (IDERIV + 1)); - double* SOMTAB = (double*)&HSOMTAB->ChangeArray1()(HSOMTAB->Lower()); + double* SOMTAB = static_cast(&HSOMTAB->ChangeArray1()(HSOMTAB->Lower())); double* SOMAPP = SOMTAB; occ::handle> HDIFTAB = new NCollection_HArray1(1, SZTAB * (IDERIV + 1)); - double* DIFTAB = (double*)&HDIFTAB->ChangeArray1()(HDIFTAB->Lower()); + double* DIFTAB = static_cast(&HDIFTAB->ChangeArray1()(HDIFTAB->Lower())); double* DIFAPP = DIFTAB; occ::handle> HCONTR1 = new NCollection_HArray1(1, (IORDRE + 2) * NDIMEN); - double* CONTR1 = (double*)&HCONTR1->ChangeArray1()(HCONTR1->Lower()); + double* CONTR1 = static_cast(&HCONTR1->ChangeArray1()(HCONTR1->Lower())); occ::handle> HCONTR2 = new NCollection_HArray1(1, (IORDRE + 2) * NDIMEN); - double* CONTR2 = (double*)&HCONTR2->ChangeArray1()(HCONTR2->Lower()); + double* CONTR2 = static_cast(&HCONTR2->ChangeArray1()(HCONTR2->Lower())); occ::handle> HERRMAX = new NCollection_HArray2(1, NBSESP, 1, IDERIV + 1); double* EMXAPP = new double[NBSESP]; diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_MathBase.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_MathBase.cxx index 44b4b8871b5..619a810888b 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_MathBase.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_MathBase.cxx @@ -359,7 +359,7 @@ int mfac_(double* f, int* n) --f; /* Function Body */ - f[1] = (float)1.; + f[1] = static_cast(1.); i__1 = *n; for (i__ = 2; i__ <= i__1; ++i__) { @@ -2488,7 +2488,7 @@ int AdvApp2Var_MathBase::mmcvctx_(int* ndimen, for (ncf = 1; ncf <= i__2; ++ncf) { tabaux[ncf + ndv * tabaux_dim1] = - tabaux[ncf + (ndv - 1) * tabaux_dim1] * (double)((ncf << 1) - ndv); + tabaux[ncf + (ndv - 1) * tabaux_dim1] * static_cast((ncf << 1) - ndv); /* L300: */ } /* L200: */ @@ -2551,7 +2551,7 @@ int AdvApp2Var_MathBase::mmcvctx_(int* ndimen, for (ncf = 1; ncf <= i__2; ++ncf) { tabaux[ncf + ndv * tabaux_dim1] = - tabaux[ncf + (ndv - 1) * tabaux_dim1] * (double)((ncf << 1) - ndv + 1); + tabaux[ncf + (ndv - 1) * tabaux_dim1] * static_cast((ncf << 1) - ndv + 1); /* L1300: */ } /* L1200: */ @@ -3168,7 +3168,7 @@ int mmdrvcb_(int* ideriv, i__3 = *ndim; for (nd = 1; nd <= i__3; ++nd) { - tabpnt[nd + i__ * tabpnt_dim1] = (double)j * tabpnt[nd + i__ * tabpnt_dim1]; + tabpnt[nd + i__ * tabpnt_dim1] = static_cast(j) * tabpnt[nd + i__ * tabpnt_dim1]; /* L1200: */ } /* L1100: */ @@ -4833,25 +4833,25 @@ int mmherm0_(double* debfin, int* iercod) /* Function Body */ d1 = std::abs(debfin[1]); - if (d1 > (float)100.) + if (d1 > static_cast(100.)) { goto L9101; } d2 = std::abs(debfin[2]); - if (d2 > (float)100.) + if (d2 > static_cast(100.)) { goto L9101; } d2 = d1 + d2; - if (d2 < (float).01) + if (d2 < static_cast(.01)) { goto L9101; } d1 = (d__1 = debfin[2] - debfin[1], std::abs(d__1)); - if (d1 / d2 < (float).01) + if (d1 / d2 < static_cast(.01)) { goto L9101; } @@ -4949,7 +4949,7 @@ int mmherm0_(double* debfin, int* iercod) i__2 = pp - 1; for (jj = 1; jj <= i__2; ++jj) { - mat[ii + jj * 6 - 7] = (float)0.; + mat[ii + jj * 6 - 7] = static_cast(0.); /* L300: */ } @@ -6781,7 +6781,7 @@ int mmpojac_(double* tparam, i__2 = *iordre; for (jj = 1; jj <= i__2; ++jj) { - aux2 = aux2 * (double)(kk1 + *iordre + jj) / (double)(kk1 + jj); + aux2 = aux2 * static_cast(kk1 + *iordre + jj) / static_cast(kk1 + jj); } i__2 = (*iordre << 1) + 1; tnorm[ii - 1] = sqrt(aux2 * (kk1 * 2. + (*iordre << 1) + 1) / pow__ii(&c__2, &i__2)); @@ -6792,7 +6792,7 @@ int mmpojac_(double* tparam, /* --- Trivial Positions ----- */ valjac(1) = 1.; - aux1 = (double)(*iordre + 1); + aux1 = static_cast(*iordre + 1); valjac(2) = aux1 * *tparam; if (*nderiv >= 1) @@ -6821,7 +6821,7 @@ int mmpojac_(double* tparam, kk1 = ii - 1; kk2 = ii - 2; - aux1 = (double)(*iordre + kk2); + aux1 = static_cast(*iordre + kk2); aux2 = aux1 * 2; cofa = aux2 * (aux2 + 1) * (aux2 + 2); cofb = (aux2 + 2) * -2. * aux1 * aux1; diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Patch.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Patch.cxx index 8f69c4c91d5..a856ce78468 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Patch.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Patch.cxx @@ -110,12 +110,12 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions occ::handle> HUROOT = Conditions.URoots(); occ::handle> HVROOT = Conditions.VRoots(); double* UROOT; - UROOT = (double*)&HUROOT->ChangeArray1()(HUROOT->Lower()); + UROOT = static_cast(&HUROOT->ChangeArray1()(HUROOT->Lower())); NBPNTU = (Conditions.URoots())->Length(); if (myOrdInU > -1) NBPNTU -= 2; double* VROOT; - VROOT = (double*)&HVROOT->ChangeArray1()(HVROOT->Lower()); + VROOT = static_cast(&HVROOT->ChangeArray1()(HVROOT->Lower())); NBPNTV = (Conditions.VRoots())->Length(); if (myOrdInV > -1) NBPNTV -= 2; @@ -169,7 +169,7 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions HCOINS->SetValue(3 * SIZE + 3 + NDIMEN * iu + NDIMEN * (IORDRU + 2) * iv, valnorm); } } - double* C1 = (double*)&HCOINS->ChangeArray1()(HCOINS->Lower()); + double* C1 = static_cast(&HCOINS->ChangeArray1()(HCOINS->Lower())); double* C2 = C1 + SIZE; double* C3 = C2 + SIZE; double* C4 = C3 + SIZE; @@ -214,10 +214,10 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions } } - double* SU0 = (double*)&HSU0->ChangeArray1()(HSU0->Lower()); - double* DU0 = (double*)&HDU0->ChangeArray1()(HDU0->Lower()); - double* SU1 = (double*)&HSU1->ChangeArray1()(HSU1->Lower()); - double* DU1 = (double*)&HDU1->ChangeArray1()(HDU1->Lower()); + double* SU0 = static_cast(&HSU0->ChangeArray1()(HSU0->Lower())); + double* DU0 = static_cast(&HDU0->ChangeArray1()(HDU0->Lower())); + double* SU1 = static_cast(&HSU1->ChangeArray1()(HSU1->Lower())); + double* DU1 = static_cast(&HDU1->ChangeArray1()(HDU1->Lower())); // tables SomTab and Diftab of discretization of isos V=V0 and V=V1 // SU0, SU1, DU0 and DU1 are dimensioned in FORTRAN at @@ -258,10 +258,10 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions } } - double* SV0 = (double*)&HSV0->ChangeArray1()(HSV0->Lower()); - double* DV0 = (double*)&HDV0->ChangeArray1()(HDV0->Lower()); - double* SV1 = (double*)&HSV1->ChangeArray1()(HSV1->Lower()); - double* DV1 = (double*)&HDV1->ChangeArray1()(HDV1->Lower()); + double* SV0 = static_cast(&HSV0->ChangeArray1()(HSV0->Lower())); + double* DV0 = static_cast(&HDV0->ChangeArray1()(HDV0->Lower())); + double* SV1 = static_cast(&HSV1->ChangeArray1()(HSV1->Lower())); + double* DV1 = static_cast(&HDV1->ChangeArray1()(HDV1->Lower())); // SOSOTB and DIDITB are dimensioned in FORTRAN at // (0:NBPNTU/2,0:NBPNTV/2,NDIMEN) @@ -269,10 +269,10 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions SIZE = (1 + NBPNTU / 2) * (1 + NBPNTV / 2) * NDIMEN; occ::handle> HSOSO = new NCollection_HArray1(1, SIZE); - double* SOSOTB = (double*)&HSOSO->ChangeArray1()(HSOSO->Lower()); + double* SOSOTB = static_cast(&HSOSO->ChangeArray1()(HSOSO->Lower())); HSOSO->Init(0.); occ::handle> HDIDI = new NCollection_HArray1(1, SIZE); - double* DIDITB = (double*)&HDIDI->ChangeArray1()(HDIDI->Lower()); + double* DIDITB = static_cast(&HDIDI->ChangeArray1()(HDIDI->Lower())); HDIDI->Init(0.); // SODITB and DISOTB are dimensioned in FORTRAN at @@ -281,10 +281,10 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions SIZE = (NBPNTU / 2) * (NBPNTV / 2) * NDIMEN; occ::handle> HSODI = new NCollection_HArray1(1, SIZE); - double* SODITB = (double*)&HSODI->ChangeArray1()(HSODI->Lower()); + double* SODITB = static_cast(&HSODI->ChangeArray1()(HSODI->Lower())); HSODI->Init(0.); occ::handle> HDISO = new NCollection_HArray1(1, SIZE); - double* DISOTB = (double*)&HDISO->ChangeArray1()(HDISO->Lower()); + double* DISOTB = static_cast(&HDISO->ChangeArray1()(HDISO->Lower())); HDISO->Init(0.); int IERCOD = 0; @@ -324,11 +324,11 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions SIZE = std::max(NBPNTU, NBPNTV); occ::handle> HTABLE = new NCollection_HArray1(1, SIZE); - double* TAB = (double*)&HTABLE->ChangeArray1()(HTABLE->Lower()); + double* TAB = static_cast(&HTABLE->ChangeArray1()(HTABLE->Lower())); occ::handle> HPOINTS = new NCollection_HArray1(1, SIZE * NDIMEN); - double* PTS = (double*)&HPOINTS->ChangeArray1()(HPOINTS->Lower()); + double* PTS = static_cast(&HPOINTS->ChangeArray1()(HPOINTS->Lower())); // GCC 3.0 would not accept this line without the void // pointer cast. Perhaps the real problem is a definition @@ -396,24 +396,24 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, // data relative to the patch int IORDRU = myOrdInU, IORDRV = myOrdInV; - double* PATCAN = (double*)&myEquation->ChangeArray1()(myEquation->Lower()); + double* PATCAN = static_cast(&myEquation->ChangeArray1()(myEquation->Lower())); // curves of approximation of Isos U int SIZE = NCFLMV * NDIMEN; occ::handle> HIsoU0 = new NCollection_HArray1(1, SIZE * (IORDRU + 1)); HIsoU0->ChangeArray1() = (Constraints.IsoU(myU0, myV0, myV1)).Polynom()->Array1(); - double* IsoU0 = (double*)&HIsoU0->ChangeArray1()(HIsoU0->Lower()); + double* IsoU0 = static_cast(&HIsoU0->ChangeArray1()(HIsoU0->Lower())); occ::handle> HCFU0 = new NCollection_HArray1(1, IORDRU + 1); - int* NCFU0 = (int*)&HCFU0->ChangeArray1()(HCFU0->Lower()); + int* NCFU0 = static_cast(&HCFU0->ChangeArray1()(HCFU0->Lower())); HCFU0->Init((Constraints.IsoU(myU0, myV0, myV1)).NbCoeff()); occ::handle> HIsoU1 = new NCollection_HArray1(1, SIZE * (IORDRU + 1)); HIsoU1->ChangeArray1() = (Constraints.IsoU(myU1, myV0, myV1)).Polynom()->Array1(); - double* IsoU1 = (double*)&HIsoU1->ChangeArray1()(HIsoU1->Lower()); + double* IsoU1 = static_cast(&HIsoU1->ChangeArray1()(HIsoU1->Lower())); occ::handle> HCFU1 = new NCollection_HArray1(1, IORDRU + 1); - int* NCFU1 = (int*)&HCFU1->ChangeArray1()(HCFU1->Lower()); + int* NCFU1 = static_cast(&HCFU1->ChangeArray1()(HCFU1->Lower())); HCFU1->Init((Constraints.IsoU(myU1, myV0, myV1)).NbCoeff()); // normalization of Isos U @@ -438,17 +438,17 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, occ::handle> HIsoV0 = new NCollection_HArray1(1, SIZE * (IORDRV + 1)); HIsoV0->ChangeArray1() = (Constraints.IsoV(myU0, myU1, myV0)).Polynom()->Array1(); - double* IsoV0 = (double*)&HIsoV0->ChangeArray1()(HIsoV0->Lower()); + double* IsoV0 = static_cast(&HIsoV0->ChangeArray1()(HIsoV0->Lower())); occ::handle> HCFV0 = new NCollection_HArray1(1, IORDRV + 1); - int* NCFV0 = (int*)&HCFV0->ChangeArray1()(HCFV0->Lower()); + int* NCFV0 = static_cast(&HCFV0->ChangeArray1()(HCFV0->Lower())); HCFV0->Init((Constraints.IsoV(myU0, myU1, myV0)).NbCoeff()); occ::handle> HIsoV1 = new NCollection_HArray1(1, SIZE * (IORDRV + 1)); HIsoV1->ChangeArray1() = (Constraints.IsoV(myU0, myU1, myV1)).Polynom()->Array1(); - double* IsoV1 = (double*)&HIsoV1->ChangeArray1()(HIsoV1->Lower()); + double* IsoV1 = static_cast(&HIsoV1->ChangeArray1()(HIsoV1->Lower())); occ::handle> HCFV1 = new NCollection_HArray1(1, IORDRV + 1); - int* NCFV1 = (int*)&HCFV1->ChangeArray1()(HCFV1->Lower()); + int* NCFV1 = static_cast(&HCFV1->ChangeArray1()(HCFV1->Lower())); HCFV1->Init((Constraints.IsoV(myU0, myU1, myV1)).NbCoeff()); // normalization of Isos V @@ -467,7 +467,7 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, // add constraints to constant V occ::handle> HHERMV = new NCollection_HArray1(1, (2 * IORDRV + 2) * (2 * IORDRV + 2)); - double* HermV = (double*)&HHERMV->ChangeArray1()(HHERMV->Lower()); + double* HermV = static_cast(&HHERMV->ChangeArray1()(HHERMV->Lower())); if (IORDRV >= 0) { AdvApp2Var_ApproxF2var::mma1her_(&IORDRV, HermV, &IERCOD); @@ -491,7 +491,7 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, // add constraints to constant U occ::handle> HHERMU = new NCollection_HArray1(1, (2 * IORDRU + 2) * (2 * IORDRU + 2)); - double* HermU = (double*)&HHERMU->ChangeArray1()(HHERMU->Lower()); + double* HermU = static_cast(&HHERMU->ChangeArray1()(HHERMU->Lower())); if (IORDRU >= 0) { AdvApp2Var_ApproxF2var::mma1her_(&IORDRU, HermU, &IERCOD); @@ -565,9 +565,9 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, int IORDMX = std::max(IORDRU, IORDRV); occ::handle> HEXTR = new NCollection_HArray1(1, 2 * IORDMX + 2); - double* EXTR = (double*)&HEXTR->ChangeArray1()(HEXTR->Lower()); + double* EXTR = static_cast(&HEXTR->ChangeArray1()(HEXTR->Lower())); occ::handle> HFACT = new NCollection_HArray1(1, IORDMX + 1); - double* FACT = (double*)&HFACT->ChangeArray1()(HFACT->Lower()); + double* FACT = static_cast(&HFACT->ChangeArray1()(HFACT->Lower())); int idim, ncf0, ncf1, iun = 1; double* Is; @@ -625,7 +625,7 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, } // add all to PATCAN - double* C1 = (double*)&HCOINS->ChangeArray1()(HCOINS->Lower()); + double* C1 = static_cast(&HCOINS->ChangeArray1()(HCOINS->Lower())); double* C2 = C1 + SIZE; double* C3 = C2 + SIZE; double* C4 = C3 + SIZE; @@ -816,35 +816,35 @@ void AdvApp2Var_Patch::MakeApprox(const AdvApp2Var_Context& Conditions, HEPSFRO->SetValue(iesp + 6 * NBSESP, (Conditions.CToler())->Value(iesp, 3)); HEPSFRO->SetValue(iesp + 7 * NBSESP, (Conditions.CToler())->Value(iesp, 4)); } - double* EPSAPR = (double*)&HEPSAPR->ChangeArray1()(HEPSAPR->Lower()); - double* EPSFRO = (double*)&HEPSFRO->ChangeArray1()(HEPSFRO->Lower()); + double* EPSAPR = static_cast(&HEPSAPR->ChangeArray1()(HEPSAPR->Lower())); + double* EPSFRO = static_cast(&HEPSFRO->ChangeArray1()(HEPSFRO->Lower())); int SIZE = (1 + NDJACU) * (1 + NDJACV) * NDIMEN; occ::handle> HPJAC = new NCollection_HArray1(1, SIZE); - double* PATJAC = (double*)&HPJAC->ChangeArray1()(HPJAC->Lower()); + double* PATJAC = static_cast(&HPJAC->ChangeArray1()(HPJAC->Lower())); SIZE = 2 * SIZE; occ::handle> HPAUX = new NCollection_HArray1(1, SIZE); - double* PATAUX = (double*)&HPAUX->ChangeArray1()(HPAUX->Lower()); + double* PATAUX = static_cast(&HPAUX->ChangeArray1()(HPAUX->Lower())); SIZE = NCFLMU * NCFLMV * NDIMEN; occ::handle> HPCAN = new NCollection_HArray1(1, SIZE); - double* PATCAN = (double*)&HPCAN->ChangeArray1()(HPCAN->Lower()); + double* PATCAN = static_cast(&HPCAN->ChangeArray1()(HPCAN->Lower())); occ::handle> HERRMAX = new NCollection_HArray1(1, NBSESP); - double* ERRMAX = (double*)&HERRMAX->ChangeArray1()(HERRMAX->Lower()); + double* ERRMAX = static_cast(&HERRMAX->ChangeArray1()(HERRMAX->Lower())); occ::handle> HERRMOY = new NCollection_HArray1(1, NBSESP); - double* ERRMOY = (double*)&HERRMOY->ChangeArray1()(HERRMOY->Lower()); + double* ERRMOY = static_cast(&HERRMOY->ChangeArray1()(HERRMOY->Lower())); // tables of discretization of the square - double* SOSOTB = (double*)&mySosoTab->ChangeArray1()(mySosoTab->Lower()); - double* DISOTB = (double*)&myDisoTab->ChangeArray1()(myDisoTab->Lower()); - double* SODITB = (double*)&mySodiTab->ChangeArray1()(mySodiTab->Lower()); - double* DIDITB = (double*)&myDidiTab->ChangeArray1()(myDidiTab->Lower()); + double* SOSOTB = static_cast(&mySosoTab->ChangeArray1()(mySosoTab->Lower())); + double* DISOTB = static_cast(&myDisoTab->ChangeArray1()(myDisoTab->Lower())); + double* SODITB = static_cast(&mySodiTab->ChangeArray1()(mySodiTab->Lower())); + double* DIDITB = static_cast(&myDidiTab->ChangeArray1()(myDidiTab->Lower())); // approximation int ITYDEC = 0, IERCOD = 0; int iun = 1, itrois = 3; NCOEFU = 0; NCOEFV = 0; - AdvApp2Var_ApproxF2var::mma2ce1_((int*)&NumDec, + AdvApp2Var_ApproxF2var::mma2ce1_(const_cast(&NumDec), &NDIMEN, &NBSESP, &NDIMSE, @@ -913,7 +913,7 @@ void AdvApp2Var_Patch::MakeApprox(const AdvApp2Var_Context& Conditions, AddErrors(Constraints); // Reduction of degrees if possible - PATCAN = (double*)&myEquation->ChangeArray1()(myEquation->Lower()); + PATCAN = static_cast(&myEquation->ChangeArray1()(myEquation->Lower())); AdvApp2Var_ApproxF2var::mma2fx6_(&NCFLMU, &NCFLMV, diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_SysBase.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_SysBase.cxx index f6f7835b121..9cfabbf3858 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_SysBase.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_SysBase.cxx @@ -1671,7 +1671,7 @@ int maoverf_(int* nbentr, double* dtable) /* Loop. The upper limit is the int value of the logarithm of base 2 */ /* of NBENTR/NLONGR. */ - i__1 = (int)(std::log((float)(*nbentr) / (float)63.) / std::log((float)2.)); + i__1 = static_cast(std::log(static_cast(*nbentr) / static_cast(63.)) / std::log(static_cast(2.))); for (ibid = 1; ibid <= i__1; ++ibid) { @@ -2193,7 +2193,7 @@ int AdvApp2Var_SysBase::mcrdelt_(int* iunit, int* isize, void* t, intptr_t* iofs initialization with goto*/ /* assign max positive int to *iofset */ const size_t shift = sizeof(*iofset) * 8 - 1; - *iofset = (uintptr_t(1) << shift) - 1 /*2147483647 for 32bit*/; + *iofset = (static_cast(1) << shift) - 1 /*2147483647 for 32bit*/; } goto L9900; @@ -2744,11 +2744,11 @@ int AdvApp2Var_SysBase::mcrrqst_(int* iunit, int* isize, void* t, intptr_t* iofs /* RANGING OF PARAMETERS IN MCRGENE */ mcrgene_.icore[mcrgene_.ncore].prot = mcrgene_.lprot; - mcrgene_.icore[mcrgene_.ncore].unit = (unsigned char)(*iunit); + mcrgene_.icore[mcrgene_.ncore].unit = static_cast(*iunit); mcrgene_.icore[mcrgene_.ncore].reqsize = *isize; mcrgene_.icore[mcrgene_.ncore].loc = loc; mcrgene_.icore[mcrgene_.ncore].offset = *iofset; - mcrgene_.icore[mcrgene_.ncore].alloctype = (unsigned char)ksys; + mcrgene_.icore[mcrgene_.ncore].alloctype = static_cast(ksys); mcrgene_.icore[mcrgene_.ncore].size = ibyte; mcrgene_.icore[mcrgene_.ncore].addr = iaddr; mcrgene_.icore[mcrgene_.ncore].userzone = mcrgene_.ncore; diff --git a/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx b/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx index a23435df442..6d319c10a54 100644 --- a/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx +++ b/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx @@ -1976,7 +1976,7 @@ void AppDef_Variational::InitSmoothCriterion() WQuality = std::max(myTolerance, Eps2 * Length); int NbConstr = myNbPassPoints + myNbTangPoints + myNbCurvPoints; - WQuadratic = std::sqrt((double)(myNbPoints - NbConstr)) * WQuality; + WQuadratic = std::sqrt(static_cast(myNbPoints - NbConstr)) * WQuality; if (WQuadratic > Eps3) WQuadratic = 1. / WQuadratic; @@ -2206,9 +2206,9 @@ void AppDef_Variational::EstTangent(const int ipnt, math_Vector& VTang) const int adr1 = 1, adr2 = adr1 + myDimension, adr3 = adr2 + myDimension; - math_Vector Pnt1((double*)&myTabPoints->Value(adr1), 1, myDimension); - math_Vector Pnt2((double*)&myTabPoints->Value(adr2), 1, myDimension); - math_Vector Pnt3((double*)&myTabPoints->Value(adr3), 1, myDimension); + math_Vector Pnt1(const_cast(&myTabPoints->Value(adr1)), 1, myDimension); + math_Vector Pnt2(const_cast(&myTabPoints->Value(adr2)), 1, myDimension); + math_Vector Pnt3(const_cast(&myTabPoints->Value(adr3)), 1, myDimension); // Parabolic interpolation // if we have parabolic interpolation: F(t) = A0 + A1*t + A2*t*t, @@ -2244,9 +2244,9 @@ void AppDef_Variational::EstTangent(const int ipnt, math_Vector& VTang) const int adr1 = (myLastPoint - 3) * myDimension + 1, adr2 = adr1 + myDimension, adr3 = adr2 + myDimension; - math_Vector Pnt1((double*)&myTabPoints->Value(adr1), 1, myDimension); - math_Vector Pnt2((double*)&myTabPoints->Value(adr2), 1, myDimension); - math_Vector Pnt3((double*)&myTabPoints->Value(adr3), 1, myDimension); + math_Vector Pnt1(const_cast(&myTabPoints->Value(adr1)), 1, myDimension); + math_Vector Pnt2(const_cast(&myTabPoints->Value(adr2)), 1, myDimension); + math_Vector Pnt3(const_cast(&myTabPoints->Value(adr3)), 1, myDimension); // Parabolic interpolation // if we have parabolic interpolation: F(t) = A0 + A1*t + A2*t*t, @@ -2276,8 +2276,8 @@ void AppDef_Variational::EstTangent(const int ipnt, math_Vector& VTang) const int adr1 = (ipnt - myFirstPoint - 1) * myDimension + 1, adr2 = adr1 + 2 * myDimension; - math_Vector Pnt1((double*)&myTabPoints->Value(adr1), 1, myDimension); - math_Vector Pnt2((double*)&myTabPoints->Value(adr2), 1, myDimension); + math_Vector Pnt1(const_cast(&myTabPoints->Value(adr1)), 1, myDimension); + math_Vector Pnt2(const_cast(&myTabPoints->Value(adr2)), 1, myDimension); VTang = Pnt2 - Pnt1; } @@ -2716,8 +2716,8 @@ void AppDef_Variational::AssemblingConstraints(const occ::handle& int MxDeg = Curve->Base().WorkDegree(), NbElm = Curve->NbElements(), NbDim = Curve->Dimension(); NCollection_Array1 G0(0, MxDeg), G1(0, MxDeg), G2(0, MxDeg); - math_Vector V0((double*)&G0(0), 0, MxDeg), V1((double*)&G1(0), 0, MxDeg), - V2((double*)&G2(0), 0, MxDeg); + math_Vector V0(static_cast(&G0(0)), 0, MxDeg), V1(static_cast(&G1(0)), 0, MxDeg), + V2(static_cast(&G2(0)), 0, MxDeg); int IndexOfConstraint, Ng3d, Ng2d, NBeg2d, NPass, NgPC1, NTang3d, NTang2d, Point, TypOfConstr, p0 = Parameters.Lower() - myFirstPoint, curel = 1, el, i, ipnt, ityp, j, k, pnt, curdim, jt, diff --git a/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves.cxx b/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves.cxx index fe30058b0db..5c7f5c9be06 100644 --- a/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves.cxx +++ b/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves.cxx @@ -227,7 +227,7 @@ void AppParCurves::SplineFunction(const int nbpoles, locpoles(pp) *= (flatknots(kindex + pp) - U) * Inverse; locpoles(pp) += locqq; locqq = Saved; - LocalInverse = (double)(deg)*Inverse; + LocalInverse = static_cast(deg)*Inverse; Saved = LocalInverse * locdpoles(pp); locdpoles(pp) *= -LocalInverse; locdpoles(pp) += locdqq; diff --git a/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves_LeastSquare.gxx b/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves_LeastSquare.gxx index c79163ba65e..a09d10d2068 100644 --- a/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves_LeastSquare.gxx +++ b/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves_LeastSquare.gxx @@ -1403,7 +1403,7 @@ AppParCurves_MultiCurve AppParCurves_LeastSquare::BezierValue() { if (!myknots.IsNull()) throw Standard_NoSuchObject(); - return (AppParCurves_MultiCurve)(BSplineValue()); + return AppParCurves_MultiCurve(BSplineValue()); } const AppParCurves_MultiBSpCurve& AppParCurves_LeastSquare::BSplineValue() diff --git a/src/ModelingData/TKGeomBase/Approx/Approx_BSplComputeLine.gxx b/src/ModelingData/TKGeomBase/Approx/Approx_BSplComputeLine.gxx index 77736c2c40e..a1c01360485 100644 --- a/src/ModelingData/TKGeomBase/Approx/Approx_BSplComputeLine.gxx +++ b/src/ModelingData/TKGeomBase/Approx/Approx_BSplComputeLine.gxx @@ -763,8 +763,8 @@ void Approx_BSplComputeLine::Perform(const MultiLine& Line) for (i = 2; i <= nbknots - 1; i++) { - l = (mylastpt - myfirstpt) * double(i - 1) / double(nbknots - 1); - int ll = (int)(l); + l = (mylastpt - myfirstpt) * static_cast(i - 1) / static_cast(nbknots - 1); + int ll = static_cast(l); double a = l - ll; double p1 = TheParam(ll + myfirstpt); double p2 = TheParam(ll + 1 + myfirstpt); @@ -888,7 +888,7 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line, { for (i = firstP + 1; i <= lastP; i++) { - TheParameters(i) = (double(i) - firstP) / (double(lastP - double(firstP))); + TheParameters(i) = (static_cast(i) - firstP) / ((lastP - static_cast(firstP))); } } } diff --git a/src/ModelingData/TKGeomBase/Approx/Approx_ComputeLine.gxx b/src/ModelingData/TKGeomBase/Approx/Approx_ComputeLine.gxx index 02cbc16fd05..9b3fc9503b2 100644 --- a/src/ModelingData/TKGeomBase/Approx/Approx_ComputeLine.gxx +++ b/src/ModelingData/TKGeomBase/Approx/Approx_ComputeLine.gxx @@ -952,7 +952,7 @@ void Approx_ComputeLine::Perform(const MultiLine& Line) } } } - mylastpt = int((myfirstpt + mylastpt) / 2); + mylastpt = ((myfirstpt + mylastpt) / 2); } } GoUp = false; @@ -1316,7 +1316,7 @@ void Approx_ComputeLine::Parameters(const MultiLine& Line, { for (i = firstP; i <= lastP; i++) { - TheParameters(i) = (double(i) - firstP) / (double(lastP) - double(firstP)); + TheParameters(i) = (static_cast(i) - firstP) / (static_cast(lastP) - static_cast(firstP)); } } } diff --git a/src/ModelingData/TKGeomBase/Approx/Approx_SameParameter.cxx b/src/ModelingData/TKGeomBase/Approx/Approx_SameParameter.cxx index dac4a36837b..5745b5e2841 100644 --- a/src/ModelingData/TKGeomBase/Approx/Approx_SameParameter.cxx +++ b/src/ModelingData/TKGeomBase/Approx/Approx_SameParameter.cxx @@ -71,7 +71,7 @@ void Approx_SameParameter_Evaluator::Evaluate(int*, /*Dimension*/ const int aDegree = 3; int extrap_mode[2] = {aDegree, aDegree}; double eval_result[2]; - double* PolesArray = (double*)&Poles(Poles.Lower()); + double* PolesArray = const_cast(&Poles(Poles.Lower())); // Evaluate the 1D B-Spline that represents the change in parameterization. BSplCLib::Eval(*Parameter, @@ -227,7 +227,7 @@ static bool Check(const NCollection_Array1& FlatKnots, double tc3d = pc3d[0] * (1.0 - t) + pc3d[nbp - 1] * t; // weight function. gp_Pnt Pc3d = c3d->Value(tc3d); double tcons; - BSplCLib::Eval(tc3d, false, 0, extrap_mode[0], aDegree, FlatKnots, 1, (double&)Poles(1), tcons); + BSplCLib::Eval(tc3d, false, 0, extrap_mode[0], aDegree, FlatKnots, 1, const_cast(Poles(1)), tcons); if (tcons < tprev || tcons > aParamLast) { @@ -837,7 +837,7 @@ bool Approx_SameParameter::IncreaseNbPoles(const NCollection_Array1& the const int DerivativeRequest = 0; int extrap_mode[2] = {aDegree, aDegree}; double eval_result; - double* PolesArray = (double*)&thePoles(thePoles.Lower()); + double* PolesArray = const_cast(&thePoles(thePoles.Lower())); int newcount = 0; for (int ii = 0; ii < theData.myNbPnt; ii++) { diff --git a/src/ModelingData/TKGeomBase/CPnts/CPnts_AbscissaPoint.cxx b/src/ModelingData/TKGeomBase/CPnts/CPnts_AbscissaPoint.cxx index dd1a57463c0..f45ef68b3d5 100644 --- a/src/ModelingData/TKGeomBase/CPnts/CPnts_AbscissaPoint.cxx +++ b/src/ModelingData/TKGeomBase/CPnts/CPnts_AbscissaPoint.cxx @@ -42,7 +42,7 @@ static double f3d(const double X, void* const C) { gp_Pnt P; gp_Vec V; - ((Adaptor3d_Curve*)C)->D1(X, P, V); + (static_cast(C))->D1(X, P, V); return V.Magnitude(); } @@ -50,7 +50,7 @@ static double f2d(const double X, void* const C) { gp_Pnt2d P; gp_Vec2d V; - ((Adaptor2d_Curve2d*)C)->D1(X, P, V); + (static_cast(C))->D1(X, P, V); return V.Magnitude(); } diff --git a/src/ModelingData/TKGeomBase/CPnts/CPnts_UniformDeflection.cxx b/src/ModelingData/TKGeomBase/CPnts/CPnts_UniformDeflection.cxx index 3df398b26b6..ec0faad9d10 100644 --- a/src/ModelingData/TKGeomBase/CPnts/CPnts_UniformDeflection.cxx +++ b/src/ModelingData/TKGeomBase/CPnts/CPnts_UniformDeflection.cxx @@ -49,26 +49,26 @@ static inline void D03d(void* const C, const double U, gp_Pnt& P) { - ((Adaptor3d_Curve*)C)->D0(U, P); + (static_cast(C))->D0(U, P); } static void D02d(void* const C, const double U, gp_Pnt& PP) { gp_Pnt2d P; - ((Adaptor2d_Curve2d*)C)->D0(U, P); + (static_cast(C))->D0(U, P); PP.SetCoord(P.X(), P.Y(), 0.); } static inline void D23d(void* const C, const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) { - ((Adaptor3d_Curve*)C)->D2(U, P, V1, V2); + (static_cast(C))->D2(U, P, V1, V2); } static void D22d(void* const C, const double U, gp_Pnt& PP, gp_Vec& VV1, gp_Vec& VV2) { gp_Pnt2d P; gp_Vec2d V1, V2; - ((Adaptor2d_Curve2d*)C)->D2(U, P, V1, V2); + (static_cast(C))->D2(U, P, V1, V2); PP.SetCoord(P.X(), P.Y(), 0.); VV1.SetCoord(V1.X(), V1.Y(), 0.); VV2.SetCoord(V2.X(), V2.Y(), 0.); diff --git a/src/ModelingData/TKGeomBase/Extrema/Extrema_ExtCS.cxx b/src/ModelingData/TKGeomBase/Extrema/Extrema_ExtCS.cxx index 56619b91dee..3ee03258ea1 100644 --- a/src/ModelingData/TKGeomBase/Extrema/Extrema_ExtCS.cxx +++ b/src/ModelingData/TKGeomBase/Extrema/Extrema_ExtCS.cxx @@ -431,7 +431,7 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C, const double Uinf, const d // Add sharp points int SolNumber = mySqDist.Length(); void* CopyC = (void*)&C; - Adaptor3d_Curve& aC = *(Adaptor3d_Curve*)CopyC; + Adaptor3d_Curve& aC = *static_cast(CopyC); int NbIntervals = aC.NbIntervals(GeomAbs_C1); NCollection_Array1 SharpPoints(1, NbIntervals + 1); aC.Intervals(SharpPoints, GeomAbs_C1); diff --git a/src/ModelingData/TKGeomBase/Extrema/Extrema_GFuncExtCC.hxx b/src/ModelingData/TKGeomBase/Extrema/Extrema_GFuncExtCC.hxx index 84f127371af..9a2b395a541 100644 --- a/src/ModelingData/TKGeomBase/Extrema/Extrema_GFuncExtCC.hxx +++ b/src/ModelingData/TKGeomBase/Extrema/Extrema_GFuncExtCC.hxx @@ -173,7 +173,7 @@ double Extrema_GFuncExtCC(NPoint); int aNum = 0; double aMax = -Precision::Infinite(); diff --git a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_QuasiUniformDeflection.cxx b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_QuasiUniformDeflection.cxx index 1a6aa27674b..362174126e1 100644 --- a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_QuasiUniformDeflection.cxx +++ b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_QuasiUniformDeflection.cxx @@ -302,9 +302,9 @@ static bool PerformCircular(const TheCurve& theC, { double anAngle = std::max(1.0 - (theDeflection / theC.Circle().Radius()), 0.0); anAngle = 2.0 * std::acos(anAngle); - int aNbPoints = (int)((theU2 - theU1) / anAngle); + int aNbPoints = static_cast((theU2 - theU1) / anAngle); aNbPoints += 2; - anAngle = (theU2 - theU1) / (double)(aNbPoints - 1); + anAngle = (theU2 - theU1) / static_cast(aNbPoints - 1); double U = theU1; for (int i = 1; i <= aNbPoints; ++i) { diff --git a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_TangentialDeflection.cxx b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_TangentialDeflection.cxx index 0d25c4e0c6a..5720c77a971 100644 --- a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_TangentialDeflection.cxx +++ b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_TangentialDeflection.cxx @@ -361,7 +361,7 @@ void GCPnts_TangentialDeflection::PerformCircular(const TheCurve& theC) const double aDiff = myLastU - myFirstu; // Round up number of points to satisfy curvatureDeflection more precisely - int NbPoints = (int)std::min(std::ceil(aDiff / Du), 1.0e+6); + int NbPoints = static_cast(std::min(std::ceil(aDiff / Du), 1.0e+6)); NbPoints = std::max(NbPoints, myMinNbPnts - 1); Du = aDiff / NbPoints; diff --git a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformAbscissa.cxx b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformAbscissa.cxx index 64b5a983d12..ae3a2f2a7bb 100644 --- a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformAbscissa.cxx +++ b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformAbscissa.cxx @@ -400,7 +400,7 @@ void GCPnts_UniformAbscissa::initialize(const TheCurve& theC, return; } - const int aSize = (int)aSizeR; + const int aSize = static_cast(aSizeR); if (!myParams.IsNull()) { if (myParams->Length() < aSize) diff --git a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformDeflection.cxx b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformDeflection.cxx index b5a088f0766..d4c54c6df7d 100644 --- a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformDeflection.cxx +++ b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformDeflection.cxx @@ -191,9 +191,9 @@ static bool PerformCircular(const TheCurve& theC, gp_Pnt aPoint; double anAngle = std::max(1.0 - (theDeflection / theC.Circle().Radius()), 0.0); anAngle = 2.0e0 * std::acos(anAngle); - int aNbPoints = (int)((theU2 - theU1) / anAngle); + int aNbPoints = static_cast((theU2 - theU1) / anAngle); aNbPoints += 2; - anAngle = (theU2 - theU1) / (double)(aNbPoints - 1); + anAngle = (theU2 - theU1) / static_cast(aNbPoints - 1); double aU = theU1; for (int i = 1; i <= aNbPoints; ++i) { diff --git a/src/ModelingData/TKGeomBase/GeomConvert/GeomConvert_1.cxx b/src/ModelingData/TKGeomBase/GeomConvert/GeomConvert_1.cxx index ea9ca53f29b..5092d7d1e0e 100644 --- a/src/ModelingData/TKGeomBase/GeomConvert/GeomConvert_1.cxx +++ b/src/ModelingData/TKGeomBase/GeomConvert/GeomConvert_1.cxx @@ -534,7 +534,7 @@ occ::handle GeomConvert::SurfaceToBSplineSurface( else { // Number of spans: maximum opening = 150 degrees ( = PI / 1.2 rad) - const int nbUSpans = (int)std::trunc(1.2 * (ULast - UFirst) / M_PI) + 1; + const int nbUSpans = static_cast(std::trunc(1.2 * (ULast - UFirst) / M_PI)) + 1; AlfaU = (ULast - UFirst) / (nbUSpans * 2); NbUPoles = 2 * nbUSpans + 1; NbUKnots = nbUSpans + 1; diff --git a/src/ModelingData/TKGeomBase/GeomLib/GeomLib.cxx b/src/ModelingData/TKGeomBase/GeomLib/GeomLib.cxx index 58089905dde..c969260a885 100644 --- a/src/ModelingData/TKGeomBase/GeomLib/GeomLib.cxx +++ b/src/ModelingData/TKGeomBase/GeomLib/GeomLib.cxx @@ -265,7 +265,7 @@ void GeomLib::RemovePointsFromArray(const int Nu loc_num_points = std::max(0, NumPoints - 2); delta = InParameters(InParameters.Upper()) - InParameters(InParameters.Lower()); - delta /= (double)(loc_num_points + 1); + delta /= static_cast(loc_num_points + 1); num_points = 1; current_parameter = InParameters(InParameters.Lower()) + delta * 0.5e0; ii = InParameters.Lower() + 1; @@ -335,7 +335,7 @@ void GeomLib::DensifyArray1OfReal(const int MinN { num_parameters_to_add = MinNumPoints - InParameters.Length(); delta = InParameters(InParameters.Upper()) - InParameters(InParameters.Lower()); - delta /= (double)(num_parameters_to_add + 1); + delta /= static_cast(num_parameters_to_add + 1); num_points = MinNumPoints; OutParameters = new NCollection_HArray1(1, num_points); index = 1; @@ -1312,11 +1312,11 @@ void GeomLib::ExtendCurveToPoint(occ::handle& Curve, dt = d1.Magnitude() / norm; if ((dt < 1.5) && (dt > 0.75)) { // The edge is within the average, keep it - Lambda = ((double)1) / std::max(d1.Magnitude() / L1, Tol); + Lambda = (static_cast(1)) / std::max(d1.Magnitude() / L1, Tol); } else { - Lambda = ((double)1) / std::max(norm / L1, Tol); + Lambda = (static_cast(1)) / std::max(norm / L1, Tol); } } else @@ -1581,7 +1581,7 @@ void GeomLib::ExtendSurfByLength(occ::handle& Surface, } } } - Padr = (double*)&Poles->ChangeValue(1); + Padr = static_cast(&Poles->ChangeValue(1)); // calculation of the connection point and tangent Point = new (NCollection_HArray1)(1, Cdim); @@ -1597,7 +1597,7 @@ void GeomLib::ExtendSurfByLength(occ::handle& Surface, NCollection_Array1& point = Point->ChangeArray1(); NCollection_Array1& lamb = lambda->ChangeArray1(); - double* Radr = (double*)&Result(1); + double* Radr = static_cast(&Result(1)); BSplCLib::Eval(Tbord, periodic_flag, diff --git a/src/ModelingData/TKGeomBase/GeomTools/GeomTools_Debug.cxx b/src/ModelingData/TKGeomBase/GeomTools/GeomTools_Debug.cxx index aadbf180691..8ced1b82cde 100644 --- a/src/ModelingData/TKGeomBase/GeomTools/GeomTools_Debug.cxx +++ b/src/ModelingData/TKGeomBase/GeomTools/GeomTools_Debug.cxx @@ -38,7 +38,7 @@ const char* GeomTools_Dump(void* theHandlePtr) { OCC_CATCH_SIGNALS const occ::handle& aHandle = - *(occ::handle*)theHandlePtr; + *static_cast*>(theHandlePtr); occ::handle GS = occ::down_cast(aHandle); if (!GS.IsNull()) diff --git a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_CompProjectedCurve.cxx b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_CompProjectedCurve.cxx index 4141f8befb9..5fada2e44e5 100644 --- a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_CompProjectedCurve.cxx +++ b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_CompProjectedCurve.cxx @@ -371,8 +371,8 @@ static bool ExactBound(gp_Pnt& Sol, gp_Pnt P; P = Seq.Last(); Seq.Remove(Seq.Length()); - ProjLib_PrjResolve aPrjPS(*Curve, *Surface, int(P.Z())); - if (int(P.Z()) == 2) + ProjLib_PrjResolve aPrjPS(*Curve, *Surface, static_cast(P.Z())); + if (static_cast(P.Z()) == 2) { aPrjPS.Perform(t, P.X(), @@ -2150,7 +2150,7 @@ void SplitOnDirection(SplitDS& theSplitDS) gp_Pnt2d aStartPnt(theSplitDS.mySurface->FirstUParameter(), theSplitDS.mySurface->FirstVParameter()); - gp_Dir2d aDir(theSplitDS.myPeriodicDir, (int)!theSplitDS.myPeriodicDir); + gp_Dir2d aDir(theSplitDS.myPeriodicDir, static_cast(!theSplitDS.myPeriodicDir)); theSplitDS.myPerMinParam = !theSplitDS.myPeriodicDir ? theSplitDS.mySurface->FirstUParameter() : theSplitDS.mySurface->FirstVParameter(); diff --git a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApprox.cxx b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApprox.cxx index 7afefb571b2..06287ef4ced 100644 --- a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApprox.cxx +++ b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApprox.cxx @@ -1392,7 +1392,7 @@ void ProjLib_ComputeApprox::Perform(const occ::handle& C, v = M_PI - v; } double newV = ElCLib::InPeriod(v, F.myV1, F.myV2); - number = (int)(std::floor((newV - v) / (F.myV2 - F.myV1))); + number = static_cast(std::floor((newV - v) / (F.myV2 - F.myV1))); dv -= number * (F.myV2 - F.myV1); } if (F.UCouture || (F.VCouture && SType == GeomAbs_Sphere)) @@ -1402,7 +1402,7 @@ void ProjLib_ComputeApprox::Perform(const occ::handle& C, du = u - P2d.X(); du = (du < 0) ? (du - Precision::PConfusion()) : (du + Precision::PConfusion()); modf(du / M_PI, &aNbPer); - number = (int)aNbPer; + number = static_cast(aNbPer); du = number * M_PI; } diff --git a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx index a14c2e82dd5..9a5b391bdf6 100644 --- a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx +++ b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx @@ -217,9 +217,9 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) gp_Cylinder Cylinder = theData.mySurf->Cylinder(); ElSLib::Parameters(Cylinder, p, S, T); if (U0 < Uinf) - decalU = -int((Uinf - U0) / (2 * M_PI)) - 1; + decalU = -static_cast((Uinf - U0) / (2 * M_PI)) - 1; if (U0 > Usup) - decalU = int((U0 - Usup) / (2 * M_PI)) + 1; + decalU = static_cast((U0 - Usup) / (2 * M_PI)) + 1; S += decalU * 2 * M_PI; break; } @@ -227,9 +227,9 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) gp_Cone Cone = theData.mySurf->Cone(); ElSLib::Parameters(Cone, p, S, T); if (U0 < Uinf) - decalU = -int((Uinf - U0) / (2 * M_PI)) - 1; + decalU = -static_cast((Uinf - U0) / (2 * M_PI)) - 1; if (U0 > Usup) - decalU = int((U0 - Usup) / (2 * M_PI)) + 1; + decalU = static_cast((U0 - Usup) / (2 * M_PI)) + 1; S += decalU * 2 * M_PI; break; } @@ -237,14 +237,14 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) gp_Sphere Sphere = theData.mySurf->Sphere(); ElSLib::Parameters(Sphere, p, S, T); if (U0 < Uinf) - decalU = -int((Uinf - U0) / (2 * M_PI)) - 1; + decalU = -static_cast((Uinf - U0) / (2 * M_PI)) - 1; if (U0 > Usup) - decalU = int((U0 - Usup) / (2 * M_PI)) + 1; + decalU = static_cast((U0 - Usup) / (2 * M_PI)) + 1; S += decalU * 2 * M_PI; if (V0 < Vinf) - decalV = -int((Vinf - V0) / (2 * M_PI)) - 1; + decalV = -static_cast((Vinf - V0) / (2 * M_PI)) - 1; if (V0 > (Vsup + (Vsup - Vinf))) - decalV = int((V0 - Vsup + (Vsup - Vinf)) / (2 * M_PI)) + 1; + decalV = static_cast((V0 - Vsup + (Vsup - Vinf)) / (2 * M_PI)) + 1; T += decalV * 2 * M_PI; if (0.4 * M_PI < std::abs(U0 - S) && std::abs(U0 - S) < 1.6 * M_PI) { @@ -260,13 +260,13 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) gp_Torus Torus = theData.mySurf->Torus(); ElSLib::Parameters(Torus, p, S, T); if (U0 < Uinf) - decalU = -int((Uinf - U0) / (2 * M_PI)) - 1; + decalU = -static_cast((Uinf - U0) / (2 * M_PI)) - 1; if (U0 > Usup) - decalU = int((U0 - Usup) / (2 * M_PI)) + 1; + decalU = static_cast((U0 - Usup) / (2 * M_PI)) + 1; if (V0 < Vinf) - decalV = -int((Vinf - V0) / (2 * M_PI)) - 1; + decalV = -static_cast((Vinf - V0) / (2 * M_PI)) - 1; if (V0 > Vsup) - decalV = int((V0 - Vsup) / (2 * M_PI)) + 1; + decalV = static_cast((V0 - Vsup) / (2 * M_PI)) + 1; S += decalU * 2 * M_PI; T += decalV * 2 * M_PI; break; @@ -288,7 +288,7 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) U0 = Uinf; else { - decalU = int((Uinf - U0) / uperiod) + 1; + decalU = static_cast((Uinf - U0) / uperiod) + 1; U0 += decalU * uperiod; } } @@ -298,7 +298,7 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) U0 = Usup; else { - decalU = -(int((U0 - Usup) / uperiod) + 1); + decalU = -(static_cast((U0 - Usup) / uperiod) + 1); U0 += decalU * uperiod; } } @@ -308,7 +308,7 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) V0 = Vinf; else { - decalV = int((Vinf - V0) / vperiod) + 1; + decalV = static_cast((Vinf - V0) / vperiod) + 1; V0 += decalV * vperiod; } } @@ -318,7 +318,7 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) V0 = Vsup; else { - decalV = -int((V0 - Vsup) / vperiod) - 1; + decalV = -static_cast((V0 - Vsup) / vperiod) - 1; V0 += decalV * vperiod; } } @@ -1738,7 +1738,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::ProjectUsi if (extrloc.IsDone()) { - Dist2Min = (int)extrloc.SquareDistance(); + Dist2Min = static_cast(extrloc.SquareDistance()); if (Dist2Min < DistTol3d2) { (extrloc.Point()).Parameter(u, v); @@ -1783,7 +1783,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::ProjectUsi if (extrloc.IsDone()) { - Dist2Min = (int)extrloc.SquareDistance(); + Dist2Min = static_cast(extrloc.SquareDistance()); if (Dist2Min < DistTol3d2) { (extrloc.Point()).Parameter(u, v); @@ -1854,7 +1854,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::ProjectUsi if (extrloc.IsDone()) { - Dist2Min = (int)extrloc.SquareDistance(); + Dist2Min = static_cast(extrloc.SquareDistance()); if (Dist2Min < DistTol3d2) { (extrloc.Point()).Parameter(u, v); @@ -1899,7 +1899,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::ProjectUsi if (extrloc.IsDone()) { - Dist2Min = (int)extrloc.SquareDistance(); + Dist2Min = static_cast(extrloc.SquareDistance()); if (Dist2Min < DistTol3d2) { (extrloc.Point()).Parameter(u, v); diff --git a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectedCurve.cxx b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectedCurve.cxx index bb19c7fd820..5a870c1c0d4 100644 --- a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectedCurve.cxx +++ b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectedCurve.cxx @@ -812,7 +812,7 @@ void ProjLib_ProjectedCurve::Perform(const occ::handle& C) aRes->D0(aCurrParam, aPnt2d); int aMapKey = - int((aPnt2d.Coord(anIdx) - aSurfFirstPar[anIdx - 1]) / aSurfPeriod[anIdx - 1]); + static_cast((aPnt2d.Coord(anIdx) - aSurfFirstPar[anIdx - 1]) / aSurfPeriod[anIdx - 1]); if (aPnt2d.Coord(anIdx) - aSurfFirstPar[anIdx - 1] < 0.0) aMapKey--; diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_Buffer.hxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_Buffer.hxx index 194a7e2a7f9..93219946d4d 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_Buffer.hxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_Buffer.hxx @@ -52,13 +52,13 @@ public: operator void*() { return myDynData ? myDynData : (void*)myAutoData; } //! Interpret the buffer as a reference to double - operator double&() { return *(myDynData ? (double*)myDynData : (double*)myAutoData); } + operator double&() { return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); } //! Interpret the buffer as a reference to int - operator int&() { return *(myDynData ? (int*)myDynData : (int*)myAutoData); } + operator int&() { return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); } //! Interpret the buffer as a reference to gp_Pnt - operator gp_Pnt&() { return *(myDynData ? (gp_Pnt*)myDynData : (gp_Pnt*)myAutoData); } + operator gp_Pnt&() { return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); } private: //! Deprecate copy constructor diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_DataSource3D.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_DataSource3D.cxx index a50888efbad..c7a21dc8e36 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_DataSource3D.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_DataSource3D.cxx @@ -30,7 +30,7 @@ occ::handle>> MeshVS_DataSource3D: occ::handle>> result = CreatePrismTopology(BasePoints); if (!result.IsNull()) - ((MeshVS_DataSource3D*)this)->myPrismTopos.Bind(BasePoints, result); + (const_cast(this))->myPrismTopos.Bind(BasePoints, result); return result; } } @@ -47,7 +47,7 @@ occ::handle>> MeshVS_DataSource3D: occ::handle>> result = CreatePyramidTopology(BasePoints); if (!result.IsNull()) - ((MeshVS_DataSource3D*)this)->myPyramidTopos.Bind(BasePoints, result); + (const_cast(this))->myPyramidTopos.Bind(BasePoints, result); return result; } } diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx index 94643690409..e62afa68c78 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx @@ -73,9 +73,9 @@ void MeshVS_ElementalColorPrsBuilder::Build(const occ::handle* anElemColorMap = - (NCollection_DataMap*)&myElemColorMap1; + const_cast*>(&myElemColorMap1); NCollection_DataMap* anElemTwoColorsMap = - (NCollection_DataMap*)&myElemColorMap2; + const_cast*>(&myElemColorMap2); NCollection_DataMap> aColorsOfElements; NCollection_DataMap> aTwoColorsOfElements; @@ -132,7 +132,7 @@ void MeshVS_ElementalColorPrsBuilder::Build(const occ::handle& aChangeValue = (NCollection_Map&)anIterC.Value(); + NCollection_Map& aChangeValue = const_cast&>(anIterC.Value()); aChangeValue.Add(aMKey); IsExist = true; } @@ -159,7 +159,7 @@ void MeshVS_ElementalColorPrsBuilder::Build(const occ::handle& aChangeValue = (NCollection_Map&)anIterC2.Value(); + NCollection_Map& aChangeValue = const_cast&>(anIterC2.Value()); aChangeValue.Add(aMKey); IsExist = true; } @@ -193,11 +193,11 @@ void MeshVS_ElementalColorPrsBuilder::Build(const occ::handleGetInteger(MeshVS_DA_EdgeType, anEdgeInt)) - anEdgeType = (Aspect_TypeOfLine)anEdgeInt; + anEdgeType = static_cast(anEdgeInt); int aLineInt = Aspect_TOL_SOLID; if (aDrawer->GetInteger(MeshVS_DA_BeamType, aLineInt)) - aLineType = (Aspect_TypeOfLine)aLineInt; + aLineType = static_cast(aLineInt); occ::handle>> aTopo; int PolygonVerticesFor3D = 0, PolygonBoundsFor3D = 0; diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_MeshPrsBuilder.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_MeshPrsBuilder.cxx index 703f112c015..4899566ea6c 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_MeshPrsBuilder.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_MeshPrsBuilder.cxx @@ -65,7 +65,7 @@ static void ProcessFace(const NCollection_Sequence& theFaceN { const int aNbPolyNodes = theFaceNodes.Length(); - double* aPolyNodesBuf = (double*)alloca((3 * aNbPolyNodes + 1) * sizeof(double)); + double* aPolyNodesBuf = static_cast(alloca((3 * aNbPolyNodes + 1) * sizeof(double))); NCollection_Array1 aPolyNodes(*aPolyNodesBuf, 0, 3 * aNbPolyNodes); for (int aNodeIdx = 0; aNodeIdx < aNbPolyNodes; ++aNodeIdx) @@ -297,8 +297,8 @@ void MeshVS_MeshPrsBuilder::BuildElements(const occ::handle& showEdges = IsWireFrame || showEdges; - int* aNodesBuf = (int*)alloca(maxnodes * sizeof(int)); - double* aCoordsBuf = (double*)alloca(3 * maxnodes * sizeof(double)); + int* aNodesBuf = static_cast(alloca(maxnodes * sizeof(int))); + double* aCoordsBuf = static_cast(alloca(3 * maxnodes * sizeof(double))); NCollection_Array1 aNodes(*aNodesBuf, 1, maxnodes); NCollection_Array1 aCoords(*aCoordsBuf, 1, 3 * maxnodes); @@ -1171,9 +1171,9 @@ void MeshVS_MeshPrsBuilder::CalculateCenter(const NCollection_Array1& th yG += theCoords(3 * k - 1); zG += theCoords(3 * k); } - xG /= double(NbNodes); - yG /= double(NbNodes); - zG /= double(NbNodes); + xG /= static_cast(NbNodes); + yG /= static_cast(NbNodes); + zG /= static_cast(NbNodes); } else { diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_NodalColorPrsBuilder.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_NodalColorPrsBuilder.cxx index 26357f5a876..0e1d43d9e32 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_NodalColorPrsBuilder.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_NodalColorPrsBuilder.cxx @@ -434,7 +434,7 @@ void MeshVS_NodalColorPrsBuilder::Build(const occ::handle& P int anEdgeInt = Aspect_TOL_SOLID; if (aDrawer->GetInteger(MeshVS_DA_EdgeType, anEdgeInt)) - anEdgeType = (Aspect_TypeOfLine)anEdgeInt; + anEdgeType = static_cast(anEdgeInt); if (myUseTexture) { @@ -792,15 +792,15 @@ occ::handle MeshVS_NodalColorPrsBuilder::CreateTexture() co // create and fill image with colors occ::handle anImage = new Image_PixMap(); - if (!anImage->InitTrash(Image_Format_RGBA, size_t(getNearestPow2(aColorsNb)), 2)) + if (!anImage->InitTrash(Image_Format_RGBA, static_cast(getNearestPow2(aColorsNb)), 2)) { return nullptr; } anImage->SetTopDown(false); - for (size_t aCol = 0; aCol < size_t(aColorsNb); ++aCol) + for (size_t aCol = 0; aCol < static_cast(aColorsNb); ++aCol) { - const Quantity_Color& aSrcColor = myTextureColorMap.Value(int(aCol) + 1); + const Quantity_Color& aSrcColor = myTextureColorMap.Value(static_cast(aCol) + 1); Image_ColorRGBA& aColor = anImage->ChangeValue(0, aCol); aColor.r() = static_cast(255.0 * aSrcColor.Red()); aColor.g() = static_cast(255.0 * aSrcColor.Green()); @@ -816,7 +816,7 @@ occ::handle MeshVS_NodalColorPrsBuilder::CreateTexture() co 0xFF}}; // fill second row - for (size_t aCol = (size_t)aColorsNb; aCol < anImage->SizeX(); ++aCol) + for (size_t aCol = static_cast(aColorsNb); aCol < anImage->SizeX(); ++aCol) { anImage->ChangeValue(0, aCol) = aLastColor; } diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx index 3c31ffe18f1..ccff8c37a4e 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx @@ -160,15 +160,15 @@ void MeshVS_TextPrsBuilder::Build(const occ::handle& Prs, int AStyleInt = Aspect_TOST_ANNOTATION; if (aDrawer->GetInteger(MeshVS_DA_TextStyle, AStyleInt)) - ATextStyle = (Aspect_TypeOfStyleText)AStyleInt; + ATextStyle = static_cast(AStyleInt); int ADispInt = Aspect_TODT_NORMAL; if (aDrawer->GetInteger(MeshVS_DA_TextDisplayType, ADispInt)) - ADisplayType = (Aspect_TypeOfDisplayText)ADispInt; + ADisplayType = static_cast(ADispInt); int AAspect = Font_FA_Bold; if (aDrawer->GetInteger(MeshVS_DA_TextFontAspect, AAspect)) - AFontAspectType = (Font_FontAspect)AAspect; + AFontAspectType = static_cast(AAspect); occ::handle aTextAspect = new Graphic3d_AspectText3d(AColor, AFont, AExpansionFactor, ASpace, ATextStyle, ADisplayType); @@ -220,9 +220,9 @@ void MeshVS_TextPrsBuilder::Build(const occ::handle& Prs, Y += aCoords(3 * i - 1); Z += aCoords(3 * i); } - X /= double(NbNodes); - Y /= double(NbNodes); - Z /= double(NbNodes); + X /= static_cast(NbNodes); + Y /= static_cast(NbNodes); + Z /= static_cast(NbNodes); } else { @@ -230,9 +230,9 @@ void MeshVS_TextPrsBuilder::Build(const occ::handle& Prs, continue; } - aPnts.Append(NCollection_Vec3((float)X, (float)Y, (float)Z)); + aPnts.Append(NCollection_Vec3(static_cast(X), static_cast(Y), static_cast(Z))); - occ::handle aText = new Graphic3d_Text((float)aHeight); + occ::handle aText = new Graphic3d_Text(static_cast(aHeight)); aText->SetText(aStr); aText->SetPosition(gp_Pnt(X, Y, Z)); aTextGroup->AddText(aText); diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_Tool.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_Tool.cxx index a0bb5cb5125..e4eb785452e 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_Tool.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_Tool.cxx @@ -43,9 +43,9 @@ occ::handle MeshVS_Tool::CreateAspectFillArea3d( Aspect_HatchStyle aHStyle = Aspect_HS_HORIZONTAL; Graphic3d_MaterialAspect aFrMat = Mat, aBackMat = Mat; - int anIntStyleI = (int)Aspect_IS_EMPTY; - int anEdgeTypeI = (int)Aspect_TOL_SOLID; - int aHStyleI = (int)Aspect_HS_HORIZONTAL; + int anIntStyleI = static_cast(Aspect_IS_EMPTY); + int anEdgeTypeI = static_cast(Aspect_TOL_SOLID); + int aHStyleI = static_cast(Aspect_HS_HORIZONTAL); if (!theDr->GetColor(MeshVS_DA_InteriorColor, anIntColor) && !UseDefaults) return anAsp; @@ -63,17 +63,17 @@ occ::handle MeshVS_Tool::CreateAspectFillArea3d( if (!theDr->GetInteger(MeshVS_DA_InteriorStyle, anIntStyleI) && !UseDefaults) return anAsp; else - anIntStyle = (Aspect_InteriorStyle)anIntStyleI; + anIntStyle = static_cast(anIntStyleI); if (!theDr->GetInteger(MeshVS_DA_EdgeType, anEdgeTypeI) && !UseDefaults) return anAsp; else - anEdgeType = (Aspect_TypeOfLine)anEdgeTypeI; + anEdgeType = static_cast(anEdgeTypeI); if (!theDr->GetInteger(MeshVS_DA_HatchStyle, aHStyleI) && !UseDefaults) return anAsp; else - aHStyle = (Aspect_HatchStyle)aHStyleI; + aHStyle = static_cast(aHStyleI); anAsp = new Graphic3d_AspectFillArea3d(anIntStyle, anIntColor, @@ -96,18 +96,18 @@ occ::handle MeshVS_Tool::CreateAspectFillArea3d( { Graphic3d_MaterialAspect aFrMat = Graphic3d_NameOfMaterial_Brass; Graphic3d_MaterialAspect aBackMat = Graphic3d_NameOfMaterial_Brass; - int aFrMatI = (int)Graphic3d_NameOfMaterial_Brass; - int aBackMatI = (int)Graphic3d_NameOfMaterial_Brass; + int aFrMatI = static_cast(Graphic3d_NameOfMaterial_Brass); + int aBackMatI = static_cast(Graphic3d_NameOfMaterial_Brass); if (!theDr->GetInteger(MeshVS_DA_FrontMaterial, aFrMatI) && !UseDefaults) return nullptr; else - aFrMat = (Graphic3d_MaterialAspect)(Graphic3d_NameOfMaterial)aFrMatI; + aFrMat = Graphic3d_MaterialAspect(static_cast(aFrMatI)); if (!theDr->GetInteger(MeshVS_DA_BackMaterial, aBackMatI) && !UseDefaults) return nullptr; else - aBackMat = (Graphic3d_MaterialAspect)(Graphic3d_NameOfMaterial)aBackMatI; + aBackMat = Graphic3d_MaterialAspect(static_cast(aBackMatI)); occ::handle aFill = CreateAspectFillArea3d(theDr, aFrMat, UseDefaults); @@ -129,7 +129,7 @@ occ::handle MeshVS_Tool::CreateAspectLine3d( Quantity_Color aBeamColor = Quantity_NOC_YELLOW; Aspect_TypeOfLine aBeamType = Aspect_TOL_SOLID; double aBeamWidth = 1.0; - int aBeamTypeI = (int)Aspect_TOL_SOLID; + int aBeamTypeI = static_cast(Aspect_TOL_SOLID); if (!theDr->GetColor(MeshVS_DA_BeamColor, aBeamColor) && !UseDefaults) return anAsp; @@ -140,7 +140,7 @@ occ::handle MeshVS_Tool::CreateAspectLine3d( if (!theDr->GetInteger(MeshVS_DA_BeamType, aBeamTypeI) && !UseDefaults) return anAsp; else - aBeamType = (Aspect_TypeOfLine)aBeamTypeI; + aBeamType = static_cast(aBeamTypeI); anAsp = new Graphic3d_AspectLine3d(aBeamColor, aBeamType, aBeamWidth); @@ -160,7 +160,7 @@ occ::handle MeshVS_Tool::CreateAspectMarker3d( Quantity_Color aMColor = Quantity_NOC_YELLOW; Aspect_TypeOfMarker aMType = Aspect_TOM_X; double aMScale = 1.0; - int aMTypeI = (int)Aspect_TOM_X; + int aMTypeI = static_cast(Aspect_TOM_X); if (!theDr->GetColor(MeshVS_DA_MarkerColor, aMColor) && !UseDefaults) return anAsp; @@ -171,7 +171,7 @@ occ::handle MeshVS_Tool::CreateAspectMarker3d( if (!theDr->GetInteger(MeshVS_DA_MarkerType, aMTypeI) && !UseDefaults) return anAsp; else - aMType = (Aspect_TypeOfMarker)aMTypeI; + aMType = static_cast(aMTypeI); anAsp = new Graphic3d_AspectMarker3d(aMType, aMColor, aMScale); @@ -195,10 +195,10 @@ occ::handle MeshVS_Tool::CreateAspectText3d( Aspect_TypeOfDisplayText aDispText = Aspect_TODT_NORMAL; TCollection_AsciiString aFontString = Font_NOF_ASCII_MONO; Font_FontAspect aFontAspect = Font_FA_Regular; - int aStyleI = (int)Aspect_TOST_NORMAL; - int aDispTextI = (int)Aspect_TODT_NORMAL; + int aStyleI = static_cast(Aspect_TOST_NORMAL); + int aDispTextI = static_cast(Aspect_TODT_NORMAL); // Bold font is used by default for better text readability - int aFontAspectI = (int)Font_FA_Bold; + int aFontAspectI = static_cast(Font_FA_Bold); if (!theDr->GetColor(MeshVS_DA_TextColor, aTColor) && !UseDefaults) return anAsp; @@ -217,17 +217,17 @@ occ::handle MeshVS_Tool::CreateAspectText3d( if (!theDr->GetInteger(MeshVS_DA_TextStyle, aStyleI) && !UseDefaults) return anAsp; else - aStyle = (Aspect_TypeOfStyleText)aStyleI; + aStyle = static_cast(aStyleI); if (!theDr->GetInteger(MeshVS_DA_TextDisplayType, aDispTextI) && !UseDefaults) return anAsp; else - aDispText = (Aspect_TypeOfDisplayText)aDispTextI; + aDispText = static_cast(aDispTextI); if (!theDr->GetInteger(MeshVS_DA_TextFontAspect, aFontAspectI) && !UseDefaults) return anAsp; else - aFontAspect = (Font_FontAspect)aFontAspectI; + aFontAspect = static_cast(aFontAspectI); anAsp = new Graphic3d_AspectText3d(aTColor, aFont, anExpFactor, aSpace, aStyle, aDispText); anAsp->SetTextFontAspect(aFontAspect); @@ -242,7 +242,7 @@ bool MeshVS_Tool::GetNormal(const NCollection_Array1& Nodes, gp_Vec& Nor if (first == 0) { first = 1; - count = int(Nodes.Value(0)); + count = static_cast(Nodes.Value(0)); } if (count < 3) @@ -306,7 +306,7 @@ bool MeshVS_Tool::GetAverageNormal(const NCollection_Array1& Nodes, gp_V if (first == 0) { first = 1; - count = int(Nodes.Value(0)); + count = static_cast(Nodes.Value(0)); } if (count < 3) diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_TwoColors.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_TwoColors.cxx index d27861e8469..142891bd081 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_TwoColors.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_TwoColors.cxx @@ -22,13 +22,13 @@ MeshVS_TwoColors BindTwoColors(const Quantity_Color& theCol1, const Quantity_Col MeshVS_TwoColors aRes; NCollection_Vec3 aColor_sRGB; theCol1.Values(aColor_sRGB.r(), aColor_sRGB.g(), aColor_sRGB.b(), Quantity_TOC_sRGB); - aRes.r1 = unsigned(aColor_sRGB.r() * 255.0); - aRes.g1 = unsigned(aColor_sRGB.g() * 255.0); - aRes.b1 = unsigned(aColor_sRGB.b() * 255.0); + aRes.r1 = static_cast(aColor_sRGB.r() * 255.0); + aRes.g1 = static_cast(aColor_sRGB.g() * 255.0); + aRes.b1 = static_cast(aColor_sRGB.b() * 255.0); theCol2.Values(aColor_sRGB.r(), aColor_sRGB.g(), aColor_sRGB.b(), Quantity_TOC_sRGB); - aRes.r2 = unsigned(aColor_sRGB.r() * 255.0); - aRes.g2 = unsigned(aColor_sRGB.g() * 255.0); - aRes.b2 = unsigned(aColor_sRGB.b() * 255.0); + aRes.r2 = static_cast(aColor_sRGB.r() * 255.0); + aRes.g2 = static_cast(aColor_sRGB.g() * 255.0); + aRes.b2 = static_cast(aColor_sRGB.b() * 255.0); return aRes; } @@ -41,14 +41,14 @@ Quantity_Color ExtractColor(MeshVS_TwoColors& theTwoColors, const int Index) double max = 255.0; if (Index == 1) - aRes.SetValues(double(theTwoColors.r1) / max, - double(theTwoColors.g1) / max, - double(theTwoColors.b1) / max, + aRes.SetValues(static_cast(theTwoColors.r1) / max, + static_cast(theTwoColors.g1) / max, + static_cast(theTwoColors.b1) / max, Quantity_TOC_sRGB); else if (Index == 2) - aRes.SetValues(double(theTwoColors.r2) / max, - double(theTwoColors.g2) / max, - double(theTwoColors.b2) / max, + aRes.SetValues(static_cast(theTwoColors.r2) / max, + static_cast(theTwoColors.g2) / max, + static_cast(theTwoColors.b2) / max, Quantity_TOC_sRGB); return aRes; @@ -59,12 +59,12 @@ Quantity_Color ExtractColor(MeshVS_TwoColors& theTwoColors, const int Index) void ExtractColors(MeshVS_TwoColors& theTwoColors, Quantity_Color& theCol1, Quantity_Color& theCol2) { double max = 255.0; - theCol1.SetValues(double(theTwoColors.r1) / max, - double(theTwoColors.g1) / max, - double(theTwoColors.b1) / max, + theCol1.SetValues(static_cast(theTwoColors.r1) / max, + static_cast(theTwoColors.g1) / max, + static_cast(theTwoColors.b1) / max, Quantity_TOC_sRGB); - theCol2.SetValues(double(theTwoColors.r2) / max, - double(theTwoColors.g2) / max, - double(theTwoColors.b2) / max, + theCol2.SetValues(static_cast(theTwoColors.r2) / max, + static_cast(theTwoColors.g2) / max, + static_cast(theTwoColors.b2) / max, Quantity_TOC_sRGB); } diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_VectorPrsBuilder.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_VectorPrsBuilder.cxx index 56acd2208fa..b946841aaef 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_VectorPrsBuilder.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_VectorPrsBuilder.cxx @@ -260,9 +260,9 @@ void MeshVS_VectorPrsBuilder::Build(const occ::handle& Prs, Y += aCoords(3 * i - 1); Z += aCoords(3 * i); } - X /= double(NbNodes); - Y /= double(NbNodes); - Z /= double(NbNodes); + X /= static_cast(NbNodes); + Y /= static_cast(NbNodes); + Z /= static_cast(NbNodes); } else { diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx index c772c69ab74..4b3244b0b29 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx @@ -185,7 +185,7 @@ void OpenGl_AspectsSprite::build(const occ::handle& theCt const OpenGl_PointSprite* aSprite = dynamic_cast(mySprite.get()); if (!aSprite->IsDisplayList()) { - theMarkerSize = float(std::max(aSprite->SizeX(), aSprite->SizeY())); + theMarkerSize = static_cast(std::max(aSprite->SizeX(), aSprite->SizeY())); } return; } @@ -213,7 +213,7 @@ void OpenGl_AspectsSprite::build(const occ::handle& theCt // reuse shared resource if (!aSprite->IsDisplayList()) { - theMarkerSize = float(std::max(aSprite->SizeX(), aSprite->SizeY())); + theMarkerSize = static_cast(std::max(aSprite->SizeX(), aSprite->SizeY())); } return; } @@ -252,7 +252,7 @@ void OpenGl_AspectsSprite::build(const occ::handle& theCt { // Creating texture resource for using it with point sprites occ::handle anImage = aNewMarkerImage->GetImage(); - theMarkerSize = std::max((float)anImage->Width(), (float)anImage->Height()); + theMarkerSize = std::max(static_cast(anImage->Width()), static_cast(anImage->Height())); if (!hadAlreadyRGBA) { @@ -288,21 +288,21 @@ void OpenGl_AspectsSprite::build(const occ::handle& theCt Image_PixMap::FlipY(*anImageCopy); anImage = anImageCopy; } - const GLint anAligment = std::min((GLint)anImage->MaxRowAligmentBytes(), 8); + const GLint anAligment = std::min(static_cast(anImage->MaxRowAligmentBytes()), 8); theCtx->core11fwd->glPixelStorei(GL_UNPACK_ALIGNMENT, anAligment); - const GLint anExtraBytes = GLint(anImage->RowExtraBytes()); - const GLint aPixelsWidth = GLint(anImage->SizeRowBytes() / anImage->SizePixelBytes()); + const GLint anExtraBytes = static_cast(anImage->RowExtraBytes()); + const GLint aPixelsWidth = static_cast(anImage->SizeRowBytes() / anImage->SizePixelBytes()); const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0; theCtx->core11fwd->glPixelStorei(GL_UNPACK_ROW_LENGTH, aRowLength); theCtx->core11ffp->glNewList(aBitmapList, GL_COMPILE); - const int aWidth = (int)anImage->Width(), aHeight = (int)anImage->Height(); + const int aWidth = static_cast(anImage->Width()), aHeight = static_cast(anImage->Height()); // clang-format off - theCtx->core11ffp->glBitmap (0, 0, 0, 0, GLfloat(-0.5f * aWidth), GLfloat(-0.5f * aHeight), nullptr); // make offsets that will be added to the current raster position + theCtx->core11ffp->glBitmap (0, 0, 0, 0, static_cast(-0.5f * aWidth), static_cast(-0.5f * aHeight), nullptr); // make offsets that will be added to the current raster position // clang-format on - theCtx->core11ffp->glDrawPixels(GLsizei(anImage->Width()), - GLsizei(anImage->Height()), + theCtx->core11ffp->glDrawPixels(static_cast(anImage->Width()), + static_cast(anImage->Height()), aFormat.PixelFormat(), aFormat.DataType(), anImage->Data()); @@ -324,13 +324,13 @@ void OpenGl_AspectsSprite::build(const occ::handle& theCt if (occ::handle> aBitMap = aNewMarkerImage->GetBitMapArray()) { theCtx->core11ffp->glNewList(aBitmapList, GL_COMPILE); - theCtx->core11ffp->glBitmap((GLsizei)aWidth, - (GLsizei)aHeight, - (GLfloat)(0.5f * aWidth), - (GLfloat)(0.5f * aHeight), + theCtx->core11ffp->glBitmap(static_cast(aWidth), + static_cast(aHeight), + static_cast(0.5f * aWidth), + static_cast(0.5f * aHeight), 0.f, 0.f, - (const GLubyte*)&aBitMap->First()); + static_cast(&aBitMap->First())); theCtx->core11ffp->glEndList(); } } @@ -358,14 +358,14 @@ void OpenGl_AspectsSprite::spriteKeys(const occ::handle& else if (theType != Aspect_TOM_POINT && theType != Aspect_TOM_EMPTY) { // predefined markers are defined with 0.5 step - const int aScale = int(theScale * 10.0f + 0.5f); + const int aScale = static_cast(theScale * 10.0f + 0.5f); theKey = TCollection_AsciiString("OpenGl_AspectMarker") + theType + "_" + aScale; theKeyA = theKey + "A"; if (theType == Aspect_TOM_BALL) { - unsigned int aColor[3] = {(unsigned int)(255.0f * theColor.r()), - (unsigned int)(255.0f * theColor.g()), - (unsigned int)(255.0f * theColor.b())}; + unsigned int aColor[3] = {static_cast(255.0f * theColor.r()), + static_cast(255.0f * theColor.g()), + static_cast(255.0f * theColor.b())}; char aBytes[8]; Sprintf(aBytes, "%02X%02X%02X", aColor[0], aColor[1], aColor[2]); theKey += aBytes; diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsTextureSet.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsTextureSet.cxx index 52851fbf2f3..51284da7297 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsTextureSet.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsTextureSet.cxx @@ -259,7 +259,7 @@ void OpenGl_AspectsTextureSet::build(const occ::handle& theC aPrevTextureUnit = aResIter0.Unit(); if (aTexUnit >= Graphic3d_TextureUnit_0 && aTexUnit <= Graphic3d_TextureUnit_5) { - aTextureSetBits |= (1 << int(aTexUnit)); + aTextureSetBits |= (1 << static_cast(aTexUnit)); } } } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_BackgroundArray.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_BackgroundArray.cxx index a1d5ad74748..02571777930 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_BackgroundArray.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_BackgroundArray.cxx @@ -75,10 +75,10 @@ void OpenGl_BackgroundArray::SetGradientParameters(const Quantity_Color& double anR, aG, aB; theColor1.Values(anR, aG, aB, Quantity_TOC_RGB); - myGradientParams.color1 = NCollection_Vec4((float)anR, (float)aG, (float)aB, 0.0f); + myGradientParams.color1 = NCollection_Vec4(static_cast(anR), static_cast(aG), static_cast(aB), 0.0f); theColor2.Values(anR, aG, aB, Quantity_TOC_RGB); - myGradientParams.color2 = NCollection_Vec4((float)anR, (float)aG, (float)aB, 0.0f); + myGradientParams.color2 = NCollection_Vec4(static_cast(anR), static_cast(aG), static_cast(aB), 0.0f); myGradientParams.type = theType; invalidateData(); @@ -202,9 +202,9 @@ bool OpenGl_BackgroundArray::createGradientArray(const occ::handle aVertices[4] = { - NCollection_Vec2(float(myViewWidth), 0.0f), - NCollection_Vec2(float(myViewWidth), float(myViewHeight)), - NCollection_Vec2(0.0f, float(myViewHeight)), + NCollection_Vec2(static_cast(myViewWidth), 0.0f), + NCollection_Vec2(static_cast(myViewWidth), static_cast(myViewHeight)), + NCollection_Vec2(0.0f, static_cast(myViewHeight)), NCollection_Vec2(0.0f, 0.0f)}; float* aCorners[4] = {}; @@ -287,14 +287,14 @@ bool OpenGl_BackgroundArray::createGradientArray(const occ::handle anEllipVerts[aSubdiv + 2]; anEllipVerts[0] = - NCollection_Vec2(float(myViewWidth) / 2.0f, float(myViewHeight) / 2.0f); + NCollection_Vec2(static_cast(myViewWidth) / 2.0f, static_cast(myViewHeight) / 2.0f); double aTetta = (M_PI * 2.0) / aSubdiv; double aParam = 0.0; for (int anIt = 1; anIt < aSubdiv + 2; ++anIt) { anEllipVerts[anIt] = NCollection_Vec2( - float(std::cos(aParam) * M_SQRT2 * myViewWidth / 2.0 + myViewWidth / 2.0f), - float(std::sin(aParam) * M_SQRT2 * myViewHeight / 2.0 + myViewHeight / 2.0f)); + static_cast(std::cos(aParam) * M_SQRT2 * myViewWidth / 2.0 + myViewWidth / 2.0f), + static_cast(std::sin(aParam) * M_SQRT2 * myViewHeight / 2.0 + myViewHeight / 2.0f)); aParam += aTetta; } @@ -366,8 +366,8 @@ bool OpenGl_BackgroundArray::createTextureArray( GLfloat aTexRangeY = 1.0f; // texture coordinate // Set up for stretching or tiling - GLfloat anOffsetX = 0.5f * (float)myViewWidth; - GLfloat anOffsetY = 0.5f * (float)myViewHeight; + GLfloat anOffsetX = 0.5f * static_cast(myViewWidth); + GLfloat anOffsetY = 0.5f * static_cast(myViewHeight); // Setting this coefficient to -1.0f allows to tile textures relatively to the top-left corner of // the view (value 1.0f corresponds to the initial behavior - tiling from the bottom-left corner) @@ -376,8 +376,8 @@ bool OpenGl_BackgroundArray::createTextureArray( // Get texture parameters const occ::handle& aCtx = theWorkspace->GetGlContext(); const OpenGl_Aspects* anAspectFace = theWorkspace->Aspects(); - GLfloat aTextureWidth = (GLfloat)anAspectFace->TextureSet(aCtx)->First()->SizeX(); - GLfloat aTextureHeight = (GLfloat)anAspectFace->TextureSet(aCtx)->First()->SizeY(); + GLfloat aTextureWidth = static_cast(anAspectFace->TextureSet(aCtx)->First()->SizeX()); + GLfloat aTextureHeight = static_cast(anAspectFace->TextureSet(aCtx)->First()->SizeY()); if (myFillMethod == Aspect_FM_CENTERED) { @@ -386,8 +386,8 @@ bool OpenGl_BackgroundArray::createTextureArray( } else if (myFillMethod == Aspect_FM_TILED) { - aTexRangeX = (GLfloat)myViewWidth / aTextureWidth; - aTexRangeY = (GLfloat)myViewHeight / aTextureHeight; + aTexRangeX = static_cast(myViewWidth) / aTextureWidth; + aTexRangeY = static_cast(myViewHeight) / aTextureHeight; } // NOTE: texture is mapped using GL_REPEAT wrapping mode so integer part @@ -559,8 +559,8 @@ void OpenGl_BackgroundArray::Render(const occ::handle& theWork aWorldView.SetColumn( 3, NCollection_Vec4( - -1.0f + (float)aViewSizeX / aTileSize.x() - 2.0f * aTileOffset.x() / aTileSize.x(), - -1.0f + (float)aViewSizeY / aTileSize.y() - 2.0f * aTileOffset.y() / aTileSize.y(), + -1.0f + static_cast(aViewSizeX) / aTileSize.x() - 2.0f * aTileOffset.x() / aTileSize.x(), + -1.0f + static_cast(aViewSizeY) / aTileSize.y() - 2.0f * aTileOffset.y() / aTileSize.y(), 0.0f, 1.0f)); } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.cxx index 706b1def8d1..a24c2358d9b 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.cxx @@ -180,8 +180,8 @@ void OpenGl_Buffer::BindBufferRange(const occ::handle& theGlCtx, theGlCtx->core30->glBindBufferRange(GetTarget(), theIndex, myBufferId, - (GLintptr)theOffset, - (GLsizeiptr)theSize); + static_cast(theOffset), + static_cast(theSize)); } //================================================================================================= @@ -243,7 +243,7 @@ bool OpenGl_Buffer::init(const occ::handle& theGlCtx, myComponentsNb = theComponentsNb; myElemsNb = theElemsNb; theGlCtx->core15fwd->glBufferData(GetTarget(), - GLsizeiptr(myElemsNb) * theStride, + static_cast(myElemsNb) * theStride, theData, GL_STATIC_DRAW); const int anErr = theGlCtx->core15fwd->glGetError(); @@ -256,8 +256,8 @@ bool OpenGl_Buffer::init(const occ::handle& theGlCtx, GL_DEBUG_SEVERITY_HIGH, TCollection_AsciiString("Error: glBufferData (") + FormatTarget(GetTarget()) + "," - + OpenGl_Context::FormatSize(GLsizeiptr(myElemsNb) * theStride) + "," - + OpenGl_Context::FormatPointer(theData) + ") Id: " + (int)myBufferId + + OpenGl_Context::FormatSize(static_cast(myElemsNb) * theStride) + "," + + OpenGl_Context::FormatPointer(theData) + ") Id: " + static_cast(myBufferId) + " failed with " + OpenGl_Context::FormatGlError(anErr)); } Unbind(theGlCtx); @@ -322,8 +322,8 @@ bool OpenGl_Buffer::subData(const occ::handle& theGlCtx, const size_t aDataSize = sizeOfGlType(theDataType); theGlCtx->core15fwd->glBufferSubData( GetTarget(), - GLintptr(theElemFrom) * GLintptr(myComponentsNb) * aDataSize, // offset in bytes - GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * aDataSize, // size in bytes + static_cast(theElemFrom) * static_cast(myComponentsNb) * aDataSize, // offset in bytes + static_cast(theElemsNb) * static_cast(myComponentsNb) * aDataSize, // size in bytes theData); const int anErr = theGlCtx->core15fwd->glGetError(); if (anErr != GL_NO_ERROR) @@ -334,11 +334,11 @@ bool OpenGl_Buffer::subData(const occ::handle& theGlCtx, 0, GL_DEBUG_SEVERITY_HIGH, TCollection_AsciiString("Error: glBufferSubData (") + FormatTarget(GetTarget()) + "," - + OpenGl_Context::FormatSize(GLintptr(theElemFrom) * GLintptr(myComponentsNb) * aDataSize) + + OpenGl_Context::FormatSize(static_cast(theElemFrom) * static_cast(myComponentsNb) * aDataSize) + "," - + OpenGl_Context::FormatSize(GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) + + OpenGl_Context::FormatSize(static_cast(theElemsNb) * static_cast(myComponentsNb) * aDataSize) - + "," + OpenGl_Context::FormatPointer(theData) + ") Id: " + (int)myBufferId + + "," + OpenGl_Context::FormatPointer(theData) + ") Id: " + static_cast(myBufferId) + " failed with " + OpenGl_Context::FormatGlError(anErr)); } Unbind(theGlCtx); @@ -401,8 +401,8 @@ bool OpenGl_Buffer::getSubData(const occ::handle& theGlCtx, Bind(theGlCtx); const size_t aDataSize = sizeOfGlType(theDataType); - const GLintptr anOffset = GLintptr(theElemFrom) * GLintptr(myComponentsNb) * aDataSize; - const GLsizeiptr aSize = GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * aDataSize; + const GLintptr anOffset = static_cast(theElemFrom) * static_cast(myComponentsNb) * aDataSize; + const GLsizeiptr aSize = static_cast(theElemsNb) * static_cast(myComponentsNb) * aDataSize; bool isDone = theGlCtx->GetBufferSubData(GetTarget(), anOffset, aSize, theData); isDone = isDone && (theGlCtx->core15fwd->glGetError() == GL_NO_ERROR); Unbind(theGlCtx); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.hxx index a19586e526c..b08886760f4 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.hxx @@ -233,7 +233,7 @@ public: //! @name advanced methods theElemsNb, theData, theDataType, - int(theComponentsNb) * int(sizeOfGlType(theDataType))); + static_cast(theComponentsNb) * static_cast(sizeOfGlType(theDataType))); } //! Update part of the buffer with new data. diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx index 358c9db356b..1b1210fdf0f 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx @@ -111,7 +111,7 @@ bool OpenGl_BufferCompatT::Create(const occ::handle { if (BaseBufferT::myBufferId == OpenGl_Buffer::NO_BUFFER) { - BaseBufferT::myBufferId = (unsigned int)-1; // dummy identifier... + BaseBufferT::myBufferId = static_cast(-1); // dummy identifier... myData = new NCollection_Buffer(Graphic3d_Buffer::DefaultAllocator()); } return BaseBufferT::myBufferId != OpenGl_Buffer::NO_BUFFER; @@ -148,7 +148,7 @@ bool OpenGl_BufferCompatT::initLink(const occ::handle(-1); // dummy identifier... } myData = theData; BaseBufferT::myDataType = theDataType; @@ -213,8 +213,8 @@ bool OpenGl_BufferCompatT::subData(const occ::handle(theElemFrom) * size_t(BaseBufferT::myComponentsNb) * aDataSize; + const size_t aNbBytes = static_cast(theElemsNb) * size_t(BaseBufferT::myComponentsNb) * aDataSize; memcpy(myData->ChangeData() + anOffset, theData, aNbBytes); return true; } @@ -235,8 +235,8 @@ bool OpenGl_BufferCompatT::getSubData(const occ::handle(theElemFrom) * size_t(BaseBufferT::myComponentsNb) * aDataSize; + const size_t aNbBytes = static_cast(theElemsNb) * size_t(BaseBufferT::myComponentsNb) * aDataSize; memcpy(theData, myData->Data() + anOffset, aNbBytes); return true; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_CappingAlgo.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_CappingAlgo.cxx index 47ed09a7686..85f5b8e4e66 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_CappingAlgo.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_CappingAlgo.cxx @@ -93,7 +93,7 @@ static void renderCappingForStructure(StencilTestSentry& th { const int aPrevFilter = theWorkspace->RenderFilter(); const int anAnyFilter = - aPrevFilter & ~(int)(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); + aPrevFilter & ~(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); const occ::handle& aContext = theWorkspace->GetGlContext(); const occ::handle& aRenderPlane = thePlane->Plane(); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_CappingPlaneResource.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_CappingPlaneResource.cxx index df466610113..aae73303394 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_CappingPlaneResource.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_CappingPlaneResource.cxx @@ -53,8 +53,8 @@ OpenGl_CappingPlaneResource::OpenGl_CappingPlaneResource( myOrientation(NCollection_Mat4::Identity()), myAspect(nullptr), myPlaneRoot(thePlane), - myEquationMod((unsigned int)-1), - myAspectMod((unsigned int)-1) + myEquationMod(static_cast(-1)), + myAspectMod(static_cast(-1)) { occ::handle anAttribs = new Graphic3d_Buffer(Graphic3d_Buffer::DefaultAllocator()); @@ -90,8 +90,8 @@ void OpenGl_CappingPlaneResource::Release(OpenGl_Context* theContext) { OpenGl_Element::Destroy(theContext, myAspect); myPrimitives.Release(theContext); - myEquationMod = (unsigned int)-1; - myAspectMod = (unsigned int)-1; + myEquationMod = static_cast(-1); + myAspectMod = static_cast(-1); } //================================================================================================= @@ -170,7 +170,7 @@ void OpenGl_CappingPlaneResource::updateTransform(const occ::handle T(anEq.xyz() * -anEqW); // project plane normal onto OX to find left vector - const float aProjLen = sqrt((float)anEq.xz().SquareModulus()); + const float aProjLen = sqrt(static_cast(anEq.xz().SquareModulus())); NCollection_Vec3 aLeft; if (aProjLen < ShortRealSmall()) { diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.cxx index 529a8d41f7b..197bebecea5 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.cxx @@ -405,10 +405,10 @@ void OpenGl_Context::ResizeViewport(const int* theRect) myViewport[3] = theRect[3]; if (HasRenderScale()) { - myViewportVirt[0] = int(theRect[0] * myRenderScaleInv); - myViewportVirt[1] = int(theRect[1] * myRenderScaleInv); - myViewportVirt[2] = int(theRect[2] * myRenderScaleInv); - myViewportVirt[3] = int(theRect[3] * myRenderScaleInv); + myViewportVirt[0] = static_cast(theRect[0] * myRenderScaleInv); + myViewportVirt[1] = static_cast(theRect[1] * myRenderScaleInv); + myViewportVirt[2] = static_cast(theRect[2] * myRenderScaleInv); + myViewportVirt[3] = static_cast(theRect[3] * myRenderScaleInv); } else { @@ -503,7 +503,7 @@ void OpenGl_Context::SetDrawBuffers(const int theNb, const int* theDrawBuffers) arbFBO->glBindFramebuffer(GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER); } - myFuncs->glDrawBuffers(theNb, (const GLenum*)theDrawBuffers); + myFuncs->glDrawBuffers(theNb, reinterpret_cast(theDrawBuffers)); } //================================================================================================= @@ -643,9 +643,9 @@ bool OpenGl_Context::IsCurrent() const return false; } - return (((Display*)myDisplay == glXGetCurrentDisplay()) - && ((GLXContext)myGContext == glXGetCurrentContext()) - && ((GLXDrawable)myWindow == glXGetCurrentDrawable())); + return ((static_cast(myDisplay) == glXGetCurrentDisplay()) + && (static_cast(myGContext) == glXGetCurrentContext()) + && (static_cast(myWindow) == glXGetCurrentDrawable())); #else return false; #endif @@ -728,7 +728,7 @@ bool OpenGl_Context::MakeCurrent() return false; } - if (!glXMakeCurrent((Display*)myDisplay, (GLXDrawable)myWindow, (GLXContext)myGContext)) + if (!glXMakeCurrent(static_cast(myDisplay), static_cast(myWindow), static_cast(myGContext))) { // if there is no current context it might be impossible to use glGetError() correctly PushMessage(GL_DEBUG_SOURCE_WINDOW_SYSTEM, @@ -766,9 +766,9 @@ void OpenGl_Context::SwapBuffers() core11fwd->glFlush(); } #elif defined(HAVE_XLIB) - if ((Display*)myDisplay != nullptr) + if (static_cast(myDisplay) != nullptr) { - glXSwapBuffers((Display*)myDisplay, (GLXDrawable)myWindow); + glXSwapBuffers(static_cast(myDisplay), static_cast(myWindow)); } #else // @@ -804,8 +804,8 @@ bool OpenGl_Context::SetSwapInterval(const int theInterval) { typedef int ( *glXSwapIntervalEXT_t_x)(Display* theDisplay, GLXDrawable theDrawable, int theInterval); - glXSwapIntervalEXT_t_x aFuncPtr = (glXSwapIntervalEXT_t_x)myFuncs->glXSwapIntervalEXT; - aFuncPtr((Display*)myDisplay, (GLXDrawable)myWindow, theInterval); + glXSwapIntervalEXT_t_x aFuncPtr = reinterpret_cast(myFuncs->glXSwapIntervalEXT); + aFuncPtr(static_cast(myDisplay), static_cast(myWindow), theInterval); return true; } else if (myFuncs->glXSwapIntervalSGI != nullptr) @@ -828,7 +828,7 @@ void* OpenGl_Context::findProc(const char* theFuncName) #elif defined(_WIN32) return (void*)wglGetProcAddress(theFuncName); #elif defined(HAVE_XLIB) - return (void*)glXGetProcAddress((const GLubyte*)theFuncName); + return reinterpret_cast(glXGetProcAddress(reinterpret_cast(theFuncName))); #elif defined(__APPLE__) return (myGlLibHandle != NULL) ? dlsym(myGlLibHandle, theFuncName) : NULL; #else @@ -863,7 +863,7 @@ bool OpenGl_Context::CheckExtension(const char* theExtName) const const size_t anExtNameLen = strlen(theExtName); for (GLint anIter = 0; anIter < anExtNb; ++anIter) { - const char* anExtension = (const char*)myFuncs->glGetStringi(GL_EXTENSIONS, (GLuint)anIter); + const char* anExtension = reinterpret_cast(myFuncs->glGetStringi(GL_EXTENSIONS, static_cast(anIter))); const size_t aTestExtNameLen = strlen(anExtension); if (aTestExtNameLen == anExtNameLen && strncmp(anExtension, theExtName, anExtNameLen) == 0) { @@ -874,7 +874,7 @@ bool OpenGl_Context::CheckExtension(const char* theExtName) const } // use old way with huge string for all extensions - const char* anExtString = (const char*)core11fwd->glGetString(GL_EXTENSIONS); + const char* anExtString = reinterpret_cast(core11fwd->glGetString(GL_EXTENSIONS)); if (anExtString == nullptr) { Messenger()->Send("TKOpenGL: glGetString (GL_EXTENSIONS) has returned NULL! No GL context?", @@ -914,7 +914,7 @@ bool OpenGl_Context::CheckExtension(const char* theExtString, const char* theExt // Search for theExtName in the extensions string. // Use of strstr() is not sufficient because extension names can be prefixes of other extension // names. - char* aPtrIter = (char*)theExtString; + char* aPtrIter = const_cast(theExtString); const char* aPtrEnd = aPtrIter + strlen(theExtString); const size_t anExtNameLen = strlen(theExtName); while (aPtrIter < aPtrEnd) @@ -950,7 +950,7 @@ bool OpenGl_Context::Init(const bool theIsCoreProfile) #elif defined(HAVE_XLIB) myDisplay = (Aspect_Display)glXGetCurrentDisplay(); myGContext = (Aspect_RenderingContext)glXGetCurrentContext(); - myWindow = (Aspect_Drawable)glXGetCurrentDrawable(); + myWindow = static_cast(glXGetCurrentDrawable()); #else // #endif @@ -994,7 +994,7 @@ TCollection_AsciiString OpenGl_Context::FormatGlEnumHex(int theGlEnum) { char aBuff[16]; Sprintf(aBuff, - theGlEnum < (int)std::numeric_limits::max() ? "0x%04X" : "0x%08X", + theGlEnum < static_cast(std::numeric_limits::max()) ? "0x%04X" : "0x%08X", theGlEnum); return aBuff; } @@ -1004,7 +1004,7 @@ TCollection_AsciiString OpenGl_Context::FormatGlEnumHex(int theGlEnum) TCollection_AsciiString OpenGl_Context::FormatSize(size_t theSize) { char aBuff[32]; - Sprintf(aBuff, "%" PRIu64, (uint64_t)theSize); + Sprintf(aBuff, "%" PRIu64, static_cast(theSize)); return aBuff; } @@ -1147,7 +1147,7 @@ void OpenGl_Context::PushMessage(const unsigned int theSource, aMsg += " | Type: "; aMsg += aType; aMsg += " | ID: "; - aMsg += (int)theId; + aMsg += static_cast(theId); aMsg += " | Severity: "; aMsg += aSev; aMsg += " | Message:\n "; @@ -1302,9 +1302,9 @@ void OpenGl_Context::init(const bool theIsCoreProfile) caps->ffpEnable = true; TCollection_ExtendedString aMsg = TCollection_ExtendedString("OpenGL driver is too old! Context info:\n") - + " Vendor: " + (const char*)core11fwd->glGetString(GL_VENDOR) + "\n" - + " Renderer: " + (const char*)core11fwd->glGetString(GL_RENDERER) + "\n" - + " Version: " + (const char*)core11fwd->glGetString(GL_VERSION) + "\n" + + " Vendor: " + reinterpret_cast(core11fwd->glGetString(GL_VENDOR)) + "\n" + + " Renderer: " + reinterpret_cast(core11fwd->glGetString(GL_RENDERER)) + "\n" + + " Version: " + reinterpret_cast(core11fwd->glGetString(GL_VERSION)) + "\n" + " Fallback using deprecated fixed-function pipeline.\n" + " Visualization might work incorrectly.\n" " Consider upgrading the graphics driver."; @@ -1315,7 +1315,7 @@ void OpenGl_Context::init(const bool theIsCoreProfile) aMsg); } - myVendor = (const char*)core11fwd->glGetString(GL_VENDOR); + myVendor = reinterpret_cast(core11fwd->glGetString(GL_VENDOR)); myVendor.LowerCase(); if (myVendor.Search("nvidia") != -1) { @@ -1669,14 +1669,14 @@ size_t OpenGl_Context::AvailableMemory() const core11fwd->glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, aMemInfo); // returned value is in KiB, however this maybe changed in future - return size_t(aMemInfo[0]) * 1024; + return static_cast(aMemInfo[0]) * 1024; } else if (nvxMem) { // current available dedicated video memory (in KiB), currently unused GPU memory GLint aMemInfo = 0; core11fwd->glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &aMemInfo); - return size_t(aMemInfo) * 1024; + return static_cast(aMemInfo) * 1024; } return 0; } @@ -1826,7 +1826,7 @@ void OpenGl_Context::MemoryInfo( unsigned int aVMemMiB = 0; if (myFuncs->glXQueryCurrentRendererIntegerMESA(GLX_RENDERER_VIDEO_MEMORY_MESA, &aVMemMiB) != 0) { - addInfo(theDict, "GPU memory", TCollection_AsciiString() + int(aVMemMiB) + " MiB"); + addInfo(theDict, "GPU memory", TCollection_AsciiString() + static_cast(aVMemMiB) + " MiB"); } } #endif @@ -1863,9 +1863,9 @@ void OpenGl_Context::WindowBufferBits(NCollection_Vec4& theColorBits, aFormat.cAlphaBits); theDepthStencilBits.SetValues(aFormat.cDepthBits, aFormat.cStencilBits); #elif defined(HAVE_XLIB) - Display* aDisplay = (Display*)myDisplay; + Display* aDisplay = static_cast(myDisplay); XWindowAttributes aWinAttribs; - XGetWindowAttributes(aDisplay, (::Window)myWindow, &aWinAttribs); + XGetWindowAttributes(aDisplay, static_cast<::Window>(myWindow), &aWinAttribs); XVisualInfo aVisInfo; aVisInfo.visualid = aWinAttribs.visual->visualid; aVisInfo.screen = DefaultScreen(aDisplay); @@ -1910,11 +1910,11 @@ void OpenGl_Context::DiagnosticInformation( addInfo(theDict, "WGLExtensions", aWglExts); } #elif defined(HAVE_XLIB) - Display* aDisplay = (Display*)myDisplay; + Display* aDisplay = static_cast(myDisplay); const int aScreen = DefaultScreen(aDisplay); addInfo(theDict, "GLXDirectRendering", - ::glXIsDirect(aDisplay, (GLXContext)myGContext) ? "Yes" : "No"); + ::glXIsDirect(aDisplay, static_cast(myGContext)) ? "Yes" : "No"); addInfo(theDict, "GLXVendor", ::glXQueryServerString(aDisplay, aScreen, GLX_VENDOR)); addInfo(theDict, "GLXVersion", ::glXQueryServerString(aDisplay, aScreen, GLX_VERSION)); if ((theFlags & Graphic3d_DiagnosticInfo_Extensions) != 0) @@ -1938,8 +1938,8 @@ void OpenGl_Context::DiagnosticInformation( { int aDriverVer[2] = {}; OpenGl_GlFunctions::readGlVersion(aDriverVer[0], aDriverVer[1]); - addInfo(theDict, "GLvendor", (const char*)core11fwd->glGetString(GL_VENDOR)); - addInfo(theDict, "GLdevice", (const char*)core11fwd->glGetString(GL_RENDERER)); + addInfo(theDict, "GLvendor", reinterpret_cast(core11fwd->glGetString(GL_VENDOR))); + addInfo(theDict, "GLdevice", reinterpret_cast(core11fwd->glGetString(GL_RENDERER))); #ifdef __EMSCRIPTEN__ if (CheckExtension("GL_WEBGL_debug_renderer_info")) { @@ -1954,7 +1954,7 @@ void OpenGl_Context::DiagnosticInformation( } #endif - addInfo(theDict, "GLversion", (const char*)core11fwd->glGetString(GL_VERSION)); + addInfo(theDict, "GLversion", reinterpret_cast(core11fwd->glGetString(GL_VERSION))); if (myGlVerMajor != aDriverVer[0] || myGlVerMinor != aDriverVer[1]) { addInfo(theDict, @@ -1965,7 +1965,7 @@ void OpenGl_Context::DiagnosticInformation( { addInfo(theDict, "GLSLversion", - (const char*)core11fwd->glGetString(GL_SHADING_LANGUAGE_VERSION)); + reinterpret_cast(core11fwd->glGetString(GL_SHADING_LANGUAGE_VERSION))); } if (myIsGlDebugCtx) { @@ -2013,7 +2013,7 @@ void OpenGl_Context::DiagnosticInformation( core11fwd->glGetIntegerv(GL_NUM_EXTENSIONS, &anExtNb); for (GLint anIter = 0; anIter < anExtNb; ++anIter) { - const char* anExtension = (const char*)myFuncs->glGetStringi(GL_EXTENSIONS, (GLuint)anIter); + const char* anExtension = reinterpret_cast(myFuncs->glGetStringi(GL_EXTENSIONS, static_cast(anIter))); if (!anExtList.IsEmpty()) { anExtList += " "; @@ -2024,7 +2024,7 @@ void OpenGl_Context::DiagnosticInformation( } else { - addInfo(theDict, "GLextensions", (const char*)core11fwd->glGetString(GL_EXTENSIONS)); + addInfo(theDict, "GLextensions", reinterpret_cast(core11fwd->glGetString(GL_EXTENSIONS))); } } } @@ -2140,7 +2140,7 @@ occ::handle OpenGl_Context::BindTextures( myTextureRgbaBlack = new OpenGl_Texture(); myTextureRgbaWhite = new OpenGl_Texture(); Image_PixMap anImage; - anImage.InitZero(Image_Format_RGBA, 2, 2, 0, (uint8_t)0); + anImage.InitZero(Image_Format_RGBA, 2, 2, 0, static_cast(0)); if (!myTextureRgbaBlack->Init(this, OpenGl_TextureFormat::Create(), NCollection_Vec2(2, 2), @@ -2153,7 +2153,7 @@ occ::handle OpenGl_Context::BindTextures( GL_DEBUG_SEVERITY_HIGH, "Error: unable to create unit mock PBR texture map."); } - anImage.InitZero(Image_Format_RGBA, 2, 2, 0, (uint8_t)255); + anImage.InitZero(Image_Format_RGBA, 2, 2, 0, static_cast(255)); if (!myTextureRgbaWhite->Init(this, OpenGl_TextureFormat::Create(), NCollection_Vec2(2, 2), @@ -2465,14 +2465,14 @@ void OpenGl_Context::SetLineStipple(const float theFactor, const uint16_t thePat { if (hasGlslBitwiseOps != OpenGl_FeatureNotAvailable) { - myActiveProgram->SetUniform(this, aPatternLoc, (int)thePattern); + myActiveProgram->SetUniform(this, aPatternLoc, static_cast(thePattern)); } else { int aPatArr[16] = {}; for (unsigned int aBit = 0; aBit < 16; ++aBit) { - aPatArr[aBit] = ((unsigned int)(thePattern) & (1U << aBit)) != 0 ? 1 : 0; + aPatArr[aBit] = (static_cast(thePattern) & (1U << aBit)) != 0 ? 1 : 0; } myActiveProgram->SetUniform(this, aPatternLoc, 16, aPatArr); } @@ -2673,7 +2673,7 @@ int OpenGl_Context::SetPolygonMode(const int theMode) myPolygonMode = theMode; if (myGapi != Aspect_GraphicsLibrary_OpenGLES) { - core11fwd->glPolygonMode(GL_FRONT_AND_BACK, (GLenum)theMode); + core11fwd->glPolygonMode(GL_FRONT_AND_BACK, static_cast(theMode)); } return anOldPolygonMode; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.hxx index 4da36f3835e..bf3fdf36519 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.hxx @@ -957,7 +957,7 @@ public: //! @name methods to alter or retrieve current state //! Note that this method rounds @theRatio to nearest integer. void SetResolution(unsigned int theResolution, float theRatio, float theScale) { - myResolution = (unsigned int)(theScale * theResolution + 0.5f); + myResolution = static_cast(theScale * theResolution + 0.5f); myRenderScale = theScale; myRenderScaleInv = 1.0f / theScale; SetResolutionRatio(theRatio * theScale); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Flipper.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Flipper.cxx index e765b9be0fa..03f61f8d35c 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Flipper.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Flipper.cxx @@ -24,21 +24,21 @@ //================================================================================================= OpenGl_Flipper::OpenGl_Flipper(const gp_Ax2& theReferenceSystem) - : myReferenceOrigin((float)theReferenceSystem.Location().X(), - (float)theReferenceSystem.Location().Y(), - (float)theReferenceSystem.Location().Z(), + : myReferenceOrigin(static_cast(theReferenceSystem.Location().X()), + static_cast(theReferenceSystem.Location().Y()), + static_cast(theReferenceSystem.Location().Z()), 1.0f), - myReferenceX((float)theReferenceSystem.XDirection().X(), - (float)theReferenceSystem.XDirection().Y(), - (float)theReferenceSystem.XDirection().Z(), + myReferenceX(static_cast(theReferenceSystem.XDirection().X()), + static_cast(theReferenceSystem.XDirection().Y()), + static_cast(theReferenceSystem.XDirection().Z()), 1.0f), - myReferenceY((float)theReferenceSystem.YDirection().X(), - (float)theReferenceSystem.YDirection().Y(), - (float)theReferenceSystem.YDirection().Z(), + myReferenceY(static_cast(theReferenceSystem.YDirection().X()), + static_cast(theReferenceSystem.YDirection().Y()), + static_cast(theReferenceSystem.YDirection().Z()), 1.0f), - myReferenceZ((float)theReferenceSystem.Axis().Direction().X(), - (float)theReferenceSystem.Axis().Direction().Y(), - (float)theReferenceSystem.Axis().Direction().Z(), + myReferenceZ(static_cast(theReferenceSystem.Axis().Direction().X()), + static_cast(theReferenceSystem.Axis().Direction().Y()), + static_cast(theReferenceSystem.Axis().Direction().Z()), 1.0f), myIsEnabled(true) { diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Font.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Font.cxx index 40964d46548..bd3c034026f 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Font.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Font.cxx @@ -124,7 +124,7 @@ bool OpenGl_Font::createTexture(const occ::handle& theCtx) const int aTextureSizeX = OpenGl_Context::GetPowerOfTwo(aGlyphsNb * aMaxTileSizeX, aMaxSize); const int aTilesPerRow = aTextureSizeX / aMaxTileSizeX; const int aTextureSizeY = - OpenGl_Context::GetPowerOfTwo(GLint((aGlyphsNb / aTilesPerRow) + 1) * myTileSizeY, aMaxSize); + OpenGl_Context::GetPowerOfTwo(static_cast((aGlyphsNb / aTilesPerRow) + 1) * myTileSizeY, aMaxSize); memset(&myLastTilePx, 0, sizeof(myLastTilePx)); myLastTilePx.Bottom = myTileSizeY; @@ -139,7 +139,7 @@ bool OpenGl_Font::createTexture(const occ::handle& theCtx) occ::handle& aTexture = myTextures.ChangeLast(); Image_PixMap aBlackImg; - if (!aBlackImg.InitZero(Image_Format_Alpha, size_t(aTextureSizeX), size_t(aTextureSizeY)) + if (!aBlackImg.InitZero(Image_Format_Alpha, static_cast(aTextureSizeX), static_cast(aTextureSizeY)) || !aTexture->Init(theCtx, aBlackImg, Graphic3d_TypeOfTexture_2D, true)) // myTextureFormat { theCtx->PushMessage(GL_DEBUG_SOURCE_APPLICATION, @@ -172,13 +172,13 @@ bool OpenGl_Font::renderGlyph(const occ::handle& theCtx, const c const Image_PixMap& anImg = myFont->GlyphImage(); const int aTileId = myLastTileId + 1; myLastTilePx.Left = myLastTilePx.Right + 3; - myLastTilePx.Right = myLastTilePx.Left + (int)anImg.SizeX(); - if (myLastTilePx.Right > aTexture->SizeX() || (int)anImg.SizeY() > myTileSizeY) + myLastTilePx.Right = myLastTilePx.Left + static_cast(anImg.SizeX()); + if (myLastTilePx.Right > aTexture->SizeX() || static_cast(anImg.SizeY()) > myTileSizeY) { myTileSizeY = myFont->GlyphMaxSizeY(true); myLastTilePx.Left = 0; - myLastTilePx.Right = (int)anImg.SizeX(); + myLastTilePx.Right = static_cast(anImg.SizeX()); myLastTilePx.Top += myTileSizeY; myLastTilePx.Bottom += myTileSizeY; @@ -207,17 +207,17 @@ bool OpenGl_Font::renderGlyph(const occ::handle& theCtx, const c 0, myLastTilePx.Left, myLastTilePx.Top, - (GLsizei)anImg.SizeX(), - (GLsizei)anImg.SizeY(), + static_cast(anImg.SizeX()), + static_cast(anImg.SizeY()), aTexture->GetFormat(), GL_UNSIGNED_BYTE, anImg.Data()); OpenGl_Font::Tile aTile; - aTile.uv.Left = GLfloat(myLastTilePx.Left) / GLfloat(aTexture->SizeX()); - aTile.uv.Right = GLfloat(myLastTilePx.Right) / GLfloat(aTexture->SizeX()); - aTile.uv.Top = GLfloat(myLastTilePx.Top) / GLfloat(aTexture->SizeY()); - aTile.uv.Bottom = GLfloat(myLastTilePx.Top + anImg.SizeY()) / GLfloat(aTexture->SizeY()); + aTile.uv.Left = static_cast(myLastTilePx.Left) / static_cast(aTexture->SizeX()); + aTile.uv.Right = static_cast(myLastTilePx.Right) / static_cast(aTexture->SizeX()); + aTile.uv.Top = static_cast(myLastTilePx.Top) / static_cast(aTexture->SizeY()); + aTile.uv.Bottom = static_cast(myLastTilePx.Top + anImg.SizeY()) / static_cast(aTexture->SizeY()); aTile.texture = aTexture->TextureId(); myFont->GlyphRect(aTile.px); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx index 06b7dca88ef..42d84d575ee 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx @@ -832,9 +832,9 @@ bool OpenGl_FrameBuffer::InitWrapper(const occ::handle& theGlCtx // clean up previous state Release(theGlCtx.operator->()); - GLint anFbo = GLint(NO_FRAMEBUFFER); + GLint anFbo = static_cast(NO_FRAMEBUFFER); theGlCtx->core11fwd->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &anFbo); - if (anFbo == GLint(NO_FRAMEBUFFER)) + if (anFbo == static_cast(NO_FRAMEBUFFER)) { return false; } @@ -852,7 +852,7 @@ bool OpenGl_FrameBuffer::InitWrapper(const occ::handle& theGlCtx GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &aDepthType); - myGlFBufferId = GLuint(anFbo); + myGlFBufferId = static_cast(anFbo); myIsOwnColor = false; myIsOwnBuffer = false; myIsOwnDepth = false; @@ -1224,13 +1224,13 @@ bool OpenGl_FrameBuffer::BufferDump(const occ::handle& theGl // setup alignment // clang-format off - const GLint anAligment = std::min(GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL + const GLint anAligment = std::min(static_cast(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL // clang-format on theGlCtx->core11fwd->glPixelStorei(GL_PACK_ALIGNMENT, anAligment); bool isBatchCopy = !theImage.IsTopDown(); - const GLint anExtraBytes = GLint(theImage.RowExtraBytes()); - GLint aPixelsWidth = GLint(theImage.SizeRowBytes() / theImage.SizePixelBytes()); + const GLint anExtraBytes = static_cast(theImage.RowExtraBytes()); + GLint aPixelsWidth = static_cast(theImage.SizeRowBytes() / theImage.SizePixelBytes()); size_t aSizeRowBytesEstim = getAligned(theImage.SizePixelBytes() * aPixelsWidth, anAligment); if (anExtraBytes < anAligment) { @@ -1264,22 +1264,22 @@ bool OpenGl_FrameBuffer::BufferDump(const occ::handle& theGl // Image_PixMap rows indexation always starts from the upper corner // while order in memory depends on the flag and processed by ChangeRow() method theGlCtx->core11fwd->glReadPixels(0, - GLint(theImage.SizeY() - aRow - 1), - GLsizei(theImage.SizeX()), + static_cast(theImage.SizeY() - aRow - 1), + static_cast(theImage.SizeX()), 1, aFormat, aType, aRowBuffer.ChangeData()); - const Image_ColorRGBA* aRowDataRgba = (const Image_ColorRGBA*)aRowBuffer.Data(); + const Image_ColorRGBA* aRowDataRgba = reinterpret_cast(aRowBuffer.Data()); if (theImage.Format() == Image_Format_BGR) { - convertRowFromRgba((Image_ColorBGR*)theImage.ChangeRow(aRow), + convertRowFromRgba(reinterpret_cast(theImage.ChangeRow(aRow)), aRowDataRgba, theImage.SizeX()); } else { - convertRowFromRgba((Image_ColorRGB*)theImage.ChangeRow(aRow), + convertRowFromRgba(reinterpret_cast(theImage.ChangeRow(aRow)), aRowDataRgba, theImage.SizeX()); } @@ -1293,8 +1293,8 @@ bool OpenGl_FrameBuffer::BufferDump(const occ::handle& theGl // Image_PixMap rows indexation always starts from the upper corner // while order in memory depends on the flag and processed by ChangeRow() method theGlCtx->core11fwd->glReadPixels(0, - GLint(theImage.SizeY() - aRow - 1), - GLsizei(theImage.SizeX()), + static_cast(theImage.SizeY() - aRow - 1), + static_cast(theImage.SizeX()), 1, aFormat, aType, @@ -1305,8 +1305,8 @@ bool OpenGl_FrameBuffer::BufferDump(const occ::handle& theGl { theGlCtx->core11fwd->glReadPixels(0, 0, - GLsizei(theImage.SizeX()), - GLsizei(theImage.SizeY()), + static_cast(theImage.SizeX()), + static_cast(theImage.SizeY()), aFormat, aType, theImage.ChangeData()); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx index c4d08f8c4f1..c5e1b6cbe31 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx @@ -36,7 +36,7 @@ static TCollection_AsciiString formatTimeMs(double theSeconds) const double aFpsVal = theSeconds != 0.0 ? 1.0 / theSeconds : 0.0; char aFps[50]; Sprintf(aFps, "%.1f", aFpsVal); - return TCollection_AsciiString() + int(theSeconds * 1000.0) + " ms (" + aFps + " FPS)"; + return TCollection_AsciiString() + static_cast(theSeconds * 1000.0) + " ms (" + aFps + " FPS)"; } } // namespace @@ -85,7 +85,7 @@ void OpenGl_FrameStatsPrs::Update(const occ::handle& theWorksp myTextAspect.SetAspect(aRendParams.StatsTextAspect); // adjust text alignment depending on corner - Graphic3d_Text aParams((float)aRendParams.StatsTextHeight); + Graphic3d_Text aParams(static_cast(aRendParams.StatsTextHeight)); aParams.SetHorizontalAlignment(Graphic3d_HTA_CENTER); aParams.SetVerticalAlignment(Graphic3d_VTA_CENTER); if (!myCountersTrsfPers.IsNull() && (myCountersTrsfPers->Corner2d() & Aspect_TOTP_LEFT) != 0) @@ -194,10 +194,10 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle& theW } if (aCharSize.y() <= 0) { - aCharSize.y() = int(0.15 * aViewSize.y()); + aCharSize.y() = static_cast(0.15 * aViewSize.y()); } - const NCollection_Vec2 aBinSize(double(aCharSize.x()) / double(aNbBins), + const NCollection_Vec2 aBinSize(static_cast(aCharSize.x()) / static_cast(aNbBins), 0.15 * aViewSize.y()); NCollection_Vec2 anOffset; if (!myChartTrsfPers.IsNull() && myChartTrsfPers->IsTrihedronOr2d()) @@ -253,7 +253,7 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle& theW aTimeElapsed += aFrame.TimerValue(aTimers[aTimerIter]); } - const double aBinX1 = anOffset.x() + double(aFrameIter) * aBinSize.x(); + const double aBinX1 = anOffset.x() + static_cast(aFrameIter) * aBinSize.x(); const double aBinX2 = aBinX1 + aBinSize.x(); const double aCurrSizeY = std::min(aTimeElapsed / aMaxDuration, 1.2) * aBinSize.y(); const double aBinY1 = @@ -300,26 +300,26 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle& theW myChartIndices->Init(aCtx, 1, myChartArray->Indices()->NbElements, - (const GLushort*)myChartArray->Indices()->Data()); + reinterpret_cast(myChartArray->Indices()->Data())); } else if (myChartArray->Indices()->Stride == 4) { myChartIndices->Init(aCtx, 1, myChartArray->Indices()->NbElements, - (const GLuint*)myChartArray->Indices()->Data()); + reinterpret_cast(myChartArray->Indices()->Data())); } { const NCollection_Vec4 aWhite(255, 255, 255, 255); const OpenGl_Vec3Vec4ub aLines[4] = { - {NCollection_Vec3((float)anOffset.x(), (float)anOffset.y(), 0.0f), aWhite}, - {NCollection_Vec3(float(anOffset.x() + aCharSize.x()), (float)anOffset.y(), 0.0f), + {NCollection_Vec3(static_cast(anOffset.x()), static_cast(anOffset.y()), 0.0f), aWhite}, + {NCollection_Vec3(static_cast(anOffset.x() + aCharSize.x()), static_cast(anOffset.y()), 0.0f), aWhite}, - {NCollection_Vec3((float)anOffset.x(), float(anOffset.y() - aBinSize.y()), 0.0f), + {NCollection_Vec3(static_cast(anOffset.x()), static_cast(anOffset.y() - aBinSize.y()), 0.0f), aWhite}, - {NCollection_Vec3(float(anOffset.x() + aCharSize.x()), - float(anOffset.y() - aBinSize.y()), + {NCollection_Vec3(static_cast(anOffset.x() + aCharSize.x()), + static_cast(anOffset.y() - aBinSize.y()), +0.0f), aWhite}, }; @@ -332,7 +332,7 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle& theW } { - Graphic3d_Text aParams((float)aRendParams.StatsTextHeight); + Graphic3d_Text aParams(static_cast(aRendParams.StatsTextHeight)); aParams.SetHorizontalAlignment((!myChartTrsfPers.IsNull() && myChartTrsfPers->IsTrihedronOr2d() && (myChartTrsfPers->Corner2d() & Aspect_TOTP_RIGHT) != 0) ? Graphic3d_HTA_RIGHT @@ -343,18 +343,18 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle& theW formatTimeMs(aMaxDuration)}; const float aLabX = aParams.HorizontalAlignment() == Graphic3d_HTA_RIGHT - ? float(anOffset.x()) - : float(anOffset.x() + aCharSize.x()); + ? static_cast(anOffset.x()) + : static_cast(anOffset.x() + aCharSize.x()); myChartLabels[0].Text()->SetText(aLabels[isTopDown ? 0 : 2].ToCString()); - myChartLabels[0].Text()->SetPosition(gp_Pnt(aLabX, float(anOffset.y()), 0.0f)); + myChartLabels[0].Text()->SetPosition(gp_Pnt(aLabX, static_cast(anOffset.y()), 0.0f)); myChartLabels[1].Text()->SetText(aLabels[isTopDown ? 1 : 1].ToCString()); myChartLabels[1].Text()->SetPosition( - gp_Pnt(aLabX, float(anOffset.y() - aBinSize.y() / 2), 0.0f)); + gp_Pnt(aLabX, static_cast(anOffset.y() - aBinSize.y() / 2), 0.0f)); myChartLabels[2].Text()->SetText(aLabels[isTopDown ? 2 : 0].ToCString()); - myChartLabels[2].Text()->SetPosition(gp_Pnt(aLabX, float(anOffset.y() - aBinSize.y()), 0.0f)); + myChartLabels[2].Text()->SetPosition(gp_Pnt(aLabX, static_cast(anOffset.y() - aBinSize.y()), 0.0f)); for (int i = 0; i < 3; i++) { diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx index dd351f4ffe3..993e8a50695 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx @@ -1687,7 +1687,7 @@ void OpenGl_GlFunctions::readGlVersion(int& theGlVerMajor, int& theGlVerMinor) // Following trash (after space) is vendor-specific. // New drivers also returns micro version of GL like '3.3.0' which has no meaning // and should be considered as vendor-specific too. - const char* aVerStr = (const char*)::glGetString(GL_VERSION); + const char* aVerStr = reinterpret_cast(::glGetString(GL_VERSION)); if (aVerStr == nullptr || *aVerStr == '\0') { // invalid GL context @@ -2356,7 +2356,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile) } } #elif defined(HAVE_XLIB) - const char* aGlxExts = ::glXQueryExtensionsString((Display*)theCtx.myDisplay, + const char* aGlxExts = ::glXQueryExtensionsString(static_cast(theCtx.myDisplay), DefaultScreen((Display*)theCtx.myDisplay)); if (checkExtensionShort(aGlxExts, "GLX_EXT_swap_control")) { @@ -2476,7 +2476,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile) && FindProcShort(glVertexAttrib4usv) && FindProcShort(glVertexAttribPointer); if (has20) { - const char* aGlslVer = (const char*)::glGetString(GL_SHADING_LANGUAGE_VERSION); + const char* aGlslVer = reinterpret_cast(::glGetString(GL_SHADING_LANGUAGE_VERSION)); if (aGlslVer == nullptr || *aGlslVer == '\0') { // broken context has been detected diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraduatedTrihedron.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraduatedTrihedron.cxx index 5f054f5e850..bac59e7ac87 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraduatedTrihedron.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraduatedTrihedron.cxx @@ -122,8 +122,8 @@ float OpenGl_GraduatedTrihedron::getNormal(const occ::handle& th aProjMatrix.Convert(theContext->ProjectionState.Current()); NCollection_Vec3 aPoint1, aPoint2, aPoint3; - Graphic3d_TransformUtils::UnProject((float)aViewport[0], - (float)aViewport[1], + Graphic3d_TransformUtils::UnProject(static_cast(aViewport[0]), + static_cast(aViewport[1]), 0.0f, aModelMatrix, aProjMatrix, @@ -132,8 +132,8 @@ float OpenGl_GraduatedTrihedron::getNormal(const occ::handle& th aPoint1.y(), aPoint1.z()); - Graphic3d_TransformUtils::UnProject((float)(aViewport[0] + aViewport[2]), - (float)aViewport[1], + Graphic3d_TransformUtils::UnProject(static_cast(aViewport[0] + aViewport[2]), + static_cast(aViewport[1]), 0.0f, aModelMatrix, aProjMatrix, @@ -142,8 +142,8 @@ float OpenGl_GraduatedTrihedron::getNormal(const occ::handle& th aPoint2.y(), aPoint2.z()); - Graphic3d_TransformUtils::UnProject((float)aViewport[0], - (float)(aViewport[1] + aViewport[3]), + Graphic3d_TransformUtils::UnProject(static_cast(aViewport[0]), + static_cast(aViewport[1] + aViewport[3]), 0.0f, aModelMatrix, aProjMatrix, @@ -157,7 +157,7 @@ float OpenGl_GraduatedTrihedron::getNormal(const occ::handle& th theNormal = NCollection_Vec3::Cross(aD1, aD2); // Distance corresponding to 1 pixel - return aD2.Modulus() / (float)aViewport[2]; + return aD2.Modulus() / static_cast(aViewport[2]); } //================================================================================================= @@ -385,7 +385,7 @@ void OpenGl_GraduatedTrihedron::renderAxis(const occ::handle& Graphic3d_TransformPers aTransMode( Graphic3d_TMF_ZoomPers, - gp_Pnt(double(anArrowVec.x()), double(anArrowVec.y()), double(anArrowVec.z()))); + gp_Pnt(static_cast(anArrowVec.x()), static_cast(anArrowVec.y()), static_cast(anArrowVec.z()))); const NCollection_Mat4& aProjection = aContext->ProjectionState.Current(); const NCollection_Mat4& aWorldView = aContext->WorldViewState.Current(); const int aWidth = theWorkspace->Width(); @@ -477,7 +477,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels( NCollection_Mat4 aModelMat(theMat); - anAxis.InitTickmark(aContext, aDir * (float)aCurAspect.TickmarksLength() * theDpix); + anAxis.InitTickmark(aContext, aDir * static_cast(aCurAspect.TickmarksLength()) * theDpix); Graphic3d_TransformUtils::Translate(aModelMat, theGridAxes.Ticks[theIndex].x(), theGridAxes.Ticks[theIndex].y(), @@ -504,7 +504,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels( NCollection_Vec3 aMiddle(theGridAxes.Ticks[theIndex] + aSizeVec * theGridAxes.Axes[theIndex] * 0.5f - + aDir * (float)(theDpix * anOffset)); + + aDir * static_cast(theDpix * anOffset)); myAspectLabels.Aspect()->SetColor(anAxis.NameColor); theWorkspace->SetAspects(&myAspectLabels); @@ -522,8 +522,8 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels( { Sprintf(aTextValue, "%g", theGridAxes.Ticks[theIndex].GetData()[theIndex] + anIt * aStep); NCollection_Vec3 aPos(theGridAxes.Ticks[theIndex] - + anAxis.Direction * (float)(anIt * aStep) - + aDir * (float)(theDpix * anOffset)); + + anAxis.Direction * (anIt * aStep) + + aDir * static_cast(theDpix * anOffset)); occ::handle aText = myLabelValues.Text(); aText->SetText(aTextValue); @@ -708,7 +708,7 @@ OpenGl_GraduatedTrihedron::Axis::Axis(const Graphic3d_GraduatedTrihedron::AxisAs Arrow(nullptr) { occ::handle aText = new Graphic3d_Text(THE_LABEL_HEIGHT); - aText->SetText((char16_t*)theAspect.Name().ToExtString()); + aText->SetText(const_cast(theAspect.Name().ToExtString())); aText->SetPosition(gp_Pnt(theDirection.x(), theDirection.y(), theDirection.z())); aText->SetHorizontalAlignment(THE_LABEL_HALIGH); aText->SetVerticalAlignment(THE_LABEL_VALIGH); @@ -759,7 +759,7 @@ void OpenGl_GraduatedTrihedron::Axis::InitArrow(const occ::handle aRadial = NCollection_Vec3::Cross(this->Direction, theNormal); - if (aRadial.Modulus() < (float)Precision::Confusion()) + if (aRadial.Modulus() < static_cast(Precision::Confusion())) { return; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx index ead51c23cb6..c9332da53d0 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx @@ -203,7 +203,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver(const occ::handleGetDisplayAspect(); + Display* aDisplay = reinterpret_cast(myDisplayConnection->GetDisplayAspect()); Bool toSync = ::getenv("CSF_GraphicSync") != nullptr || ::getenv("CALL_SYNCHRO_X") != nullptr; XSynchronize(aDisplay, toSync); #endif @@ -446,7 +446,7 @@ void OpenGl_GraphicDriver::chooseVisualInfo() } #if defined(HAVE_XLIB) - Display* aDisp = (Display*)myDisplayConnection->GetDisplayAspect(); + Display* aDisp = reinterpret_cast(myDisplayConnection->GetDisplayAspect()); XVisualInfo* aVisInfo = nullptr; Aspect_FBConfig anFBConfig = nullptr; @@ -507,7 +507,7 @@ void OpenGl_GraphicDriver::chooseVisualInfo() #endif if (aVisInfo != nullptr) { - myDisplayConnection->SetDefaultVisualInfo((Aspect_XVisualInfo*)aVisInfo, anFBConfig); + myDisplayConnection->SetDefaultVisualInfo(reinterpret_cast(aVisInfo), anFBConfig); } else { diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Group.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Group.hxx index bac71fe3f35..2a10285804d 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Group.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Group.hxx @@ -90,7 +90,7 @@ public: public: OpenGl_Structure* GlStruct() const { - return (OpenGl_Structure*)(myStructure->CStructure().operator->()); + return reinterpret_cast(myStructure->CStructure().operator->()); } Standard_EXPORT void AddElement(OpenGl_Element* theElem); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_HaltonSampler.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_HaltonSampler.hxx index 788a285837a..7ad9795742d 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_HaltonSampler.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_HaltonSampler.hxx @@ -102,14 +102,14 @@ private: { return (myPerm3[theIndex % 243u] * 14348907u + myPerm3[(theIndex / 243u) % 243u] * 59049u + myPerm3[(theIndex / 59049u) % 243u] * 243u + myPerm3[(theIndex / 14348907u) % 243u]) - * float(0.999999999999999 / 3486784401u); // Results in [0,1). + * static_cast(0.999999999999999 / 3486784401u); // Results in [0,1). } float halton5(unsigned theIndex) const { return (myPerm5[theIndex % 125u] * 1953125u + myPerm5[(theIndex / 125u) % 125u] * 15625u + myPerm5[(theIndex / 15625u) % 125u] * 125u + myPerm5[(theIndex / 1953125u) % 125u]) - * float(0.999999999999999 / 244140625u); // Results in [0,1). + * static_cast(0.999999999999999 / 244140625u); // Results in [0,1). } private: diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_LayerList.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_LayerList.cxx index 69bba2cf5e2..5daa92b20ce 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_LayerList.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_LayerList.cxx @@ -672,7 +672,7 @@ void OpenGl_LayerList::renderLayer(const occ::handle& theWorks ++aPriorityIter) { const NCollection_IndexedMap& aStructures = - theLayer.Structures((Graphic3d_DisplayPriority)aPriorityIter); + theLayer.Structures(static_cast(aPriorityIter)); for (OpenGl_Structure::StructIterator aStructIter(aStructures); aStructIter.More(); aStructIter.Next()) { @@ -752,7 +752,7 @@ void OpenGl_LayerList::Render(const occ::handle& theWorkspace, // fragmentation during regular rendering. const int aPrevFilter = theWorkspace->RenderFilter() - & ~(int)(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); + & ~(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); theWorkspace->SetRenderFilter(aPrevFilter | OpenGl_RenderFilter_OpaqueOnly); myTransparentToProcess.Clear(); @@ -925,7 +925,7 @@ void OpenGl_LayerList::renderTransparent(const occ::handle& th const int aPrevFilter = theWorkspace->RenderFilter() - & ~(int)(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); + & ~(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); theWorkspace->SetRenderFilter(aPrevFilter | OpenGl_RenderFilter_TransparentOnly); aCtx->core11fwd->glEnable(GL_BLEND); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_LineAttributes.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_LineAttributes.cxx index 3575559171a..40ddddff4e4 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_LineAttributes.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_LineAttributes.cxx @@ -42,7 +42,7 @@ void OpenGl_LineAttributes::Release(OpenGl_Context* theGlCtx) anIter.More(); anIter.Next()) { - theGlCtx->core11ffp->glDeleteLists((GLuint)anIter.Value(), 1); + theGlCtx->core11ffp->glDeleteLists(static_cast(anIter.Value()), 1); } } myStyles.Clear(); @@ -54,8 +54,8 @@ unsigned int OpenGl_LineAttributes::init(const OpenGl_Context* const occ::handle& theStyle) { const unsigned int aListId = theGlCtx->core11ffp->glGenLists(1); - theGlCtx->core11ffp->glNewList((GLuint)aListId, GL_COMPILE); - theGlCtx->core11ffp->glPolygonStipple((const GLubyte*)theStyle->Pattern()); + theGlCtx->core11ffp->glNewList(static_cast(aListId), GL_COMPILE); + theGlCtx->core11ffp->glPolygonStipple(static_cast(theStyle->Pattern())); theGlCtx->core11ffp->glEndList(); return aListId; } @@ -78,6 +78,6 @@ bool OpenGl_LineAttributes::SetTypeOfHatch(const OpenGl_Context* myStyles.Bind(theStyle, aGpuListId); } - theGlCtx->core11ffp->glCallList((GLuint)aGpuListId); + theGlCtx->core11ffp->glCallList(static_cast(aGpuListId)); return true; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx index c1be68e036b..a94259cf9c8 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx @@ -299,7 +299,7 @@ bool OpenGl_PBREnvironment::initTextures(const occ::handle& theC if (!myIBLMaps[OpenGl_TypeOfIBLMap_Specular].InitCubeMap(theCtx, occ::handle(), - size_t(1) << myPow2Size, + static_cast(1) << myPow2Size, Image_Format_RGB, true, false)) @@ -371,7 +371,7 @@ bool OpenGl_PBREnvironment::processDiffIBLMap(const occ::handle& aProg->SetSampler(theCtx, "uEnvMap", theCtx->PBRSpecIBLMapTexUnit()); aProg->SetUniform(theCtx, "uZCoeff", theDrawParams->IsZInverted ? -1 : 1); aProg->SetUniform(theCtx, "uYCoeff", theDrawParams->IsTopDown ? 1 : -1); - aProg->SetUniform(theCtx, "uSamplesNum", int(theDrawParams->NbDiffSamples)); + aProg->SetUniform(theCtx, "uSamplesNum", static_cast(theDrawParams->NbDiffSamples)); myVBO.BindAttribute(theCtx, Graphic3d_TOA_POS); theCtx->core11fwd->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); @@ -476,11 +476,11 @@ bool OpenGl_PBREnvironment::processSpecIBLMap(const occ::handle& const occ::handle& aProg = theCtx->ActiveProgram(); const float aSolidAngleSource = - float(4.0 * M_PI / (6.0 * float(theDrawParams->EnvMapSize * theDrawParams->EnvMapSize))); + static_cast(4.0 * M_PI / (6.0 * static_cast(theDrawParams->EnvMapSize * theDrawParams->EnvMapSize))); aProg->SetSampler(theCtx, "uEnvMap", theCtx->PBRSpecIBLMapTexUnit()); aProg->SetUniform(theCtx, "uZCoeff", theDrawParams->IsZInverted ? -1 : 1); aProg->SetUniform(theCtx, "uYCoeff", theDrawParams->IsTopDown ? 1 : -1); - aProg->SetUniform(theCtx, "occNbSpecIBLLevels", int(mySpecMapLevelsNumber)); + aProg->SetUniform(theCtx, "occNbSpecIBLLevels", static_cast(mySpecMapLevelsNumber)); aProg->SetUniform(theCtx, "uEnvSolidAngleSource", aSolidAngleSource); myVBO.BindAttribute(theCtx, Graphic3d_TOA_POS); } @@ -502,9 +502,9 @@ bool OpenGl_PBREnvironment::processSpecIBLMap(const occ::handle& theCtx->ResizeViewport(aViewport); if (theDrawParams != nullptr) { - const int aNbSamples = int(Graphic3d_PBRMaterial::SpecIBLMapSamplesFactor( + const int aNbSamples = static_cast(Graphic3d_PBRMaterial::SpecIBLMapSamplesFactor( theDrawParams->Probability, - aLevelIter / float(mySpecMapLevelsNumber - 1)) + aLevelIter / static_cast(mySpecMapLevelsNumber - 1)) * theDrawParams->NbSpecSamples); theCtx->ActiveProgram()->SetUniform(theCtx, "uSamplesNum", aNbSamples); theCtx->ActiveProgram()->SetUniform(theCtx, "uCurrentLevel", aLevelIter); @@ -535,8 +535,8 @@ bool OpenGl_PBREnvironment::processSpecIBLMap(const occ::handle& anIntFormat, 0, 0, - (GLsizei)aSize, - (GLsizei)aSize, + static_cast(aSize), + static_cast(aSize), 0); myIBLMaps[OpenGl_TypeOfIBLMap_Specular].Unbind(theCtx, Graphic3d_TextureUnit_1); const GLenum anErr = theCtx->core11fwd->glGetError(); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx index f7fcf154890..4f094b5ecb3 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx @@ -573,7 +573,7 @@ void OpenGl_PrimitiveArray::drawEdges(const occ::handle& theWo aGlContext->SetColor4fv(theWorkspace->EdgeColor().a() >= 0.1f ? theWorkspace->EdgeColor() : theWorkspace->View()->BackgroundColor()); - aGlContext->SetLineStipple((float)anAspect->Aspect()->LineStippleFactor(), + aGlContext->SetLineStipple(static_cast(anAspect->Aspect()->LineStippleFactor()), anAspect->Aspect()->LinePattern()); aGlContext->SetLineWidth(anAspect->Aspect()->EdgeWidth()); @@ -1039,7 +1039,7 @@ void OpenGl_PrimitiveArray::Render(const occ::handle& theWorks { if (myDrawMode == GL_LINES || myDrawMode == GL_LINE_STRIP) { - aCtx->SetLineStipple((float)anAspectFace->Aspect()->LineStippleFactor(), + aCtx->SetLineStipple(static_cast(anAspectFace->Aspect()->LineStippleFactor()), anAspectFace->Aspect()->LinePattern()); aCtx->SetLineWidth(anAspectFace->Aspect()->LineWidth()); } @@ -1061,9 +1061,9 @@ void OpenGl_PrimitiveArray::Render(const occ::handle& theWorks const NCollection_Vec2 aViewSize(aCtx->Viewport()[2], aCtx->Viewport()[3]); const int aMin = aViewSize.minComp(); const GLfloat anEdgeWidth = - (GLfloat)anAspectFace->Aspect()->EdgeWidth() * aCtx->LineWidthScale() / (GLfloat)aMin; + static_cast(anAspectFace->Aspect()->EdgeWidth()) * aCtx->LineWidthScale() / static_cast(aMin); const GLfloat anOrthoScale = - aCtx->Camera()->IsOrthographic() ? (GLfloat)aCtx->Camera()->Scale() : -1.0f; + aCtx->Camera()->IsOrthographic() ? static_cast(aCtx->Camera()->Scale()) : -1.0f; const occ::handle& anOutlineProgram = aCtx->ActiveProgram(); anOutlineProgram->SetUniform( diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_SceneGeometry.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_SceneGeometry.cxx index 22874d48c09..87400bd8a72 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_SceneGeometry.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_SceneGeometry.cxx @@ -391,7 +391,7 @@ bool OpenGl_RaytraceGeometry::AcquireTextures(const occ::handle& { // need to recreate texture sampler handle // clang-format off - aHandle = GLuint64(-1); // specs do not define value for invalid handle, set -1 to initialize something + aHandle = static_cast(-1); // specs do not define value for invalid handle, set -1 to initialize something // clang-format on if (!aTexture->InitSamplerObject(theContext)) { @@ -514,7 +514,7 @@ bool OpenGl_RaytraceGeometry::UpdateTextureHandles(const occ::handle(-1); // specs do not define value for invalid handle, set -1 to initialize something // clang-format on const occ::handle& aTexture = aTexSrcIter.Value(); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx index 4cb5834a839..b3d0f65438a 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx @@ -110,7 +110,7 @@ static void bindLight(const Graphic3d_CLight& theLight, theLight.Concentration() * 128.0f); theCtx->core11ffp->glLightf(theLightGlId, GL_SPOT_CUTOFF, - (theLight.Angle() * 180.0f) / GLfloat(M_PI)); + (theLight.Angle() * 180.0f) / static_cast(M_PI)); theCtx->core11ffp->glLightf(theLightGlId, GL_CONSTANT_ATTENUATION, theLight.ConstAttenuation()); @@ -590,7 +590,7 @@ void OpenGl_ShaderManager::pushLightSourceState( if (myLightSourceState.HasShadowMaps()) { aSizeBias.SetValues(1.0f - / (float)myLightSourceState.ShadowMaps()->First()->Texture()->SizeX(), + / static_cast(myLightSourceState.ShadowMaps()->First()->Texture()->SizeX()), myLightSourceState.ShadowMaps()->First()->ShadowMapBias()); const int aNbShadows = std::min(theProgram->NbShadowMaps(), myLightSourceState.ShadowMaps()->Size()); @@ -1027,7 +1027,7 @@ void OpenGl_ShaderManager::pushOitState(const occ::handle& if (const OpenGl_ShaderUniformLocation& aLocOutput = theProgram->GetStateLocation(OpenGl_OCCT_OIT_OUTPUT)) { - theProgram->SetUniform(myContext, aLocOutput, (GLint)myOitState.ActiveMode()); + theProgram->SetUniform(myContext, aLocOutput, static_cast(myOitState.ActiveMode())); } if (const OpenGl_ShaderUniformLocation& aLocDepthFactor = theProgram->GetStateLocation(OpenGl_OCCT_OIT_DEPTH_FACTOR)) @@ -1103,10 +1103,10 @@ void OpenGl_ShaderManager::PushState(const occ::handle& th { theProgram->SetUniform(myContext, aLocViewPort, - NCollection_Vec4((float)myContext->Viewport()[0], - (float)myContext->Viewport()[1], - (float)myContext->Viewport()[2], - (float)myContext->Viewport()[3])); + NCollection_Vec4(static_cast(myContext->Viewport()[0]), + static_cast(myContext->Viewport()[1]), + static_cast(myContext->Viewport()[2]), + static_cast(myContext->Viewport()[3]))); } } else if (myContext->core11ffp != nullptr) @@ -1317,7 +1317,7 @@ bool OpenGl_ShaderManager::prepareStdProgramPhong(occ::handle= Graphic3d_StereoMode_NB) + if (theStereoMode < 0 || static_cast(theStereoMode) >= Graphic3d_StereoMode_NB) { return false; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.hxx index 06403ff05d7..b2852c0de01 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.hxx @@ -769,13 +769,13 @@ protected: { myClipChainArray.SetValue(thePlaneId, theChainFwd); NCollection_Vec4& aPlaneEq = myClipPlaneArray.ChangeValue(thePlaneId); - aPlaneEq.x() = float(theEq.x()); - aPlaneEq.y() = float(theEq.y()); - aPlaneEq.z() = float(theEq.z()); - aPlaneEq.w() = float(theEq.w()); + aPlaneEq.x() = static_cast(theEq.x()); + aPlaneEq.y() = static_cast(theEq.y()); + aPlaneEq.z() = static_cast(theEq.z()); + aPlaneEq.w() = static_cast(theEq.w()); if (myHasLocalOrigin) { - aPlaneEq.w() = float(LocalClippingPlaneW(thePlane)); + aPlaneEq.w() = static_cast(LocalClippingPlaneW(thePlane)); } ++thePlaneId; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderObject.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderObject.cxx index 670f0d394bb..e4887168a73 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderObject.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderObject.cxx @@ -223,7 +223,7 @@ bool OpenGl_ShaderObject::FetchInfoLog(const occ::handle& theCtx theCtx->core20fwd->glGetShaderiv(myShaderID, GL_INFO_LOG_LENGTH, &aLength); if (aLength > 0) { - GLchar* aLog = (GLchar*)alloca(aLength); + GLchar* aLog = static_cast(alloca(aLength)); memset(aLog, 0, aLength); theCtx->core20fwd->glGetShaderInfoLog(myShaderID, aLength, nullptr, aLog); theLog = aLog; @@ -348,7 +348,7 @@ static bool restoreShaderSource(TCollection_AsciiString& theSource, return false; } - const int aSize = (int)aFile.Size(); + const int aSize = static_cast(aFile.Size()); if (aSize > 0) { theSource = TCollection_AsciiString(aSize, '\0'); @@ -399,7 +399,7 @@ bool OpenGl_ShaderObject::updateDebugDump(const occ::handle& the theCtx->core20fwd->glGetShaderSource(myShaderID, aLength, nullptr, - (GLchar*)aSource.ToCString()); + const_cast(aSource.ToCString())); dumpShaderSource(aFileName, aSource, theToBeautify); isDumped = true; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx index f15a9c146b7..2b06ed990e5 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx @@ -607,63 +607,63 @@ bool OpenGl_ShaderProgram::Initialize( if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occActiveSampler")) { - SetUniform(theCtx, aLocSampler, GLint(Graphic3d_TextureUnit_0)); + SetUniform(theCtx, aLocSampler, static_cast(Graphic3d_TextureUnit_0)); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occSamplerBaseColor")) { myTextureSetBits |= Graphic3d_TextureSetBits_BaseColor; - SetUniform(theCtx, aLocSampler, GLint(Graphic3d_TextureUnit_BaseColor)); + SetUniform(theCtx, aLocSampler, static_cast(Graphic3d_TextureUnit_BaseColor)); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occSamplerPointSprite")) { // Graphic3d_TextureUnit_PointSprite // myTextureSetBits |= Graphic3d_TextureSetBits_PointSprite; - SetUniform(theCtx, aLocSampler, GLint(theCtx->SpriteTextureUnit())); + SetUniform(theCtx, aLocSampler, static_cast(theCtx->SpriteTextureUnit())); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occSamplerMetallicRoughness")) { myTextureSetBits |= Graphic3d_TextureSetBits_MetallicRoughness; - SetUniform(theCtx, aLocSampler, GLint(Graphic3d_TextureUnit_MetallicRoughness)); + SetUniform(theCtx, aLocSampler, static_cast(Graphic3d_TextureUnit_MetallicRoughness)); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occSamplerEmissive")) { myTextureSetBits |= Graphic3d_TextureSetBits_Emissive; - SetUniform(theCtx, aLocSampler, GLint(Graphic3d_TextureUnit_Emissive)); + SetUniform(theCtx, aLocSampler, static_cast(Graphic3d_TextureUnit_Emissive)); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occSamplerOcclusion")) { myTextureSetBits |= Graphic3d_TextureSetBits_Occlusion; - SetUniform(theCtx, aLocSampler, GLint(Graphic3d_TextureUnit_Occlusion)); + SetUniform(theCtx, aLocSampler, static_cast(Graphic3d_TextureUnit_Occlusion)); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occSamplerNormal")) { myTextureSetBits |= Graphic3d_TextureSetBits_Normal; - SetUniform(theCtx, aLocSampler, GLint(Graphic3d_TextureUnit_Normal)); + SetUniform(theCtx, aLocSampler, static_cast(Graphic3d_TextureUnit_Normal)); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occDiffIBLMapSHCoeffs")) { - SetUniform(theCtx, aLocSampler, GLint(theCtx->PBRDiffIBLMapSHTexUnit())); + SetUniform(theCtx, aLocSampler, static_cast(theCtx->PBRDiffIBLMapSHTexUnit())); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occSpecIBLMap")) { - SetUniform(theCtx, aLocSampler, GLint(theCtx->PBRSpecIBLMapTexUnit())); + SetUniform(theCtx, aLocSampler, static_cast(theCtx->PBRSpecIBLMapTexUnit())); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occEnvLUT")) { - SetUniform(theCtx, aLocSampler, GLint(theCtx->PBREnvLUTTexUnit())); + SetUniform(theCtx, aLocSampler, static_cast(theCtx->PBREnvLUTTexUnit())); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occShadowMapSamplers")) { std::vector aShadowSamplers(myNbShadowMaps); - const GLint aSamplFrom = GLint(theCtx->ShadowMapTexUnit()) - myNbShadowMaps + 1; + const GLint aSamplFrom = static_cast(theCtx->ShadowMapTexUnit()) - myNbShadowMaps + 1; for (int aSamplerIter = 0; aSamplerIter < myNbShadowMaps; ++aSamplerIter) { aShadowSamplers[aSamplerIter] = aSamplFrom + aSamplerIter; @@ -674,12 +674,12 @@ bool OpenGl_ShaderProgram::Initialize( if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occDepthPeelingDepth")) { - SetUniform(theCtx, aLocSampler, GLint(theCtx->DepthPeelingDepthTexUnit())); + SetUniform(theCtx, aLocSampler, static_cast(theCtx->DepthPeelingDepthTexUnit())); } if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation(theCtx, "occDepthPeelingFrontColor")) { - SetUniform(theCtx, aLocSampler, GLint(theCtx->DepthPeelingFrontColorTexUnit())); + SetUniform(theCtx, aLocSampler, static_cast(theCtx->DepthPeelingFrontColorTexUnit())); } const TCollection_AsciiString aSamplerNamePrefix("occSampler"); @@ -852,7 +852,7 @@ bool OpenGl_ShaderProgram::FetchInfoLog(const occ::handle& theCt theCtx->core20fwd->glGetProgramiv(myProgramID, GL_INFO_LOG_LENGTH, &aLength); if (aLength > 0) { - GLchar* aLog = (GLchar*)alloca(aLength); + GLchar* aLog = static_cast(alloca(aLength)); memset(aLog, 0, aLength); theCtx->core20fwd->glGetProgramInfoLog(myProgramID, aLength, nullptr, aLog); theOutput = aLog; diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Structure.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Structure.cxx index e9ba3bdf1b2..78aaa6a499e 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Structure.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Structure.cxx @@ -49,11 +49,11 @@ void OpenGl_Structure::renderBoundingBox(const occ::handle& th aCtx->ActiveProgram()->SetUniform( aCtx, "occBBoxCenter", - NCollection_Vec3((float)aCenter.x(), (float)aCenter.y(), (float)aCenter.z())); + NCollection_Vec3(static_cast(aCenter.x()), static_cast(aCenter.y()), static_cast(aCenter.z()))); aCtx->ActiveProgram()->SetUniform( aCtx, "occBBoxSize", - NCollection_Vec3((float)aSize.x(), (float)aSize.y(), (float)aSize.z())); + NCollection_Vec3(static_cast(aSize.x()), static_cast(aSize.y()), static_cast(aSize.z()))); aCtx->SetColor4fv(theWorkspace->InteriorColor()); const occ::handle& aBoundBoxVertBuffer = @@ -66,8 +66,8 @@ void OpenGl_Structure::renderBoundingBox(const occ::handle& th { const NCollection_Vec3 aMind = myBndBox.CornerMin() + aMoveVec; const NCollection_Vec3 aMaxd = myBndBox.CornerMax() + aMoveVec; - const NCollection_Vec3 aMin((float)aMind.x(), (float)aMind.y(), (float)aMind.z()); - const NCollection_Vec3 aMax((float)aMaxd.x(), (float)aMaxd.y(), (float)aMaxd.z()); + const NCollection_Vec3 aMin(static_cast(aMind.x()), static_cast(aMind.y()), static_cast(aMind.z())); + const NCollection_Vec3 aMax(static_cast(aMaxd.x()), static_cast(aMaxd.y()), static_cast(aMaxd.z())); const NCollection_Vec3 aVerts[16] = { NCollection_Vec3(aMin.x(), aMin.y(), aMin.z()), NCollection_Vec3(aMin.x(), aMin.y(), aMax.z()), @@ -678,9 +678,9 @@ void OpenGl_Structure::applyPersistence(const occ::handle& NCollection_Mat4& aModelWorld = theCtx->ModelWorldState.ChangeCurrent(); gp_Pnt aStartPnt = theTrsfPers->AnchorPoint(); NCollection_Vec4 anAnchorPoint = aModelWorld - * NCollection_Vec4((float)aStartPnt.X(), - (float)aStartPnt.Y(), - (float)aStartPnt.Z(), + * NCollection_Vec4(static_cast(aStartPnt.X()), + static_cast(aStartPnt.Y()), + static_cast(aStartPnt.Z()), 1.0f); // clang-format off aModelWorld.SetColumn (3, NCollection_Vec4 (NCollection_Vec3 (0.0), 1.0)); // reset translation part diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Text.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Text.cxx index 2e48ec45592..59175268ade 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Text.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Text.cxx @@ -101,7 +101,7 @@ void OpenGl_Text::SetFontSize(const occ::handle& theCtx, const i { Release(theCtx.operator->()); } - myText->SetHeight((float)theFontSize); + myText->SetHeight(static_cast(theFontSize)); } //================================================================================================= @@ -239,9 +239,9 @@ void OpenGl_Text::StringSize(const occ::handle& theCtx, theAscent = 0.0f; theDescent = 0.0f; const TCollection_AsciiString aFontKey = - FontKey(theTextAspect, (int)theHeight, theResolution, theFontHinting); + FontKey(theTextAspect, static_cast(theHeight), theResolution, theFontHinting); occ::handle aFont = - FindFont(theCtx, theTextAspect, (int)theHeight, theResolution, theFontHinting, aFontKey); + FindFont(theCtx, theTextAspect, static_cast(theHeight), theResolution, theFontHinting, aFontKey); if (aFont.IsNull() || !aFont->IsValid()) { return; @@ -517,7 +517,7 @@ void OpenGl_Text::drawText(const occ::handle& theCtx, aVerts->BindAttribute(theCtx, Graphic3d_TOA_POS); aTCrds->BindAttribute(theCtx, Graphic3d_TOA_UV); - theCtx->core11fwd->glDrawArrays(GL_TRIANGLES, 0, GLsizei(aVerts->GetElemsNb())); + theCtx->core11fwd->glDrawArrays(GL_TRIANGLES, 0, static_cast(aVerts->GetElemsNb())); aTCrds->UnbindAttribute(theCtx, Graphic3d_TOA_UV); aVerts->UnbindAttribute(theCtx, Graphic3d_TOA_POS); @@ -540,7 +540,7 @@ TCollection_AsciiString OpenGl_Text::FontKey(const OpenGl_Aspects& theAspect, : THE_DEFAULT_FONT; char aSuff[64]; - Sprintf(aSuff, ":%d:%d:%d:%d", int(anAspect), int(theResolution), theHeight, int(theFontHinting)); + Sprintf(aSuff, ":%d:%d:%d:%d", static_cast(anAspect), static_cast(theResolution), theHeight, static_cast(theFontHinting)); return aFont + aSuff; } @@ -669,7 +669,7 @@ void OpenGl_Text::render(const occ::handle& theCtx, // Note that using difference resolution in different Views in same Viewer // will lead to performance regression (for example, text will be recreated every time). const TCollection_AsciiString aFontKey = - FontKey(theTextAspect, (int)myText->Height(), theResolution, theFontHinting); + FontKey(theTextAspect, static_cast(myText->Height()), theResolution, theFontHinting); if (!myFont.IsNull() && !myFont->ResourceKey().IsEqual(aFontKey)) { // font changed @@ -680,7 +680,7 @@ void OpenGl_Text::render(const occ::handle& theCtx, { myFont = FindFont(theCtx, theTextAspect, - (int)myText->Height(), + static_cast(myText->Height()), theResolution, theFontHinting, aFontKey); @@ -724,7 +724,7 @@ void OpenGl_Text::render(const occ::handle& theCtx, theCtx->WorldViewState.Push(); myModelMatrix.Convert(theCtx->WorldViewState.Current() * theCtx->ModelWorldState.Current()); - const GLdouble aPointSize = (GLdouble)myFont->FTFont()->PointSize(); + const GLdouble aPointSize = static_cast(myFont->FTFont()->PointSize()); if (!myIs2d) { const gp_Pnt& aPoint = myText->Position(); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.cxx index d27cea4c3e3..4615ae7c9af 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.cxx @@ -347,11 +347,11 @@ bool OpenGl_Texture::Init(const occ::handle& theCtx, if (aDataPtr != nullptr) { // clang-format off - const GLint anAligment = std::min((GLint )theImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes + const GLint anAligment = std::min(static_cast(theImage->MaxRowAligmentBytes()), 8); // OpenGL supports alignment upto 8 bytes // clang-format on theCtx->core11fwd->glPixelStorei(GL_UNPACK_ALIGNMENT, anAligment); - const GLint anExtraBytes = GLint(theImage->RowExtraBytes()); - const GLint aPixelsWidth = GLint(theImage->SizeRowBytes() / theImage->SizePixelBytes()); + const GLint anExtraBytes = static_cast(theImage->RowExtraBytes()); + const GLint aPixelsWidth = static_cast(theImage->SizeRowBytes() / theImage->SizePixelBytes()); if (theCtx->hasUnpackRowLength) { theCtx->core11fwd->glPixelStorei(GL_UNPACK_ROW_LENGTH, @@ -1326,7 +1326,7 @@ bool OpenGl_Texture::InitCubeMap(const occ::handle& theCtx, myTarget = GL_TEXTURE_CUBE_MAP; myNbSamples = 1; - mySize.SetValues((GLsizei)theSize, (GLsizei)theSize, 1); + mySize.SetValues(static_cast(theSize), static_cast(theSize), 1); myTextFormat = aFormat.Format(); mySizedFormat = aFormat.Internal(); @@ -1409,10 +1409,10 @@ bool OpenGl_Texture::InitCubeMap(const occ::handle& theCtx, if (!anImage.IsNull()) { // clang-format off - const GLint anAligment = std::min((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes + const GLint anAligment = std::min(static_cast(anImage->MaxRowAligmentBytes()), 8); // OpenGL supports alignment upto 8 bytes // clang-format on - const GLint anExtraBytes = GLint(anImage->RowExtraBytes()); - const GLint aPixelsWidth = GLint(anImage->SizeRowBytes() / anImage->SizePixelBytes()); + const GLint anExtraBytes = static_cast(anImage->RowExtraBytes()); + const GLint aPixelsWidth = static_cast(anImage->SizeRowBytes() / anImage->SizePixelBytes()); const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0; if (theCtx->hasUnpackRowLength) { @@ -1431,7 +1431,7 @@ bool OpenGl_Texture::InitCubeMap(const occ::handle& theCtx, } anImage = aCopyImage; // clang-format off - const GLint anAligment2 = std::min((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes + const GLint anAligment2 = std::min(static_cast(anImage->MaxRowAligmentBytes()), 8); // OpenGL supports alignment upto 8 bytes // clang-format on theCtx->core11fwd->glPixelStorei(GL_UNPACK_ALIGNMENT, anAligment2); } @@ -1460,8 +1460,8 @@ bool OpenGl_Texture::InitCubeMap(const occ::handle& theCtx, theCtx->core11fwd->glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, anIntFormat, - GLsizei(theSize), - GLsizei(theSize), + static_cast(theSize), + static_cast(theSize), 0, aFormat.PixelFormat(), aFormat.DataType(), @@ -1477,7 +1477,7 @@ bool OpenGl_Texture::InitCubeMap(const occ::handle& theCtx, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, - TCollection_AsciiString("Error: cubemap side ") + (int)theSize + "x" + (int)theSize + TCollection_AsciiString("Error: cubemap side ") + static_cast(theSize) + "x" + static_cast(theSize) + " IF: " + OpenGl_TextureFormat::FormatFormat(anIntFormat) + " PF: " + OpenGl_TextureFormat::FormatFormat(aFormat.PixelFormat()) + " DT: " + OpenGl_TextureFormat::FormatDataType(aFormat.DataType()) @@ -1591,11 +1591,11 @@ size_t OpenGl_Texture::EstimatedDataSize() const size_t aSize = PixelSizeOfPixelFormat(mySizedFormat) * mySize.x() * myNbSamples; if (mySize.y() != 0) { - aSize *= size_t(mySize.y()); + aSize *= static_cast(mySize.y()); } if (mySize.z() != 0) { - aSize *= size_t(mySize.z()); + aSize *= static_cast(mySize.z()); } if (myTarget == GL_TEXTURE_CUBE_MAP) { @@ -1650,7 +1650,7 @@ bool OpenGl_Texture::ImageDump(Image_PixMap& theImage, } // clang-format off - const GLint anAligment = std::min(GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL + const GLint anAligment = std::min(static_cast(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL // clang-format on theCtx->core11fwd->glPixelStorei(GL_PACK_ALIGNMENT, anAligment); if (theCtx->hasPackRowLength) diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TextureSetPairIterator.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TextureSetPairIterator.hxx index b7703d069b3..2e977f819d0 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TextureSetPairIterator.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TextureSetPairIterator.hxx @@ -53,7 +53,7 @@ public: bool More() const { return myUnitCurrent <= myUnitUpper; } //! Return current texture unit. - Graphic3d_TextureUnit Unit() const { return (Graphic3d_TextureUnit)myUnitCurrent; } + Graphic3d_TextureUnit Unit() const { return static_cast(myUnitCurrent); } //! Access texture from first texture set. const OpenGl_Texture* Texture1() const { return myTexture1; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.cxx index b36f381cbb8..6d55ae9fd20 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.cxx @@ -75,8 +75,8 @@ void OpenGl_TileSampler::GrabVarianceMap(const occ::handle& theC "Internal Error: signed integer overflow within OpenGl_TileSampler"); float& aTile = myVarianceMap.ChangeValue(aRowIter, aColIter); - aTile = aFactor * float(aRawValue); - aTile *= 1.0f / tileArea((int)aColIter, (int)aRowIter); // average error over the tile + aTile = aFactor * static_cast(aRawValue); + aTile *= 1.0f / tileArea(static_cast(aColIter), static_cast(aRowIter)); // average error over the tile if (aRowIter != 0) { aTile += myVarianceMap.Value(aRowIter - 1, aColIter); @@ -123,7 +123,7 @@ NCollection_Vec2 OpenGl_TileSampler::nextTileToSample() { NCollection_Vec2 aTile(0, 0); const float aKsiX = mySampler.sample(0, myLastSample) * myMarginalMap.back(); - for (; (size_t)aTile.x() < myMarginalMap.size() - 1; ++aTile.x()) + for (; static_cast(aTile.x()) < myMarginalMap.size() - 1; ++aTile.x()) { if (aKsiX <= myMarginalMap[aTile.x()]) { @@ -133,7 +133,7 @@ NCollection_Vec2 OpenGl_TileSampler::nextTileToSample() const float aKsiY = mySampler.sample(1, myLastSample) * myVarianceMap.Value(myVarianceMap.SizeY - 1, aTile.x()); - for (; (size_t)aTile.y() < myVarianceMap.SizeY - 1; ++aTile.y()) + for (; static_cast(aTile.y()) < myVarianceMap.SizeY - 1; ++aTile.y()) { if (aKsiY <= myVarianceMap.Value(aTile.y(), aTile.x())) { @@ -162,10 +162,10 @@ void OpenGl_TileSampler::SetSize(const Graphic3d_RenderingParams& theParams, std::max(1, static_cast(ceilf(static_cast(theSize.x()) / aTileSize))); const int aNbTilesY = std::max(1, static_cast(ceilf(static_cast(theSize.y()) / aTileSize))); - if (myTileSize != aTileSize || (int)myTiles.SizeX != aNbTilesX || (int)myTiles.SizeY != aNbTilesY) + if (myTileSize != aTileSize || static_cast(myTiles.SizeX) != aNbTilesX || static_cast(myTiles.SizeY) != aNbTilesY) { myTileSize = aTileSize; - myScaleFactor = 1.0e6f * (1024.0f / float(myTileSize * myTileSize)); + myScaleFactor = 1.0e6f * (1024.0f / static_cast(myTileSize * myTileSize)); occ::handle anAlloc = NCollection_BaseAllocator::CommonBaseAllocator(); @@ -194,7 +194,7 @@ void OpenGl_TileSampler::SetSize(const Graphic3d_RenderingParams& theParams, } // calculate a size of compact offsets texture optimal for rendering reduced number of tiles - int aNbShunkTilesX = (int)myTiles.SizeX, aNbShunkTilesY = (int)myTiles.SizeY; + int aNbShunkTilesX = static_cast(myTiles.SizeX), aNbShunkTilesY = static_cast(myTiles.SizeY); if (theParams.NbRayTracingTiles > 0) { aNbShunkTilesX = 8; @@ -204,7 +204,7 @@ void OpenGl_TileSampler::SetSize(const Graphic3d_RenderingParams& theParams, (anIdx % 2 == 0 ? aNbShunkTilesX : aNbShunkTilesY) <<= 1; } } - if ((int)myOffsetsShrunk.SizeX != aNbShunkTilesX || (int)myOffsetsShrunk.SizeY != aNbShunkTilesY) + if (static_cast(myOffsetsShrunk.SizeX) != aNbShunkTilesX || static_cast(myOffsetsShrunk.SizeY) != aNbShunkTilesY) { myOffsetsShrunk.SetTopDown(true); myOffsetsShrunk.Init(myTiles.Allocator(), aNbShunkTilesX, aNbShunkTilesY); @@ -244,7 +244,7 @@ bool OpenGl_TileSampler::upload(const occ::handle& theContext, { NCollection_Vec2& aRedirectTile = anOffsets.ChangeValue(aRowIter, aColIter); aRedirectTile = - theAdaptive ? nextTileToSample() : NCollection_Vec2((int)aColIter, (int)aRowIter); + theAdaptive ? nextTileToSample() : NCollection_Vec2(static_cast(aColIter), static_cast(aRowIter)); myTiles.ChangeValue(aRedirectTile.y(), aRedirectTile.x()) += 1; } } @@ -263,7 +263,7 @@ bool OpenGl_TileSampler::upload(const occ::handle& theContext, for (size_t aColIter = 0; aColIter < myTiles.SizeX; ++aColIter) { myTileSamples.ChangeValue(aRowIter, aColIter) = - tileArea((int)aColIter, (int)aRowIter) * myTiles.Value(aRowIter, aColIter); + tileArea(static_cast(aColIter), static_cast(aRowIter)) * myTiles.Value(aRowIter, aColIter); } } @@ -277,15 +277,15 @@ bool OpenGl_TileSampler::upload(const occ::handle& theContext, { theContext->core11fwd->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); } - if (theSamplesTexture->SizeX() == (int)myTileSamples.SizeX - && theSamplesTexture->SizeY() == (int)myTileSamples.SizeY) + if (theSamplesTexture->SizeX() == static_cast(myTileSamples.SizeX) + && theSamplesTexture->SizeY() == static_cast(myTileSamples.SizeY)) { theContext->core11fwd->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, - (int)myTileSamples.SizeX, - (int)myTileSamples.SizeY, + static_cast(myTileSamples.SizeX), + static_cast(myTileSamples.SizeY), GL_RED_INTEGER, GL_INT, myTileSamples.Data()); @@ -308,14 +308,14 @@ bool OpenGl_TileSampler::upload(const occ::handle& theContext, if (!theOffsetsTexture.IsNull()) { - if (theOffsetsTexture->SizeX() != (int)anOffsets.SizeX - || theOffsetsTexture->SizeY() != (int)anOffsets.SizeY || !theOffsetsTexture->IsValid()) + if (theOffsetsTexture->SizeX() != static_cast(anOffsets.SizeX) + || theOffsetsTexture->SizeY() != static_cast(anOffsets.SizeY) || !theOffsetsTexture->IsValid()) { theOffsetsTexture->Release(theContext.get()); if (!theOffsetsTexture->Init( theContext, OpenGl_TextureFormat::FindSizedFormat(theContext, GL_RG32I), - NCollection_Vec2((int)anOffsets.SizeX, (int)anOffsets.SizeY), + NCollection_Vec2(static_cast(anOffsets.SizeX), static_cast(anOffsets.SizeY)), Graphic3d_TypeOfTexture_2D)) { hasErrors = true; @@ -333,8 +333,8 @@ bool OpenGl_TileSampler::upload(const occ::handle& theContext, 0, 0, 0, - (int)anOffsets.SizeX, - (int)anOffsets.SizeY, + static_cast(anOffsets.SizeX), + static_cast(anOffsets.SizeY), GL_RG_INTEGER, GL_INT, anOffsets.Data()); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.hxx index ee79ee477ea..f1198319058 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.hxx @@ -46,13 +46,13 @@ public: float VarianceScaleFactor() const { return myScaleFactor; } //! Returns number of tiles in X dimension. - int NbTilesX() const { return (int)myTiles.SizeX; } + int NbTilesX() const { return static_cast(myTiles.SizeX); } //! Returns number of tiles in Y dimension. - int NbTilesY() const { return (int)myTiles.SizeY; } + int NbTilesY() const { return static_cast(myTiles.SizeY); } //! Returns total number of tiles in viewport. - int NbTiles() const { return int(myTiles.SizeX * myTiles.SizeY); } + int NbTiles() const { return static_cast(myTiles.SizeX * myTiles.SizeY); } //! Returns ray-tracing viewport. const NCollection_Vec2& ViewSize() const { return myViewSize; } @@ -61,8 +61,8 @@ public: NCollection_Vec2 NbOffsetTiles(bool theAdaptive) const { return theAdaptive - ? NCollection_Vec2((int)myOffsetsShrunk.SizeX, (int)myOffsetsShrunk.SizeY) - : NCollection_Vec2((int)myOffsets.SizeX, (int)myOffsets.SizeY); + ? NCollection_Vec2(static_cast(myOffsetsShrunk.SizeX), static_cast(myOffsetsShrunk.SizeY)) + : NCollection_Vec2(static_cast(myOffsets.SizeX), static_cast(myOffsets.SizeY)); } //! Maximum number of tiles within offsets texture. diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx index fe3d9dec769..50bb1005a1d 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx @@ -38,14 +38,14 @@ unsigned int OpenGl_VertexBuffer::GetTarget() const void OpenGl_VertexBuffer::BindVertexAttrib(const occ::handle& theGlCtx, const unsigned int theAttribLoc) const { - if (!IsValid() || theAttribLoc == GLuint(-1)) + if (!IsValid() || theAttribLoc == static_cast(-1)) { return; } Bind(theGlCtx); theGlCtx->core20fwd->glEnableVertexAttribArray(theAttribLoc); theGlCtx->core20fwd - ->glVertexAttribPointer(theAttribLoc, GLint(myComponentsNb), myDataType, GL_FALSE, 0, myOffset); + ->glVertexAttribPointer(theAttribLoc, static_cast(myComponentsNb), myDataType, GL_FALSE, 0, myOffset); } //================================================================================================= @@ -53,7 +53,7 @@ void OpenGl_VertexBuffer::BindVertexAttrib(const occ::handle& th void OpenGl_VertexBuffer::UnbindVertexAttrib(const occ::handle& theGlCtx, const unsigned int theAttribLoc) const { - if (!IsValid() || theAttribLoc == GLuint(-1)) + if (!IsValid() || theAttribLoc == static_cast(-1)) { return; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx index f48295aad60..4820d1b2674 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx @@ -456,8 +456,8 @@ static void SetMinMaxValuesCallback(Graphic3d_CView* theView) gp_Pnt aMin = aBox.CornerMin(); gp_Pnt aMax = aBox.CornerMax(); - NCollection_Vec3 aMinVec((float)aMin.X(), (float)aMin.Y(), (float)aMin.Z()); - NCollection_Vec3 aMaxVec((float)aMax.X(), (float)aMax.Y(), (float)aMax.Z()); + NCollection_Vec3 aMinVec(static_cast(aMin.X()), static_cast(aMin.Y()), static_cast(aMin.Z())); + NCollection_Vec3 aMaxVec(static_cast(aMax.X()), static_cast(aMax.Y()), static_cast(aMax.Z())); aView->GraduatedTrihedronMinMaxValues(aMinVec, aMaxVec); } } @@ -571,8 +571,8 @@ bool OpenGl_View::ShadowMapDump(Image_PixMap& theImage, const TCollection_AsciiS const occ::handle& aShadowFbo = aShadow->FrameBuffer(); if (aShadowFbo->GetVPSizeX() == myRenderParams.ShadowMapResolution) { - if ((int)theImage.Width() != aShadowFbo->GetVPSizeX() - || (int)theImage.Height() != aShadowFbo->GetVPSizeY()) + if (static_cast(theImage.Width()) != aShadowFbo->GetVPSizeX() + || static_cast(theImage.Height()) != aShadowFbo->GetVPSizeY()) { theImage.InitZero(Image_Format_GrayF, aShadowFbo->GetVPSizeX(), aShadowFbo->GetVPSizeY()); } @@ -591,14 +591,14 @@ bool OpenGl_View::ShadowMapDump(Image_PixMap& theImage, const TCollection_AsciiS } // Setup alignment. // clang-format off - const GLint anAligment = std::min(GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL. + const GLint anAligment = std::min(static_cast(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL. // clang-format on aGlCtx->core11fwd->glPixelStorei(GL_PACK_ALIGNMENT, anAligment); // Read data. aGlCtx->core11fwd->glReadPixels(0, 0, - GLsizei(theImage.SizeX()), - GLsizei(theImage.SizeY()), + static_cast(theImage.SizeX()), + static_cast(theImage.SizeY()), GL_DEPTH_COMPONENT, GL_FLOAT, theImage.ChangeData()); @@ -873,8 +873,8 @@ Bnd_Box OpenGl_View::MinMaxValues(const bool theToIncludeAuxiliary) const if (theToIncludeAuxiliary && myRenderParams.ToShowStats && !myWorkspace->GetGlContext()->arbDepthClamp) { - Bnd_Box aStatsBox(gp_Pnt(float(myWindow->Width() / 2.0), float(myWindow->Height() / 2.0), 0.0), - gp_Pnt(float(myWindow->Width() / 2.0), float(myWindow->Height() / 2.0), 0.0)); + Bnd_Box aStatsBox(gp_Pnt(static_cast(myWindow->Width() / 2.0), static_cast(myWindow->Height() / 2.0), 0.0), + gp_Pnt(static_cast(myWindow->Width() / 2.0), static_cast(myWindow->Height() / 2.0), 0.0)); myRenderParams.StatsPosition->Apply(myCamera, myCamera->ProjectionMatrix(), myCamera->OrientationMatrix(), @@ -1173,8 +1173,8 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj) aSizeY = myWindow->Height(); } - const NCollection_Vec2 aRendSize(int(myRenderParams.RenderResolutionScale * aSizeX + 0.5f), - int(myRenderParams.RenderResolutionScale * aSizeY + 0.5f)); + const NCollection_Vec2 aRendSize(static_cast(myRenderParams.RenderResolutionScale * aSizeX + 0.5f), + static_cast(myRenderParams.RenderResolutionScale * aSizeY + 0.5f)); if (aSizeX < 1 || aSizeY < 1 || aRendSize.x() < 1 || aRendSize.y() < 1) { myBackBufferRestored = false; @@ -1424,7 +1424,7 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj) if (anImgFormat == Image_Format_RGF) { aPixMap->InitWrapper(Image_Format_RGF, - (uint8_t*)Textures_EnvLUT, + reinterpret_cast(Textures_EnvLUT), Textures_EnvLUTSize, Textures_EnvLUTSize); } @@ -1433,7 +1433,7 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj) aPixMap->InitZero(anImgFormat, Textures_EnvLUTSize, Textures_EnvLUTSize); Image_PixMap aPixMapRG; aPixMapRG.InitWrapper(Image_Format_RGF, - (uint8_t*)Textures_EnvLUT, + reinterpret_cast(Textures_EnvLUT), Textures_EnvLUTSize, Textures_EnvLUTSize); for (size_t aRowIter = 0; aRowIter < aPixMapRG.SizeY(); ++aRowIter) @@ -1476,7 +1476,7 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj) if (!aTexFormat.IsValid() || !anEnvLUT->Init(aCtx, aTexFormat, - NCollection_Vec2((int)Textures_EnvLUTSize), + NCollection_Vec2(static_cast(Textures_EnvLUTSize)), Graphic3d_TypeOfTexture_2D, aPixMap.get())) { @@ -1655,7 +1655,7 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj) myShadowMaps->Resize(0, myLights->NbCastShadows() - 1, true); } - const GLint aSamplFrom = GLint(aCtx->ShadowMapTexUnit()) - myLights->NbCastShadows() + 1; + const GLint aSamplFrom = static_cast(aCtx->ShadowMapTexUnit()) - myLights->NbCastShadows() + 1; for (int aShadowIter = 0; aShadowIter < myShadowMaps->Size(); ++aShadowIter) { occ::handle& aShadow = myShadowMaps->ChangeValue(aShadowIter); @@ -1665,7 +1665,7 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj) } aShadow->SetShadowMapBias(myRenderParams.ShadowMapBias); aShadow->Texture()->Sampler()->Parameters()->SetTextureUnit( - (Graphic3d_TextureUnit)(aSamplFrom + aShadowIter)); + static_cast(aSamplFrom + aShadowIter)); const occ::handle& aShadowFbo = aShadow->FrameBuffer(); if (aShadowFbo->GetVPSizeX() != myRenderParams.ShadowMapResolution && toUseShadowMap) @@ -1858,7 +1858,7 @@ void OpenGl_View::Redraw() blitBuffers(aMainFbos[0], anXRFbo); // resize or resolve MSAA samples } const Aspect_GraphicsLibrary aGraphicsLib = aCtx->GraphicsLibrary(); - myXRSession->SubmitEye((void*)(size_t)anXRFbo->ColorTexture()->TextureId(), + myXRSession->SubmitEye((void*)static_cast(anXRFbo->ColorTexture()->TextureId()), aGraphicsLib, Aspect_ColorSpace_sRGB, Aspect_Eye_Left); @@ -1897,7 +1897,7 @@ void OpenGl_View::Redraw() } const Aspect_GraphicsLibrary aGraphicsLib = aCtx->GraphicsLibrary(); - myXRSession->SubmitEye((void*)(size_t)anXRFbo->ColorTexture()->TextureId(), + myXRSession->SubmitEye((void*)static_cast(anXRFbo->ColorTexture()->TextureId()), aGraphicsLib, Aspect_ColorSpace_sRGB, Aspect_Eye_Right); @@ -2415,7 +2415,7 @@ void OpenGl_View::renderShadowMap(const occ::handle& theShadow | OpenGl_RenderFilter_SkipTrsfPersistence); renderScene(aProjection, aShadowBuffer.get(), nullptr, false); myWorkspace->SetRenderFilter(myWorkspace->RenderFilter() - & ~(int)OpenGl_RenderFilter_SkipTrsfPersistence); + & ~static_cast(OpenGl_RenderFilter_SkipTrsfPersistence)); aCtx->SetColorMask(true); myWorkspace->ResetAppliedAspect(); @@ -2671,7 +2671,7 @@ void OpenGl_View::renderStructs(Graphic3d_Camera::Projection theProjection, theOitAccumFbo); const int aPrevFilter = - myWorkspace->RenderFilter() & ~(int)(OpenGl_RenderFilter_NonRaytraceableOnly); + myWorkspace->RenderFilter() & ~static_cast(OpenGl_RenderFilter_NonRaytraceableOnly); myWorkspace->SetRenderFilter(aPrevFilter | OpenGl_RenderFilter_NonRaytraceableOnly); { if (theReadDrawFbo != nullptr) @@ -3227,7 +3227,7 @@ void OpenGl_View::drawStereoPair(OpenGl_FrameBuffer* theDrawFbo) case Graphic3d_StereoMode_RowInterlaced: { NCollection_Vec2 aTexOffset = myRenderParams.ToSmoothInterlacing - ? NCollection_Vec2(0.0f, -0.5f / float(aPair[0]->GetSizeY())) + ? NCollection_Vec2(0.0f, -0.5f / static_cast(aPair[0]->GetSizeY())) : NCollection_Vec2(); aCtx->ActiveProgram()->SetUniform(aCtx, "uTexOffset", aTexOffset); break; @@ -3235,7 +3235,7 @@ void OpenGl_View::drawStereoPair(OpenGl_FrameBuffer* theDrawFbo) case Graphic3d_StereoMode_ColumnInterlaced: { NCollection_Vec2 aTexOffset = myRenderParams.ToSmoothInterlacing - ? NCollection_Vec2(0.5f / float(aPair[0]->GetSizeX()), 0.0f) + ? NCollection_Vec2(0.5f / static_cast(aPair[0]->GetSizeX()), 0.0f) : NCollection_Vec2(); aCtx->ActiveProgram()->SetUniform(aCtx, "uTexOffset", aTexOffset); break; @@ -3243,8 +3243,8 @@ void OpenGl_View::drawStereoPair(OpenGl_FrameBuffer* theDrawFbo) case Graphic3d_StereoMode_ChessBoard: { NCollection_Vec2 aTexOffset = myRenderParams.ToSmoothInterlacing - ? NCollection_Vec2(0.5f / float(aPair[0]->GetSizeX()), - -0.5f / float(aPair[0]->GetSizeY())) + ? NCollection_Vec2(0.5f / static_cast(aPair[0]->GetSizeX()), + -0.5f / static_cast(aPair[0]->GetSizeY())) : NCollection_Vec2(); aCtx->ActiveProgram()->SetUniform(aCtx, "uTexOffset", aTexOffset); break; @@ -3257,7 +3257,7 @@ void OpenGl_View::drawStereoPair(OpenGl_FrameBuffer* theDrawFbo) { OpenGl_FrameBuffer* anEyeFbo = aPair[anEyeIter]; anEyeFbo->ColorTexture()->Bind(aCtx, - (Graphic3d_TextureUnit)(Graphic3d_TextureUnit_0 + anEyeIter)); + static_cast(Graphic3d_TextureUnit_0 + anEyeIter)); if (anEyeFbo->ColorTexture()->Sampler()->Parameters()->Filter() != Graphic3d_TOTF_BILINEAR) { // force filtering @@ -3406,9 +3406,9 @@ void OpenGl_View::updateSkydomeBg(const occ::handle& theCtx) // Setup uniforms aProg->SetUniform(theCtx, "uSunDir", - NCollection_Vec3((float)mySkydomeAspect.SunDirection().X(), - (float)mySkydomeAspect.SunDirection().Y(), - (float)mySkydomeAspect.SunDirection().Z())); + NCollection_Vec3(static_cast(mySkydomeAspect.SunDirection().X()), + static_cast(mySkydomeAspect.SunDirection().Y()), + static_cast(mySkydomeAspect.SunDirection().Z()))); aProg->SetUniform(theCtx, "uCloudy", mySkydomeAspect.Cloudiness()); aProg->SetUniform(theCtx, "uTime", mySkydomeAspect.TimeParameter()); aProg->SetUniform(theCtx, "uFog", mySkydomeAspect.Fogginess()); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx index 6b0be54bf42..a00ba1af0ce 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx @@ -123,7 +123,7 @@ bool OpenGl_View::updateRaytraceGeometry(const RaytraceUpdateMode theM ++aPriorityIter) { const NCollection_IndexedMap& aStructures = - aLayer->Structures((Graphic3d_DisplayPriority)aPriorityIter); + aLayer->Structures(static_cast(aPriorityIter)); for (OpenGl_Structure::StructIterator aStructIt(aStructures); aStructIt.More(); aStructIt.Next()) { @@ -348,7 +348,7 @@ OpenGl_RaytraceMaterial OpenGl_View::convertMaterial( const Graphic3d_MaterialAspect& aSrcMat = theAspect->Aspect()->FrontMaterial(); const NCollection_Vec3& aMatCol = theAspect->Aspect()->InteriorColor(); - const float aShine = 128.0f * float(aSrcMat.Shininess()); + const float aShine = 128.0f * (aSrcMat.Shininess()); const NCollection_Vec3& aSrcAmb = aSrcMat.AmbientColor(); const NCollection_Vec3& aSrcDif = aSrcMat.DiffuseColor(); @@ -380,7 +380,7 @@ OpenGl_RaytraceMaterial OpenGl_View::convertMaterial( aResMat.Reflection.SetValues(aSrcSpe * aReflectionScale, 0.0f); } - const float anIndex = (float)aSrcMat.RefractionIndex(); + const float anIndex = aSrcMat.RefractionIndex(); aResMat.Transparency = BVH_Vec4f(aSrcMat.Alpha(), aSrcMat.Transparency(), anIndex == 0 ? 1.0f : anIndex, @@ -1096,7 +1096,7 @@ bool OpenGl_View::ShaderSource::LoadFromFiles(const TCollection_AsciiString* the } TCollection_AsciiString aSource; - aFile.Read(aSource, (int)aFile.Size()); + aFile.Read(aSource, static_cast(aFile.Size())); if (!aSource.IsEmpty()) { mySource += TCollection_AsciiString("\n") + aSource; @@ -2094,7 +2094,7 @@ void OpenGl_View::updateCamera(const NCollection_Mat4& theOrientation, { for (int aX = -1; aX <= 1; aX += 2) { - NCollection_Vec4 aOrigin(GLfloat(aX), GLfloat(aY), -1.0f, 1.0f); + NCollection_Vec4 aOrigin(static_cast(aX), static_cast(aY), -1.0f, 1.0f); aOrigin = theUnview * aOrigin; @@ -2102,7 +2102,7 @@ void OpenGl_View::updateCamera(const NCollection_Mat4& theOrientation, aOrigin.y() = aOrigin.y() / aOrigin.w(); aOrigin.z() = aOrigin.z() / aOrigin.w(); - NCollection_Vec4 aDirect(GLfloat(aX), GLfloat(aY), 1.0f, 1.0f); + NCollection_Vec4 aDirect(static_cast(aX), static_cast(aY), 1.0f, 1.0f); aDirect = theUnview * aDirect; @@ -2342,15 +2342,15 @@ bool OpenGl_View::uploadRaytraceData(const occ::handle& theGlCon { aResult &= mySceneNodeInfoTexture->Init(theGlContext, 4, - GLsizei(aTotalBVHNodesNb), + static_cast(aTotalBVHNodesNb), static_cast(nullptr)); aResult &= mySceneMinPointTexture->Init(theGlContext, 3, - GLsizei(aTotalBVHNodesNb), + static_cast(aTotalBVHNodesNb), static_cast(nullptr)); aResult &= mySceneMaxPointTexture->Init(theGlContext, 3, - GLsizei(aTotalBVHNodesNb), + static_cast(aTotalBVHNodesNb), static_cast(nullptr)); } @@ -2364,7 +2364,7 @@ bool OpenGl_View::uploadRaytraceData(const occ::handle& theGlCon { aResult &= myGeometryTriangTexture->Init(theGlContext, 4, - GLsizei(aTotalElementsNb), + static_cast(aTotalElementsNb), static_cast(nullptr)); } @@ -2372,15 +2372,15 @@ bool OpenGl_View::uploadRaytraceData(const occ::handle& theGlCon { aResult &= myGeometryVertexTexture->Init(theGlContext, 3, - GLsizei(aTotalVerticesNb), + static_cast(aTotalVerticesNb), static_cast(nullptr)); aResult &= myGeometryNormalTexture->Init(theGlContext, 3, - GLsizei(aTotalVerticesNb), + static_cast(aTotalVerticesNb), static_cast(nullptr)); aResult &= myGeometryTexCrdTexture->Init(theGlContext, 2, - GLsizei(aTotalVerticesNb), + static_cast(aTotalVerticesNb), static_cast(nullptr)); } @@ -2467,17 +2467,17 @@ bool OpenGl_View::uploadRaytraceData(const occ::handle& theGlCon aResult &= myGeometryNormalTexture->SubData( theGlContext, aVerticesOffset, - GLsizei(aTriangleSet->Normals.size()), + static_cast(aTriangleSet->Normals.size()), reinterpret_cast(&aTriangleSet->Normals.front())); aResult &= myGeometryTexCrdTexture->SubData( theGlContext, aVerticesOffset, - GLsizei(aTriangleSet->TexCrds.size()), + static_cast(aTriangleSet->TexCrds.size()), reinterpret_cast(&aTriangleSet->TexCrds.front())); aResult &= myGeometryVertexTexture->SubData( theGlContext, aVerticesOffset, - GLsizei(aTriangleSet->Vertices.size()), + static_cast(aTriangleSet->Vertices.size()), reinterpret_cast(&aTriangleSet->Vertices.front())); } @@ -2493,7 +2493,7 @@ bool OpenGl_View::uploadRaytraceData(const occ::handle& theGlCon aResult &= myGeometryTriangTexture->SubData( theGlContext, anElementsOffset, - GLsizei(aTriangleSet->Elements.size()), + static_cast(aTriangleSet->Elements.size()), reinterpret_cast(&aTriangleSet->Elements.front())); } @@ -2511,7 +2511,7 @@ bool OpenGl_View::uploadRaytraceData(const occ::handle& theGlCon { aResult &= myRaytraceMaterialTexture->Init(theGlContext, 4, - GLsizei(myRaytraceGeometry.Materials.size() * 19), + static_cast(myRaytraceGeometry.Materials.size() * 19), myRaytraceGeometry.Materials.front().Packed()); if (!aResult) @@ -2677,7 +2677,7 @@ bool OpenGl_View::updateRaytraceLightSources(const NCollection_Mat4& const GLfloat* aDataPtr = myRaytraceGeometry.Sources.front().Packed(); if (!myRaytraceLightSrcTexture->Init(theGlContext, 4, - GLsizei(myRaytraceGeometry.Sources.size() * 2), + static_cast(myRaytraceGeometry.Sources.size() * 2), aDataPtr)) { Message::SendTrace() << "Error: Failed to upload light source buffer"; @@ -2839,8 +2839,8 @@ bool OpenGl_View::setUniformState(const int theProgramI int aTileSize = myCamera->Tile().TileSize.y(); int aViewSize = myCamera->Tile().TotalSize.y(); NCollection_Vec4 aColorRange = aBackColorTop - aBackColorBot; - aBackColorBot = aBackColorBot + aColorRange * ((float)aTileOffset / aViewSize); - aBackColorTop = aBackColorBot + aColorRange * ((float)aTileSize / aViewSize); + aBackColorBot = aBackColorBot + aColorRange * (static_cast(aTileOffset) / aViewSize); + aBackColorTop = aBackColorBot + aColorRange * (static_cast(aTileSize) / aViewSize); } } aBackColorTop = theGlContext->Vec4FromQuantityColor(aBackColorTop); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Window.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Window.cxx index af21a1f514c..9f49874c65c 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Window.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Window.cxx @@ -601,10 +601,10 @@ void OpenGl_Window::Init(const occ::handle& theDriver, (Aspect_RenderingContext)aGContext, isCoreProfile); #elif defined(HAVE_XLIB) - Window aWindow = (Window)myPlatformWindow->NativeHandle(); - Display* aDisp = (Display*)theDriver->GetDisplayConnection()->GetDisplayAspect(); - GLXContext aGContext = (GLXContext)theGContext; - GLXContext aSlaveCtx = !theShareCtx.IsNull() ? (GLXContext)theShareCtx->myGContext : nullptr; + Window aWindow = static_cast(myPlatformWindow->NativeHandle()); + Display* aDisp = reinterpret_cast(theDriver->GetDisplayConnection()->GetDisplayAspect()); + GLXContext aGContext = static_cast(theGContext); + GLXContext aSlaveCtx = !theShareCtx.IsNull() ? static_cast(theShareCtx->myGContext) : nullptr; XWindowAttributes aWinAttribs; XGetWindowAttributes(aDisp, aWindow, &aWinAttribs); @@ -645,7 +645,7 @@ void OpenGl_Window::Init(const occ::handle& theDriver, Bool direct, const int* attrib_list); glXCreateContextAttribsARB_t aCreateCtxProc = - (glXCreateContextAttribsARB_t)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); + reinterpret_cast(glXGetProcAddress(reinterpret_cast("glXCreateContextAttribsARB"))); if (!theCaps->contextCompatible) { int aCoreCtxAttribs[] = {GLX_CONTEXT_MAJOR_VERSION_ARB, @@ -745,7 +745,7 @@ void OpenGl_Window::Init(const occ::handle& theDriver, aMsg); } - myGlContext->Init((Aspect_Drawable)aWindow, + myGlContext->Init(static_cast(aWindow), (Aspect_Display)aDisp, (Aspect_RenderingContext)aGContext, isCoreProfile); @@ -794,8 +794,8 @@ OpenGl_Window::~OpenGl_Window() } ReleaseDC(aWindow, aWindowDC); #elif defined(HAVE_XLIB) - Display* aDisplay = (Display*)myGlContext->myDisplay; - GLXContext aWindowGContext = (GLXContext)myGlContext->myGContext; + Display* aDisplay = static_cast(myGlContext->myDisplay); + GLXContext aWindowGContext = static_cast(myGlContext->myGContext); GLXContext aThreadGContext = glXGetCurrentContext(); myGlContext.Nullify(); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Workspace.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Workspace.cxx index 078167da937..bff9b27b3dd 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Workspace.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Workspace.cxx @@ -115,7 +115,7 @@ OpenGl_Workspace::OpenGl_Workspace(OpenGl_View* theView, if (myGlContext->core11ffp != nullptr) { // enable two-side lighting by default - myGlContext->core11ffp->glLightModeli((GLenum)GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); + myGlContext->core11ffp->glLightModeli(static_cast(GL_LIGHT_MODEL_TWO_SIDE), GL_TRUE); myGlContext->core11fwd->glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST); if (myGlContext->caps->ffpEnable) { diff --git a/src/Visualization/TKService/Aspect/Aspect_CircularGrid.cxx b/src/Visualization/TKService/Aspect/Aspect_CircularGrid.cxx index ffc88b533a7..e358ad3c8e2 100644 --- a/src/Visualization/TKService/Aspect/Aspect_CircularGrid.cxx +++ b/src/Visualization/TKService/Aspect/Aspect_CircularGrid.cxx @@ -76,14 +76,14 @@ void Aspect_CircularGrid::Compute(const double X, double xo = XOrigin(); double yo = YOrigin(); double d = std::sqrt((xo - X) * (xo - X) + (yo - Y) * (yo - Y)); - int n = (int)(d / myRadiusStep + 0.5); - double radius = double(n) * myRadiusStep; + int n = static_cast(d / myRadiusStep + 0.5); + double radius = static_cast(n) * myRadiusStep; double cosinus = (X - xo) / d; double a = std::acos(cosinus); double ra = RotationAngle(); if (Y < yo) a = 2 * M_PI - a; - n = (int)((a - ra) / myAlpha + std::copysign(0.5, a - ra)); + n = static_cast((a - ra) / myAlpha + std::copysign(0.5, a - ra)); double cs = 0, sn = 0; bool done = false; @@ -145,7 +145,7 @@ void Aspect_CircularGrid::Compute(const double X, if (!done) { - double ang = ra + double(n) * myAlpha; + double ang = ra + static_cast(n) * myAlpha; cs = std::cos(ang); sn = std::sin(ang); } @@ -165,7 +165,7 @@ int Aspect_CircularGrid::DivisionNumber() const void Aspect_CircularGrid::Init() { - myAlpha = M_PI / double(myDivisionNumber); + myAlpha = M_PI / static_cast(myDivisionNumber); myA1 = std::cos(myAlpha); myB1 = std::sin(myAlpha); } diff --git a/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.cxx b/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.cxx index 93c1cf6ba6c..26f746f4884 100644 --- a/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.cxx +++ b/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.cxx @@ -49,7 +49,7 @@ Aspect_DisplayConnection::~Aspect_DisplayConnection() } if (myDisplay != nullptr && myIsOwnDisplay) { - XCloseDisplay((Display*)myDisplay); + XCloseDisplay(reinterpret_cast(myDisplay)); } #endif } @@ -99,13 +99,13 @@ void Aspect_DisplayConnection::Init(Aspect_XDisplay* theDisplay) #if defined(HAVE_XLIB) if (myDisplay != nullptr && myIsOwnDisplay) { - XCloseDisplay((Display*)myDisplay); + XCloseDisplay(reinterpret_cast(myDisplay)); } myIsOwnDisplay = false; myAtoms.Clear(); myDisplay = - theDisplay != nullptr ? theDisplay : (Aspect_XDisplay*)XOpenDisplay(myDisplayName.ToCString()); + theDisplay != nullptr ? theDisplay : reinterpret_cast(XOpenDisplay(myDisplayName.ToCString())); if (myDisplay == nullptr) { TCollection_AsciiString aMessage; @@ -117,7 +117,7 @@ void Aspect_DisplayConnection::Init(Aspect_XDisplay* theDisplay) { myIsOwnDisplay = theDisplay == nullptr; myAtoms.Bind(Aspect_XA_DELETE_WINDOW, - (uint64_t)XInternAtom((Display*)myDisplay, "WM_DELETE_WINDOW", False)); + static_cast(XInternAtom(reinterpret_cast(myDisplay), "WM_DELETE_WINDOW", False))); } #else myDisplay = theDisplay; diff --git a/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.hxx b/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.hxx index caedc8a246b..699c889abe6 100644 --- a/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.hxx @@ -91,29 +91,29 @@ public: //! WARNING! it is a responsibility of application to keep this pointer //! valid while Aspect_DisplayConnection is alive and to close Display when it is no more needed. Aspect_DisplayConnection(Display* theDisplay) - : Aspect_DisplayConnection((Aspect_XDisplay*)theDisplay) + : Aspect_DisplayConnection(reinterpret_cast(theDisplay)) { } //! @return pointer to Display structure that serves as the connection to the X server. - Display* GetDisplay() { return (Display*)myDisplay; } + Display* GetDisplay() { return reinterpret_cast(myDisplay); } //! Return default window visual or NULL when undefined. - XVisualInfo* GetDefaultVisualInfoX() const { return (XVisualInfo*)myDefVisualInfo; } + XVisualInfo* GetDefaultVisualInfoX() const { return reinterpret_cast(myDefVisualInfo); } //! Set default window visual; the visual will be deallocated using XFree(). void SetDefaultVisualInfo(XVisualInfo* theVisual, Aspect_FBConfig theFBConfig) { - SetDefaultVisualInfo((Aspect_XVisualInfo*)theVisual, theFBConfig); + SetDefaultVisualInfo(reinterpret_cast(theVisual), theFBConfig); } //! @return identifier(atom) for custom named property associated with windows that use current //! connection to X server. - Atom GetAtomX(const Aspect_XAtom theAtom) const { return (Atom)GetAtom(theAtom); } + Atom GetAtomX(const Aspect_XAtom theAtom) const { return static_cast(GetAtom(theAtom)); } //! Open connection with display specified in myDisplayName class field //! or takes theDisplay parameter when it is not NULL. - void Init(Display* theDisplay) { Init((Aspect_XDisplay*)theDisplay); } + void Init(Display* theDisplay) { Init(reinterpret_cast(theDisplay)); } #endif private: diff --git a/src/Visualization/TKService/Aspect/Aspect_NeutralWindow.hxx b/src/Visualization/TKService/Aspect/Aspect_NeutralWindow.hxx index 95b2f5f6faf..9aa9b229bfb 100644 --- a/src/Visualization/TKService/Aspect/Aspect_NeutralWindow.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_NeutralWindow.hxx @@ -69,7 +69,7 @@ public: //! Returns window ratio equal to the physical width/height dimensions. double Ratio() const override { - return (myWidth != 0 && myHeight != 0) ? double(myWidth) / double(myHeight) : 1.0; + return (myWidth != 0 && myHeight != 0) ? static_cast(myWidth) / static_cast(myHeight) : 1.0; } //! Return the window position. diff --git a/src/Visualization/TKService/Aspect/Aspect_RectangularGrid.cxx b/src/Visualization/TKService/Aspect/Aspect_RectangularGrid.cxx index c1d9fa373c2..cddd267324b 100644 --- a/src/Visualization/TKService/Aspect/Aspect_RectangularGrid.cxx +++ b/src/Visualization/TKService/Aspect/Aspect_RectangularGrid.cxx @@ -95,10 +95,10 @@ void Aspect_RectangularGrid::Compute(const double X, { double D1 = b1 * X - a1 * Y - c1; double D2 = b2 * X - a2 * Y - c2; - int n1 = int(std::abs(D1) / myXStep + 0.5); - int n2 = int(std::abs(D2) / myYStep + 0.5); - double offset1 = c1 + double(n1) * std::copysign(myXStep, D1); - double offset2 = c2 + double(n2) * std::copysign(myYStep, D2); + int n1 = static_cast(std::abs(D1) / myXStep + 0.5); + int n2 = static_cast(std::abs(D2) / myYStep + 0.5); + double offset1 = c1 + static_cast(n1) * std::copysign(myXStep, D1); + double offset2 = c2 + static_cast(n2) * std::copysign(myYStep, D2); double Delta = a1 * b2 - b1 * a2; gridX = (offset2 * a1 - offset1 * a2) / Delta; gridY = (offset2 * b1 - offset1 * b2) / Delta; diff --git a/src/Visualization/TKService/Aspect/Aspect_WindowInputListener.cxx b/src/Visualization/TKService/Aspect/Aspect_WindowInputListener.cxx index dda7adca339..a15678206d0 100644 --- a/src/Visualization/TKService/Aspect/Aspect_WindowInputListener.cxx +++ b/src/Visualization/TKService/Aspect/Aspect_WindowInputListener.cxx @@ -67,7 +67,7 @@ void Aspect_WindowInputListener::AddTouchPoint(size_t t { if (theClearBefore) { - RemoveTouchPoint((size_t)-1); + RemoveTouchPoint(static_cast(-1)); } myTouchPoints.Add(theId, Aspect_Touch(thePnt, false)); @@ -78,7 +78,7 @@ void Aspect_WindowInputListener::AddTouchPoint(size_t t bool Aspect_WindowInputListener::RemoveTouchPoint(size_t theId, bool theClearSelectPnts) { (void)theClearSelectPnts; - if (theId == (size_t)-1) + if (theId == static_cast(-1)) { myTouchPoints.Clear(false); } diff --git a/src/Visualization/TKService/Font/Font_FTFont.cxx b/src/Visualization/TKService/Font/Font_FTFont.cxx index b30b2d1f3ef..c5b4cff6805 100644 --- a/src/Visualization/TKService/Font/Font_FTFont.cxx +++ b/src/Visualization/TKService/Font/Font_FTFont.cxx @@ -126,8 +126,8 @@ bool Font_FTFont::Init(const occ::handle& theData, { if (FT_New_Memory_Face(myFTLib->Instance(), theData->Data(), - (FT_Long)theData->Size(), - (FT_Long)theFaceId, + static_cast(theData->Size()), + static_cast(theFaceId), &myFTFace) != 0) { @@ -139,7 +139,7 @@ bool Font_FTFont::Init(const occ::handle& theData, } else { - if (FT_New_Face(myFTLib->Instance(), myFontPath.ToCString(), (FT_Long)theFaceId, &myFTFace) + if (FT_New_Face(myFTLib->Instance(), myFontPath.ToCString(), static_cast(theFaceId), &myFTFace) != 0) { // Message::SendTrace (TCollection_AsciiString("Font '") + myFontPath + "' failed to load from @@ -174,12 +174,12 @@ bool Font_FTFont::Init(const occ::handle& theData, const double THE_SHEAR_ANGLE = 10.0 * M_PI / 180.0; FT_Matrix aMat; - aMat.xx = FT_Fixed(std::cos(-THE_SHEAR_ANGLE) * (1 << 16)); + aMat.xx = static_cast(std::cos(-THE_SHEAR_ANGLE) * (1 << 16)); aMat.xy = 0; aMat.yx = 0; aMat.yy = aMat.xx; - FT_Fixed aFactor = FT_Fixed(std::tan(THE_SHEAR_ANGLE) * (1 << 16)); + FT_Fixed aFactor = static_cast(std::tan(THE_SHEAR_ANGLE) * (1 << 16)); aMat.xy += FT_MulFix(aFactor, aMat.xx); FT_Set_Transform(myFTFace, &aMat, nullptr); @@ -358,7 +358,7 @@ bool Font_FTFont::loadGlyph(const char32_t theUChar) } } - if (FT_Load_Char(myActiveFTFace, theUChar, FT_Int32(myLoadFlags)) != 0 + if (FT_Load_Char(myActiveFTFace, theUChar, static_cast(myLoadFlags)) != 0 || myActiveFTFace->glyph == nullptr) { return false; @@ -391,7 +391,7 @@ bool Font_FTFont::RenderGlyph(const char32_t theUChar) } if (theUChar == 0 - || FT_Load_Char(myActiveFTFace, theUChar, FT_Int32(myLoadFlags | FT_LOAD_RENDER)) != 0 + || FT_Load_Char(myActiveFTFace, theUChar, static_cast(myLoadFlags | FT_LOAD_RENDER)) != 0 || myActiveFTFace->glyph == nullptr || myActiveFTFace->glyph->format != FT_GLYPH_FORMAT_BITMAP) { @@ -425,9 +425,9 @@ bool Font_FTFont::RenderGlyph(const char32_t theUChar) myGlyphImg.SetTopDown(aBitmap.pitch > 0); const int aNumOfBytesInRow = aBitmap.width / 8 + (aBitmap.width % 8 ? 1 : 0); - for (int aRow = 0; aRow < (int)aBitmap.rows; ++aRow) + for (int aRow = 0; aRow < static_cast(aBitmap.rows); ++aRow) { - for (int aCol = 0; aCol < (int)aBitmap.width; ++aCol) + for (int aCol = 0; aCol < static_cast(aBitmap.width); ++aCol) { const int aBitOn = aBitmap.buffer[aNumOfBytesInRow * aRow + aCol / 8] & (0x80 >> (aCol % 8)); @@ -456,10 +456,10 @@ unsigned int Font_FTFont::GlyphMaxSizeX(bool theToIncludeFallback) const if (!theToIncludeFallback) { float aWidth = (FT_IS_SCALABLE(myFTFace) != 0) - ? float(myFTFace->bbox.xMax - myFTFace->bbox.xMin) - * (float(myFTFace->size->metrics.x_ppem) / float(myFTFace->units_per_EM)) + ? static_cast(myFTFace->bbox.xMax - myFTFace->bbox.xMin) + * (static_cast(myFTFace->size->metrics.x_ppem) / static_cast(myFTFace->units_per_EM)) : fromFTPoints(myFTFace->size->metrics.max_advance); - return (unsigned int)(aWidth + 0.5f); + return static_cast(aWidth + 0.5f); } unsigned int aWidth = GlyphMaxSizeX(false); @@ -488,10 +488,10 @@ unsigned int Font_FTFont::GlyphMaxSizeY(bool theToIncludeFallback) const if (!theToIncludeFallback) { float aHeight = (FT_IS_SCALABLE(myFTFace) != 0) - ? float(myFTFace->bbox.yMax - myFTFace->bbox.yMin) - * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM)) + ? static_cast(myFTFace->bbox.yMax - myFTFace->bbox.yMin) + * (static_cast(myFTFace->size->metrics.y_ppem) / static_cast(myFTFace->units_per_EM)) : fromFTPoints(myFTFace->size->metrics.height); - return (unsigned int)(aHeight + 0.5f); + return static_cast(aHeight + 0.5f); } unsigned int aHeight = GlyphMaxSizeY(false); @@ -517,8 +517,8 @@ unsigned int Font_FTFont::GlyphMaxSizeY(bool theToIncludeFallback) const float Font_FTFont::Ascender() const { #ifdef HAVE_FREETYPE - return float(myFTFace->ascender) - * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM)); + return static_cast(myFTFace->ascender) + * (static_cast(myFTFace->size->metrics.y_ppem) / static_cast(myFTFace->units_per_EM)); #else return 0.0f; #endif @@ -529,8 +529,8 @@ float Font_FTFont::Ascender() const float Font_FTFont::Descender() const { #ifdef HAVE_FREETYPE - return float(myFTFace->descender) - * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM)); + return static_cast(myFTFace->descender) + * (static_cast(myFTFace->size->metrics.y_ppem) / static_cast(myFTFace->units_per_EM)); #else return 0.0f; #endif @@ -541,8 +541,8 @@ float Font_FTFont::Descender() const float Font_FTFont::LineSpacing() const { #ifdef HAVE_FREETYPE - return float(myFTFace->height) - * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM)); + return static_cast(myFTFace->height) + * (static_cast(myFTFace->size->metrics.y_ppem) / static_cast(myFTFace->units_per_EM)); #else return 0.0f; #endif @@ -638,7 +638,7 @@ float Font_FTFont::AdvanceY(char32_t theUCharNext) const int Font_FTFont::GlyphsNumber(bool theToIncludeFallback) const { #ifdef HAVE_FREETYPE - int aNbGlyphs = (int)myFTFace->num_glyphs; + int aNbGlyphs = static_cast(myFTFace->num_glyphs); if (theToIncludeFallback) { for (int aFontIter = 0; aFontIter < Font_UnicodeSubset_NB; ++aFontIter) @@ -662,10 +662,10 @@ void Font_FTFont::GlyphRect(Font_Rect& theRect) const { #ifdef HAVE_FREETYPE const FT_Bitmap& aBitmap = myActiveFTFace->glyph->bitmap; - theRect.Left = float(myActiveFTFace->glyph->bitmap_left); - theRect.Top = float(myActiveFTFace->glyph->bitmap_top); - theRect.Right = float(myActiveFTFace->glyph->bitmap_left + (int)aBitmap.width); - theRect.Bottom = float(myActiveFTFace->glyph->bitmap_top - (int)aBitmap.rows); + theRect.Left = static_cast(myActiveFTFace->glyph->bitmap_left); + theRect.Top = static_cast(myActiveFTFace->glyph->bitmap_top); + theRect.Right = static_cast(myActiveFTFace->glyph->bitmap_left + static_cast(aBitmap.width)); + theRect.Bottom = static_cast(myActiveFTFace->glyph->bitmap_top - static_cast(aBitmap.rows)); #else (void)theRect; #endif diff --git a/src/Visualization/TKService/Font/Font_FontMgr.cxx b/src/Visualization/TKService/Font/Font_FontMgr.cxx index ed263019890..597ef9c51b7 100644 --- a/src/Visualization/TKService/Font/Font_FontMgr.cxx +++ b/src/Visualization/TKService/Font/Font_FontMgr.cxx @@ -251,7 +251,7 @@ static bool checkFont(NCollection_Sequence>& theFon } occ::handle aResult = new Font_SystemFont(aFamily); - aResult->SetFontPath(anAspect, theFontPath, (int)aFaceId); + aResult->SetFontPath(anAspect, theFontPath, static_cast(aFaceId)); // automatically identify some known single-line fonts aResult->SetSingleStrokeFont(aResult->FontKey().StartsWith("olf ")); theFonts.Append(aResult); @@ -582,20 +582,20 @@ bool Font_FontMgr::RegisterFont(const occ::handle& theFont, occ::handle anOldFont = myFontMap.FindKey(anOldIndex); for (int anAspectIter = 0; anAspectIter < Font_FontAspect_NB; ++anAspectIter) { - if (anOldFont->FontPath((Font_FontAspect)anAspectIter) - .IsEqual(theFont->FontPath((Font_FontAspect)anAspectIter)) - && anOldFont->FontFaceId((Font_FontAspect)anAspectIter) - == theFont->FontFaceId((Font_FontAspect)anAspectIter)) + if (anOldFont->FontPath(static_cast(anAspectIter)) + .IsEqual(theFont->FontPath(static_cast(anAspectIter))) + && anOldFont->FontFaceId(static_cast(anAspectIter)) + == theFont->FontFaceId(static_cast(anAspectIter))) { continue; } - else if (theToOverride || !anOldFont->HasFontAspect((Font_FontAspect)anAspectIter)) + else if (theToOverride || !anOldFont->HasFontAspect(static_cast(anAspectIter))) { - anOldFont->SetFontPath((Font_FontAspect)anAspectIter, - theFont->FontPath((Font_FontAspect)anAspectIter), - theFont->FontFaceId((Font_FontAspect)anAspectIter)); + anOldFont->SetFontPath(static_cast(anAspectIter), + theFont->FontPath(static_cast(anAspectIter)), + theFont->FontFaceId(static_cast(anAspectIter))); } - else if (theFont->HasFontAspect((Font_FontAspect)anAspectIter)) + else if (theFont->HasFontAspect(static_cast(anAspectIter))) { return false; } @@ -717,7 +717,7 @@ void Font_FontMgr::InitFontDataBase() break; } - TCollection_AsciiString aPathStr((const char*)aFcFolder); + TCollection_AsciiString aPathStr(reinterpret_cast(aFcFolder)); OSD_Path aPath(aPathStr); addDirsRecursively(aPath, aMapOfFontsDirs); } diff --git a/src/Visualization/TKService/Font/Font_SystemFont.cxx b/src/Visualization/TKService/Font/Font_SystemFont.cxx index 81a02ee679a..d5a9cc00ec0 100644 --- a/src/Visualization/TKService/Font/Font_SystemFont.cxx +++ b/src/Visualization/TKService/Font/Font_SystemFont.cxx @@ -67,7 +67,7 @@ TCollection_AsciiString Font_SystemFont::ToString() const aDesc += " [aspects: "; for (int anAspectIter = 0; anAspectIter < Font_FontAspect_NB; ++anAspectIter) { - if (!HasFontAspect((Font_FontAspect)anAspectIter)) + if (!HasFontAspect(static_cast(anAspectIter))) { continue; } @@ -80,7 +80,7 @@ TCollection_AsciiString Font_SystemFont::ToString() const { isFirstAspect = false; } - aDesc += Font_FontMgr::FontAspectToString((Font_FontAspect)anAspectIter); + aDesc += Font_FontMgr::FontAspectToString(static_cast(anAspectIter)); } aDesc += "]"; @@ -88,7 +88,7 @@ TCollection_AsciiString Font_SystemFont::ToString() const aDesc += " [paths: "; for (int anAspectIter = 0; anAspectIter < Font_FontAspect_NB; ++anAspectIter) { - if (!HasFontAspect((Font_FontAspect)anAspectIter)) + if (!HasFontAspect(static_cast(anAspectIter))) { continue; } @@ -101,10 +101,10 @@ TCollection_AsciiString Font_SystemFont::ToString() const { isFirstAspect = false; } - aDesc += FontPath((Font_FontAspect)anAspectIter); - if (FontFaceId((Font_FontAspect)anAspectIter) != 0) + aDesc += FontPath(static_cast(anAspectIter)); + if (FontFaceId(static_cast(anAspectIter)) != 0) { - aDesc = aDesc + "," + FontFaceId((Font_FontAspect)anAspectIter); + aDesc = aDesc + "," + FontFaceId(static_cast(anAspectIter)); } } aDesc += "]"; diff --git a/src/Visualization/TKService/Font/Font_TextFormatter.cxx b/src/Visualization/TKService/Font/Font_TextFormatter.cxx index e2b645b5e53..d78f4e4c725 100644 --- a/src/Visualization/TKService/Font/Font_TextFormatter.cxx +++ b/src/Visualization/TKService/Font/Font_TextFormatter.cxx @@ -140,7 +140,7 @@ void Font_TextFormatter::Append(const NCollection_String& theString, Font_FTFont else if (aCharThis == '\t') { const int aSpacesNum = (myTabSize - (aSymbolsCounter - 1) % myTabSize); - anAdvanceX = theFont.AdvanceX(' ', aCharNext) * float(aSpacesNum); + anAdvanceX = theFont.AdvanceX(' ', aCharNext) * static_cast(aSpacesNum); aSymbolsCounter += aSpacesNum; } else @@ -299,7 +299,7 @@ void Font_TextFormatter::Format() } else if (myAlignY == Graphic3d_VTA_CENTER) { - myBndTop = 0.5f * (myLineSpacing * float(myLinesNb)); + myBndTop = 0.5f * (myLineSpacing * static_cast(myLinesNb)); } else if (myAlignY == Graphic3d_VTA_TOPFIRSTLINE) { @@ -414,7 +414,7 @@ int Font_TextFormatter::LineIndex(const int theIndex) const return 0; } - return (int)std::abs((BottomLeft(theIndex).y() + myAscender) / myLineSpacing); + return static_cast(std::abs((BottomLeft(theIndex).y() + myAscender) / myLineSpacing)); } //================================================================================================= diff --git a/src/Visualization/TKService/Font/Font_TextFormatter.hxx b/src/Visualization/TKService/Font/Font_TextFormatter.hxx index 5001b5a1605..004bd40b786 100644 --- a/src/Visualization/TKService/Font/Font_TextFormatter.hxx +++ b/src/Visualization/TKService/Font/Font_TextFormatter.hxx @@ -221,7 +221,7 @@ public: inline float ResultWidth() const { return myBndWidth; } //! @return height of formatted text. - inline float ResultHeight() const { return myLineSpacing * float(myLinesNb); } + inline float ResultHeight() const { return myLineSpacing * static_cast(myLinesNb); } //! @return maximum width of the text symbol float MaximumSymbolWidth() const { return myMaxSymbolWidth; } @@ -246,7 +246,7 @@ public: } } theBndBox.Top = myBndTop; - theBndBox.Bottom = theBndBox.Top - myLineSpacing * float(myLinesNb); + theBndBox.Bottom = theBndBox.Top - myLineSpacing * static_cast(myLinesNb); } //! Returns internal container of the top left corners of a formatted rectangles. diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx index 83e4e3dc576..cbe074b7258 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx @@ -134,7 +134,7 @@ void Graphic3d_ArrayOfPrimitives::init(Graphic3d_TypeOfPrimitiveArray theType, { myIndices = new Graphic3d_IndexBuffer(anAlloc); } - if (theMaxVertexs < int(USHRT_MAX)) + if (theMaxVertexs < (USHRT_MAX)) { if (!myIndices->Init(theMaxEdges)) { @@ -192,7 +192,7 @@ void Graphic3d_ArrayOfPrimitives::init(Graphic3d_TypeOfPrimitiveArray theType, memset(myAttribs->ChangeData(), 0, - size_t(myAttribs->Stride) * size_t(myAttribs->NbMaxElements())); + static_cast(myAttribs->Stride) * static_cast(myAttribs->NbMaxElements())); if ((theArrayOptions & Graphic3d_ArrayFlags_AttribsMutable) == 0 && (theArrayOptions & Graphic3d_ArrayFlags_AttribsDeinterleaved) == 0) { diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx index 3e3a6c1af2b..44b0bcc01b0 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx @@ -207,9 +207,9 @@ public: return AddVertex(RealToShortReal(theX), RealToShortReal(theY), RealToShortReal(theZ), - float(theNX), - float(theNY), - float(theNZ)); + static_cast(theNX), + static_cast(theNY), + static_cast(theNZ)); } //! Adds a vertice and vertex normal in the vertex array. @@ -273,8 +273,8 @@ public: return AddVertex(RealToShortReal(theX), RealToShortReal(theY), RealToShortReal(theZ), - float(theTX), - float(theTY)); + static_cast(theTX), + static_cast(theTY)); } //! Adds a vertice and vertex texture coordinates in the vertex array. @@ -324,11 +324,11 @@ public: return AddVertex(RealToShortReal(theX), RealToShortReal(theY), RealToShortReal(theZ), - float(theNX), - float(theNY), - float(theNZ), - float(theTX), - float(theTY)); + static_cast(theNX), + static_cast(theNY), + static_cast(theNZ), + static_cast(theTX), + static_cast(theTY)); } //! Adds a vertice,vertex normal and texture in the vertex array. @@ -356,7 +356,7 @@ public: //! @param[in] theVertex 3D coordinates void SetVertice(const int theIndex, const gp_Pnt& theVertex) { - SetVertice(theIndex, float(theVertex.X()), float(theVertex.Y()), float(theVertex.Z())); + SetVertice(theIndex, static_cast(theVertex.X()), static_cast(theVertex.Y()), static_cast(theVertex.Z())); } //! Change the vertice in the array. @@ -369,7 +369,7 @@ public: Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > myAttribs->NbMaxElements(), "BAD VERTEX index"); NCollection_Vec3& aVec = *reinterpret_cast*>( - myAttribs->ChangeData() + myPosStride * ((size_t)theIndex - 1)); + myAttribs->ChangeData() + myPosStride * (static_cast(theIndex) - 1)); aVec.x() = theX; aVec.y() = theY; aVec.z() = theZ; @@ -399,7 +399,7 @@ public: if (myColData != nullptr) { NCollection_Vec4* aColorPtr = reinterpret_cast*>( - myColData + myColStride * ((size_t)theIndex - 1)); + myColData + myColStride * (static_cast(theIndex) - 1)); aColorPtr->SetValues(static_cast(theR * 255.0), static_cast(theG * 255.0), static_cast(theB * 255.0), @@ -418,7 +418,7 @@ public: if (myColData != nullptr) { NCollection_Vec4* aColorPtr = reinterpret_cast*>( - myColData + myColStride * ((size_t)theIndex - 1)); + myColData + myColStride * (static_cast(theIndex) - 1)); (*aColorPtr) = theColor; } myAttribs->NbElements = (std::max)(theIndex, myAttribs->NbElements); @@ -436,7 +436,7 @@ public: "BAD VERTEX index"); if (myColData != nullptr) { - *reinterpret_cast(myColData + myColStride * ((size_t)theIndex - 1)) = theColor32; + *reinterpret_cast(myColData + myColStride * (static_cast(theIndex) - 1)) = theColor32; } } @@ -463,10 +463,10 @@ public: if (myNormData != nullptr) { NCollection_Vec3& aVec = *reinterpret_cast*>( - myNormData + myNormStride * ((size_t)theIndex - 1)); - aVec.x() = float(theNX); - aVec.y() = float(theNY); - aVec.z() = float(theNZ); + myNormData + myNormStride * (static_cast(theIndex) - 1)); + aVec.x() = static_cast(theNX); + aVec.y() = static_cast(theNY); + aVec.z() = static_cast(theNZ); } myAttribs->NbElements = (std::max)(theIndex, myAttribs->NbElements); } @@ -490,9 +490,9 @@ public: if (myTexData != nullptr) { NCollection_Vec2& aVec = *reinterpret_cast*>( - myTexData + myTexStride * ((size_t)theIndex - 1)); - aVec.x() = float(theTX); - aVec.y() = float(theTY); + myTexData + myTexStride * (static_cast(theIndex) - 1)); + aVec.x() = static_cast(theTX); + aVec.y() = static_cast(theTY); } myAttribs->NbElements = (std::max)(theIndex, myAttribs->NbElements); } @@ -518,10 +518,10 @@ public: Standard_OutOfRange_Raise_if(theRank < 1 || theRank > myAttribs->NbElements, "BAD VERTEX index"); const NCollection_Vec3& aVec = *reinterpret_cast*>( - myAttribs->Data() + myPosStride * ((size_t)theRank - 1)); - theX = double(aVec.x()); - theY = double(aVec.y()); - theZ = double(aVec.z()); + myAttribs->Data() + myPosStride * (static_cast(theRank) - 1)); + theX = static_cast(aVec.x()); + theY = static_cast(aVec.y()); + theZ = static_cast(aVec.z()); } //! Returns the vertex color at rank theRank from the vertex table if defined. @@ -543,7 +543,7 @@ public: || theIndex > myAttribs->NbElements, "BAD VERTEX index"); theColor = *reinterpret_cast*>( - myColData + myColStride * ((size_t)theIndex - 1)); + myColData + myColStride * (static_cast(theIndex) - 1)); } //! Returns the vertex color values from the vertex table if defined. @@ -561,10 +561,10 @@ public: return; } const NCollection_Vec4& aColor = *reinterpret_cast*>( - myColData + myColStride * ((size_t)theRank - 1)); - theR = double(aColor.r()) / 255.0; - theG = double(aColor.g()) / 255.0; - theB = double(aColor.b()) / 255.0; + myColData + myColStride * (static_cast(theRank) - 1)); + theR = static_cast(aColor.r()) / 255.0; + theG = static_cast(aColor.g()) / 255.0; + theB = static_cast(aColor.b()) / 255.0; } //! Returns the vertex color values from the vertex table if defined. @@ -576,7 +576,7 @@ public: "BAD VERTEX index"); if (myColData != nullptr) { - theColor = *reinterpret_cast(myColData + myColStride * ((size_t)theRank - 1)); + theColor = *reinterpret_cast(myColData + myColStride * (static_cast(theRank) - 1)); } } @@ -603,10 +603,10 @@ public: if (myNormData != nullptr) { const NCollection_Vec3& aVec = *reinterpret_cast*>( - myNormData + myNormStride * ((size_t)theRank - 1)); - theNX = double(aVec.x()); - theNY = double(aVec.y()); - theNZ = double(aVec.z()); + myNormData + myNormStride * (static_cast(theRank) - 1)); + theNX = static_cast(aVec.x()); + theNY = static_cast(aVec.y()); + theNZ = static_cast(aVec.z()); } } @@ -632,9 +632,9 @@ public: if (myTexData != nullptr) { const NCollection_Vec2& aVec = *reinterpret_cast*>( - myTexData + myTexStride * ((size_t)theRank - 1)); - theTX = double(aVec.x()); - theTY = double(aVec.y()); + myTexData + myTexStride * (static_cast(theRank) - 1)); + theTX = static_cast(aVec.x()); + theTY = static_cast(aVec.y()); } } @@ -654,7 +654,7 @@ public: //! @name optional array of Indices/Edges for using shared Vertex data Standard_OutOfRange_Raise_if(myIndices.IsNull() || theRank < 1 || theRank > myIndices->NbElements, "BAD EDGE index"); - return int(myIndices->Index(theRank - 1) + 1); + return (myIndices->Index(theRank - 1) + 1); } //! Adds an edge in the range [1,VertexNumber()] in the array. @@ -821,9 +821,9 @@ public: //! @name optional array of Bounds/Subgroups within primitive array (e.g || theRank > myBounds->NbBounds, "BAD BOUND index"); const NCollection_Vec4& aVec = myBounds->Colors[theRank - 1]; - theR = double(aVec.r()); - theG = double(aVec.g()); - theB = double(aVec.b()); + theR = static_cast(aVec.r()); + theG = static_cast(aVec.g()); + theB = static_cast(aVec.b()); } //! Adds a bound of length theEdgeNumber in the bound array @@ -863,9 +863,9 @@ public: //! @name optional array of Bounds/Subgroups within primitive array (e.g || theIndex > myBounds->NbMaxBounds, "BAD BOUND index"); NCollection_Vec4& aVec = myBounds->Colors[theIndex - 1]; - aVec.r() = float(theR); - aVec.g() = float(theG); - aVec.b() = float(theB); + aVec.r() = static_cast(theR); + aVec.g() = static_cast(theG); + aVec.b() = static_cast(theB); aVec.a() = 1.0f; myBounds->NbBounds = (std::max)(theIndex, myBounds->NbBounds); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectFillArea3d.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectFillArea3d.cxx index 8bba5ea926d..ee7dda58a1b 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectFillArea3d.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectFillArea3d.cxx @@ -42,5 +42,5 @@ Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d( myEdgeColor.SetRGB(theEdgeColor); myInteriorStyle = theInteriorStyle; myLineType = theEdgeLineType; - SetEdgeWidth((float)theEdgeLineWidth); + SetEdgeWidth(static_cast(theEdgeLineWidth)); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectLine3d.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectLine3d.cxx index 14d1e3ba7bf..fead1786a9d 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectLine3d.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectLine3d.cxx @@ -36,5 +36,5 @@ Graphic3d_AspectLine3d::Graphic3d_AspectLine3d(const Quantity_Color& theColor, myShadingModel = Graphic3d_TypeOfShadingModel_Unlit; myInteriorColor.SetRGB(theColor); SetLineType(theType); - SetLineWidth((float)theWidth); + SetLineWidth(static_cast(theWidth)); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectLine3d.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectLine3d.hxx index f19fd80a2ac..74615d60b89 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectLine3d.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectLine3d.hxx @@ -52,7 +52,7 @@ public: //! Modifies the line thickness. //! Warning: Raises Standard_OutOfRange if the width is a negative value. - void SetWidth(const double theWidth) { SetWidth((float)theWidth); } + void SetWidth(const double theWidth) { SetWidth(static_cast(theWidth)); } //! Modifies the line thickness. //! Warning: Raises Standard_OutOfRange if the width is a negative value. diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectMarker3d.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectMarker3d.cxx index 444e833bb4c..791661f94c5 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectMarker3d.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectMarker3d.cxx @@ -36,7 +36,7 @@ Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d(const Aspect_TypeOfMarker the myShadingModel = Graphic3d_TypeOfShadingModel_Unlit; myInteriorColor.SetRGB(theColor); myMarkerType = theType; - SetMarkerScale((float)theScale); + SetMarkerScale(static_cast(theScale)); } //================================================================================================= diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectMarker3d.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectMarker3d.hxx index 751076f382b..448faa9eb24 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectMarker3d.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectMarker3d.hxx @@ -58,7 +58,7 @@ public: void SetScale(const float theScale) { SetMarkerScale(theScale); } //! Assign scale factor. - void SetScale(const double theScale) { SetScale((float)theScale); } + void SetScale(const double theScale) { SetScale(static_cast(theScale)); } //! Return marker type. Aspect_TypeOfMarker Type() const { return myMarkerType; } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectText3d.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectText3d.hxx index 9fa09b8849a..26e74cab396 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_AspectText3d.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_AspectText3d.hxx @@ -105,7 +105,7 @@ public: float GetTextAngle() const { return myTextAngle; } //! Turns usage of text rotated - void SetTextAngle(const double theAngle) { myTextAngle = (float)theAngle; } + void SetTextAngle(const double theAngle) { myTextAngle = static_cast(theAngle); } //! Returns text FontAspect Font_FontAspect GetTextFontAspect() const { return myTextFontAspect; } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Aspects.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Aspects.hxx index d0c07c7974a..72fbb381099 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Aspects.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Aspects.hxx @@ -231,7 +231,7 @@ public: const float theFactor = 1.0f, const float theUnits = 0.0f) { - myPolygonOffset.Mode = (Aspect_PolygonOffsetMode)(theMode & Aspect_POM_Mask); + myPolygonOffset.Mode = static_cast(theMode & Aspect_POM_Mask); myPolygonOffset.Factor = theFactor; myPolygonOffset.Units = theUnits; } @@ -423,7 +423,7 @@ public: float TextAngle() const { return myTextAngle; } //! Turns usage of text rotated - void SetTextAngle(float theAngle) { myTextAngle = (float)theAngle; } + void SetTextAngle(float theAngle) { myTextAngle = theAngle; } //! @name parameters specific to Mesh Edges (of triangulation primitive) rendering public: @@ -468,7 +468,7 @@ public: float EdgeWidth() const { return myLineWidth; } //! Modifies the edge thickness (same as SetLineWidth()) - void SetEdgeWidth(double theWidth) { SetLineWidth((float)theWidth); } + void SetEdgeWidth(double theWidth) { SetLineWidth(static_cast(theWidth)); } //! Returns TRUE if drawing element edges should discard first edge in triangle; FALSE by default. //! Graphics hardware works mostly with triangles, so that wireframe presentation will draw diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_AttribBuffer.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_AttribBuffer.cxx index 7bf5bf52f23..3c2ee8c9b74 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_AttribBuffer.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_AttribBuffer.cxx @@ -36,7 +36,7 @@ bool Graphic3d_AttribBuffer::Init(const int theNbElems, return false; } - if (mySize > (size_t)IntegerLast() && myIsMutable) + if (mySize > static_cast(IntegerLast()) && myIsMutable) { throw Standard_OutOfRange("Graphic3d_AttribBuffer::Init(), Mutable flag cannot be used for " "buffer exceeding 32-bit address space"); @@ -48,7 +48,7 @@ bool Graphic3d_AttribBuffer::Init(const int theNbElems, void Graphic3d_AttribBuffer::SetMutable(bool theMutable) { - if (mySize > (size_t)IntegerLast() && theMutable) + if (mySize > static_cast(IntegerLast()) && theMutable) { throw Standard_OutOfRange("Graphic3d_AttribBuffer::SetMutable(), Mutable flag cannot be used " "for buffer exceeding 32-bit address space"); @@ -72,7 +72,7 @@ void Graphic3d_AttribBuffer::SetInterleaved(bool theIsInterleaved) void Graphic3d_AttribBuffer::invalidate(const Graphic3d_BufferRange& theRange) { - if (mySize > (size_t)IntegerLast()) + if (mySize > static_cast(IntegerLast())) { throw Standard_OutOfRange( "Graphic3d_Buffer::Invalidate() cannot be used for buffer exceeding 32-bit address space"); @@ -85,13 +85,13 @@ void Graphic3d_AttribBuffer::invalidate(const Graphic3d_BufferRange& theRange) void Graphic3d_AttribBuffer::Invalidate() { - if (mySize > (size_t)IntegerLast()) + if (mySize > static_cast(IntegerLast())) { throw Standard_OutOfRange("Graphic3d_AttribBuffer::Invalidate() cannot be used for buffer " "exceeding 32-bit address space"); } - invalidate(Graphic3d_BufferRange(0, (int)mySize)); + invalidate(Graphic3d_BufferRange(0, static_cast(mySize))); } //================================================================================================= diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_BSDF.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_BSDF.cxx index 1dd6a47817b..83ca1171446 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_BSDF.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_BSDF.cxx @@ -182,7 +182,7 @@ Graphic3d_BSDF Graphic3d_BSDF::CreateGlass(const NCollection_Vec3& theWei Graphic3d_BSDF Graphic3d_BSDF::CreateMetallicRoughness(const Graphic3d_PBRMaterial& thePbr) { const NCollection_Vec3 aDiff = - (NCollection_Vec3)thePbr.Color().GetRGB() * thePbr.Alpha(); + NCollection_Vec3(thePbr.Color().GetRGB()) * thePbr.Alpha(); const float aRougness2 = thePbr.NormalizedRoughness() * thePbr.NormalizedRoughness(); Graphic3d_BSDF aBsdf; diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Buffer.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Buffer.hxx index b08842a6bcf..63ddaf63e45 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Buffer.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Buffer.hxx @@ -101,12 +101,12 @@ public: //! Return number of initially allocated elements which can fit into this buffer, //! while NbElements can be overwritten to smaller value. - int NbMaxElements() const { return Stride != 0 ? int(mySize / size_t(Stride)) : 0; } + int NbMaxElements() const { return Stride != 0 ? static_cast(mySize / static_cast(Stride)) : 0; } //! @return array of attributes definitions const Graphic3d_Attribute* AttributesArray() const { - return (Graphic3d_Attribute*)(myData + mySize); + return reinterpret_cast(myData + mySize); } //! @return attribute definition @@ -118,7 +118,7 @@ public: //! @return attribute definition Graphic3d_Attribute& ChangeAttribute(const int theAttribIndex) { - return *((Graphic3d_Attribute*)(myData + mySize) + theAttribIndex); + return *(reinterpret_cast(myData + mySize) + theAttribIndex); } //! Find attribute index. @@ -160,10 +160,10 @@ public: uint8_t* ChangeData(const int theAttribIndex) { return myData + AttributeOffset(theAttribIndex); } //! Access specified element. - inline const uint8_t* value(const int theElem) const { return myData + Stride * size_t(theElem); } + inline const uint8_t* value(const int theElem) const { return myData + Stride * static_cast(theElem); } //! Access specified element. - inline uint8_t* changeValue(const int theElem) { return myData + Stride * size_t(theElem); } + inline uint8_t* changeValue(const int theElem) { return myData + Stride * static_cast(theElem); } //! Access element with specified position and type. template @@ -193,7 +193,7 @@ public: int& theAttribIndex, size_t& theAttribStride) { - return (uint8_t*)AttributeData(theAttrib, theAttribIndex, theAttribStride); + return const_cast(AttributeData(theAttrib, theAttribIndex, theAttribStride)); } //! Return the attribute data with stride size specific to this attribute. @@ -272,7 +272,7 @@ public: NbAttributes = theNbAttribs; if (NbElements != 0) { - const size_t aDataSize = size_t(Stride) * size_t(NbElements); + const size_t aDataSize = static_cast(Stride) * static_cast(NbElements); if (!Allocate(aDataSize + sizeof(Graphic3d_Attribute) * NbAttributes)) { release(); diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_CView.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_CView.cxx index 3d0e00c2657..bdf000aae91 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_CView.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_CView.cxx @@ -238,11 +238,11 @@ static int getSubViewOffset(double theOffset, int theWinSize) { if (theOffset >= 1.0) { - return int(theOffset); + return static_cast(theOffset); } else { - return int(theOffset * theWinSize); + return static_cast(theOffset * theWinSize); } } @@ -259,11 +259,11 @@ void Graphic3d_CView::SubviewResized(const occ::handle& th NCollection_Vec2 aViewSize(NCollection_Vec2(aWinSize) * mySubviewSize); if (mySubviewSize.x() > 1.0) { - aViewSize.x() = (int)mySubviewSize.x(); + aViewSize.x() = static_cast(mySubviewSize.x()); } if (mySubviewSize.y() > 1.0) { - aViewSize.y() = (int)mySubviewSize.y(); + aViewSize.y() = static_cast(mySubviewSize.y()); } NCollection_Vec2 anOffset(getSubViewOffset(mySubviewOffset.x(), aWinSize.x()), @@ -1455,8 +1455,8 @@ void Graphic3d_CView::DiagnosticInformation( TCollection_AsciiString aDisplay = TCollection_AsciiString() + myXRSession->RecommendedViewport().x() + "x" + myXRSession->RecommendedViewport().y() + "@" - + (int)std::round(myXRSession->DisplayFrequency()) - + " [FOVy: " + (int)std::round(myXRSession->FieldOfView()) + "]"; + + static_cast(std::round(myXRSession->DisplayFrequency())) + + " [FOVy: " + static_cast(std::round(myXRSession->FieldOfView())) + "]"; theDict.ChangeFromIndex(theDict.Add("VRvendor", aVendor)) = aVendor; theDict.ChangeFromIndex(theDict.Add("VRdevice", aDevice)) = aDevice; diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Camera.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Camera.cxx index 0baecce533d..8473dc244a9 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Camera.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Camera.cxx @@ -51,7 +51,7 @@ static double zEpsilon() static double zEpsilon(const double theValue) { double anAbsValue = std::abs(theValue); - if (anAbsValue <= (double)FLT_MIN) + if (anAbsValue <= static_cast(FLT_MIN)) { return FLT_MIN; } @@ -588,7 +588,7 @@ gp_Pnt Graphic3d_Camera::Project(const gp_Pnt& thePnt) const aPnt = aViewMx * aPnt; // convert to view coordinate space aPnt = aProjMx * aPnt; // convert to projection coordinate space - const double aInvW = 1.0 / double(aPnt.w()); + const double aInvW = 1.0 / static_cast(aPnt.w()); return gp_Pnt(aPnt.x() * aInvW, aPnt.y() * aInvW, aPnt.z() * aInvW); } @@ -615,7 +615,7 @@ gp_Pnt Graphic3d_Camera::UnProject(const gp_Pnt& thePnt) const aPnt = aInvProj * aPnt; // convert to view coordinate space aPnt = aInvView * aPnt; // convert to world coordinate space - const double aInvW = 1.0 / double(aPnt.w()); + const double aInvW = 1.0 / static_cast(aPnt.w()); return gp_Pnt(aPnt.x() * aInvW, aPnt.y() * aInvW, aPnt.z() * aInvW); } @@ -631,7 +631,7 @@ gp_Pnt Graphic3d_Camera::ConvertView2Proj(const gp_Pnt& thePnt) const aPnt = aProjMx * aPnt; // convert to projection coordinate space - const double aInvW = 1.0 / double(aPnt.w()); + const double aInvW = 1.0 / static_cast(aPnt.w()); return gp_Pnt(aPnt.x() * aInvW, aPnt.y() * aInvW, aPnt.z() * aInvW); } @@ -655,7 +655,7 @@ gp_Pnt Graphic3d_Camera::ConvertProj2View(const gp_Pnt& thePnt) const aPnt = aInvProj * aPnt; // convert to view coordinate space - const double aInvW = 1.0 / double(aPnt.w()); + const double aInvW = 1.0 / static_cast(aPnt.w()); return gp_Pnt(aPnt.x() * aInvW, aPnt.y() * aInvW, aPnt.z() * aInvW); } @@ -671,7 +671,7 @@ gp_Pnt Graphic3d_Camera::ConvertWorld2View(const gp_Pnt& thePnt) const aPnt = aViewMx * aPnt; // convert to view coordinate space - const double aInvW = 1.0 / double(aPnt.w()); + const double aInvW = 1.0 / static_cast(aPnt.w()); return gp_Pnt(aPnt.x() * aInvW, aPnt.y() * aInvW, aPnt.z() * aInvW); } @@ -694,7 +694,7 @@ gp_Pnt Graphic3d_Camera::ConvertView2World(const gp_Pnt& thePnt) const aPnt = aInvView * aPnt; // convert to world coordinate space - const double aInvW = 1.0 / double(aPnt.w()); + const double aInvW = 1.0 / static_cast(aPnt.w()); return gp_Pnt(aPnt.x() * aInvW, aPnt.y() * aInvW, aPnt.z() * aInvW); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_ClipPlane.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_ClipPlane.hxx index eb38b55dfce..43f54019826 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_ClipPlane.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_ClipPlane.hxx @@ -195,7 +195,7 @@ public: // @name user-defined graphical attributes //! @return hatching style. Aspect_HatchStyle CappingHatch() const { - return (Aspect_HatchStyle)myAspect->HatchStyle()->HatchType(); + return static_cast(myAspect->HatchStyle()->HatchType()); } //! Set custom hatch style (stipple) and turn hatching on. diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_CubeMapPacked.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_CubeMapPacked.cxx index e03c23bf6c3..f82e96e138a 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_CubeMapPacked.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_CubeMapPacked.cxx @@ -59,7 +59,7 @@ occ::handle Graphic3d_CubeMapPacked::CompressedValue( { const unsigned int aTileIndex = myOrder[myCurrentSide]; occ::handle anImage = - Image_DDSParser::Load(theSupported, aFilePath, (int)aTileIndex); + Image_DDSParser::Load(theSupported, aFilePath, static_cast(aTileIndex)); if (!anImage.IsNull() && anImage->NbFaces() == 6 && anImage->SizeX() == anImage->SizeY()) { myIsTopDown = anImage->IsTopDown(); diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_CubeMapSeparate.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_CubeMapSeparate.cxx index 522f72caa13..3923ccd913a 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_CubeMapSeparate.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_CubeMapSeparate.cxx @@ -115,7 +115,7 @@ occ::handle Graphic3d_CubeMapSeparate::CompressedValue( return anImage; } - if (anImage->BaseFormat() == myFormat && anImage->SizeX() == (int)mySize) + if (anImage->BaseFormat() == myFormat && anImage->SizeX() == static_cast(mySize)) { return anImage; } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStats.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStats.cxx index 5fc0d833d10..e5ad104ee47 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStats.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStats.cxx @@ -33,17 +33,17 @@ static std::ostream& formatCounter(std::ostream& theStream, theStream << std::setfill(' ') << std::setw(theWidth); if (theValue >= 1000000000) { - double aValM = double(theValue) / 1000000000.0; + double aValM = static_cast(theValue) / 1000000000.0; theStream << std::fixed << std::setprecision(1) << aValM << "G"; } else if (theValue >= 1000000) { - double aValM = double(theValue) / 1000000.0; + double aValM = static_cast(theValue) / 1000000.0; theStream << std::fixed << std::setprecision(1) << aValM << "M"; } else if (theValue >= 1000) { - double aValK = double(theValue) / 1000.0; + double aValK = static_cast(theValue) / 1000.0; theStream << std::fixed << std::setprecision(1) << aValK << "k"; } else @@ -92,17 +92,17 @@ static std::ostream& formatBytes(std::ostream& theStream, theStream << std::setfill(' ') << std::setw(theWidth); if (theValue >= 1024 * 1024 * 1024) { - double aValM = double(theValue) / (1024.0 * 1024.0 * 1024.0); + double aValM = static_cast(theValue) / (1024.0 * 1024.0 * 1024.0); theStream << std::fixed << std::setprecision(1) << aValM << " GiB"; } else if (theValue >= 1024 * 1024) { - double aValM = double(theValue) / (1024.0 * 1024.0); + double aValM = static_cast(theValue) / (1024.0 * 1024.0); theStream << std::fixed << std::setprecision(1) << aValM << " MiB"; } else if (theValue >= 1024) { - double aValK = double(theValue) / 1024.0; + double aValK = static_cast(theValue) / 1024.0; theStream << std::fixed << std::setprecision(1) << aValK << " KiB"; } else @@ -137,12 +137,12 @@ static std::ostream& formatTime(std::ostream& theStream, } double aSecIn = theSeconds; - unsigned int aHours = (unsigned int)(aSecIn * THE_SECOND_IN_HOUR); - aSecIn -= double(aHours) * THE_SECONDS_IN_HOUR; - unsigned int aMinutes = (unsigned int)(aSecIn * THE_SECOND_IN_MINUTE); - aSecIn -= double(aMinutes) * THE_SECONDS_IN_MINUTE; - unsigned int aSeconds = (unsigned int)aSecIn; - aSecIn -= double(aSeconds); + unsigned int aHours = static_cast(aSecIn * THE_SECOND_IN_HOUR); + aSecIn -= static_cast(aHours) * THE_SECONDS_IN_HOUR; + unsigned int aMinutes = static_cast(aSecIn * THE_SECOND_IN_MINUTE); + aSecIn -= static_cast(aMinutes) * THE_SECONDS_IN_MINUTE; + unsigned int aSeconds = static_cast(aSecIn); + aSecIn -= static_cast(aSeconds); double aMilliSeconds = 1000.0 * aSecIn; char aBuffer[64]; @@ -213,12 +213,12 @@ static void addTimeInfo( double theSeconds) { double aSecIn = theSeconds; - unsigned int aHours = (unsigned int)(aSecIn * THE_SECOND_IN_HOUR); - aSecIn -= double(aHours) * THE_SECONDS_IN_HOUR; - unsigned int aMinutes = (unsigned int)(aSecIn * THE_SECOND_IN_MINUTE); - aSecIn -= double(aMinutes) * THE_SECONDS_IN_MINUTE; - unsigned int aSeconds = (unsigned int)aSecIn; - aSecIn -= double(aSeconds); + unsigned int aHours = static_cast(aSecIn * THE_SECOND_IN_HOUR); + aSecIn -= static_cast(aHours) * THE_SECONDS_IN_HOUR; + unsigned int aMinutes = static_cast(aSecIn * THE_SECOND_IN_MINUTE); + aSecIn -= static_cast(aMinutes) * THE_SECONDS_IN_MINUTE; + unsigned int aSeconds = static_cast(aSecIn); + aSecIn -= static_cast(aSeconds); double aMilliSeconds = 1000.0 * aSecIn; char aBuffer[64]; @@ -745,9 +745,9 @@ void Graphic3d_FrameStats::FrameEnd(const occ::handle& theView, if (theIsImmediateOnly) { - myCountersTmp.ChangeImmediateFrameRate() = double(myFpsFrameCount) / aTime; + myCountersTmp.ChangeImmediateFrameRate() = static_cast(myFpsFrameCount) / aTime; myCountersTmp.ChangeImmediateFrameRateCpu() = - aCpuSec > gp::Resolution() ? double(myFpsFrameCount) / aCpuSec : -1.0; + aCpuSec > gp::Resolution() ? static_cast(myFpsFrameCount) / aCpuSec : -1.0; myCountersTmp.ChangeFrameRate() = aPrevFrame.FrameRate(); myCountersTmp.ChangeFrameRateCpu() = aPrevFrame.FrameRateCpu(); } @@ -755,9 +755,9 @@ void Graphic3d_FrameStats::FrameEnd(const occ::handle& theView, { myCountersTmp.ChangeImmediateFrameRate() = -1.0; myCountersTmp.ChangeImmediateFrameRateCpu() = -1.0; - myCountersTmp.ChangeFrameRate() = double(myFpsFrameCount) / aTime; + myCountersTmp.ChangeFrameRate() = static_cast(myFpsFrameCount) / aTime; myCountersTmp.ChangeFrameRateCpu() = - aCpuSec > gp::Resolution() ? double(myFpsFrameCount) / aCpuSec : -1.0; + aCpuSec > gp::Resolution() ? static_cast(myFpsFrameCount) / aCpuSec : -1.0; } myCountersTmp.FlushTimers(myFpsFrameCount, true); myCountersMax.FillMax(myCountersTmp); @@ -794,8 +794,8 @@ void Graphic3d_FrameStats::FrameEnd(const occ::handle& theView, <= Graphic3d_FrameStatsCounter_RENDERED_UPPER; ++aCntIter) { - myCountersTmp.ChangeCounterValue((Graphic3d_FrameStatsCounter)(aCntIter + anImmShift)) = - myCountersTmp.CounterValue((Graphic3d_FrameStatsCounter)aCntIter); + myCountersTmp.ChangeCounterValue(static_cast(aCntIter + anImmShift)) = + myCountersTmp.CounterValue(static_cast(aCntIter)); } // copy main rendered counters from previous non-immediate frame @@ -803,8 +803,8 @@ void Graphic3d_FrameStats::FrameEnd(const occ::handle& theView, aCntIter <= Graphic3d_FrameStatsCounter_RENDERED_UPPER; ++aCntIter) { - myCountersTmp.ChangeCounterValue((Graphic3d_FrameStatsCounter)aCntIter) = - aPrevFrame.CounterValue((Graphic3d_FrameStatsCounter)aCntIter); + myCountersTmp.ChangeCounterValue(static_cast(aCntIter)) = + aPrevFrame.CounterValue(static_cast(aCntIter)); } myCountersTmp.ChangeCounterValue(Graphic3d_FrameStatsCounter_EstimatedBytesGeom) = aPrevFrame.CounterValue(Graphic3d_FrameStatsCounter_EstimatedBytesGeom); diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStatsData.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStatsData.cxx index 94c41c8f966..bb397e763ce 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStatsData.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStatsData.cxx @@ -146,7 +146,7 @@ void Graphic3d_FrameStatsDataTmp::FlushTimers(size_t theNbFrames, bool theIsFina if (theIsFinal) { - const double aNbFrames = (double)theNbFrames; + const double aNbFrames = static_cast(theNbFrames); for (size_t aTimerIter = 0; aTimerIter < myTimers.size(); ++aTimerIter) { myTimers[aTimerIter] /= aNbFrames; diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Group.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Group.cxx index aefc4f52479..0ee42209446 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Group.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Group.cxx @@ -161,12 +161,12 @@ void Graphic3d_Group::MinMaxValues(double& theXMin, { const NCollection_Vec4& aMinPt = myBounds.CornerMin(); const NCollection_Vec4& aMaxPt = myBounds.CornerMax(); - theXMin = double(aMinPt.x()); - theYMin = double(aMinPt.y()); - theZMin = double(aMinPt.z()); - theXMax = double(aMaxPt.x()); - theYMax = double(aMaxPt.y()); - theZMax = double(aMaxPt.z()); + theXMin = static_cast(aMinPt.x()); + theYMin = static_cast(aMinPt.y()); + theZMin = static_cast(aMinPt.z()); + theXMax = static_cast(aMaxPt.x()); + theYMax = static_cast(aMaxPt.y()); + theZMax = static_cast(aMaxPt.z()); } else { @@ -283,7 +283,7 @@ void Graphic3d_Group::Text(const char* const theText, const Graphic3d_VerticalTextAlignment theVta, const bool theToEvalMinMax) { - occ::handle aText = new Graphic3d_Text((float)theHeight); + occ::handle aText = new Graphic3d_Text(static_cast(theHeight)); aText->SetText(theText); aText->SetPosition(gp_Pnt(thePoint.X(), thePoint.Y(), thePoint.Z())); aText->SetHorizontalAlignment(theHta); @@ -298,7 +298,7 @@ void Graphic3d_Group::Text(const char* const theText, const double theHeight, const bool theToEvalMinMax) { - occ::handle aText = new Graphic3d_Text((float)theHeight); + occ::handle aText = new Graphic3d_Text(static_cast(theHeight)); aText->SetText(theText); aText->SetPosition(gp_Pnt(thePoint.X(), thePoint.Y(), thePoint.Z())); AddText(aText, theToEvalMinMax); @@ -315,7 +315,7 @@ void Graphic3d_Group::Text(const TCollection_ExtendedString& theText, const Graphic3d_VerticalTextAlignment theVta, const bool theToEvalMinMax) { - occ::handle aText = new Graphic3d_Text((float)theHeight); + occ::handle aText = new Graphic3d_Text(static_cast(theHeight)); aText->SetText(theText.ToExtString()); aText->SetPosition(gp_Pnt(thePoint.X(), thePoint.Y(), thePoint.Z())); aText->SetHorizontalAlignment(theHta); @@ -335,7 +335,7 @@ void Graphic3d_Group::Text(const TCollection_ExtendedString& theText, const bool theToEvalMinMax, const bool theHasOwnAnchor) { - occ::handle aText = new Graphic3d_Text((float)theHeight); + occ::handle aText = new Graphic3d_Text(static_cast(theHeight)); aText->SetText(theText.ToExtString()); aText->SetOrientation(theOrientation); aText->SetOwnAnchorPoint(theHasOwnAnchor); @@ -356,7 +356,7 @@ void Graphic3d_Group::Text(const char* const theText, const bool theToEvalMinMax, const bool theHasOwnAnchor) { - occ::handle aText = new Graphic3d_Text((float)theHeight); + occ::handle aText = new Graphic3d_Text(static_cast(theHeight)); aText->SetText(theText); aText->SetOrientation(theOrientation); aText->SetOwnAnchorPoint(theHasOwnAnchor); @@ -372,7 +372,7 @@ void Graphic3d_Group::Text(const TCollection_ExtendedString& theText, const double theHeight, const bool theToEvalMinMax) { - occ::handle aText = new Graphic3d_Text((float)theHeight); + occ::handle aText = new Graphic3d_Text(static_cast(theHeight)); aText->SetText(theText.ToExtString()); aText->SetPosition(gp_Pnt(thePoint.X(), thePoint.Y(), thePoint.Z())); AddText(aText, theToEvalMinMax); @@ -393,9 +393,9 @@ void Graphic3d_Group::AddText(const occ::handle& theTextParams, myStructure->CStructure()->Is2dText = !theTextParams->HasPlane(); gp_Pnt aPosition = theTextParams->Position(); - myBounds.Add(NCollection_Vec4((float)aPosition.X(), - (float)aPosition.Y(), - (float)aPosition.Z(), + myBounds.Add(NCollection_Vec4(static_cast(aPosition.X()), + static_cast(aPosition.Y()), + static_cast(aPosition.Z()), 1.0f)); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx index 66f47be7e9a..5e299a6519b 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx @@ -117,7 +117,7 @@ const uint8_t* Graphic3d_HatchStyle::Pattern() const { return !myPattern.IsNull() ? myPattern->Data() - : (myHatchType < Aspect_HS_NB ? (const uint8_t*)myPredefinedPatterns[myHatchType] + : (myHatchType < Aspect_HS_NB ? reinterpret_cast(myPredefinedPatterns[myHatchType]) : nullptr); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_IndexBuffer.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_IndexBuffer.hxx index 13d3accb826..5208713cd03 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_IndexBuffer.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_IndexBuffer.hxx @@ -40,7 +40,7 @@ public: NbElements = theNbElems; NbAttributes = 0; - if (NbElements != 0 && !Allocate(size_t(Stride) * size_t(NbElements))) + if (NbElements != 0 && !Allocate(static_cast(Stride) * static_cast(NbElements))) { release(); return false; @@ -54,8 +54,8 @@ public: //! Access index at specified position int Index(const int theIndex) const { - return Stride == sizeof(unsigned short) ? int(Value(theIndex)) - : int(Value(theIndex)); + return Stride == sizeof(unsigned short) ? static_cast(Value(theIndex)) + : static_cast(Value(theIndex)); } //! Change index at specified position @@ -63,11 +63,11 @@ public: { if (Stride == sizeof(unsigned short)) { - ChangeValue(theIndex) = (unsigned short)theValue; + ChangeValue(theIndex) = static_cast(theValue); } else { - ChangeValue(theIndex) = (unsigned int)theValue; + ChangeValue(theIndex) = static_cast(theValue); } } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Layer.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Layer.cxx index 7f6b70c8192..8506bf546da 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Layer.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Layer.cxx @@ -122,7 +122,7 @@ bool Graphic3d_Layer::Remove(const Graphic3d_CStructure* theStruct, } } --myNbStructures; - thePriority = (Graphic3d_DisplayPriority)aPriorityIter; + thePriority = static_cast(aPriorityIter); return true; } @@ -708,7 +708,7 @@ bool Graphic3d_Layer::Append(const Graphic3d_Layer& theOther) aStructIter.More(); aStructIter.Next()) { - Add(aStructIter.Value(), (Graphic3d_DisplayPriority)aPriorityIter); + Add(aStructIter.Value(), static_cast(aPriorityIter)); } } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx index 5cf510d87fd..c92f61f6f5a 100755 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx @@ -54,10 +54,10 @@ static void getMarkerBitMapParam(const Aspect_TypeOfMarker theMarkerType, int& theOffset, int& theNumOfBytes) { - const int aType = int(theMarkerType > Aspect_TOM_O ? Aspect_TOM_O : theMarkerType); - const double anIndex = (double)(TEL_NO_OF_SIZES - 1) * (theScale - (double)TEL_PM_START_SIZE) - / (double)(TEL_PM_END_SIZE - TEL_PM_START_SIZE); - int anId = (int)(anIndex + 0.5); + const int aType = static_cast(theMarkerType > Aspect_TOM_O ? Aspect_TOM_O : theMarkerType); + const double anIndex = static_cast(TEL_NO_OF_SIZES - 1) * (theScale - TEL_PM_START_SIZE) + / (TEL_PM_END_SIZE - TEL_PM_START_SIZE); + int anId = static_cast(anIndex + 0.5); if (anId < 0) { anId = 0; @@ -67,8 +67,8 @@ static void getMarkerBitMapParam(const Aspect_TypeOfMarker theMarkerType, anId = TEL_NO_OF_SIZES - 1; } - theWidth = (int)arrPMFontInfo[aType][anId].width; - theHeight = (int)arrPMFontInfo[aType][anId].height; + theWidth = static_cast(arrPMFontInfo[aType][anId].width); + theHeight = static_cast(arrPMFontInfo[aType][anId].height); theOffset = arrPMFontInfo[aType][anId].offset; const int aNumOfBytesInRow = theWidth / 8 + (theWidth % 8 ? 1 : 0); theNumOfBytes = theHeight * aNumOfBytesInRow; @@ -90,15 +90,15 @@ static occ::handle mergeImages(const occ::handle& th int aWidth1 = 0, aHeight1 = 0; if (!theImage1.IsNull()) { - aWidth1 = (int)theImage1->Width(); - aHeight1 = (int)theImage1->Height(); + aWidth1 = static_cast(theImage1->Width()); + aHeight1 = static_cast(theImage1->Height()); } int aWidth2 = 0, aHeight2 = 0; if (!theImage2.IsNull()) { - aWidth2 = (int)theImage2->Width(); - aHeight2 = (int)theImage2->Height(); + aWidth2 = static_cast(theImage2->Width()); + aHeight2 = static_cast(theImage2->Height()); } const int aMaxWidth = std::max(aWidth1, aWidth2); @@ -178,8 +178,8 @@ Graphic3d_MarkerImage::Graphic3d_MarkerImage(const occ::handle& th : myImage(theImage), myImageAlpha(theImageAlpha), myMargin(1), - myWidth((int)theImage->Width()), - myHeight((int)theImage->Height()) + myWidth(static_cast(theImage->Width())), + myHeight(static_cast(theImage->Height())) { myImageId = TCollection_AsciiString("Graphic3d_MarkerImage_") + TCollection_AsciiString(++THE_MARKER_IMAGE_COUNTER); @@ -212,8 +212,8 @@ Graphic3d_MarkerImage::Graphic3d_MarkerImage(const TCollection_AsciiString& th myImage(theImage), myImageAlpha(theImageAlpha), myMargin(1), - myWidth((int)theImage->Width()), - myHeight((int)theImage->Height()) + myWidth(static_cast(theImage->Width())), + myHeight(static_cast(theImage->Height())) { if (!theImageAlpha.IsNull()) { @@ -266,10 +266,10 @@ occ::handle> Graphic3d_MarkerImage::GetBitMapArray( return myBitMap; } - const int aNumOfBytesInRow = (int)(myImage->Width() / 8) + (myImage->Width() % 8 ? 1 : 0); - const int aNumOfBytes = (int)(aNumOfBytesInRow * myImage->Height()); - const int aHeight = (int)myImage->Height(); - const int aWidth = (int)myImage->Width(); + const int aNumOfBytesInRow = static_cast(myImage->Width() / 8) + (myImage->Width() % 8 ? 1 : 0); + const int aNumOfBytes = static_cast(aNumOfBytesInRow * myImage->Height()); + const int aHeight = static_cast(myImage->Height()); + const int aWidth = static_cast(myImage->Width()); occ::handle> aBitMap = new NCollection_HArray1(0, aNumOfBytes - 1); aBitMap->Init(0); @@ -292,7 +292,7 @@ occ::handle> Graphic3d_MarkerImage::GetBitMapArray( int anIndex = aNumOfBytesInRow * aResRow + aColumn / 8; aBitMap->SetValue( anIndex, - (uint8_t)(aBitMap->Value(anIndex) + (aBitOn ? (0x80 >> (aColumn % 8)) : 0))); + static_cast(aBitMap->Value(anIndex) + (aBitOn ? (0x80 >> (aColumn % 8)) : 0))); } } @@ -359,7 +359,7 @@ const occ::handle& Graphic3d_MarkerImage::GetImageAlpha() uint8_t* anImageRow = myImageAlpha->ChangeRow(aRowIter); for (size_t aColumnIter = 0; aColumnIter < myImage->Width(); aColumnIter++) { - const Quantity_ColorRGBA aColor = myImage->PixelColor((int)aColumnIter, (int)aRowIter); + const Quantity_ColorRGBA aColor = myImage->PixelColor(static_cast(aColumnIter), static_cast(aRowIter)); anImageRow[aColumnIter] = static_cast(255.0 * aColor.Alpha()); } } @@ -404,16 +404,16 @@ occ::handle Graphic3d_MarkerImage::StandardMarker( } // predefined markers are defined with 0.5 step - const int aScaleInt = int(theScale * 10.0f + 0.5f); + const int aScaleInt = static_cast(theScale * 10.0f + 0.5f); TCollection_AsciiString aKey = TCollection_AsciiString("Graphic3d_MarkerImage_") + THE_MARKER_NAMES[theMarkerType] + "_" + aScaleInt; TCollection_AsciiString aKeyA = TCollection_AsciiString("Graphic3d_MarkerImageAlpha_") + THE_MARKER_NAMES[theMarkerType] + "_" + aScaleInt; if (theMarkerType == Aspect_TOM_BALL) { - unsigned int aColor[3] = {(unsigned int)(255.0f * theColor.r()), - (unsigned int)(255.0f * theColor.g()), - (unsigned int)(255.0f * theColor.b())}; + unsigned int aColor[3] = {static_cast(255.0f * theColor.r()), + static_cast(255.0f * theColor.g()), + static_cast(255.0f * theColor.b())}; char aBytes[8]; Sprintf(aBytes, "%02X%02X%02X", aColor[0], aColor[1], aColor[2]); aKey += aBytes; @@ -432,7 +432,7 @@ occ::handle Graphic3d_MarkerImage::StandardMarker( if (theMarkerType == Aspect_TOM_O_POINT) { // draw inner point as filled rectangle - const int aSize = theScale > 7 ? 7 : (int)(theScale + 0.5F); + const int aSize = theScale > 7 ? 7 : static_cast(theScale + 0.5F); occ::handle> aBitMap = fillPointBitmap(aSize); aMarkerImage2 = new Graphic3d_MarkerImage(aBitMap, aSize, aSize); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_MaterialAspect.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_MaterialAspect.cxx index f699f507490..7c80a4254b3 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_MaterialAspect.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_MaterialAspect.cxx @@ -556,8 +556,8 @@ void Graphic3d_MaterialAspect::SetColor(const Quantity_Color& theColor) myPBRMaterial.SetColor(theColor); const RawMaterial& aSrcMat = THE_MATERIALS[myRequestedMaterialName]; - const Quantity_Color anAmbient((NCollection_Vec3)theColor * aSrcMat.AmbientCoef); - const Quantity_Color aDiffuse((NCollection_Vec3)theColor * aSrcMat.DiffuseCoef); + const Quantity_Color anAmbient(NCollection_Vec3(theColor) * aSrcMat.AmbientCoef); + const Quantity_Color aDiffuse(NCollection_Vec3(theColor) * aSrcMat.DiffuseCoef); if (myMaterialName != Graphic3d_NameOfMaterial_UserDefined && (!myColors[Graphic3d_TOR_AMBIENT].IsEqual(anAmbient) || !myColors[Graphic3d_TOR_DIFFUSE].IsEqual(aDiffuse))) diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_MediaTexture.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_MediaTexture.cxx index 5aad8ed74c0..3ed5eed5d4d 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_MediaTexture.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_MediaTexture.cxx @@ -46,7 +46,7 @@ Graphic3d_MediaTexture::Graphic3d_MediaTexture(std::mutex& theMutex, int thePlan myParams->SetModulate(false); myParams->SetRepeat(false); myParams->SetFilter(Graphic3d_TOTF_BILINEAR); - myParams->SetTextureUnit(Graphic3d_TextureUnit(int(Graphic3d_TextureUnit_0) + thePlane)); + myParams->SetTextureUnit(Graphic3d_TextureUnit(static_cast(Graphic3d_TextureUnit_0) + thePlane)); } //================================================================================================= diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_MutableIndexBuffer.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_MutableIndexBuffer.hxx index 43e67c7750a..d698622601f 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_MutableIndexBuffer.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_MutableIndexBuffer.hxx @@ -37,7 +37,7 @@ public: void Validate() override { myInvalidatedRange.Clear(); } //! Invalidate the entire buffer data. - void Invalidate() override { invalidate(Graphic3d_BufferRange(0, (int)mySize)); } + void Invalidate() override { invalidate(Graphic3d_BufferRange(0, static_cast(mySize))); } //! Invalidate the given indexes (starting from 0) void Invalidate(int theIndexLower, int theIndexUpper) diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.cxx index 78d855eed6d..a0df2bf5cee 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.cxx @@ -32,7 +32,7 @@ float Graphic3d_PBRMaterial::RoughnessFromSpecular(const Quantity_Color& theSpec // low specular intensity should produce a rough material even if shininess is high aRoughnessFactor *= (1.0 - aSpecIntens); } - return (float)aRoughnessFactor; + return static_cast(aRoughnessFactor); } //================================================================================================= @@ -184,11 +184,11 @@ void Graphic3d_PBRMaterial::GenerateEnvLUT(const occ::handle& theL for (unsigned int y = 0; y < theLUT->SizeY(); ++y) { - float aRoughness = Roughness(y / float(theLUT->SizeY() - 1)); + float aRoughness = Roughness(y / static_cast(theLUT->SizeY() - 1)); for (unsigned int x = 0; x < theLUT->SizeX(); ++x) { - float aCosV = x / float(theLUT->SizeX() - 1); + float aCosV = x / static_cast(theLUT->SizeX() - 1); NCollection_Vec3 aView = lutGenView(aCosV); NCollection_Vec2 aResult = NCollection_Vec2(0.f); for (unsigned int i = 0; i < theNbIntegralSamples; ++i) @@ -210,7 +210,7 @@ void Graphic3d_PBRMaterial::GenerateEnvLUT(const occ::handle& theL } } - aResult = aResult / float(theNbIntegralSamples); + aResult = aResult / static_cast(theNbIntegralSamples); theLUT->ChangeValue>(theLUT->SizeY() - 1 - y, x) = aResult; } } @@ -220,7 +220,7 @@ void Graphic3d_PBRMaterial::GenerateEnvLUT(const occ::handle& theL float Graphic3d_PBRMaterial::SpecIBLMapSamplesFactor(float theProbability, float theRoughness) { - return acosf(lutGenImportanceSampleCosTheta(theProbability, theRoughness)) * 2.f / float(M_PI); + return acosf(lutGenImportanceSampleCosTheta(theProbability, theRoughness)) * 2.f / static_cast(M_PI); } //================================================================================================= @@ -248,10 +248,10 @@ NCollection_Vec2 Graphic3d_PBRMaterial::lutGenHammersley(unsigned int the { break; } - aPhi2 += ((theNumber >> i) & 1) / float(1 << (i + 1)); + aPhi2 += ((theNumber >> i) & 1) / static_cast(1 << (i + 1)); } - return NCollection_Vec2(theNumber / float(theCount), aPhi2); + return NCollection_Vec2(theNumber / static_cast(theCount), aPhi2); } //================================================================================================= @@ -280,7 +280,7 @@ NCollection_Vec3 Graphic3d_PBRMaterial::lutGenImportanceSample( const NCollection_Vec2& theHammerslayPoint, float theRoughness) { - float aPhi = 2.f * float(M_PI) * theHammerslayPoint.y(); + float aPhi = 2.f * static_cast(M_PI) * theHammerslayPoint.y(); float aCosTheta = lutGenImportanceSampleCosTheta(theHammerslayPoint.x(), theRoughness); float aSinTheta = sqrtf(1.f - aCosTheta * aCosTheta); diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.hxx index 414b05b4618..7786cea1f5d 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.hxx @@ -123,7 +123,7 @@ public: //! @return metallicity within [0..1] range static float MetallicFromSpecular(const Quantity_Color& theSpecular) { - return ((NCollection_Vec3)theSpecular).maxComp(); + return (NCollection_Vec3(theSpecular)).maxComp(); } public: diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx index 1ad92ac2b9b..860b402a1be 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx @@ -57,7 +57,7 @@ occ::handle Graphic3d_ShaderObject::CreateFromFile( } aFile.Open(OSD_ReadOnly, OSD_Protection()); - aFile.Read(aShader->mySource, (int)aFile.Size()); + aFile.Read(aShader->mySource, static_cast(aFile.Size())); aFile.Close(); return aShader; @@ -122,7 +122,7 @@ occ::handle Graphic3d_ShaderObject::CreateFromSource( { const ShaderVariable& aVar = aVarListIter.Value(); int aStageLower = IntegerLast(), aStageUpper = IntegerFirst(); - for (int aStageIter = Graphic3d_TOS_VERTEX; aStageIter <= (int)Graphic3d_TOS_COMPUTE; + for (int aStageIter = Graphic3d_TOS_VERTEX; aStageIter <= static_cast(Graphic3d_TOS_COMPUTE); aStageIter = aStageIter << 1) { if ((aVar.Stages & aStageIter) != 0) @@ -131,7 +131,7 @@ occ::handle Graphic3d_ShaderObject::CreateFromSource( aStageUpper = std::max(aStageUpper, aStageIter); } } - if ((int)theType < aStageLower || (int)theType > aStageUpper) + if (static_cast(theType) < aStageLower || static_cast(theType) > aStageUpper) { continue; } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.cxx index a3ad9a28880..b3aae1506cd 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.cxx @@ -724,12 +724,12 @@ void Graphic3d_Structure::getBox(Graphic3d_BndBox3d& theBox, Graphic3d_BndBox4f aBoxF = minMaxCoord(); if (aBoxF.IsValid()) { - theBox = Graphic3d_BndBox3d(NCollection_Vec3((double)aBoxF.CornerMin().x(), - (double)aBoxF.CornerMin().y(), - (double)aBoxF.CornerMin().z()), - NCollection_Vec3((double)aBoxF.CornerMax().x(), - (double)aBoxF.CornerMax().y(), - (double)aBoxF.CornerMax().z())); + theBox = Graphic3d_BndBox3d(NCollection_Vec3(static_cast(aBoxF.CornerMin().x()), + static_cast(aBoxF.CornerMin().y()), + static_cast(aBoxF.CornerMin().z())), + NCollection_Vec3(static_cast(aBoxF.CornerMax().x()), + static_cast(aBoxF.CornerMax().y()), + static_cast(aBoxF.CornerMax().z()))); if (IsInfinite() && !theToIgnoreInfiniteFlag) { const NCollection_Vec3 aDiagVec = theBox.CornerMax() - theBox.CornerMin(); diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.hxx index 6d80b0e2943..411a27d56c6 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.hxx @@ -87,7 +87,7 @@ public: "instead of integer number to SetDisplayPriority()") void SetDisplayPriority(const int thePriority) { - SetDisplayPriority((Graphic3d_DisplayPriority)thePriority); + SetDisplayPriority(static_cast(thePriority)); } //! Reset the current priority of the structure to the previous priority. diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Texture3D.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Texture3D.cxx index 5a2bf498b58..5abb4d60a24 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Texture3D.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Texture3D.cxx @@ -96,7 +96,7 @@ occ::handle Graphic3d_Texture3D::GetImage( anImage->SizeRowBytes())) { Message::SendFail() << "Graphic3d_Texture3D::GetImage() failed to allocate 3D image " - << (int)anImage->SizeX() << "x" << (int)anImage->SizeY() << "x" + << static_cast(anImage->SizeX()) << "x" << static_cast(anImage->SizeY()) << "x" << aNbSlices; return occ::handle(); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_TextureSetBits.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_TextureSetBits.hxx index 9a652f14311..9d26eac30b9 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_TextureSetBits.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_TextureSetBits.hxx @@ -20,12 +20,12 @@ enum Graphic3d_TextureSetBits { Graphic3d_TextureSetBits_NONE = 0, - Graphic3d_TextureSetBits_BaseColor = (unsigned int)(1 << int(Graphic3d_TextureUnit_BaseColor)), - Graphic3d_TextureSetBits_Emissive = (unsigned int)(1 << int(Graphic3d_TextureUnit_Emissive)), - Graphic3d_TextureSetBits_Occlusion = (unsigned int)(1 << int(Graphic3d_TextureUnit_Occlusion)), - Graphic3d_TextureSetBits_Normal = (unsigned int)(1 << int(Graphic3d_TextureUnit_Normal)), + Graphic3d_TextureSetBits_BaseColor = static_cast(1 << static_cast(Graphic3d_TextureUnit_BaseColor)), + Graphic3d_TextureSetBits_Emissive = static_cast(1 << static_cast(Graphic3d_TextureUnit_Emissive)), + Graphic3d_TextureSetBits_Occlusion = static_cast(1 << static_cast(Graphic3d_TextureUnit_Occlusion)), + Graphic3d_TextureSetBits_Normal = static_cast(1 << static_cast(Graphic3d_TextureUnit_Normal)), Graphic3d_TextureSetBits_MetallicRoughness = - (unsigned int)(1 << int(Graphic3d_TextureUnit_MetallicRoughness)), + static_cast(1 << static_cast(Graphic3d_TextureUnit_MetallicRoughness)), }; #endif // _Graphic3d_TextureSetBits_HeaderFile diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_TransformPers.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_TransformPers.hxx index 7094786e7b0..e9b57946cd5 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_TransformPers.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_TransformPers.hxx @@ -271,7 +271,7 @@ public: gp_Pnt(myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ)); const double aFocus = aVecToObj.Dot(aVecToEye); const gp_XYZ aViewDim = theCamera->ViewDimensions(aFocus); - return std::abs(aViewDim.Y()) / double(aVPSizeY); + return std::abs(aViewDim.Y()) / static_cast(aVPSizeY); } //! Create orientation matrix based on camera and view dimensions. @@ -395,18 +395,18 @@ public: const double aFocus = aProxyCamera->IsOrthographic() ? aProxyCamera->Distance() : (aProxyCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative - ? double(aProxyCamera->ZFocus() * aProxyCamera->Distance()) - : double(aProxyCamera->ZFocus())); + ? (aProxyCamera->ZFocus() * aProxyCamera->Distance()) + : (aProxyCamera->ZFocus())); // scale factor to pixels const gp_XYZ aViewDim = aProxyCamera->ViewDimensions(aFocus); - const double aScale = std::abs(aViewDim.Y()) / double(aVPSizeY); + const double aScale = std::abs(aViewDim.Y()) / static_cast(aVPSizeY); const gp_Dir aForward = aProxyCamera->Direction(); gp_XYZ aCenter = aProxyCamera->Center().XYZ() + aForward.XYZ() * (aFocus - aProxyCamera->Distance()); if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0) { - const double anOffsetX = (double(myParams.Params2d.OffsetX) + aJitterComp) * aScale; + const double anOffsetX = (static_cast(myParams.Params2d.OffsetX) + aJitterComp) * aScale; const gp_Dir aSide = aForward.Crossed(aProxyCamera->Up()); const gp_XYZ aDeltaX = aSide.XYZ() * (std::abs(aViewDim.X()) * aProxyCamera->NDC2dOffsetX() - anOffsetX); @@ -421,7 +421,7 @@ public: } if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0) { - const double anOffsetY = (double(myParams.Params2d.OffsetY) + aJitterComp) * aScale; + const double anOffsetY = (static_cast(myParams.Params2d.OffsetY) + aJitterComp) * aScale; const gp_XYZ aDeltaY = aProxyCamera->Up().XYZ() * (std::abs(aViewDim.Y()) * aProxyCamera->NDC2dOffsetY() - anOffsetY); @@ -446,17 +446,17 @@ public: const double aFocus = aProxyCamera->IsOrthographic() ? aProxyCamera->Distance() : (aProxyCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative - ? double(aProxyCamera->ZFocus() * aProxyCamera->Distance()) - : double(aProxyCamera->ZFocus())); + ? (aProxyCamera->ZFocus() * aProxyCamera->Distance()) + : (aProxyCamera->ZFocus())); // scale factor to pixels const gp_XYZ aViewDim = aProxyCamera->ViewDimensions(aFocus); - const double aScale = std::abs(aViewDim.Y()) / double(aVPSizeY); + const double aScale = std::abs(aViewDim.Y()) / static_cast(aVPSizeY); gp_XYZ aCenter(0.0, 0.0, -aFocus); if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0) { aCenter.SetX(-aViewDim.X() * aProxyCamera->NDC2dOffsetX() - + (double(myParams.Params2d.OffsetX) + aJitterComp) * aScale); + + (static_cast(myParams.Params2d.OffsetX) + aJitterComp) * aScale); if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0) { aCenter.SetX(-aCenter.X()); @@ -465,7 +465,7 @@ public: if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0) { aCenter.SetY(-aViewDim.Y() * aProxyCamera->NDC2dOffsetY() - + (double(myParams.Params2d.OffsetY) + aJitterComp) * aScale); + + (static_cast(myParams.Params2d.OffsetY) + aJitterComp) * aScale); if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0) { aCenter.SetY(-aCenter.Y()); diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Vertex.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Vertex.hxx index 5557110211d..a0e7857f360 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Vertex.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Vertex.hxx @@ -54,9 +54,9 @@ public: //! Modifies the coordinates. void SetCoord(const double theX, const double theY, const double theZ) { - xyz[0] = float(theX); - xyz[1] = float(theY); - xyz[2] = float(theZ); + xyz[0] = static_cast(theX); + xyz[1] = static_cast(theY); + xyz[2] = static_cast(theZ); } //! Returns the coordinates. diff --git a/src/Visualization/TKService/Image/Image_AlienPixMap.cxx b/src/Visualization/TKService/Image/Image_AlienPixMap.cxx index 238efdcc421..e3759cec559 100644 --- a/src/Visualization/TKService/Image/Image_AlienPixMap.cxx +++ b/src/Visualization/TKService/Image/Image_AlienPixMap.cxx @@ -1026,7 +1026,7 @@ bool Image_AlienPixMap::savePPM(const TCollection_AsciiString& theFileName) cons } // Write header - fprintf(aFile, "P6\n%d %d\n255\n", (int)SizeX(), (int)SizeY()); + fprintf(aFile, "P6\n%d %d\n255\n", static_cast(SizeX()), static_cast(SizeY())); // Write pixel data uint8_t aByte; @@ -1035,7 +1035,7 @@ bool Image_AlienPixMap::savePPM(const TCollection_AsciiString& theFileName) cons for (size_t aCol = 0; aCol < SizeX(); ++aCol) { // extremely SLOW but universal (implemented for all supported pixel formats) - const Quantity_ColorRGBA aColor = PixelColor((int)aCol, (int)aRow); + const Quantity_ColorRGBA aColor = PixelColor(static_cast(aCol), static_cast(aRow)); aByte = static_cast(aColor.GetRGB().Red() * 255.0); fwrite(&aByte, 1, 1, aFile); aByte = static_cast(aColor.GetRGB().Green() * 255.0); diff --git a/src/Visualization/TKService/Image/Image_DDSParser.cxx b/src/Visualization/TKService/Image/Image_DDSParser.cxx index a75a4a1c386..89beea78b02 100644 --- a/src/Visualization/TKService/Image/Image_DDSParser.cxx +++ b/src/Visualization/TKService/Image/Image_DDSParser.cxx @@ -82,16 +82,16 @@ occ::handle Image_DDSParser::Load( } if (theFileOffset != 0) { - aFile->seekg((std::streamoff)theFileOffset, std::ios::beg); + aFile->seekg(static_cast(theFileOffset), std::ios::beg); } aFile->read(aHeader, 128); - size_t aNbReadBytes = (size_t)aFile->gcount(); + size_t aNbReadBytes = static_cast(aFile->gcount()); if (aNbReadBytes < 128 || ::memcmp(aHeader, "DDS ", 4) != 0) { return occ::handle(); } - occ::handle aDef = parseHeader(*(const DDSFileHeader*)(aHeader + 4)); + occ::handle aDef = parseHeader(*reinterpret_cast(aHeader + 4)); if (aDef.IsNull()) { return occ::handle(); @@ -117,12 +117,12 @@ occ::handle Image_DDSParser::Load( const size_t anOffset = aDef->FaceBytes() * theFaceIndex; if (anOffset != 0) { - aFile->seekg((std::streamoff)anOffset, std::ios::cur); + aFile->seekg(static_cast(anOffset), std::ios::cur); } occ::handle aBuffer = new NCollection_Buffer(Image_PixMap::DefaultAllocator(), aDef->FaceBytes()); - aFile->read((char*)aBuffer->ChangeData(), aDef->FaceBytes()); - aNbReadBytes = (size_t)aFile->gcount(); + aFile->read(reinterpret_cast(aBuffer->ChangeData()), aDef->FaceBytes()); + aNbReadBytes = static_cast(aFile->gcount()); if (aNbReadBytes < aDef->FaceBytes()) { Message::SendFail(TCollection_AsciiString("DDS Reader error - unable to read face #") @@ -146,7 +146,7 @@ occ::handle Image_DDSParser::Load( } occ::handle aDef = - parseHeader(*(const DDSFileHeader*)(theBuffer->Data() + 4)); + parseHeader(*reinterpret_cast(theBuffer->Data() + 4)); if (aDef.IsNull()) { return occ::handle(); @@ -223,12 +223,12 @@ occ::handle Image_DDSParser::parseHeader(const DDSFileHe } occ::handle aDef = new Image_CompressedPixMap(); - aDef->SetSize((int)theHeader.Width, (int)theHeader.Height); + aDef->SetSize(static_cast(theHeader.Width), static_cast(theHeader.Height)); aDef->SetNbFaces(theHeader.IscompleteCubemap() != 0 ? 6 : 1); aDef->SetBaseFormat(aBaseFormat); aDef->SetCompressedFormat(aFormat); - const int aNbMipMaps = std::max((int)theHeader.MipMapCount, 1); + const int aNbMipMaps = std::max(static_cast(theHeader.MipMapCount), 1); aDef->ChangeMipMaps().Resize(0, aNbMipMaps - 1, false); { size_t aFaceSize = 0; diff --git a/src/Visualization/TKService/Image/Image_Diff.cxx b/src/Visualization/TKService/Image/Image_Diff.cxx index dcb5ad2d7a9..9949d4750af 100644 --- a/src/Visualization/TKService/Image/Image_Diff.cxx +++ b/src/Visualization/TKService/Image/Image_Diff.cxx @@ -53,7 +53,7 @@ static bool isBlackPixel(const Image_PixMap& theData, size_t theY, size_t theX) return aColor[0] == 0 && aColor[1] == 0 && aColor[2] == 0; } default: { - const Quantity_ColorRGBA aPixelRgba = theData.PixelColor((int)theY, (int)theX); + const Quantity_ColorRGBA aPixelRgba = theData.PixelColor(static_cast(theY), static_cast(theX)); const NCollection_Vec4& aPixel = aPixelRgba; return aPixel.r() == 0.0f && aPixel.g() == 0.0f && aPixel.b() == 0.0f; } @@ -152,16 +152,16 @@ int Image_Diff::Compare() case Image_Format_Gray: case Image_Format_Alpha: { // Tolerance of comparison operation for color - const int aDiffThreshold = int(255.0 * myColorTolerance); + const int aDiffThreshold = static_cast(255.0 * myColorTolerance); for (size_t aRow = 0; aRow < myImageRef->SizeY(); ++aRow) { for (size_t aCol = 0; aCol < myImageRef->SizeX(); ++aCol) { - const int aDiff = int(myImageNew->Value(aRow, aCol)) - - int(myImageRef->Value(aRow, aCol)); + const int aDiff = static_cast(myImageNew->Value(aRow, aCol)) + - static_cast(myImageRef->Value(aRow, aCol)); if (std::abs(aDiff) > aDiffThreshold) { - myDiffPixels.Append(PackXY((uint16_t)aCol, (uint16_t)aRow)); + myDiffPixels.Append(PackXY(static_cast(aCol), static_cast(aRow))); ++aNbDiffColors; } } @@ -176,7 +176,7 @@ int Image_Diff::Compare() case Image_Format_BGRA: { // Tolerance of comparison operation for color // Maximum difference between colors (white - black) = 100% - const int aDiffThreshold = int(255.0 * myColorTolerance); + const int aDiffThreshold = static_cast(255.0 * myColorTolerance); // we don't care about RGB/BGR/RGBA/BGRA/RGB32/BGR32 differences // because we just compute summ of r g b components @@ -187,14 +187,14 @@ int Image_Diff::Compare() // compute Chebyshev distance between two colors const uint8_t* aColorRef = myImageRef->RawValue(aRow, aCol); const uint8_t* aColorNew = myImageNew->RawValue(aRow, aCol); - const int aDiff = NCollection_Vec3(int(aColorRef[0]) - int(aColorNew[0]), - int(aColorRef[1]) - int(aColorNew[1]), - int(aColorRef[2]) - int(aColorNew[2])) + const int aDiff = NCollection_Vec3(static_cast(aColorRef[0]) - static_cast(aColorNew[0]), + static_cast(aColorRef[1]) - static_cast(aColorNew[1]), + static_cast(aColorRef[2]) - static_cast(aColorNew[2])) .cwiseAbs() .maxComp(); if (aDiff > aDiffThreshold) { - myDiffPixels.Append(PackXY((uint16_t)aCol, (uint16_t)aRow)); + myDiffPixels.Append(PackXY(static_cast(aCol), static_cast(aRow))); ++aNbDiffColors; } } @@ -204,20 +204,20 @@ int Image_Diff::Compare() default: { // Tolerance of comparison operation for color // Maximum difference between colors (white - black) = 100% - const float aDiffThreshold = float(myColorTolerance); + const float aDiffThreshold = static_cast(myColorTolerance); for (size_t aRow = 0; aRow < myImageRef->SizeY(); ++aRow) { for (size_t aCol = 0; aCol < myImageRef->SizeX(); ++aCol) { // compute Chebyshev distance between two colors - const Quantity_ColorRGBA aPixel1Rgba = myImageRef->PixelColor(int(aCol), int(aRow)); - const Quantity_ColorRGBA aPixel2Rgba = myImageNew->PixelColor(int(aCol), int(aRow)); + const Quantity_ColorRGBA aPixel1Rgba = myImageRef->PixelColor(static_cast(aCol), static_cast(aRow)); + const Quantity_ColorRGBA aPixel2Rgba = myImageNew->PixelColor(static_cast(aCol), static_cast(aRow)); const NCollection_Vec3& aPixel1 = aPixel1Rgba.GetRGB(); const NCollection_Vec3& aPixel2 = aPixel2Rgba.GetRGB(); const float aDiff = (aPixel2 - aPixel1).cwiseAbs().maxComp(); if (aDiff > aDiffThreshold) { - myDiffPixels.Append(PackXY((uint16_t)aCol, (uint16_t)aRow)); + myDiffPixels.Append(PackXY(static_cast(aCol), static_cast(aRow))); ++aNbDiffColors; } } @@ -404,8 +404,8 @@ int Image_Diff::ignoreBorderEffect() for (int aPixelId2 = aPixelId1 + 1; aPixelId2 < myDiffPixels.Length(); ++aPixelId2) { int aValue2 = myDiffPixels.Value(aPixelId2); - if (std::abs(int(UnpackX(aValue1)) - int(UnpackX(aValue2))) <= 1 - && std::abs(int(UnpackY(aValue1)) - int(UnpackY(aValue2))) <= 1) + if (std::abs(static_cast(UnpackX(aValue1)) - static_cast(UnpackX(aValue2))) <= 1 + && std::abs(static_cast(UnpackY(aValue1)) - static_cast(UnpackY(aValue2))) <= 1) { // A neighbour is found. Create a new group and add both pixels. if (myGroupsOfDiffPixels.IsEmpty()) @@ -474,9 +474,9 @@ int Image_Diff::ignoreBorderEffect() { int anX = UnpackX(aDiffPixel) + Image_Diff_NEIGHBOR_PIXELS[aNgbrIter][0]; int anY = UnpackY(aDiffPixel) + Image_Diff_NEIGHBOR_PIXELS[aNgbrIter][1]; - if (size_t(anX) < myImageRef->SizeX() // this unsigned math checks size_t(-1) at-once - && size_t(anY) < myImageRef->SizeY() - && aGroup->Map().Contains(PackXY((uint16_t)anX, (uint16_t)anY))) + if (static_cast(anX) < myImageRef->SizeX() // this unsigned math checks size_t(-1) at-once + && static_cast(anY) < myImageRef->SizeY() + && aGroup->Map().Contains(PackXY(static_cast(anX), static_cast(anY)))) { ++aNeighboursNb; } @@ -500,9 +500,9 @@ int Image_Diff::ignoreBorderEffect() { int anX = UnpackX(aDiffPixel) + Image_Diff_NEIGHBOR_PIXELS[aNgbrIter][0]; int anY = UnpackY(aDiffPixel) + Image_Diff_NEIGHBOR_PIXELS[aNgbrIter][1]; - if (size_t(anX) < myImageRef->SizeX() // this unsigned math checks size_t(-1) at-once - && size_t(anY) < myImageRef->SizeY() - && !isBlackPixel(*myImageRef, size_t(anY), size_t(anX))) + if (static_cast(anX) < myImageRef->SizeX() // this unsigned math checks size_t(-1) at-once + && static_cast(anY) < myImageRef->SizeY() + && !isBlackPixel(*myImageRef, static_cast(anY), static_cast(anX))) { ++aNeighboursNb; } diff --git a/src/Visualization/TKService/Image/Image_Diff.hxx b/src/Visualization/TKService/Image/Image_Diff.hxx index 6af5d3ee935..d51b12764b0 100644 --- a/src/Visualization/TKService/Image/Image_Diff.hxx +++ b/src/Visualization/TKService/Image/Image_Diff.hxx @@ -119,17 +119,17 @@ protected: //! Map two pixel coordinates to 32-bit integer static int PackXY(uint16_t theX, uint16_t theY) { - return int((unsigned int)theY | ((unsigned int)theX << 16)); + return static_cast(static_cast(theY) | (static_cast(theX) << 16)); } //! Get pixel X coordinate from 32-bit packed integer static uint16_t UnpackX(int theXY) { - return (uint16_t)(((unsigned int)theXY & 0xffff0000) >> 16); + return static_cast((static_cast(theXY) & 0xffff0000) >> 16); } //! Get pixel Y coordinate from 32-bit packed integer - static uint16_t UnpackY(int theXY) { return (uint16_t)((unsigned int)theXY & 0xffff); } + static uint16_t UnpackY(int theXY) { return static_cast(static_cast(theXY) & 0xffff); } protected: occ::handle myImageRef; //!< reference image to compare (from) diff --git a/src/Visualization/TKService/Image/Image_PixMap.cxx b/src/Visualization/TKService/Image/Image_PixMap.cxx index 1fc5fa58f66..43ef73e3763 100644 --- a/src/Visualization/TKService/Image/Image_PixMap.cxx +++ b/src/Visualization/TKService/Image/Image_PixMap.cxx @@ -37,7 +37,7 @@ struct Image_FormatInfo : Name(theName), Format(theFormat), NbComponents(theNbComponents), - PixelSize((unsigned int)thePixelSize) + PixelSize(static_cast(thePixelSize)) { } @@ -48,7 +48,7 @@ struct Image_FormatInfo : Name(theName), Format(theFormat), NbComponents(theNbComponents), - PixelSize((unsigned int)thePixelSize) + PixelSize(static_cast(thePixelSize)) { } }; @@ -250,7 +250,7 @@ bool Image_PixMap::InitZero3D(Image_Format thePixelFormat, return false; } } - memset(myData.ChangeData(), (int)theValue, SizeBytes()); + memset(myData.ChangeData(), static_cast(theValue), SizeBytes()); return true; } @@ -363,92 +363,92 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel(const uint8_t* theRawValu const Image_ColorRGBA& aPixel = *reinterpret_cast(theRawValue); return theToLinearize ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.b()) / 255.0f), - float(aPixel.a()) / 255.0f) - : Quantity_ColorRGBA(float(aPixel.r()) / 255.0f, - float(aPixel.g()) / 255.0f, - float(aPixel.b()) / 255.0f, - float(aPixel.a()) / 255.0f); + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), + static_cast(aPixel.a()) / 255.0f) + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, + static_cast(aPixel.a()) / 255.0f); } case Image_Format_BGRA: { const Image_ColorBGRA& aPixel = *reinterpret_cast(theRawValue); return theToLinearize ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.b()) / 255.0f), - float(aPixel.a()) / 255.0f) - : Quantity_ColorRGBA(float(aPixel.r()) / 255.0f, - float(aPixel.g()) / 255.0f, - float(aPixel.b()) / 255.0f, - float(aPixel.a()) / 255.0f); + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), + static_cast(aPixel.a()) / 255.0f) + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, + static_cast(aPixel.a()) / 255.0f); } case Image_Format_RGB32: { const Image_ColorRGB32& aPixel = *reinterpret_cast(theRawValue); return theToLinearize ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.b()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), 1.0f) - : Quantity_ColorRGBA(float(aPixel.r()) / 255.0f, - float(aPixel.g()) / 255.0f, - float(aPixel.b()) / 255.0f, + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, 1.0f); } case Image_Format_BGR32: { const Image_ColorBGR32& aPixel = *reinterpret_cast(theRawValue); return theToLinearize ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.b()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), 1.0f) - : Quantity_ColorRGBA(float(aPixel.r()) / 255.0f, - float(aPixel.g()) / 255.0f, - float(aPixel.b()) / 255.0f, + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, 1.0f); } case Image_Format_RGB: { const Image_ColorRGB& aPixel = *reinterpret_cast(theRawValue); return theToLinearize ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.b()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), 1.0f) - : Quantity_ColorRGBA(float(aPixel.r()) / 255.0f, - float(aPixel.g()) / 255.0f, - float(aPixel.b()) / 255.0f, + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, 1.0f); } case Image_Format_BGR: { const Image_ColorBGR& aPixel = *reinterpret_cast(theRawValue); return theToLinearize ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(float(aPixel.b()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), 1.0f) - : Quantity_ColorRGBA(float(aPixel.r()) / 255.0f, - float(aPixel.g()) / 255.0f, - float(aPixel.b()) / 255.0f, + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, 1.0f); } case Image_Format_Gray: { const uint8_t& aPixel = *reinterpret_cast(theRawValue); - const float anIntensity = float(aPixel) / 255.0f; + const float anIntensity = static_cast(aPixel) / 255.0f; return Quantity_ColorRGBA(anIntensity, anIntensity, anIntensity, 1.0f); // opaque } case Image_Format_Alpha: { const uint8_t& aPixel = *reinterpret_cast(theRawValue); - return Quantity_ColorRGBA(1.0f, 1.0f, 1.0f, float(aPixel) / 255.0f); + return Quantity_ColorRGBA(1.0f, 1.0f, 1.0f, static_cast(aPixel) / 255.0f); } case Image_Format_Gray16: { const uint16_t& aPixel = *reinterpret_cast(theRawValue); - const float anIntensity = float(aPixel) / 65535.0f; + const float anIntensity = static_cast(aPixel) / 65535.0f; return Quantity_ColorRGBA(anIntensity, anIntensity, anIntensity, 1.0f); // opaque } case Image_Format_UNKNOWN: { @@ -662,7 +662,7 @@ void Image_PixMap::ColorToRawPixel(uint8_t* theRawValue, return; } case Image_Format_Gray16: { - *reinterpret_cast(theRawValue) = uint16_t(aColor.r() * 65535.0f); + *reinterpret_cast(theRawValue) = static_cast(aColor.r() * 65535.0f); return; } case Image_Format_UNKNOWN: { diff --git a/src/Visualization/TKService/Image/Image_PixMap.hxx b/src/Visualization/TKService/Image/Image_PixMap.hxx index 0f602692af9..97f43171fa3 100644 --- a/src/Visualization/TKService/Image/Image_PixMap.hxx +++ b/src/Visualization/TKService/Image/Image_PixMap.hxx @@ -122,7 +122,7 @@ public: // high-level API } //! Return width / height. - double Ratio() const { return (SizeY() > 0) ? (double(SizeX()) / double(SizeY())) : 1.0; } + double Ratio() const { return (SizeY() > 0) ? (static_cast(SizeX()) / static_cast(SizeY())) : 1.0; } //! Return true if data is NULL. bool IsEmpty() const { return myData.IsEmpty(); } @@ -143,7 +143,7 @@ public: // high-level API //! @return the pixel color Quantity_ColorRGBA PixelColor(int theX, int theY, bool theToLinearize = false) const { - if (IsEmpty() || theX < 0 || (size_t)theX >= SizeX() || theY < 0 || (size_t)theY >= SizeY()) + if (IsEmpty() || theX < 0 || static_cast(theX) >= SizeX() || theY < 0 || static_cast(theY) >= SizeY()) { return Quantity_ColorRGBA(0.0f, 0.0f, 0.0f, 0.0f); // transparent } @@ -181,7 +181,7 @@ public: // high-level API const Quantity_ColorRGBA& theColor, const bool theToDeLinearize = false) { - if (IsEmpty() || theX < 0 || size_t(theX) >= SizeX() || theY < 0 || size_t(theY) >= SizeY()) + if (IsEmpty() || theX < 0 || static_cast(theX) >= SizeX() || theY < 0 || static_cast(theY) >= SizeY()) { return; } @@ -456,7 +456,7 @@ public: const uint32_t e = (theHalf & 0x7C00) >> 10; // exponent const uint32_t m = (theHalf & 0x03FF) << 13; // mantissa FloatUint32 mf, aRes; - mf.Float32 = (float)m; + mf.Float32 = static_cast(m); // clang-format off const uint32_t v = mf.UInt32 >> 23; // evil log2 bit hack to count leading zeros in denormalized format aRes.UInt32 = (theHalf & 0x8000)<<16 | (e != 0) * ((e + 112) << 23 | m) | ((e == 0) & (m != 0)) * ((v - 37) << 23 | ((m << (150 - v)) & 0x007FE000)); // sign : normalized : denormalized @@ -479,7 +479,7 @@ public: const uint32_t b = anInput.UInt32 + 0x00001000; // round-to-nearest-even: add last bit after truncated mantissa const uint32_t e = (b & 0x7F800000) >> 23; // exponent const uint32_t m = b & 0x007FFFFF; // mantissa; in line below: 0x007FF000 = 0x00800000-0x00001000 = decimal indicator flag - initial rounding - return (uint16_t)((b & 0x80000000) >> 16 | (e > 112) * ((((e - 112) << 10) & 0x7C00) | m >> 13) + return static_cast((b & 0x80000000) >> 16 | (e > 112) * ((((e - 112) << 10) & 0x7C00) | m >> 13) | ((e < 113) & (e > 101)) * ((((0x007FF000 + m) >> (125 - e)) + 1) >> 1) | (e > 143) * 0x7FFF); // sign : normalized : denormalized : saturate // clang-format on } diff --git a/src/Visualization/TKService/Image/Image_PixMapData.hxx b/src/Visualization/TKService/Image/Image_PixMapData.hxx index 04277b5d3cf..759d64c09df 100644 --- a/src/Visualization/TKService/Image/Image_PixMapData.hxx +++ b/src/Visualization/TKService/Image/Image_PixMapData.hxx @@ -34,7 +34,7 @@ public: SizeZ(0), SizeRowBytes(0), SizeSliceBytes(0), - TopToDown(size_t(-1)) + TopToDown(static_cast(-1)) { // } @@ -92,75 +92,75 @@ public: //! Return data pointer to requested row (first column). const uint8_t* Row(const size_t theRow) const { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown); + return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown); } //! Return data pointer to requested row (first column). uint8_t* ChangeRow(const size_t theRow) { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown); + return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown); } //! Return data pointer to requested position. const uint8_t* Value(const size_t theRow, const size_t theCol) const { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol; + return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol; } //! Return data pointer to requested position. uint8_t* ChangeValue(size_t theRow, size_t theCol) { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol; + return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol; } //! Return data pointer to requested position. const uint8_t* ValueXY(size_t theX, size_t theY) const { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theY * TopToDown) + SizeBPP * theX; + return myTopRowPtr + static_cast(SizeRowBytes * theY * TopToDown) + SizeBPP * theX; } //! Return data pointer to requested position. uint8_t* ChangeValueXY(size_t theX, size_t theY) { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theY * TopToDown) + SizeBPP * theX; + return myTopRowPtr + static_cast(SizeRowBytes * theY * TopToDown) + SizeBPP * theX; } public: //! Return data pointer to requested 2D slice. const uint8_t* Slice(size_t theSlice) const { - return myData + ptrdiff_t(SizeSliceBytes * theSlice); + return myData + static_cast(SizeSliceBytes * theSlice); } //! Return data pointer to requested 2D slice. - uint8_t* ChangeSlice(size_t theSlice) { return myData + ptrdiff_t(SizeSliceBytes * theSlice); } + uint8_t* ChangeSlice(size_t theSlice) { return myData + static_cast(SizeSliceBytes * theSlice); } //! Return data pointer to requested row (first column). const uint8_t* SliceRow(size_t theSlice, size_t theRow) const { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) - + ptrdiff_t(SizeSliceBytes * theSlice); + return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown) + + static_cast(SizeSliceBytes * theSlice); } //! Return data pointer to requested row (first column). uint8_t* ChangeSliceRow(size_t theSlice, size_t theRow) { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) - + ptrdiff_t(SizeSliceBytes * theSlice); + return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown) + + static_cast(SizeSliceBytes * theSlice); } //! Return data pointer to requested position. const uint8_t* ValueXYZ(size_t theX, size_t theY, size_t theZ) const { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theY * TopToDown) + SizeBPP * theX - + ptrdiff_t(SizeSliceBytes * theZ); + return myTopRowPtr + static_cast(SizeRowBytes * theY * TopToDown) + SizeBPP * theX + + static_cast(SizeSliceBytes * theZ); } //! Return data pointer to requested position. uint8_t* ChangeValueXYZ(size_t theX, size_t theY, size_t theZ) { - return myTopRowPtr + ptrdiff_t(SizeRowBytes * theY * TopToDown) + SizeBPP * theX - + ptrdiff_t(SizeSliceBytes * theZ); + return myTopRowPtr + static_cast(SizeRowBytes * theY * TopToDown) + SizeBPP * theX + + static_cast(SizeSliceBytes * theZ); } //! Compute the maximal row alignment for current row size. @@ -183,7 +183,7 @@ public: //! @param theIsTopDown top-down flag void SetTopDown(const bool theIsTopDown) { - TopToDown = (theIsTopDown ? 1 : size_t(-1)); + TopToDown = (theIsTopDown ? 1 : static_cast(-1)); myTopRowPtr = ((TopToDown == 1 || myData == nullptr) ? myData : (myData + SizeRowBytes * (SizeY - 1))); } diff --git a/src/Visualization/TKService/Image/Image_Texture.cxx b/src/Visualization/TKService/Image/Image_Texture.cxx index 0e004cf02e9..648199a8bc2 100644 --- a/src/Visualization/TKService/Image/Image_Texture.cxx +++ b/src/Visualization/TKService/Image/Image_Texture.cxx @@ -145,14 +145,14 @@ occ::handle Image_Texture::loadImageBuffer( { return occ::handle(); } - else if (theBuffer->Size() > (size_t)IntegerLast()) + else if (theBuffer->Size() > static_cast(IntegerLast())) { Message::SendFail(TCollection_AsciiString("Error: Image file size is too big '") + theId + "'"); return occ::handle(); } occ::handle anImage = new Image_AlienPixMap(); - if (!anImage->Load(theBuffer->Data(), (int)theBuffer->Size(), theId)) + if (!anImage->Load(theBuffer->Data(), static_cast(theBuffer->Size()), theId)) { return occ::handle(); } @@ -181,7 +181,7 @@ occ::handle Image_Texture::loadImageOffset(const TCollection_Ascii + "' cannot be opened"); return occ::handle(); } - aFile->seekg((std::streamoff)theOffset, std::ios_base::beg); + aFile->seekg(static_cast(theOffset), std::ios_base::beg); if (!aFile->good()) { Message::SendFail(TCollection_AsciiString("Error: Image is defined with invalid file offset '") @@ -246,7 +246,7 @@ TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const } if (myOffset >= 0) { - aFileIn->seekg((std::streamoff)myOffset, std::ios_base::beg); + aFileIn->seekg(static_cast(myOffset), std::ios_base::beg); if (!aFileIn->good()) { Message::SendFail( @@ -335,7 +335,7 @@ bool Image_Texture::WriteImage(std::ostream& theStream, const TCollection_AsciiS { if (!myBuffer.IsNull()) { - theStream.write((const char*)myBuffer->Data(), myBuffer->Size()); + theStream.write(reinterpret_cast(myBuffer->Data()), myBuffer->Size()); if (!theStream.good()) { Message::SendFail(TCollection_AsciiString("File '") + theFile + "' cannot be written"); @@ -356,7 +356,7 @@ bool Image_Texture::WriteImage(std::ostream& theStream, const TCollection_AsciiS int64_t aLen = myLength; if (myOffset >= 0) { - aFileIn->seekg((std::streamoff)myOffset, std::ios_base::beg); + aFileIn->seekg(static_cast(myOffset), std::ios_base::beg); if (!aFileIn->good()) { Message::SendFail( @@ -378,15 +378,15 @@ bool Image_Texture::WriteImage(std::ostream& theStream, const TCollection_AsciiS { if (aChunkIter + aChunkSize >= aLen) { - aChunkSize = int(aLen - aChunkIter); + aChunkSize = static_cast(aLen - aChunkIter); } - if (!aFileIn->read((char*)&aBuffer.ChangeFirst(), aChunkSize)) + if (!aFileIn->read(reinterpret_cast(&aBuffer.ChangeFirst()), aChunkSize)) { Message::SendFail(TCollection_AsciiString("Error: unable to read image file '") + myImagePath + "'"); return false; } - theStream.write((const char*)&aBuffer.First(), aChunkSize); + theStream.write(reinterpret_cast(&aBuffer.First()), aChunkSize); } if (!theStream.good()) { diff --git a/src/Visualization/TKService/Media/Media_FormatContext.cxx b/src/Visualization/TKService/Media/Media_FormatContext.cxx index 4465f938603..775dcce8304 100644 --- a/src/Visualization/TKService/Media/Media_FormatContext.cxx +++ b/src/Visualization/TKService/Media/Media_FormatContext.cxx @@ -288,12 +288,12 @@ void Media_FormatContext::Close() TCollection_AsciiString Media_FormatContext::FormatTime(double theSeconds) { double aSecIn = theSeconds; - unsigned int aHours = (unsigned int)(aSecIn * THE_SECOND_IN_HOUR); - aSecIn -= double(aHours) * THE_SECONDS_IN_HOUR; - unsigned int aMinutes = (unsigned int)(aSecIn * THE_SECOND_IN_MINUTE); - aSecIn -= double(aMinutes) * THE_SECONDS_IN_MINUTE; - unsigned int aSeconds = (unsigned int)aSecIn; - aSecIn -= double(aSeconds); + unsigned int aHours = static_cast(aSecIn * THE_SECOND_IN_HOUR); + aSecIn -= static_cast(aHours) * THE_SECONDS_IN_HOUR; + unsigned int aMinutes = static_cast(aSecIn * THE_SECOND_IN_MINUTE); + aSecIn -= static_cast(aMinutes) * THE_SECONDS_IN_MINUTE; + unsigned int aSeconds = static_cast(aSecIn); + aSecIn -= static_cast(aSeconds); double aMilliSeconds = 1000.0 * aSecIn; char aBuffer[64]; @@ -322,20 +322,20 @@ TCollection_AsciiString Media_FormatContext::FormatTimeProgress(double theProgre double theDuration) { double aSecIn1 = theProgress; - unsigned int aHours1 = (unsigned int)(aSecIn1 * THE_SECOND_IN_HOUR); - aSecIn1 -= double(aHours1) * THE_SECONDS_IN_HOUR; - unsigned int aMinutes1 = (unsigned int)(aSecIn1 * THE_SECOND_IN_MINUTE); - aSecIn1 -= double(aMinutes1) * THE_SECONDS_IN_MINUTE; - unsigned int aSeconds1 = (unsigned int)aSecIn1; - aSecIn1 -= double(aSeconds1); + unsigned int aHours1 = static_cast(aSecIn1 * THE_SECOND_IN_HOUR); + aSecIn1 -= static_cast(aHours1) * THE_SECONDS_IN_HOUR; + unsigned int aMinutes1 = static_cast(aSecIn1 * THE_SECOND_IN_MINUTE); + aSecIn1 -= static_cast(aMinutes1) * THE_SECONDS_IN_MINUTE; + unsigned int aSeconds1 = static_cast(aSecIn1); + aSecIn1 -= static_cast(aSeconds1); double aSecIn2 = theDuration; - unsigned int aHours2 = (unsigned int)(aSecIn2 * THE_SECOND_IN_HOUR); - aSecIn2 -= double(aHours2) * THE_SECONDS_IN_HOUR; - unsigned int aMinutes2 = (unsigned int)(aSecIn2 * THE_SECOND_IN_MINUTE); - aSecIn2 -= double(aMinutes2) * THE_SECONDS_IN_MINUTE; - unsigned int aSeconds2 = (unsigned int)aSecIn2; - aSecIn2 -= double(aSeconds2); + unsigned int aHours2 = static_cast(aSecIn2 * THE_SECOND_IN_HOUR); + aSecIn2 -= static_cast(aHours2) * THE_SECONDS_IN_HOUR; + unsigned int aMinutes2 = static_cast(aSecIn2 * THE_SECOND_IN_MINUTE); + aSecIn2 -= static_cast(aMinutes2) * THE_SECONDS_IN_MINUTE; + unsigned int aSeconds2 = static_cast(aSecIn2); + aSecIn2 -= static_cast(aSeconds2); char aBuffer[256]; if (aHours1 > 0 || aHours2 > 0) diff --git a/src/Visualization/TKService/Media/Media_PlayerContext.cxx b/src/Visualization/TKService/Media/Media_PlayerContext.cxx index d40f1290f75..e769ade9962 100644 --- a/src/Visualization/TKService/Media/Media_PlayerContext.cxx +++ b/src/Visualization/TKService/Media/Media_PlayerContext.cxx @@ -187,12 +187,12 @@ bool Media_PlayerContext::DumpFirstFrame(const TCollection_AsciiString& theSrcVi if (aResSizeX > aResSizeY) { aResSizeX = theMaxSize; - aResSizeY = int((double(aFrame->SizeY()) / double(aFrame->SizeX())) * double(aResSizeX)); + aResSizeY = static_cast((static_cast(aFrame->SizeY()) / static_cast(aFrame->SizeX())) * static_cast(aResSizeX)); } else { aResSizeY = theMaxSize; - aResSizeX = int((double(aFrame->SizeX()) / double(aFrame->SizeY())) * double(aResSizeY)); + aResSizeX = static_cast((static_cast(aFrame->SizeX()) / static_cast(aFrame->SizeY())) * static_cast(aResSizeY)); } } if (!aPixMap->InitZero(Image_Format_RGB, aResSizeX, aResSizeY)) @@ -350,7 +350,7 @@ bool Media_PlayerContext::popPlayEvent(Media_PlayerEvent& t //! Returns nearest (greater or equal) aligned number. static int getAligned(size_t theNumber, size_t theAlignment = 32) { - return int(theNumber + theAlignment - 1 - (theNumber - 1) % theAlignment); + return static_cast(theNumber + theAlignment - 1 - (theNumber - 1) % theAlignment); } //================================================================================================= diff --git a/src/Visualization/TKService/Media/Media_PlayerContext.hxx b/src/Visualization/TKService/Media/Media_PlayerContext.hxx index cb62b0f9e36..6213f686ab9 100644 --- a/src/Visualization/TKService/Media/Media_PlayerContext.hxx +++ b/src/Visualization/TKService/Media/Media_PlayerContext.hxx @@ -118,7 +118,7 @@ private: //! Thread creation callback. static void* doThreadWrapper(void* theData) { - Media_PlayerContext* aThis = (Media_PlayerContext*)theData; + Media_PlayerContext* aThis = static_cast(theData); aThis->doThreadLoop(); return nullptr; } diff --git a/src/Visualization/TKService/WNT/WNT_HIDSpaceMouse.cxx b/src/Visualization/TKService/WNT/WNT_HIDSpaceMouse.cxx index fb4e53c417f..57e98db799e 100644 --- a/src/Visualization/TKService/WNT/WNT_HIDSpaceMouse.cxx +++ b/src/Visualization/TKService/WNT/WNT_HIDSpaceMouse.cxx @@ -262,7 +262,7 @@ NCollection_Vec3 WNT_HIDSpaceMouse::fromRawVec3(bool& theIsIdle if (!theIsQuadric) { - return aVec / double(myValueRange); + return aVec / static_cast(myValueRange); } for (int aCompIter = 0; aCompIter < 3; ++aCompIter) @@ -270,7 +270,7 @@ NCollection_Vec3 WNT_HIDSpaceMouse::fromRawVec3(bool& theIsIdle aVec[aCompIter] = aRaw16[aCompIter] > 0 ? aVec[aCompIter] * aVec[aCompIter] : -aVec[aCompIter] * aVec[aCompIter]; } - return aVec / (double(myValueRange) * double(myValueRange)); + return aVec / (static_cast(myValueRange) * static_cast(myValueRange)); } //================================================================================================= @@ -290,7 +290,7 @@ Aspect_VKey WNT_HIDSpaceMouse::HidToSpaceKey(unsigned short theKeyBit) const case SpaceVKey_8: case SpaceVKey_9: case SpaceVKey_10: - return (int(aKey) - int(SpaceVKey_1)) + Aspect_VKey_1; + return (static_cast(aKey) - static_cast(SpaceVKey_1)) + Aspect_VKey_1; case SpaceVKey_Esc: return Aspect_VKey_Escape; case SpaceVKey_Shift: diff --git a/src/Visualization/TKService/Wasm/Wasm_Window.cxx b/src/Visualization/TKService/Wasm/Wasm_Window.cxx index add67d58162..0fdc062b61a 100644 --- a/src/Visualization/TKService/Wasm/Wasm_Window.cxx +++ b/src/Visualization/TKService/Wasm/Wasm_Window.cxx @@ -98,7 +98,7 @@ double Wasm_Window::Ratio() const } return (aCanvasSize.x() != 0 && aCanvasSize.y() != 0) - ? double(aCanvasSize.x()) / double(aCanvasSize.y()) + ? static_cast(aCanvasSize.x()) / static_cast(aCanvasSize.y()) : 1.0; } diff --git a/src/Visualization/TKService/Xw/Xw_Window.cxx b/src/Visualization/TKService/Xw/Xw_Window.cxx index eac592448af..b48c5415f7a 100644 --- a/src/Visualization/TKService/Xw/Xw_Window.cxx +++ b/src/Visualization/TKService/Xw/Xw_Window.cxx @@ -75,7 +75,7 @@ Xw_Window::Xw_Window(const occ::handle& theXDisplay, aWinAttr.border_pixel = 0; aWinAttr.override_redirect = False; - myXWindow = (Window)XCreateWindow(aDisp, + myXWindow = XCreateWindow(aDisp, aParent, myXLeft, myYTop, @@ -101,7 +101,7 @@ Xw_Window::Xw_Window(const occ::handle& theXDisplay, aSizeHints.height = thePxHeight; aSizeHints.flags |= PSize; XSetStandardProperties(aDisp, - (Window)myXWindow, + static_cast(myXWindow), theTitle, theTitle, None, @@ -154,7 +154,7 @@ Xw_Window::Xw_Window(const occ::handle& theXDisplay, Display* aDisp = myDisplay->GetDisplay(); XWindowAttributes aWinAttr; - XGetWindowAttributes(aDisp, (Window)myXWindow, &aWinAttr); + XGetWindowAttributes(aDisp, static_cast(myXWindow), &aWinAttr); XVisualInfo aVisInfoTmp; aVisInfoTmp.visualid = aWinAttr.visual->visualid; aVisInfoTmp.screen = DefaultScreen(aDisp); @@ -180,7 +180,7 @@ Xw_Window::~Xw_Window() if (myIsOwnWin && myXWindow != 0 && !myDisplay.IsNull()) { #if defined(HAVE_XLIB) - XDestroyWindow(myDisplay->GetDisplay(), (Window)myXWindow); + XDestroyWindow(myDisplay->GetDisplay(), static_cast(myXWindow)); #endif } } @@ -201,7 +201,7 @@ bool Xw_Window::IsMapped() const #if defined(HAVE_XLIB) XFlush(myDisplay->GetDisplay()); XWindowAttributes aWinAttr; - XGetWindowAttributes(myDisplay->GetDisplay(), (Window)myXWindow, &aWinAttr); + XGetWindowAttributes(myDisplay->GetDisplay(), static_cast(myXWindow), &aWinAttr); return aWinAttr.map_state == IsUnviewable || aWinAttr.map_state == IsViewable; #else return false; @@ -218,7 +218,7 @@ void Xw_Window::Map() const } #if defined(HAVE_XLIB) - XMapWindow(myDisplay->GetDisplay(), (Window)myXWindow); + XMapWindow(myDisplay->GetDisplay(), static_cast(myXWindow)); XFlush(myDisplay->GetDisplay()); #endif } @@ -234,7 +234,7 @@ void Xw_Window::Unmap() const #if defined(HAVE_XLIB) XIconifyWindow(myDisplay->GetDisplay(), - (Window)myXWindow, + static_cast(myXWindow), DefaultScreen(myDisplay->GetDisplay())); #endif } @@ -252,7 +252,7 @@ Aspect_TypeOfResize Xw_Window::DoResize() XFlush(myDisplay->GetDisplay()); XWindowAttributes aWinAttr; memset(&aWinAttr, 0, sizeof(aWinAttr)); - XGetWindowAttributes(myDisplay->GetDisplay(), (Window)myXWindow, &aWinAttr); + XGetWindowAttributes(myDisplay->GetDisplay(), static_cast(myXWindow), &aWinAttr); if (aWinAttr.map_state == IsUnmapped) { return Aspect_TOR_UNKNOWN; @@ -318,15 +318,15 @@ double Xw_Window::Ratio() const { if (IsVirtual() || myXWindow == 0) { - return double(myXRight - myXLeft) / double(myYBottom - myYTop); + return static_cast(myXRight - myXLeft) / static_cast(myYBottom - myYTop); } #if defined(HAVE_XLIB) XFlush(myDisplay->GetDisplay()); XWindowAttributes aWinAttr; memset(&aWinAttr, 0, sizeof(aWinAttr)); - XGetWindowAttributes(myDisplay->GetDisplay(), (Window)myXWindow, &aWinAttr); - return double(aWinAttr.width) / double(aWinAttr.height); + XGetWindowAttributes(myDisplay->GetDisplay(), static_cast(myXWindow), &aWinAttr); + return static_cast(aWinAttr.width) / static_cast(aWinAttr.height); #else return 1.0; #endif @@ -349,11 +349,11 @@ void Xw_Window::Position(int& theX1, int& theY1, int& theX2, int& theY2) const XFlush(myDisplay->GetDisplay()); XWindowAttributes anAttributes; memset(&anAttributes, 0, sizeof(anAttributes)); - XGetWindowAttributes(myDisplay->GetDisplay(), (Window)myXWindow, &anAttributes); + XGetWindowAttributes(myDisplay->GetDisplay(), static_cast(myXWindow), &anAttributes); Window aChild; XTranslateCoordinates(myDisplay->GetDisplay(), anAttributes.root, - (Window)myXWindow, + static_cast(myXWindow), 0, 0, &anAttributes.x, @@ -382,7 +382,7 @@ void Xw_Window::Size(int& theWidth, int& theHeight) const XFlush(myDisplay->GetDisplay()); XWindowAttributes aWinAttr; memset(&aWinAttr, 0, sizeof(aWinAttr)); - XGetWindowAttributes(myDisplay->GetDisplay(), (Window)myXWindow, &aWinAttr); + XGetWindowAttributes(myDisplay->GetDisplay(), static_cast(myXWindow), &aWinAttr); theWidth = aWinAttr.width; theHeight = aWinAttr.height; #endif @@ -395,7 +395,7 @@ void Xw_Window::SetTitle(const TCollection_AsciiString& theTitle) if (myXWindow != 0) { #if defined(HAVE_XLIB) - XStoreName(myDisplay->GetDisplay(), (Window)myXWindow, theTitle.ToCString()); + XStoreName(myDisplay->GetDisplay(), static_cast(myXWindow), theTitle.ToCString()); #else (void)theTitle; #endif @@ -418,8 +418,8 @@ void Xw_Window::InvalidateContent(const occ::handle& t XEvent anEvent; memset(&anEvent, 0, sizeof(anEvent)); anEvent.type = Expose; - anEvent.xexpose.window = (Window)myXWindow; - XSendEvent(aDispX, (Window)myXWindow, False, ExposureMask, &anEvent); + anEvent.xexpose.window = static_cast(myXWindow); + XSendEvent(aDispX, static_cast(myXWindow), False, ExposureMask, &anEvent); XFlush(aDispX); #else (void)theDisp; @@ -433,24 +433,24 @@ Aspect_VKey Xw_Window::VirtualKeyFromNative(unsigned long theKey) #if defined(HAVE_XLIB) if (theKey >= XK_0 && theKey <= XK_9) { - return Aspect_VKey(theKey - XK_0 + Aspect_VKey_0); + return static_cast(theKey - XK_0 + Aspect_VKey_0); } if (theKey >= XK_A && theKey <= XK_Z) { - return Aspect_VKey(theKey - XK_A + Aspect_VKey_A); + return static_cast(theKey - XK_A + Aspect_VKey_A); } if (theKey >= XK_a && theKey <= XK_z) { - return Aspect_VKey(theKey - XK_a + Aspect_VKey_A); + return static_cast(theKey - XK_a + Aspect_VKey_A); } if (theKey >= XK_F1 && theKey <= XK_F24) { if (theKey <= XK_F12) { - return Aspect_VKey(theKey - XK_F1 + Aspect_VKey_F1); + return static_cast(theKey - XK_F1 + Aspect_VKey_F1); } return Aspect_VKey_UNKNOWN; } @@ -591,8 +591,8 @@ bool Xw_Window::ProcessMessage(Aspect_WindowInputListener& theListener, switch (theMsg.type) { case ClientMessage: { - if ((Atom)theMsg.xclient.data.l[0] == myDisplay->GetAtom(Aspect_XA_DELETE_WINDOW) - && theMsg.xclient.window == (Window)myXWindow) + if (static_cast(theMsg.xclient.data.l[0]) == myDisplay->GetAtom(Aspect_XA_DELETE_WINDOW) + && theMsg.xclient.window == static_cast(myXWindow)) { theListener.ProcessClose(); return true; @@ -601,14 +601,14 @@ bool Xw_Window::ProcessMessage(Aspect_WindowInputListener& theListener, } case FocusIn: case FocusOut: { - if (theMsg.xfocus.window == (Window)myXWindow) + if (theMsg.xfocus.window == static_cast(myXWindow)) { theListener.ProcessFocus(theMsg.type == FocusIn); } return true; } case Expose: { - if (theMsg.xexpose.window == (Window)myXWindow) + if (theMsg.xexpose.window == static_cast(myXWindow)) { theListener.ProcessExpose(); } @@ -616,7 +616,7 @@ bool Xw_Window::ProcessMessage(Aspect_WindowInputListener& theListener, // remove all the ExposureMask and process them at once for (int aNbMaxEvents = XPending(aDisplay); aNbMaxEvents > 0; --aNbMaxEvents) { - if (!XCheckWindowEvent(aDisplay, (Window)myXWindow, ExposureMask, &theMsg)) + if (!XCheckWindowEvent(aDisplay, static_cast(myXWindow), ExposureMask, &theMsg)) { break; } @@ -628,13 +628,13 @@ bool Xw_Window::ProcessMessage(Aspect_WindowInputListener& theListener, // remove all the StructureNotifyMask and process them at once for (int aNbMaxEvents = XPending(aDisplay); aNbMaxEvents > 0; --aNbMaxEvents) { - if (!XCheckWindowEvent(aDisplay, (Window)myXWindow, StructureNotifyMask, &theMsg)) + if (!XCheckWindowEvent(aDisplay, static_cast(myXWindow), StructureNotifyMask, &theMsg)) { break; } } - if (theMsg.xconfigure.window == (Window)myXWindow) + if (theMsg.xconfigure.window == static_cast(myXWindow)) { theListener.ProcessConfigure(true); } @@ -642,7 +642,7 @@ bool Xw_Window::ProcessMessage(Aspect_WindowInputListener& theListener, } case KeyPress: case KeyRelease: { - XKeyEvent* aKeyEvent = (XKeyEvent*)&theMsg; + XKeyEvent* aKeyEvent = reinterpret_cast(&theMsg); const KeySym aKeySym = XLookupKeysym(aKeyEvent, 0); const Aspect_VKey aVKey = Xw_Window::VirtualKeyFromNative(aKeySym); if (aVKey != Aspect_VKey_UNKNOWN) @@ -713,7 +713,7 @@ bool Xw_Window::ProcessMessage(Aspect_WindowInputListener& theListener, return true; } case MotionNotify: { - if (theMsg.xmotion.window != (Window)myXWindow) + if (theMsg.xmotion.window != static_cast(myXWindow)) { return false; } @@ -722,7 +722,7 @@ bool Xw_Window::ProcessMessage(Aspect_WindowInputListener& theListener, for (int aNbMaxEvents = XPending(aDisplay); aNbMaxEvents > 0; --aNbMaxEvents) { if (!XCheckWindowEvent(aDisplay, - (Window)myXWindow, + static_cast(myXWindow), ButtonMotionMask | PointerMotionMask, &theMsg)) { diff --git a/src/Visualization/TKV3d/AIS/AIS_Circle.cxx b/src/Visualization/TKV3d/AIS/AIS_Circle.cxx index c4aa280f57e..7d380722a96 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Circle.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Circle.cxx @@ -138,7 +138,7 @@ void AIS_Circle::SetColor(const Quantity_Color& aCol) void AIS_Circle::SetWidth(const double aValue) { - myOwnWidth = (float)aValue; + myOwnWidth = static_cast(aValue); if (!myDrawer->HasOwnLineAspect()) { @@ -190,7 +190,7 @@ void AIS_Circle::UnsetWidth() else { float WW = myDrawer->HasLink() - ? (float)AIS_GraphicTool::GetLineWidth(myDrawer->Link(), AIS_TOA_Line) + ? static_cast(AIS_GraphicTool::GetLineWidth(myDrawer->Link(), AIS_TOA_Line)) : 1.0f; myDrawer->LineAspect()->SetWidth(WW); myOwnWidth = WW; diff --git a/src/Visualization/TKV3d/AIS/AIS_ColorScale.cxx b/src/Visualization/TKV3d/AIS/AIS_ColorScale.cxx index d4d7431536c..5e89a43a63f 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ColorScale.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ColorScale.cxx @@ -93,7 +93,7 @@ static int colorDiscreteInterval(double theValue, double theMin, double theMax, } int anInterval = - 1 + (int)std::floor(double(theNbIntervals) * (theValue - theMin) / (theMax - theMin)); + 1 + static_cast(std::floor(static_cast(theNbIntervals) * (theValue - theMin) / (theMax - theMin))); // map the very upper value (theValue==theMax) to the largest color interval anInterval = std::min(anInterval, theNbIntervals); return anInterval; @@ -299,7 +299,7 @@ NCollection_Sequence AIS_ColorScale::MakeUniformColors(int th } // discretize the range with 1 degree step - const int NBCOLORS = 2 + (int)std::abs(aHueRange / 1.); + const int NBCOLORS = 2 + static_cast(std::abs(aHueRange / 1.)); double aHueStep = aHueRange / (NBCOLORS - 1); NCollection_Array1 aGrid(0, NBCOLORS - 1); for (int i = 0; i < NBCOLORS; i++) @@ -340,8 +340,8 @@ NCollection_Sequence AIS_ColorScale::MakeUniformColors(int th aParam = aPrev + aMetric(i); while (aTarget <= aParam) { - float aCoefPrev = float((aParam - aTarget) / (aParam - aPrev)); - float aCoefCurr = float((aTarget - aPrev) / (aParam - aPrev)); + float aCoefPrev = static_cast((aParam - aTarget) / (aParam - aPrev)); + float aCoefCurr = static_cast((aTarget - aPrev) / (aParam - aPrev)); Quantity_Color aColor(aGrid(i).Rgb() * aCoefCurr + aGrid(i - 1).Rgb() * aCoefPrev); aResult.Append(aColor); aTarget += aDStep; @@ -373,7 +373,7 @@ void AIS_ColorScale::SizeHint(int& theWidth, int& theHeight) const } const int aScaleWidth = aColorWidth + aTextWidth + (aTextWidth ? 3 : 2) * mySpacing; - const int aScaleHeight = (int)(1.5 * (myNbIntervals + (myIsLabelAtBorder ? 2 : 1)) * aTextHeight); + const int aScaleHeight = static_cast(1.5 * (myNbIntervals + (myIsLabelAtBorder ? 2 : 1)) * aTextHeight); int aTitleWidth = 0; int aTitleHeight = 0; @@ -585,7 +585,7 @@ void AIS_ColorScale::drawColorBar(const occ::handle& thePrs, const int theMaxLabelWidth, const int theColorBreadth) { - const double aStepY = double(theBarHeight) / double(myNbIntervals); + const double aStepY = static_cast(theBarHeight) / static_cast(myNbIntervals); if (aStepY <= 0.0) { return; @@ -622,7 +622,7 @@ void AIS_ColorScale::drawColorBar(const occ::handle& thePrs, false, true); // per-vertex colors // clang-format on Quantity_Color aColor1(aColors.Value(1)), aColor2; - int aSizeY = int(aStepY / 2); + int aSizeY = static_cast(aStepY / 2); const int anYBottom = theBarBottom + aSizeY; int anYBottomIter = anYBottom; addColoredQuad(aTriangles, anXLeft, theBarBottom, theColorBreadth, aSizeY, aColor1, aColor1); @@ -630,7 +630,7 @@ void AIS_ColorScale::drawColorBar(const occ::handle& thePrs, { aColor1 = aColors.Value(aColorIter + 1); aColor2 = aColors.Value(aColorIter + 2); - aSizeY = anYBottom + int((aColorIter + 1) * aStepY) - anYBottomIter; + aSizeY = anYBottom + static_cast((aColorIter + 1) * aStepY) - anYBottomIter; addColoredQuad(aTriangles, anXLeft, anYBottomIter, theColorBreadth, aSizeY, aColor1, aColor2); anYBottomIter += aSizeY; } @@ -696,7 +696,7 @@ void AIS_ColorScale::drawColorBar(const occ::handle& thePrs, for (int aColorIter = 0; aColorIter < myNbIntervals; ++aColorIter) { const Quantity_Color& aColor = aColors.Value(aColorIter + 1); - const int aSizeY = theBarBottom + int((aColorIter + 1) * aStepY) - anYBottomIter; + const int aSizeY = theBarBottom + static_cast((aColorIter + 1) * aStepY) - anYBottomIter; addColoredQuad(aTriangles, anXLeft, anYBottomIter, theColorBreadth, aSizeY, aColor, aColor); anYBottomIter += aSizeY; } @@ -726,7 +726,7 @@ void AIS_ColorScale::drawLabels(const occ::handle& const int aNbLabels = theLabels.Size(); const int aNbIntervals = myIsLabelAtBorder ? aNbLabels - 1 : aNbLabels; - const double aStepY = double(theBarHeight) / double(aNbIntervals); + const double aStepY = static_cast(theBarHeight) / static_cast(aNbIntervals); if (aStepY <= 0.0) { return; @@ -743,10 +743,10 @@ void AIS_ColorScale::drawLabels(const occ::handle& return; } - const double aVal = double(aNbLabels) * myTextHeight / aSpc; + const double aVal = static_cast(aNbLabels) * myTextHeight / aSpc; double anIPart = 0.0; double anFPart = std::modf(aVal, &anIPart); - aFilter = (int)anIPart + (anFPart != 0 ? 1 : 0); + aFilter = static_cast(anIPart) + (anFPart != 0 ? 1 : 0); } if (aFilter <= 0) { @@ -775,7 +775,7 @@ void AIS_ColorScale::drawLabels(const occ::handle& int i2 = aNbLabels - 1; int aLast1 = i1; int aLast2 = i2; - const int anYBottom = myIsLabelAtBorder ? theBarBottom : theBarBottom + int(aStepY / 2); + const int anYBottom = myIsLabelAtBorder ? theBarBottom : theBarBottom + static_cast(aStepY / 2); while (i2 - i1 >= aFilter || (i2 == 0 && i1 == 0)) { int aPos1 = i1; @@ -785,7 +785,7 @@ void AIS_ColorScale::drawLabels(const occ::handle& drawText(theGroup, theLabels.Value(i1 + 1), anXLeft, - anYBottom + int(i1 * aStepY + anAscent), + anYBottom + static_cast(i1 * aStepY + anAscent), Graphic3d_VTA_CENTER); aLast1 = i1; } @@ -794,7 +794,7 @@ void AIS_ColorScale::drawLabels(const occ::handle& drawText(theGroup, theLabels.Value(i2 + 1), anXLeft, - anYBottom + int(i2 * aStepY + anAscent), + anYBottom + static_cast(i2 * aStepY + anAscent), Graphic3d_VTA_CENTER); aLast2 = i2; } @@ -818,7 +818,7 @@ void AIS_ColorScale::drawLabels(const occ::handle& drawText(theGroup, theLabels.Value(i0 + 1), anXLeft, - anYBottom + int(i0 * aStepY + anAscent), + anYBottom + static_cast(i0 * aStepY + anAscent), Graphic3d_VTA_CENTER); } } @@ -856,7 +856,7 @@ void AIS_ColorScale::drawText(const occ::handle& theGroup, { const occ::handle& anAspect = myDrawer->TextAspect(); - occ::handle aText = new Graphic3d_Text((float)anAspect->Height()); + occ::handle aText = new Graphic3d_Text(static_cast(anAspect->Height())); aText->SetText(theText.ToExtString()); aText->SetOrientation(gp_Ax2(gp_Pnt(theX, theY, 0.0), gp::DZ())); aText->SetOwnAnchorPoint(false); @@ -898,9 +898,9 @@ void AIS_ColorScale::TextSize(const TCollection_ExtendedString& theText, const occ::handle& aViewer = GetContext()->CurrentViewer(); const occ::handle& aView = aViewer->ActiveViewIterator().Value()->View(); aViewer->Driver() - ->TextSize(aView, aText.ToCString(), (float)theHeight, aWidth, anAscent, aDescent); + ->TextSize(aView, aText.ToCString(), static_cast(theHeight), aWidth, anAscent, aDescent); } - theWidth = (int)aWidth; - theAscent = (int)anAscent; - theDescent = (int)aDescent; + theWidth = static_cast(aWidth); + theAscent = static_cast(anAscent); + theDescent = static_cast(aDescent); } diff --git a/src/Visualization/TKV3d/AIS/AIS_ColoredShape.cxx b/src/Visualization/TKV3d/AIS/AIS_ColoredShape.cxx index 8b7810c1419..c157e619858 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ColoredShape.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ColoredShape.cxx @@ -379,7 +379,7 @@ void AIS_ColoredShape::Compute(const occ::handle& th myShapeColors.Find(myshape, aBaseDrawer); // myShapeColors + anOpened --> array[TopAbs_ShapeEnum] of map of color-to-compound - DataMapOfDrawerCompd aDispatchedOpened[(size_t)TopAbs_SHAPE]; + DataMapOfDrawerCompd aDispatchedOpened[static_cast(TopAbs_SHAPE)]; DataMapOfDrawerCompd aDispatchedClosed; dispatchColors(aBaseDrawer, myshape, @@ -576,7 +576,7 @@ void AIS_ColoredShape::addShapesWithCustomProps( const int theMode) { occ::handle anOpenGroup, aClosedGroup, anEdgesGroup; - for (size_t aShType = 0; aShType <= (size_t)TopAbs_SHAPE; ++aShType) + for (size_t aShType = 0; aShType <= static_cast(TopAbs_SHAPE); ++aShType) { const bool isClosed = aShType == TopAbs_SHAPE; occ::handle& aShadedGroup = isClosed ? aClosedGroup : anOpenGroup; @@ -797,7 +797,7 @@ bool AIS_ColoredShape::dispatchColors( TopoDS_Compound aCompound; DataMapOfDrawerCompd& aDrawerShapeMap = theIsParentClosed && aShapeType == TopAbs_FACE ? theDrawerClosedFaces - : theDrawerOpenedShapePerType[(size_t)aShapeType]; + : theDrawerOpenedShapePerType[static_cast(aShapeType)]; if (!aDrawerShapeMap.FindFromKey(aDrawer, aCompound)) { aBBuilder.MakeCompound(aCompound); diff --git a/src/Visualization/TKV3d/AIS/AIS_ExclusionFilter.cxx b/src/Visualization/TKV3d/AIS/AIS_ExclusionFilter.cxx index 201f44f518e..30a18e7e1e0 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ExclusionFilter.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ExclusionFilter.cxx @@ -36,7 +36,7 @@ AIS_ExclusionFilter::AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclu : myIsExclusionFlagOn(ExclusionFlagOn) { NCollection_List L; - myStoredTypes.Bind((int)TypeToExclude, L); + myStoredTypes.Bind(static_cast(TypeToExclude), L); } AIS_ExclusionFilter::AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude, @@ -46,7 +46,7 @@ AIS_ExclusionFilter::AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclu { NCollection_List L; L.Append(SignatureInType); - myStoredTypes.Bind((int)TypeToExclude, L); + myStoredTypes.Bind(static_cast(TypeToExclude), L); } //================================================================================================= @@ -56,7 +56,7 @@ bool AIS_ExclusionFilter::Add(const AIS_KindOfInteractive TypeToExclude) if (IsStored(TypeToExclude)) return false; NCollection_List L; - myStoredTypes.Bind((int)TypeToExclude, L); + myStoredTypes.Bind(static_cast(TypeToExclude), L); return true; } @@ -66,11 +66,11 @@ bool AIS_ExclusionFilter::Add(const AIS_KindOfInteractive TypeToExclude, const i { NCollection_List L; L.Append(SignatureInType); - myStoredTypes.Bind((int)TypeToExclude, L); + myStoredTypes.Bind(static_cast(TypeToExclude), L); return true; } - myStoredTypes((int)TypeToExclude).Append(SignatureInType); + myStoredTypes(static_cast(TypeToExclude)).Append(SignatureInType); return true; } @@ -80,8 +80,8 @@ bool AIS_ExclusionFilter::Remove(const AIS_KindOfInteractive TypeToExclude) { if (!IsStored(TypeToExclude)) return false; - myStoredTypes((int)TypeToExclude).Clear(); - myStoredTypes.UnBind((int)TypeToExclude); + myStoredTypes(static_cast(TypeToExclude)).Clear(); + myStoredTypes.UnBind(static_cast(TypeToExclude)); return true; } @@ -90,7 +90,7 @@ bool AIS_ExclusionFilter::Remove(const AIS_KindOfInteractive TypeToExclude, { if (!IsStored(TypeToExclude)) return false; - NCollection_List& LL = myStoredTypes.ChangeFind((int)TypeToExclude); + NCollection_List& LL = myStoredTypes.ChangeFind(static_cast(TypeToExclude)); for (NCollection_List::Iterator it(LL); it.More(); it.Next()) { if (it.Value() == SignatureInType) @@ -116,7 +116,7 @@ void AIS_ExclusionFilter::Clear() bool AIS_ExclusionFilter::IsStored(const AIS_KindOfInteractive aType) const { - return myStoredTypes.IsBound(int(aType)); + return myStoredTypes.IsBound(static_cast(aType)); } //================================================================================================= @@ -126,7 +126,7 @@ bool AIS_ExclusionFilter::IsSignatureIn(const AIS_KindOfInteractive aType, { if (!myStoredTypes.IsBound(aType)) return false; - for (NCollection_List::Iterator Lit(myStoredTypes((int)aType)); Lit.More(); Lit.Next()) + for (NCollection_List::Iterator Lit(myStoredTypes(static_cast(aType))); Lit.More(); Lit.Next()) { if (Lit.Value() == SignatureInType) return true; diff --git a/src/Visualization/TKV3d/AIS/AIS_InteractiveContext.cxx b/src/Visualization/TKV3d/AIS/AIS_InteractiveContext.cxx index 1595ce74ce1..719d361082c 100644 --- a/src/Visualization/TKV3d/AIS/AIS_InteractiveContext.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_InteractiveContext.cxx @@ -90,7 +90,7 @@ static void initDefaultHilightAttributes(const occ::handle& theDra for (int aPartIter = 0; aPartIter < Prs3d_DatumParts_None; ++aPartIter) { if (occ::handle aLineAsp = - theDrawer->DatumAspect()->LineAspect((Prs3d_DatumParts)aPartIter)) + theDrawer->DatumAspect()->LineAspect(static_cast(aPartIter))) { aLineAsp->SetColor(theColor); } @@ -2818,7 +2818,7 @@ AIS_StatusOfPick AIS_InteractiveContext::SelectDetected(const AIS_SelectionSchem gp_Pnt2d aMouseRealPos = MainSelector()->GetManager().GetMousePosition(); if (!Precision::IsInfinite(aMouseRealPos.X()) && !Precision::IsInfinite(aMouseRealPos.Y())) { - aMousePos.SetValues((int)aMouseRealPos.X(), (int)aMouseRealPos.Y()); + aMousePos.SetValues(static_cast(aMouseRealPos.X()), static_cast(aMouseRealPos.Y())); } if (myLastPicked->HandleMouseClick(aMousePos, Aspect_VKeyMouse_LeftButton, diff --git a/src/Visualization/TKV3d/AIS/AIS_InteractiveContext.hxx b/src/Visualization/TKV3d/AIS/AIS_InteractiveContext.hxx index 4c957bd4400..f17336cb6a6 100644 --- a/src/Visualization/TKV3d/AIS/AIS_InteractiveContext.hxx +++ b/src/Visualization/TKV3d/AIS/AIS_InteractiveContext.hxx @@ -319,7 +319,7 @@ public: //! @name object presence management (View affinity, Layer, Priority) "instead of integer number to SetDisplayPriority()") void SetDisplayPriority(const occ::handle& theIObj, const int thePriority) { - SetDisplayPriority(theIObj, (Graphic3d_DisplayPriority)thePriority); + SetDisplayPriority(theIObj, static_cast(thePriority)); } //! Get Z layer id set for displayed interactive object. diff --git a/src/Visualization/TKV3d/AIS/AIS_LightSource.cxx b/src/Visualization/TKV3d/AIS/AIS_LightSource.cxx index bfb6a32a7df..ed4562c1673 100644 --- a/src/Visualization/TKV3d/AIS/AIS_LightSource.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_LightSource.cxx @@ -99,7 +99,7 @@ void AIS_LightSourceOwner::HilightWithColor(const occ::handleAddPrimitiveArray(aPoints); const double aRadius = aLightSource->Size() * 0.5; - const int aNbPnts = int(aLightSource->ArcSize() * 180 / (M_PI * aRadius)); + const int aNbPnts = static_cast(aLightSource->ArcSize() * 180 / (M_PI * aRadius)); NCollection_Array1 aCircPoints(0, aNbPnts); const gp_Dir aDirNorm(gp_Vec(gp::Origin(), aDetPnt)); gp_Dir aDirNormToPln(gp::DY()); @@ -849,7 +849,7 @@ void AIS_LightSource::ComputeSelection(const occ::handle& t aSensPosition->SetSensitivityFactor(12); if (!myTransformPersistence.IsNull() && myTransformPersistence->IsTrihedronOr2d()) { - aSensPosition->SetSensitivityFactor(std::max(12, int(mySize * 0.5))); + aSensPosition->SetSensitivityFactor(std::max(12, static_cast(mySize * 0.5))); } theSel->Add(aSensPosition); } diff --git a/src/Visualization/TKV3d/AIS/AIS_Line.cxx b/src/Visualization/TKV3d/AIS/AIS_Line.cxx index 0d7e1d789d5..98d41168898 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Line.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Line.cxx @@ -161,7 +161,7 @@ void AIS_Line::UnsetColor() void AIS_Line::SetWidth(const double aValue) { - myOwnWidth = (float)aValue; + myOwnWidth = static_cast(aValue); if (!myDrawer->HasOwnLineAspect()) { @@ -190,7 +190,7 @@ void AIS_Line::UnsetWidth() else { float WW = myDrawer->HasLink() - ? (float)AIS_GraphicTool::GetLineWidth(myDrawer->Link(), AIS_TOA_Line) + ? static_cast(AIS_GraphicTool::GetLineWidth(myDrawer->Link(), AIS_TOA_Line)) : 1.0f; myDrawer->LineAspect()->SetWidth(WW); myOwnWidth = WW; diff --git a/src/Visualization/TKV3d/AIS/AIS_Manipulator.cxx b/src/Visualization/TKV3d/AIS/AIS_Manipulator.cxx index 8657f3f541f..e59721ff0ea 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Manipulator.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Manipulator.cxx @@ -357,7 +357,7 @@ void AIS_Manipulator::adjustSize(const Bnd_Box& theBox) double aYSize = aYmax - aYmin; double aZSize = aZmax - aZmin; - SetSize((float)(std::max(aXSize, std::max(aYSize, aZSize)) * 0.5)); + SetSize(static_cast(std::max(aXSize, std::max(aYSize, aZSize)) * 0.5)); } //================================================================================================= @@ -1412,7 +1412,7 @@ void AIS_Manipulator::ComputeSelection(const occ::handle& t const int theMode) { // Check mode - const AIS_ManipulatorMode aMode = (AIS_ManipulatorMode)theMode; + const AIS_ManipulatorMode aMode = static_cast(theMode); if (aMode == AIS_MM_None) { return; diff --git a/src/Visualization/TKV3d/AIS/AIS_MediaPlayer.cxx b/src/Visualization/TKV3d/AIS/AIS_MediaPlayer.cxx index f8fc7bc124e..ebce4e12de4 100644 --- a/src/Visualization/TKV3d/AIS/AIS_MediaPlayer.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_MediaPlayer.cxx @@ -136,25 +136,25 @@ bool AIS_MediaPlayer::updateSize(const NCollection_Vec2& theLeftCorner, NCollection_Vec2 aNewSize = myFrameSize; if (aFrameSize.x() > 0 && aFrameSize.y() > 0) { - const double anAspect = double(theMaxSize.x()) / double(theMaxSize.y()); - const double aFitAspect = double(aFrameSize.x()) / double(aFrameSize.y()); + const double anAspect = static_cast(theMaxSize.x()) / static_cast(theMaxSize.y()); + const double aFitAspect = static_cast(aFrameSize.x()) / static_cast(aFrameSize.y()); aNewSize = aFrameSize; if (aFitAspect >= anAspect) { - aNewSize.y() = int(double(aFrameSize.x()) / aFitAspect); + aNewSize.y() = static_cast(static_cast(aFrameSize.x()) / aFitAspect); } else { - aNewSize.x() = int(double(aFrameSize.y()) * aFitAspect); + aNewSize.x() = static_cast(static_cast(aFrameSize.y()) * aFitAspect); } for (int aCoord = 0; aCoord < 2; ++aCoord) { if (aNewSize[aCoord] > theMaxSize[aCoord]) { - const double aScale = double(theMaxSize[aCoord]) / double(aNewSize[aCoord]); - aNewSize.x() = int(double(aNewSize.x()) * aScale); - aNewSize.y() = int(double(aNewSize.y()) * aScale); + const double aScale = static_cast(theMaxSize[aCoord]) / static_cast(aNewSize[aCoord]); + aNewSize.x() = static_cast(static_cast(aNewSize.x()) * aScale); + aNewSize.y() = static_cast(static_cast(aNewSize.y()) * aScale); } } diff --git a/src/Visualization/TKV3d/AIS/AIS_Plane.cxx b/src/Visualization/TKV3d/AIS/AIS_Plane.cxx index 3cb6325670e..819bb3fa1a7 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Plane.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Plane.cxx @@ -218,8 +218,8 @@ void AIS_Plane::Compute(const occ::handle&, occ::handle aGroup = thePrs->CurrentGroup(); aGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect()); gp_Pnt p1; - const double Xmax = 0.5 * double(anAspect->PlaneXLength()); - const double Ymax = 0.5 * double(anAspect->PlaneYLength()); + const double Xmax = 0.5 * (anAspect->PlaneXLength()); + const double Ymax = 0.5 * (anAspect->PlaneYLength()); occ::handle aQuads = new Graphic3d_ArrayOfQuadrangles(4); diff --git a/src/Visualization/TKV3d/AIS/AIS_PointCloud.cxx b/src/Visualization/TKV3d/AIS/AIS_PointCloud.cxx index 6d47f0a80b9..cb0741c4203 100644 --- a/src/Visualization/TKV3d/AIS/AIS_PointCloud.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_PointCloud.cxx @@ -292,7 +292,7 @@ void AIS_PointCloud::UnsetColor() if (IsTransparent()) { double aTransp = myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel); - aMat.SetTransparency(float(aTransp)); + aMat.SetTransparency(static_cast(aTransp)); } myDrawer->ShadingAspect()->SetMaterial(aMat, myCurrentFacingModel); myDrawer->ShadingAspect()->Aspect()->SetInteriorColor(aColor); diff --git a/src/Visualization/TKV3d/AIS/AIS_RubberBand.cxx b/src/Visualization/TKV3d/AIS/AIS_RubberBand.cxx index 769554362ab..c6f95caac58 100644 --- a/src/Visualization/TKV3d/AIS/AIS_RubberBand.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_RubberBand.cxx @@ -258,7 +258,7 @@ bool AIS_RubberBand::fillTriangles() IMeshData::VectorOfInteger anIndexes(myPoints.Length(), anAllocator); for (int aPtIdx = aPtsLower; aPtIdx <= aPtsUpper; ++aPtIdx) { - gp_XY aP((double)myPoints.Value(aPtIdx).x(), (double)myPoints.Value(aPtIdx).y()); + gp_XY aP(static_cast(myPoints.Value(aPtIdx).x()), static_cast(myPoints.Value(aPtIdx).y())); BRepMesh_Vertex aVertex(aP, aPtIdx, BRepMesh_Frontier); anIndexes.Append(aMeshStructure->AddNode(aVertex)); } @@ -267,8 +267,8 @@ bool AIS_RubberBand::fillTriangles() for (int aIdx = aPtsLower; aIdx <= aPtsUpper; ++aIdx) { int aNextIdx = (aIdx % myPoints.Length()) + 1; - aPtSum += (double)(myPoints.Value(aNextIdx).x() - myPoints.Value(aIdx).x()) - * (double)(myPoints.Value(aNextIdx).y() + myPoints.Value(aIdx).y()); + aPtSum += static_cast(myPoints.Value(aNextIdx).x() - myPoints.Value(aIdx).x()) + * static_cast(myPoints.Value(aNextIdx).y() + myPoints.Value(aIdx).y()); } bool isClockwiseOrdered = aPtSum < 0; @@ -325,7 +325,7 @@ bool AIS_RubberBand::fillTriangles() { for (int anIt = 0; anIt < 3; ++anIt) { - myTriangles->SetVertice(aVertexIndex++, (float)aPts[anIt].X(), (float)aPts[anIt].Y(), 0.0f); + myTriangles->SetVertice(aVertexIndex++, static_cast(aPts[anIt].X()), static_cast(aPts[anIt].Y()), 0.0f); } } } @@ -362,12 +362,12 @@ void AIS_RubberBand::Compute(const occ::handle&, myBorders = new Graphic3d_ArrayOfPolylines(myPoints.Length() + (myIsPolygonClosed ? 1 : 0)); for (int anIt = 1; anIt <= myPoints.Length(); anIt++) { - myBorders->AddVertex((double)myPoints.Value(anIt).x(), (double)myPoints.Value(anIt).y(), 0.0); + myBorders->AddVertex(static_cast(myPoints.Value(anIt).x()), static_cast(myPoints.Value(anIt).y()), 0.0); } if (myIsPolygonClosed) { - myBorders->AddVertex((double)myPoints.Value(1).x(), (double)myPoints.Value(1).y(), 0.0); + myBorders->AddVertex(static_cast(myPoints.Value(1).x()), static_cast(myPoints.Value(1).y()), 0.0); } } else @@ -375,16 +375,16 @@ void AIS_RubberBand::Compute(const occ::handle&, for (int anIt = 1; anIt <= myPoints.Length(); anIt++) { myBorders->SetVertice(anIt, - (float)myPoints.Value(anIt).x(), - (float)myPoints.Value(anIt).y(), + static_cast(myPoints.Value(anIt).x()), + static_cast(myPoints.Value(anIt).y()), 0.0f); } if (myIsPolygonClosed) { myBorders->SetVertice(myPoints.Length() + 1, - (float)myPoints.Value(1).x(), - (float)myPoints.Value(1).y(), + static_cast(myPoints.Value(1).x()), + static_cast(myPoints.Value(1).y()), 0.0f); } } diff --git a/src/Visualization/TKV3d/AIS/AIS_Shape.cxx b/src/Visualization/TKV3d/AIS/AIS_Shape.cxx index 557f8f66ce1..4e2b159f362 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Shape.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Shape.cxx @@ -110,9 +110,9 @@ void AIS_Shape::Compute(const occ::handle&, { // TopAbs_WIRE -> 7, TopAbs_EDGE -> 8, TopAbs_VERTEX -> 9 (Graphic3d_DisplayPriority_Highlight) const int aPrior = - (int)Graphic3d_DisplayPriority_Above1 + (int)myshape.ShapeType() - TopAbs_WIRE; + static_cast(Graphic3d_DisplayPriority_Above1) + static_cast(myshape.ShapeType()) - TopAbs_WIRE; thePrs->SetVisual(Graphic3d_TOS_ALL); - thePrs->SetDisplayPriority((Graphic3d_DisplayPriority)aPrior); + thePrs->SetDisplayPriority(static_cast(aPrior)); } if (IsInfinite()) @@ -140,7 +140,7 @@ void AIS_Shape::Compute(const occ::handle&, } case AIS_Shaded: { StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange(myshape, myDrawer, true); - if ((int)myshape.ShapeType() > 4) + if (static_cast(myshape.ShapeType()) > 4) { StdPrs_WFShape::Add(thePrs, myshape, myDrawer); } @@ -490,7 +490,7 @@ void AIS_Shape::UnsetColor() if (IsTransparent()) { double aTransp = myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel); - mat.SetTransparency(float(aTransp)); + mat.SetTransparency(static_cast(aTransp)); } myDrawer->ShadingAspect()->SetMaterial(mat, myCurrentFacingModel); myDrawer->ShadingAspect()->Aspect()->SetInteriorColor(anInteriorColors[0]); @@ -532,7 +532,7 @@ bool AIS_Shape::setWidth(const occ::handle& theDrawer, void AIS_Shape::SetWidth(const double theLineWidth) { - myOwnWidth = (float)theLineWidth; + myOwnWidth = static_cast(theLineWidth); if (!setWidth(myDrawer, theLineWidth) || !myDrawer->HasLink()) { @@ -686,7 +686,7 @@ void AIS_Shape::SetTransparency(const double theValue) { const bool toRecompute = !myDrawer->HasOwnShadingAspect(); setTransparency(myDrawer, theValue); - myDrawer->SetTransparency((float)theValue); + myDrawer->SetTransparency(static_cast(theValue)); if (!toRecompute || !myDrawer->HasLink()) { diff --git a/src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx b/src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx index 6ae80000837..65059816089 100644 --- a/src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx @@ -61,14 +61,14 @@ void AIS_TextLabel::SetColor(const Quantity_Color& theColor) void AIS_TextLabel::SetTransparency(const double theValue) { Quantity_ColorRGBA aTextColor(myDrawer->TextAspect()->Aspect()->Color()); - aTextColor.SetAlpha(float(1.0 - theValue)); + aTextColor.SetAlpha(static_cast(1.0 - theValue)); Quantity_ColorRGBA aSubColor(myDrawer->TextAspect()->Aspect()->ColorSubTitle()); aSubColor.SetAlpha(aTextColor.Alpha()); myDrawer->TextAspect()->Aspect()->SetColor(aTextColor); myDrawer->TextAspect()->Aspect()->SetColorSubTitle(aSubColor); - myDrawer->SetTransparency(float(theValue)); + myDrawer->SetTransparency(static_cast(theValue)); SynchronizeAspects(); } @@ -288,9 +288,9 @@ void AIS_TextLabel::Compute(const occ::handle&, Graphic3d_BndBox4f& aBox = thePrs->CurrentGroup()->ChangeBoundingBox(); aBox.Add( - NCollection_Vec4((float)aMinPnt.X(), (float)aMinPnt.Y(), (float)aMinPnt.Z(), 1.0)); + NCollection_Vec4(static_cast(aMinPnt.X()), static_cast(aMinPnt.Y()), static_cast(aMinPnt.Z()), 1.0)); aBox.Add( - NCollection_Vec4((float)aMaxPnt.X(), (float)aMaxPnt.Y(), (float)aMaxPnt.Z(), 1.0)); + NCollection_Vec4(static_cast(aMaxPnt.X()), static_cast(aMaxPnt.Y()), static_cast(aMaxPnt.Z()), 1.0)); } break; @@ -358,7 +358,7 @@ bool AIS_TextLabel::calculateLabelParams(const gp_Pnt& thePosition, const Graphic3d_RenderingParams& aRendParams = GetContext()->CurrentViewer()->DefaultRenderingParams(); Font_FTFontParams aFontParams; - aFontParams.PointSize = (unsigned int)anAsp->Height(); + aFontParams.PointSize = static_cast(anAsp->Height()); aFontParams.Resolution = aRendParams.Resolution; aFontParams.FontHinting = aRendParams.FontHinting; diff --git a/src/Visualization/TKV3d/AIS/AIS_TexturedShape.cxx b/src/Visualization/TKV3d/AIS/AIS_TexturedShape.cxx index cca230d09ff..e7e3a295280 100644 --- a/src/Visualization/TKV3d/AIS/AIS_TexturedShape.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_TexturedShape.cxx @@ -313,9 +313,9 @@ void AIS_TexturedShape::Compute(const occ::handle&, { // TopAbs_WIRE -> 7, TopAbs_EDGE -> 8, TopAbs_VERTEX -> 9 (Graphic3d_DisplayPriority_Highlight) const int aPrior = - (int)Graphic3d_DisplayPriority_Above1 + (int)myshape.ShapeType() - TopAbs_WIRE; + static_cast(Graphic3d_DisplayPriority_Above1) + static_cast(myshape.ShapeType()) - TopAbs_WIRE; thePrs->SetVisual(Graphic3d_TOS_ALL); - thePrs->SetDisplayPriority((Graphic3d_DisplayPriority)aPrior); + thePrs->SetDisplayPriority(static_cast(aPrior)); } if (IsInfinite()) diff --git a/src/Visualization/TKV3d/AIS/AIS_Triangulation.cxx b/src/Visualization/TKV3d/AIS/AIS_Triangulation.cxx index ff6e6cf476f..5ad12d98b33 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Triangulation.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Triangulation.cxx @@ -51,7 +51,7 @@ void AIS_Triangulation::SetTransparency(const double theValue) // override transparency myDrawer->ShadingAspect()->SetTransparency(theValue, myCurrentFacingModel); - myDrawer->SetTransparency((float)theValue); + myDrawer->SetTransparency(static_cast(theValue)); updatePresentation(); } @@ -242,8 +242,8 @@ NCollection_Vec4 AIS_Triangulation::attenuateColor(const int theColo 255.0 - myDrawer->ShadingAspect()->Aspect()->FrontMaterial().Transparency() * 255.0) : 255; - return NCollection_Vec4((uint8_t)(theComposition * anRgbx[0]), - (uint8_t)(theComposition * anRgbx[1]), - (uint8_t)(theComposition * anRgbx[2]), + return NCollection_Vec4(static_cast(theComposition * anRgbx[0]), + static_cast(theComposition * anRgbx[1]), + static_cast(theComposition * anRgbx[2]), anAlpha); } diff --git a/src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx b/src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx index 1e8cc1c2135..ee0674a53ed 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx @@ -188,7 +188,7 @@ void AIS_Trihedron::ComputeSelection(const occ::handle& the aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter; + const Prs3d_DatumParts aPart = static_cast(aPartIter); if (!anAspect->DrawDatumPart(aPart)) { continue; @@ -211,7 +211,7 @@ void AIS_Trihedron::ComputeSelection(const occ::handle& the case AIS_TrihedronSelectionMode_Axes: { for (int aPartIter = Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter; + const Prs3d_DatumParts aPart = static_cast(aPartIter); if (!anAspect->DrawDatumPart(aPart)) { continue; @@ -228,7 +228,7 @@ void AIS_Trihedron::ComputeSelection(const occ::handle& the for (int aPartIter = Prs3d_DatumParts_XOYAxis; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter; + const Prs3d_DatumParts aPart = static_cast(aPartIter); if (!anAspect->DrawDatumPart(aPart)) { continue; @@ -435,7 +435,7 @@ void AIS_Trihedron::computePresentation( for (int anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { - Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; + Prs3d_DatumParts aPart = static_cast(anAxisIter); if (!anAspect->DrawDatumPart(aPart)) { continue; @@ -481,7 +481,7 @@ void AIS_Trihedron::computePresentation( for (int anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; + const Prs3d_DatumParts aPart = static_cast(anAxisIter); if (!anAspect->DrawDatumPart(aPart)) { continue; @@ -514,7 +514,7 @@ void AIS_Trihedron::computePresentation( for (int anAxisIter = Prs3d_DatumParts_XOYAxis; anAxisIter <= Prs3d_DatumParts_XOZAxis; ++anAxisIter) { - Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; + Prs3d_DatumParts aPart = static_cast(anAxisIter); if (!anAspect->DrawDatumPart(aPart)) { continue; @@ -640,8 +640,8 @@ void AIS_Trihedron::SetArrowColor(const Quantity_Color& theColor) for (int anAxisIter = Prs3d_DatumParts_XArrow; anAxisIter <= Prs3d_DatumParts_ZArrow; ++anAxisIter) { - myDrawer->DatumAspect()->ShadingAspect((Prs3d_DatumParts)anAxisIter)->SetColor(theColor); - myDrawer->DatumAspect()->LineAspect((Prs3d_DatumParts)anAxisIter)->SetColor(theColor); + myDrawer->DatumAspect()->ShadingAspect(static_cast(anAxisIter))->SetColor(theColor); + myDrawer->DatumAspect()->LineAspect(static_cast(anAxisIter))->SetColor(theColor); } } @@ -763,7 +763,7 @@ void AIS_Trihedron::updatePrimitives(const occ::handle& theAs gp_XYZ anXYZOrigin = theOrigin.XYZ(); for (int anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { - Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; + Prs3d_DatumParts aPart = static_cast(anAxisIter); anAxisPoints.Bind( aPart, gp_Pnt(anXYZOrigin + anAxisDirs.Find(aPart).XYZ() * theAspect->AxisLength(aPart))); @@ -781,7 +781,7 @@ void AIS_Trihedron::updatePrimitives(const occ::handle& theAs // axes for (int aPartIter = Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter; + const Prs3d_DatumParts aPart = static_cast(aPartIter); if (theAspect->DrawDatumPart(aPart)) { occ::handle aPrims = new Graphic3d_ArrayOfSegments(2); @@ -799,7 +799,7 @@ void AIS_Trihedron::updatePrimitives(const occ::handle& theAs theAspect->ArrowAspect()->Angle(), theAspect->AxisLength(aPart) * theAspect->Attribute(Prs3d_DatumAttribute_ShadingConeLengthPercent), - (int)theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes)); + static_cast(theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes))); } } } @@ -813,7 +813,7 @@ void AIS_Trihedron::updatePrimitives(const occ::handle& theAs theAspect->AxisLength(Prs3d_DatumParts_XAxis) * theAspect->Attribute(Prs3d_DatumAttribute_ShadingOriginRadiusPercent); const int aNbOfFacettes = - (int)theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes); + static_cast(theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes)); gp_Trsf aSphereTransform; aSphereTransform.SetTranslationPart(gp_Vec(gp::Origin(), theOrigin)); myPrimitives[Prs3d_DatumParts_Origin] = @@ -822,7 +822,7 @@ void AIS_Trihedron::updatePrimitives(const occ::handle& theAs // axes { const int aNbOfFacettes = - (int)theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes); + static_cast(theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes)); const double aTubeRadiusPercent = theAspect->Attribute(Prs3d_DatumAttribute_ShadingTubeRadiusPercent); const double aConeLengthPercent = @@ -832,7 +832,7 @@ void AIS_Trihedron::updatePrimitives(const occ::handle& theAs for (int anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; + const Prs3d_DatumParts aPart = static_cast(anAxisIter); const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis(aPart); const bool aDrawArrow = theAspect->DrawDatumPart(anArrowPart); const double anAxisLength = theAspect->AxisLength(aPart); @@ -867,7 +867,7 @@ void AIS_Trihedron::updatePrimitives(const occ::handle& theAs for (int aPlaneIter = Prs3d_DatumParts_XOYAxis; aPlaneIter <= Prs3d_DatumParts_XOZAxis; ++aPlaneIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPlaneIter; + const Prs3d_DatumParts aPart = static_cast(aPlaneIter); if (!theAspect->DrawDatumPart(aPart)) { continue; diff --git a/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx b/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx index de3e05979ce..daaa6774d03 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx @@ -87,7 +87,7 @@ AIS_ViewController::AIS_ViewController() myTouchToleranceScale(1.0f), myTouchClickThresholdPx(3.0f), myTouchRotationThresholdPx(6.0f), - myTouchZRotationThreshold(float(2.0 * M_PI / 180.0)), + myTouchZRotationThreshold(static_cast(2.0 * M_PI / 180.0)), myTouchPanThresholdPx(4.0f), myTouchZoomThresholdPx(6.0f), myTouchZoomRatio(0.13f), @@ -118,42 +118,42 @@ AIS_ViewController::AIS_ViewController() myRubberBand->SetDisplayMode(0); myRubberBand->SetMutable(true); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_RotateOrbit); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_LeftButton - | (unsigned int)Aspect_VKeyFlags_CTRL, + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_LeftButton), AIS_MouseGesture_RotateOrbit); + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_LeftButton) + | static_cast(Aspect_VKeyFlags_CTRL), AIS_MouseGesture_Zoom); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_LeftButton - | (unsigned int)Aspect_VKeyFlags_SHIFT, + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_LeftButton) + | static_cast(Aspect_VKeyFlags_SHIFT), AIS_MouseGesture_Pan); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_LeftButton - | (unsigned int)Aspect_VKeyFlags_ALT, + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_LeftButton) + | static_cast(Aspect_VKeyFlags_ALT), AIS_MouseGesture_SelectRectangle); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_LeftButton - | (unsigned int)Aspect_VKeyFlags_ALT - | (unsigned int)Aspect_VKeyFlags_SHIFT, + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_LeftButton) + | static_cast(Aspect_VKeyFlags_ALT) + | static_cast(Aspect_VKeyFlags_SHIFT), AIS_MouseGesture_SelectRectangle); - myMouseSelectionSchemes.Bind((unsigned int)Aspect_VKeyMouse_LeftButton, + myMouseSelectionSchemes.Bind(static_cast(Aspect_VKeyMouse_LeftButton), AIS_SelectionScheme_Replace); - myMouseSelectionSchemes.Bind((unsigned int)Aspect_VKeyMouse_LeftButton - | (unsigned int)Aspect_VKeyFlags_ALT, + myMouseSelectionSchemes.Bind(static_cast(Aspect_VKeyMouse_LeftButton) + | static_cast(Aspect_VKeyFlags_ALT), AIS_SelectionScheme_Replace); - myMouseSelectionSchemes.Bind((unsigned int)Aspect_VKeyMouse_LeftButton - | (unsigned int)Aspect_VKeyFlags_SHIFT, + myMouseSelectionSchemes.Bind(static_cast(Aspect_VKeyMouse_LeftButton) + | static_cast(Aspect_VKeyFlags_SHIFT), AIS_SelectionScheme_XOR); - myMouseSelectionSchemes.Bind((unsigned int)Aspect_VKeyMouse_LeftButton - | (unsigned int)Aspect_VKeyFlags_ALT - | (unsigned int)Aspect_VKeyFlags_SHIFT, + myMouseSelectionSchemes.Bind(static_cast(Aspect_VKeyMouse_LeftButton) + | static_cast(Aspect_VKeyFlags_ALT) + | static_cast(Aspect_VKeyFlags_SHIFT), AIS_SelectionScheme_XOR); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_RightButton, AIS_MouseGesture_Zoom); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_RightButton - | (unsigned int)Aspect_VKeyFlags_CTRL, + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_RightButton), AIS_MouseGesture_Zoom); + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_RightButton) + | static_cast(Aspect_VKeyFlags_CTRL), AIS_MouseGesture_RotateOrbit); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_MiddleButton, AIS_MouseGesture_Pan); - myMouseGestureMap.Bind((unsigned int)Aspect_VKeyMouse_MiddleButton - | (unsigned int)Aspect_VKeyFlags_CTRL, + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_MiddleButton), AIS_MouseGesture_Pan); + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_MiddleButton) + | static_cast(Aspect_VKeyFlags_CTRL), AIS_MouseGesture_Pan); myMouseGestureMapDrag.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Drag); @@ -425,7 +425,7 @@ void AIS_ViewController::flushGestures(const occ::handle myGL.OrbitRotation.ToRotate = true; myGL.OrbitRotation.PointTo = myGL.OrbitRotation.PointStart + aRotDelta * aRotAccel; myGL.Dragging.ToMove = true; - myGL.Dragging.PointTo.SetValues((int)aTouch.To.x(), (int)aTouch.To.y()); + myGL.Dragging.PointTo.SetValues(static_cast(aTouch.To.x()), static_cast(aTouch.To.y())); } else { @@ -433,7 +433,7 @@ void AIS_ViewController::flushGestures(const occ::handle myGL.ViewRotation.ToRotate = true; myGL.ViewRotation.PointTo = myGL.ViewRotation.PointStart + aRotDelta * aRotAccel; myGL.Dragging.ToMove = true; - myGL.Dragging.PointTo.SetValues((int)aTouch.To.x(), (int)aTouch.To.y()); + myGL.Dragging.PointTo.SetValues(static_cast(aTouch.To.x()), static_cast(aTouch.To.y())); } aTouch.From = aTouch.To; @@ -483,7 +483,7 @@ void AIS_ViewController::flushGestures(const occ::handle aRotAngle = std::atan(aNumerator / aDenomenator); } - if (std::abs(aRotAngle) > double(myTouchZRotationThreshold)) + if (std::abs(aRotAngle) > static_cast(myTouchZRotationThreshold)) { myGL.ZRotate.ToRotate = true; myGL.ZRotate.Angle = aRotAngle; @@ -494,7 +494,7 @@ void AIS_ViewController::flushGestures(const occ::handle if (std::abs(aDeltaSize) > aTolScale * myTouchZoomThresholdPx) { // zoom - aDeltaSize *= double(myTouchZoomRatio); + aDeltaSize *= static_cast(myTouchZoomRatio); Aspect_ScrollDelta aParams(NCollection_Vec2(aPinchCenterStart), aDeltaSize); myGL.ZoomActions.Append(aParams); anIsClearDev = true; @@ -514,8 +514,8 @@ void AIS_ViewController::flushGestures(const occ::handle } myGL.Panning.ToPan = true; - myGL.Panning.Delta.x() = int(aPinchCenterXDev); - myGL.Panning.Delta.y() = int(-aPinchCenterYDev); + myGL.Panning.Delta.x() = static_cast(aPinchCenterXDev); + myGL.Panning.Delta.y() = static_cast(-aPinchCenterYDev); anIsClearDev = true; } @@ -688,7 +688,7 @@ bool AIS_ViewController::UpdateMouseButtons(const NCollection_Vec2& thePoin if (theButtons == Aspect_VKeyMouse_NONE && myMouseSingleButton > 0) { const NCollection_Vec2 aDelta = thePoint - myMousePressPoint; - if (double(aDelta.cwiseAbs().maxComp()) < aTolClick) + if (static_cast(aDelta.cwiseAbs().maxComp()) < aTolClick) { ++myMouseClickCounter; @@ -715,7 +715,7 @@ bool AIS_ViewController::UpdateMouseButtons(const NCollection_Vec2& thePoin myMouseClickCounter = 0; } toUpdateView = UpdateMouseClick(thePoint, - (Aspect_VKeyMouse)myMouseSingleButton, + static_cast(myMouseSingleButton), theModifiers, isDoubleClick) || toUpdateView; @@ -763,7 +763,7 @@ bool AIS_ViewController::UpdateMouseButtons(const NCollection_Vec2& thePoin if (myMouseClickCounter == 1) { const NCollection_Vec2 aDelta = thePoint - myMousePressPoint; - if (double(aDelta.cwiseAbs().maxComp()) >= aTolClick) + if (static_cast(aDelta.cwiseAbs().maxComp()) >= aTolClick) { myMouseClickTimer.Stop(); myMouseClickCounter = 0; @@ -901,7 +901,7 @@ bool AIS_ViewController::UpdateMousePosition(const NCollection_Vec2& thePoi { const double aTolClick = (theIsEmulated ? myTouchToleranceScale : 1.0) * myMouseClickThreshold; const NCollection_Vec2 aPressDelta = thePoint - myMousePressPoint; - if (double(aPressDelta.cwiseAbs().maxComp()) >= aTolClick) + if (static_cast(aPressDelta.cwiseAbs().maxComp()) >= aTolClick) { myMouseClickTimer.Stop(); myMouseClickCounter = 0; @@ -982,7 +982,7 @@ bool AIS_ViewController::UpdateMousePosition(const NCollection_Vec2& thePoi } const double aRotTol = - theIsEmulated ? double(myTouchToleranceScale) * myTouchRotationThresholdPx : 0.0; + theIsEmulated ? static_cast(myTouchToleranceScale) * myTouchRotationThresholdPx : 0.0; const NCollection_Vec2 aDeltaF(aDelta); if (std::abs(aDeltaF.x()) + std::abs(aDeltaF.y()) > aRotTol) { @@ -1019,7 +1019,7 @@ bool AIS_ViewController::UpdateMousePosition(const NCollection_Vec2& thePoi break; } const double aZoomTol = - theIsEmulated ? double(myTouchToleranceScale) * myTouchZoomThresholdPx : 0.0; + theIsEmulated ? static_cast(myTouchToleranceScale) * myTouchZoomThresholdPx : 0.0; const double aScrollDelta = myMouseActiveGesture == AIS_MouseGesture_Zoom ? aDelta.x() : aDelta.y(); if (std::abs(aScrollDelta) > aZoomTol) @@ -1042,7 +1042,7 @@ bool AIS_ViewController::UpdateMousePosition(const NCollection_Vec2& thePoi break; } const double aPanTol = - theIsEmulated ? double(myTouchToleranceScale) * myTouchPanThresholdPx : 0.0; + theIsEmulated ? static_cast(myTouchToleranceScale) * myTouchPanThresholdPx : 0.0; const NCollection_Vec2 aDeltaF(aDelta); if (std::abs(aDeltaF.x()) + std::abs(aDeltaF.y()) > aPanTol) { @@ -1080,8 +1080,8 @@ bool AIS_ViewController::UpdateMousePosition(const NCollection_Vec2& thePoi } const double aDragTol = - theIsEmulated ? double(myTouchToleranceScale) * myTouchDraggingThresholdPx : 0.0; - if (double(std::abs(aDelta.x()) + std::abs(aDelta.y())) > aDragTol) + theIsEmulated ? static_cast(myTouchToleranceScale) * myTouchDraggingThresholdPx : 0.0; + if (static_cast(std::abs(aDelta.x()) + std::abs(aDelta.y())) > aDragTol) { const double aRotAccel = myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel; @@ -1131,7 +1131,7 @@ void AIS_ViewController::AddTouchPoint(size_t theId, if (myToAllowDragging) { myUI.Dragging.ToStart = true; - myUI.Dragging.PointStart.SetValues((int)thePnt.x(), (int)thePnt.y()); + myUI.Dragging.PointStart.SetValues(static_cast(thePnt.x()), static_cast(thePnt.y())); } } else if (myTouchPoints.Extent() == 2) @@ -1176,7 +1176,7 @@ bool AIS_ViewController::RemoveTouchPoint(size_t theId, bool theClearSelectPnts) myUI.Dragging.ToStop = true; - if (theId == (size_t)-1) + if (theId == static_cast(-1)) { // abort clicking myTouchClick.From = NCollection_Vec2(-1); @@ -1213,7 +1213,7 @@ void AIS_ViewController::UpdateTouchPoint(size_t theId, const NCollection_Vec2(myTouchToleranceScale) * static_cast(myTouchClickThresholdPx); if (myTouchPoints.Extent() == 1 && (myTouchClick.From - thePnt).cwiseAbs().maxComp() > aTouchTol) { myTouchClick.From.SetValues(-1.0, -1.0); @@ -1456,8 +1456,8 @@ void AIS_ViewController::handlePanning(const occ::handle& theView) const gp_Pnt aViewDims = aCam->ViewDimensions (anEyeToPnt.Dot (aCam->Direction().XYZ())); // view dimensions at 3D point // clang-format on const NCollection_Vec2 aDxy( - -aViewDims.X() * myGL.Panning.Delta.x() / double(aWinSize.x()), - -aViewDims.X() * myGL.Panning.Delta.y() / double(aWinSize.x())); + -aViewDims.X() * myGL.Panning.Delta.x() / static_cast(aWinSize.x()), + -aViewDims.X() * myGL.Panning.Delta.y() / static_cast(aWinSize.x())); // theView->Translate (aCam, aDxy.x(), aDxy.y()); gp_Trsf aPanTrsf; @@ -1483,9 +1483,9 @@ void AIS_ViewController::handleZRotate(const occ::handle& theView) NCollection_Vec2 aViewPort; theView->Window()->Size(aViewPort.x(), aViewPort.y()); NCollection_Vec2 aRotPnt(0.99 * aViewPort.x(), 0.5 * aViewPort.y()); - theView->StartRotation(int(aRotPnt.x()), int(aRotPnt.y()), 0.4); + theView->StartRotation(static_cast(aRotPnt.x()), static_cast(aRotPnt.y()), 0.4); aRotPnt.y() += myGL.ZRotate.Angle * aViewPort.y(); - theView->Rotation(int(aRotPnt.x()), int(aRotPnt.y())); + theView->Rotation(static_cast(aRotPnt.x()), static_cast(aRotPnt.y())); theView->Invalidate(); theView->View()->SynchronizeXRPosedToBaseCamera(); } @@ -1580,8 +1580,8 @@ void AIS_ViewController::handleZoom(const occ::handle& theView, theView->Window()->Size(aWinSize.x(), aWinSize.y()); const NCollection_Vec2 aWinSizeF(aWinSize); const NCollection_Vec2 aPanFromCenterPx( - double(theParams.Point.x()) - 0.5 * aWinSizeF.x(), - aWinSizeF.y() - double(theParams.Point.y()) - 1.0 - 0.5 * aWinSizeF.y()); + static_cast(theParams.Point.x()) - 0.5 * aWinSizeF.x(), + aWinSizeF.y() - static_cast(theParams.Point.y()) - 1.0 - 0.5 * aWinSizeF.y()); aDxy.x() += -aViewDims1.X() * aPanFromCenterPx.x() / aWinSizeF.x(); aDxy.y() += -aViewDims1.Y() * aPanFromCenterPx.y() / aWinSizeF.y(); } @@ -1660,10 +1660,10 @@ void AIS_ViewController::handleOrbitRotation(const occ::handle& theVie // Calculate deltas exactly as in original double aYawAngleDelta = - ((myGL.OrbitRotation.PointStart.x() - myGL.OrbitRotation.PointTo.x()) / double(aWinXY.x())) + ((myGL.OrbitRotation.PointStart.x() - myGL.OrbitRotation.PointTo.x()) / static_cast(aWinXY.x())) * (M_PI * 0.5); double aPitchAngleDelta = - ((myGL.OrbitRotation.PointTo.y() - myGL.OrbitRotation.PointStart.y()) / double(aWinXY.y())) + ((myGL.OrbitRotation.PointTo.y() - myGL.OrbitRotation.PointStart.y()) / static_cast(aWinXY.y())) * (M_PI * 0.5); // Z-up locking: clamp pitch to prevent camera flipping at top/bottom @@ -1733,8 +1733,8 @@ void AIS_ViewController::handleOrbitRotation(const occ::handle& theVie NCollection_Vec2 aWinXY; theView->Size(aWinXY.x(), aWinXY.y()); - const double rx = (double)theView->Convert(aWinXY.x()); - const double ry = (double)theView->Convert(aWinXY.y()); + const double rx = static_cast(theView->Convert(aWinXY.x())); + const double ry = static_cast(theView->Convert(aWinXY.y())); const double THE_2PI = M_PI * 2.0; double aDX = (myGL.OrbitRotation.PointTo.x() - myGL.OrbitRotation.PointStart.x()) * M_PI / rx; @@ -1838,10 +1838,10 @@ void AIS_ViewController::handleViewRotation(const occ::handle& theView NCollection_Vec2 aWinXY; theView->Window()->Size(aWinXY.x(), aWinXY.y()); double aYawAngleDelta = - ((myGL.ViewRotation.PointStart.x() - myGL.ViewRotation.PointTo.x()) / double(aWinXY.x())) + ((myGL.ViewRotation.PointStart.x() - myGL.ViewRotation.PointTo.x()) / static_cast(aWinXY.x())) * (M_PI * 0.5); double aPitchAngleDelta = - -((myGL.ViewRotation.PointStart.y() - myGL.ViewRotation.PointTo.y()) / double(aWinXY.y())) + -((myGL.ViewRotation.PointStart.y() - myGL.ViewRotation.PointTo.y()) / static_cast(aWinXY.y())) * (M_PI * 0.5); // Add extra rotation from parameters @@ -1965,8 +1965,8 @@ gp_Pnt AIS_ViewController::GravityPoint(const occ::handle aCursor((int)myGL.OrbitRotation.PointStart.x(), - (int)myGL.OrbitRotation.PointStart.y()); + NCollection_Vec2 aCursor(static_cast(myGL.OrbitRotation.PointStart.x()), + static_cast(myGL.OrbitRotation.PointStart.y())); if (myRotationMode == AIS_RotationMode_PickCenter) { NCollection_Vec2 aViewPort; @@ -2064,9 +2064,9 @@ void AIS_ViewController::handleViewOrientationKeys( {Aspect_VKey_ViewBack, V3d_TypeOfOrientation_Zup_Back}, {Aspect_VKey_ViewAxoLeftProj, V3d_TypeOfOrientation_Zup_AxoLeft}, {Aspect_VKey_ViewAxoRightProj, V3d_TypeOfOrientation_Zup_AxoRight}, - {Aspect_VKey_ViewRoll90CW, (V3d_TypeOfOrientation)-1}, - {Aspect_VKey_ViewRoll90CCW, (V3d_TypeOfOrientation)-1}, - {Aspect_VKey_ViewFitAll, (V3d_TypeOfOrientation)-1}}; + {Aspect_VKey_ViewRoll90CW, static_cast(-1)}, + {Aspect_VKey_ViewRoll90CCW, static_cast(-1)}, + {Aspect_VKey_ViewFitAll, static_cast(-1)}}; { const size_t aNbKeys = sizeof(THE_VIEW_KEYS) / sizeof(*THE_VIEW_KEYS); const double anEventTime = EventTime(); @@ -2084,7 +2084,7 @@ void AIS_ViewController::handleViewOrientationKeys( aCameraBack = theView->Camera(); theView->SetCamera(new Graphic3d_Camera(aCameraBack)); } - if (aKeyAction.Orientation != (V3d_TypeOfOrientation)-1) + if (aKeyAction.Orientation != static_cast(-1)) { theView->SetProj(aKeyAction.Orientation); FitAllAuto(theCtx, theView); @@ -3393,7 +3393,7 @@ void AIS_ViewController::handleXRPresentations(const occ::handleUnitFactor() != (float)theView->View()->UnitFactor()) + if (!aPosePrs.IsNull() && aPosePrs->UnitFactor() != static_cast(theView->View()->UnitFactor())) { theCtx->Remove(aPosePrs, false); aPosePrs.Nullify(); @@ -3415,7 +3415,7 @@ void AIS_ViewController::handleXRPresentations(const occ::handleSetUnitFactor((float)theView->View()->UnitFactor()); + aPosePrs->SetUnitFactor(static_cast(theView->View()->UnitFactor())); aPosePrs->SetMutable(true); aPosePrs->SetInfiniteState(true); } @@ -3475,7 +3475,7 @@ void AIS_ViewController::handleXRPresentations(const occ::handleSetLaserColor(myXRLaserTeleColor); } - aPosePrs->SetLaserLength((float)aLaserLen); + aPosePrs->SetLaserLength(static_cast(aLaserLen)); } } diff --git a/src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx b/src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx index b551eefde10..ab2b2157618 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx @@ -348,7 +348,7 @@ void AIS_ViewCube::createRoundRectangleTriangles( const double anAngle = NCollection_Lerp::Interpolate(M_PI * 0.5, 0.0, - double(aNodeIter) / double(THE_NB_ROUND_SPLITS)); + static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); theTris->AddVertex(gp_Pnt(aHSize.X() + aRadius * std::cos(anAngle), aHSize.Y() + aRadius * std::sin(anAngle), 0.0) @@ -359,7 +359,7 @@ void AIS_ViewCube::createRoundRectangleTriangles( const double anAngle = NCollection_Lerp::Interpolate(0.0, -M_PI * 0.5, - double(aNodeIter) / double(THE_NB_ROUND_SPLITS)); + static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); theTris->AddVertex(gp_Pnt(aHSize.X() + aRadius * std::cos(anAngle), -aHSize.Y() + aRadius * std::sin(anAngle), 0.0) @@ -370,7 +370,7 @@ void AIS_ViewCube::createRoundRectangleTriangles( const double anAngle = NCollection_Lerp::Interpolate(-M_PI * 0.5, -M_PI, - double(aNodeIter) / double(THE_NB_ROUND_SPLITS)); + static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); theTris->AddVertex(gp_Pnt(-aHSize.X() + aRadius * std::cos(anAngle), -aHSize.Y() + aRadius * std::sin(anAngle), 0.0) @@ -381,7 +381,7 @@ void AIS_ViewCube::createRoundRectangleTriangles( const double anAngle = NCollection_Lerp::Interpolate(-M_PI, -M_PI * 1.5, - double(aNodeIter) / double(THE_NB_ROUND_SPLITS)); + static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); theTris->AddVertex(gp_Pnt(-aHSize.X() + aRadius * std::cos(anAngle), aHSize.Y() + aRadius * std::sin(anAngle), 0.0) @@ -520,7 +520,7 @@ void AIS_ViewCube::createBoxCornerTriangles(const occ::handle::Interpolate(2.0 * M_PI, 0.0, - double(aNodeIter) / double(THE_NB_DISK_SLICES)); + static_cast(aNodeIter) / static_cast(THE_NB_DISK_SLICES)); theTris->AddVertex( gp_Pnt(aRadius * std::cos(anAngle), aRadius * std::sin(anAngle), 0.0).Transformed(aTrsf)); } @@ -582,7 +582,7 @@ void AIS_ViewCube::Compute(const occ::handle&, for (int anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; + const Prs3d_DatumParts aPart = static_cast(anAxisIter); if (!aDatumAspect->DrawDatumPart(aPart)) { continue; @@ -653,12 +653,12 @@ void AIS_ViewCube::Compute(const occ::handle&, // Display box sides { int aNbNodes = 0, aNbTris = 0; - for (int aPartIter = V3d_Xpos; aPartIter <= int(V3d_Zneg); ++aPartIter) + for (int aPartIter = V3d_Xpos; aPartIter <= static_cast(V3d_Zneg); ++aPartIter) { createBoxPartTriangles(occ::handle(), aNbNodes, aNbTris, - (V3d_TypeOfOrientation)aPartIter); + static_cast(aPartIter)); } if (aNbNodes > 0) { @@ -670,11 +670,11 @@ void AIS_ViewCube::Compute(const occ::handle&, aSegs = new Graphic3d_ArrayOfSegments(aNbNodes, aNbNodes * 2, Graphic3d_ArrayFlags_None); } aNbNodes = aNbTris = 0; - for (int aPartIter = V3d_Xpos; aPartIter <= int(V3d_Zneg); ++aPartIter) + for (int aPartIter = V3d_Xpos; aPartIter <= static_cast(V3d_Zneg); ++aPartIter) { int aTriNodesFrom = aTris->VertexNumber(); const int aTriFrom = aNbTris; - createBoxPartTriangles(aTris, aNbNodes, aNbTris, (V3d_TypeOfOrientation)aPartIter); + createBoxPartTriangles(aTris, aNbNodes, aNbTris, static_cast(aPartIter)); if (aSegs.IsNull()) { continue; @@ -710,9 +710,9 @@ void AIS_ViewCube::Compute(const occ::handle&, // Display box sides labels occ::handle aTextGroup = thePrs->NewGroup(); aTextGroup->SetGroupPrimitivesAspect(myDrawer->TextAspect()->Aspect()); - for (int aPartIter = V3d_Xpos; aPartIter <= int(V3d_Zneg); ++aPartIter) + for (int aPartIter = V3d_Xpos; aPartIter <= static_cast(V3d_Zneg); ++aPartIter) { - const V3d_TypeOfOrientation anOrient = (V3d_TypeOfOrientation)aPartIter; + const V3d_TypeOfOrientation anOrient = static_cast(aPartIter); TCollection_AsciiString aLabel; if (!myBoxSideLabels.Find(anOrient, aLabel) || aLabel.IsEmpty()) @@ -746,7 +746,7 @@ void AIS_ViewCube::Compute(const occ::handle&, const gp_Ax2 aPosition(aPos, aDir, anUp.Crossed(aDir)); occ::handle aText = - new Graphic3d_Text((float)myDrawer->TextAspect()->Height()); + new Graphic3d_Text(static_cast(myDrawer->TextAspect()->Height())); aText->SetText(aLabel); aText->SetOrientation(aPosition); aText->SetOwnAnchorPoint(false); @@ -759,21 +759,21 @@ void AIS_ViewCube::Compute(const occ::handle&, // Display box edges { int aNbNodes = 0, aNbTris = 0; - for (int aPartIter = V3d_XposYpos; aPartIter <= int(V3d_YposZneg); ++aPartIter) + for (int aPartIter = V3d_XposYpos; aPartIter <= static_cast(V3d_YposZneg); ++aPartIter) { createBoxPartTriangles(occ::handle(), aNbNodes, aNbTris, - (V3d_TypeOfOrientation)aPartIter); + static_cast(aPartIter)); } if (aNbNodes > 0) { occ::handle aTris = new Graphic3d_ArrayOfTriangles(aNbNodes, aNbTris * 3, Graphic3d_ArrayFlags_VertexNormal); aNbNodes = aNbTris = 0; - for (int aPartIter = V3d_XposYpos; aPartIter <= int(V3d_YposZneg); ++aPartIter) + for (int aPartIter = V3d_XposYpos; aPartIter <= static_cast(V3d_YposZneg); ++aPartIter) { - const V3d_TypeOfOrientation anOrient = (V3d_TypeOfOrientation)aPartIter; + const V3d_TypeOfOrientation anOrient = static_cast(aPartIter); createBoxPartTriangles(aTris, aNbNodes, aNbTris, anOrient); } @@ -787,21 +787,21 @@ void AIS_ViewCube::Compute(const occ::handle&, // Display box corners { int aNbNodes = 0, aNbTris = 0; - for (int aPartIter = V3d_XposYposZpos; aPartIter <= int(V3d_XnegYnegZneg); ++aPartIter) + for (int aPartIter = V3d_XposYposZpos; aPartIter <= static_cast(V3d_XnegYnegZneg); ++aPartIter) { createBoxPartTriangles(occ::handle(), aNbNodes, aNbTris, - (V3d_TypeOfOrientation)aPartIter); + static_cast(aPartIter)); } if (aNbNodes > 0) { occ::handle aTris = new Graphic3d_ArrayOfTriangles(aNbNodes, aNbTris * 3, Graphic3d_ArrayFlags_VertexNormal); aNbNodes = aNbTris = 0; - for (int aPartIter = V3d_XposYposZpos; aPartIter <= int(V3d_XnegYnegZneg); ++aPartIter) + for (int aPartIter = V3d_XposYposZpos; aPartIter <= static_cast(V3d_XnegYnegZneg); ++aPartIter) { - const V3d_TypeOfOrientation anOrient = (V3d_TypeOfOrientation)aPartIter; + const V3d_TypeOfOrientation anOrient = static_cast(aPartIter); createBoxPartTriangles(aTris, aNbNodes, aNbTris, anOrient); } @@ -823,9 +823,9 @@ void AIS_ViewCube::ComputeSelection(const occ::handle& theS return; } - for (int aPartIter = 0; aPartIter <= int(V3d_XnegYnegZneg); ++aPartIter) + for (int aPartIter = 0; aPartIter <= static_cast(V3d_XnegYnegZneg); ++aPartIter) { - const V3d_TypeOfOrientation anOri = (V3d_TypeOfOrientation)aPartIter; + const V3d_TypeOfOrientation anOri = static_cast(aPartIter); int aNbNodes = 0, aNbTris = 0; createBoxPartTriangles(occ::handle(), aNbNodes, aNbTris, anOri); if (aNbNodes <= 0) diff --git a/src/Visualization/TKV3d/DsgPrs/DsgPrs_AnglePresentation.cxx b/src/Visualization/TKV3d/DsgPrs/DsgPrs_AnglePresentation.cxx index a907998ec06..a8e9e216b07 100644 --- a/src/Visualization/TKV3d/DsgPrs/DsgPrs_AnglePresentation.cxx +++ b/src/Visualization/TKV3d/DsgPrs/DsgPrs_AnglePresentation.cxx @@ -295,7 +295,7 @@ void DsgPrs_AnglePresentation::Add(const occ::handle& aPrese } const double alpha = std::abs(ufin - udeb); - const int nbp = std::max(4, int(50. * alpha / M_PI)); + const int nbp = std::max(4, static_cast(50. * alpha / M_PI)); const double dteta = alpha / (nbp - 1); occ::handle aPrims = new Graphic3d_ArrayOfPolylines(nbp + 4, 3); @@ -402,8 +402,8 @@ void DsgPrs_AnglePresentation::Add(const occ::handle& aPrese if (theval > Precision::Angular() && std::abs(M_PI - theval) > Precision::Angular()) { const double Alpha = std::abs(LastParAngleCirc - FirstParAngleCirc); - const int NodeNumber = std::max(4, int(50. * Alpha / M_PI)); - const double delta = Alpha / (double)(NodeNumber - 1); + const int NodeNumber = std::max(4, static_cast(50. * Alpha / M_PI)); + const double delta = Alpha / static_cast(NodeNumber - 1); aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber + 4, 3); aPrims->AddBound(NodeNumber); @@ -455,8 +455,8 @@ void DsgPrs_AnglePresentation::Add(const occ::handle& aPrese { // Creating the arc from AttachmentPoint2 to its projection const double Alpha = std::abs(LastParAttachCirc - FirstParAttachCirc); - const int NodeNumber = std::max(4, int(50. * Alpha / M_PI)); - const double delta = Alpha / (double)(NodeNumber - 1); + const int NodeNumber = std::max(4, static_cast(50. * Alpha / M_PI)); + const double delta = Alpha / static_cast(NodeNumber - 1); aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber); for (int i = 0; i < NodeNumber; i++, FirstParAttachCirc += delta) @@ -542,7 +542,7 @@ void DsgPrs_AnglePresentation::Add(const occ::handle& aPrese } const double alpha = std::abs(ufin - udeb); - const int nbp = std::max(4, int(50. * alpha / M_PI)); + const int nbp = std::max(4, static_cast(50. * alpha / M_PI)); const double dteta = alpha / (nbp - 1); occ::handle aPrims = new Graphic3d_ArrayOfPolylines(nbp + 4, 3); @@ -668,7 +668,7 @@ void DsgPrs_AnglePresentation::Add(const occ::handle& aPrese } const double alpha = std::abs(ufin - udeb); - const int nbp = std::max(4, int(50. * alpha / M_PI)); + const int nbp = std::max(4, static_cast(50. * alpha / M_PI)); const double dteta = alpha / (nbp - 1); occ::handle aPrims = new Graphic3d_ArrayOfPolylines(nbp + 4, 3); @@ -787,7 +787,7 @@ void DsgPrs_AnglePresentation::Add(const occ::handle& aPrese } const double alpha = std::abs(ufin - udeb); - const int nbp = std::max(4, int(50. * alpha / M_PI)); + const int nbp = std::max(4, static_cast(50. * alpha / M_PI)); const double dteta = alpha / (nbp - 1); occ::handle aPrims = new Graphic3d_ArrayOfPolylines(nbp + 4, 3); @@ -859,7 +859,7 @@ void DsgPrs_AnglePresentation::Add(const occ::handle& aPrese gp_Ax2 ax(CenterPoint, theAxe.Direction(), dir1); gp_Circ cer(ax, CenterPoint.Distance(AttachmentPoint1)); - const int nbp = std::max(4, int(50. * theval / M_PI)); + const int nbp = std::max(4, static_cast(50. * theval / M_PI)); const double dteta = theval / (nbp - 1); occ::handle aPrims = new Graphic3d_ArrayOfPolylines(nbp); diff --git a/src/Visualization/TKV3d/DsgPrs/DsgPrs_EllipseRadiusPresentation.cxx b/src/Visualization/TKV3d/DsgPrs/DsgPrs_EllipseRadiusPresentation.cxx index a3b30748f70..6235094a05b 100644 --- a/src/Visualization/TKV3d/DsgPrs/DsgPrs_EllipseRadiusPresentation.cxx +++ b/src/Visualization/TKV3d/DsgPrs/DsgPrs_EllipseRadiusPresentation.cxx @@ -99,7 +99,7 @@ void DsgPrs_EllipseRadiusPresentation::Add(const occ::handle gp_Dir dir(Vpnt ^ Vapex); double parFirst = anEllipse.Position().Direction().IsOpposite(dir, Precision::Angular()) ? uLast : uFirst; - const int NodeNumber = std::max(4, int(50. * Alpha / M_PI)); + const int NodeNumber = std::max(4, static_cast(50. * Alpha / M_PI)); const double delta = Alpha / (NodeNumber - 1); occ::handle aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber); @@ -154,7 +154,7 @@ void DsgPrs_EllipseRadiusPresentation::Add(const occ::handle gp_Vec Vpnt(aCenter, p1); gp_Dir dir(Vpnt ^ Vapex); double parFirst = aCurve->Direction().IsOpposite(dir, Precision::Angular()) ? uLast : uFirst; - const int NodeNumber = std::max(4, int(50. * Alpha / M_PI)); + const int NodeNumber = std::max(4, static_cast(50. * Alpha / M_PI)); const double delta = Alpha / (NodeNumber - 1); occ::handle aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber); diff --git a/src/Visualization/TKV3d/DsgPrs/DsgPrs_EqualDistancePresentation.cxx b/src/Visualization/TKV3d/DsgPrs/DsgPrs_EqualDistancePresentation.cxx index 12eeff0968f..810ff6b49b8 100644 --- a/src/Visualization/TKV3d/DsgPrs/DsgPrs_EqualDistancePresentation.cxx +++ b/src/Visualization/TKV3d/DsgPrs/DsgPrs_EqualDistancePresentation.cxx @@ -203,7 +203,7 @@ void DsgPrs_EqualDistancePresentation::AddIntervalBetweenTwoArcs( aPar12 += 2. * M_PI; if (std::abs(aPar12 - aPar11) > Precision::Confusion()) { - aNodeNb = int(std::max(std::abs(aPar12 - aPar11) * 50. / M_PI + 0.5, 4.)); + aNodeNb = static_cast(std::max(std::abs(aPar12 - aPar11) * 50. / M_PI + 0.5, 4.)); aDelta = (aPar12 - aPar11) / aNodeNb; aCurPar = aPar11; @@ -217,7 +217,7 @@ void DsgPrs_EqualDistancePresentation::AddIntervalBetweenTwoArcs( aPar22 += 2. * M_PI; if (std::abs(aPar22 - aPar21) > Precision::Confusion()) { - aNodeNb = int(std::max(std::abs(aPar22 - aPar21) * 50. / M_PI + 0.5, 4.)); + aNodeNb = static_cast(std::max(std::abs(aPar22 - aPar21) * 50. / M_PI + 0.5, 4.)); aDelta = (aPar22 - aPar21) / aNodeNb; aCurPar = aPar21; diff --git a/src/Visualization/TKV3d/DsgPrs/DsgPrs_FilletRadiusPresentation.cxx b/src/Visualization/TKV3d/DsgPrs/DsgPrs_FilletRadiusPresentation.cxx index 5b6bfd48a89..f8efe705ac9 100644 --- a/src/Visualization/TKV3d/DsgPrs/DsgPrs_FilletRadiusPresentation.cxx +++ b/src/Visualization/TKV3d/DsgPrs/DsgPrs_FilletRadiusPresentation.cxx @@ -85,7 +85,7 @@ void DsgPrs_FilletRadiusPresentation::Add(const occ::handle& if (!SpecCase) { const double Alpha = std::abs(LastParCirc - FirstParCirc); - const int NodeNumber = std::max(4, int(50. * Alpha / M_PI)); + const int NodeNumber = std::max(4, static_cast(50. * Alpha / M_PI)); const double delta = Alpha / (NodeNumber - 1); occ::handle aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber); diff --git a/src/Visualization/TKV3d/DsgPrs/DsgPrs_IdenticPresentation.cxx b/src/Visualization/TKV3d/DsgPrs/DsgPrs_IdenticPresentation.cxx index ffe784bf2a5..bf53b971d3a 100644 --- a/src/Visualization/TKV3d/DsgPrs/DsgPrs_IdenticPresentation.cxx +++ b/src/Visualization/TKV3d/DsgPrs/DsgPrs_IdenticPresentation.cxx @@ -118,7 +118,7 @@ void DsgPrs_IdenticPresentation::Add(const occ::handle& aPre double alpha = pSAttach - pFAttach; if (alpha < 0) alpha += 2. * M_PI; - const int nb = (int)(50. * alpha / M_PI); + const int nb = static_cast(50. * alpha / M_PI); const int nbp = std::max(4, nb); const double dteta = alpha / (nbp - 1); @@ -168,7 +168,7 @@ void DsgPrs_IdenticPresentation::Add(const occ::handle& aPre double alpha = pSAttach - pFAttach; if (alpha < 0) alpha += 2. * M_PI; - const int nb = (int)(50. * alpha / M_PI); + const int nb = static_cast(50. * alpha / M_PI); const int nbp = std::max(4, nb); const double dteta = alpha / (nbp - 1); @@ -215,7 +215,7 @@ void DsgPrs_IdenticPresentation::Add(const occ::handle& aPre double alpha = pSAttach - pFAttach; if (alpha < 0) alpha += 2. * M_PI; - const int nb = (int)(50.0 * alpha / M_PI); + const int nb = static_cast(50.0 * alpha / M_PI); const int nbp = std::max(4, nb); const double dteta = alpha / (nbp - 1); diff --git a/src/Visualization/TKV3d/DsgPrs/DsgPrs_LengthPresentation.cxx b/src/Visualization/TKV3d/DsgPrs/DsgPrs_LengthPresentation.cxx index 6f4f85a0444..a9b870619f4 100644 --- a/src/Visualization/TKV3d/DsgPrs/DsgPrs_LengthPresentation.cxx +++ b/src/Visualization/TKV3d/DsgPrs/DsgPrs_LengthPresentation.cxx @@ -358,8 +358,8 @@ void DsgPrs_LengthPresentation::Add(const occ::handle& aPres Alpha = std::abs(deltaU); if (Alpha > Precision::Angular() && Alpha < Precision::Infinite()) { - NodeNumber = std::max(4, int(50. * Alpha / M_PI)); - delta = deltaU / (double)(NodeNumber - 1); + NodeNumber = std::max(4, static_cast(50. * Alpha / M_PI)); + delta = deltaU / static_cast(NodeNumber - 1); aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber); for (int i = 1; i <= NodeNumber; i++, FirstU += delta) aPrims->AddVertex(VCurve->Value(FirstU)); @@ -368,8 +368,8 @@ void DsgPrs_LengthPresentation::Add(const occ::handle& aPres Alpha = std::abs(deltaV); if (Alpha > Precision::Angular() && Alpha < Precision::Infinite()) { - NodeNumber = std::max(4, int(50. * Alpha / M_PI)); - delta = deltaV / (double)(NodeNumber - 1); + NodeNumber = std::max(4, static_cast(50. * Alpha / M_PI)); + delta = deltaV / static_cast(NodeNumber - 1); aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber); for (int i = 1; i <= NodeNumber; i++, FirstV += delta) aPrims->AddVertex(UCurve->Value(FirstV)); diff --git a/src/Visualization/TKV3d/DsgPrs/DsgPrs_MidPointPresentation.cxx b/src/Visualization/TKV3d/DsgPrs/DsgPrs_MidPointPresentation.cxx index 5e130ae506d..5a8b8a412e9 100644 --- a/src/Visualization/TKV3d/DsgPrs/DsgPrs_MidPointPresentation.cxx +++ b/src/Visualization/TKV3d/DsgPrs/DsgPrs_MidPointPresentation.cxx @@ -198,7 +198,7 @@ void DsgPrs_MidPointPresentation::Add(const occ::handle& aPr double alpha = pl - pf; if (alpha < 0) alpha += 2. * M_PI; - const int nb = (int)(50.0 * alpha / M_PI); + const int nb = static_cast(50.0 * alpha / M_PI); int nbp = std::max(4, nb); double dteta = alpha / (nbp - 1); @@ -278,7 +278,7 @@ void DsgPrs_MidPointPresentation::Add(const occ::handle& aPr double alpha = pl - pf; if (alpha < 0) alpha += 2 * M_PI; - const int nb = (int)(50.0 * alpha / M_PI); + const int nb = static_cast(50.0 * alpha / M_PI); int nbp = std::max(4, nb); double dteta = alpha / (nbp - 1); diff --git a/src/Visualization/TKV3d/DsgPrs/DsgPrs_SymmetricPresentation.cxx b/src/Visualization/TKV3d/DsgPrs/DsgPrs_SymmetricPresentation.cxx index 5f509a8946e..d7b1301c886 100644 --- a/src/Visualization/TKV3d/DsgPrs/DsgPrs_SymmetricPresentation.cxx +++ b/src/Visualization/TKV3d/DsgPrs/DsgPrs_SymmetricPresentation.cxx @@ -532,12 +532,12 @@ void DsgPrs_SymmetricPresentation::Add(const occ::handle& aP if (alpha > M_PI) { alpha = (2. * M_PI) - alpha; - nbp = (int)std::trunc(alpha / (alpha * .02)); + nbp = static_cast(std::trunc(alpha / (alpha * .02))); Dalpha = alpha / (nbp - 1); } else { - nbp = (int)std::trunc(alpha / (alpha * .02)); + nbp = static_cast(std::trunc(alpha / (alpha * .02))); Dalpha = -alpha / (nbp - 1); } } @@ -546,12 +546,12 @@ void DsgPrs_SymmetricPresentation::Add(const occ::handle& aP if (alpha > M_PI) { alpha = (2. * M_PI) - alpha; - nbp = (int)std::trunc(alpha / (alpha * .02)); + nbp = static_cast(std::trunc(alpha / (alpha * .02))); Dalpha = -alpha / (nbp - 1); } else { - nbp = (int)std::trunc(alpha / (alpha * .02)); + nbp = static_cast(std::trunc(alpha / (alpha * .02))); Dalpha = alpha / (nbp - 1); } } @@ -580,12 +580,12 @@ void DsgPrs_SymmetricPresentation::Add(const occ::handle& aP if (alpha > M_PI) { alpha = (2 * M_PI) - alpha; - nbp = (int)std::trunc(alpha / (alpha * .02)); + nbp = static_cast(std::trunc(alpha / (alpha * .02))); Dalpha = alpha / (nbp - 1); } else { - nbp = (int)std::trunc(alpha / (alpha * .02)); + nbp = static_cast(std::trunc(alpha / (alpha * .02))); Dalpha = -alpha / (nbp - 1); } } @@ -594,12 +594,12 @@ void DsgPrs_SymmetricPresentation::Add(const occ::handle& aP if (alpha > M_PI) { alpha = (2 * M_PI) - alpha; - nbp = (int)std::trunc(alpha / (alpha * .02)); + nbp = static_cast(std::trunc(alpha / (alpha * .02))); Dalpha = -alpha / (nbp - 1); } else { - nbp = (int)std::trunc(alpha / (alpha * .02)); + nbp = static_cast(std::trunc(alpha / (alpha * .02))); Dalpha = alpha / (nbp - 1); } } diff --git a/src/Visualization/TKV3d/Prs3d/Prs3d_DatumAspect.cxx b/src/Visualization/TKV3d/Prs3d/Prs3d_DatumAspect.cxx index a1721647cd4..a565cf4e553 100644 --- a/src/Visualization/TKV3d/Prs3d/Prs3d_DatumAspect.cxx +++ b/src/Visualization/TKV3d/Prs3d/Prs3d_DatumAspect.cxx @@ -41,7 +41,7 @@ Prs3d_DatumAspect::Prs3d_DatumAspect() myArrowAspect = new Prs3d_ArrowAspect(); for (int aPartIter = Prs3d_DatumParts_Origin; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter; + const Prs3d_DatumParts aPart = static_cast(aPartIter); Quantity_Color aColor = aDefaultColor; if (aPart >= Prs3d_DatumParts_XArrow && aPart <= Prs3d_DatumParts_ZArrow) @@ -151,7 +151,7 @@ void Prs3d_DatumAspect::CopyAspectsFrom(const occ::handle& th *theOther->myTextAspects[Prs3d_DatumParts_ZAxis]->Aspect(); for (int aPartIter = Prs3d_DatumParts_Origin; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter; + const Prs3d_DatumParts aPart = static_cast(aPartIter); if (!myLineAspects[aPart].IsNull()) { *myLineAspects[aPart]->Aspect() = *theOther->myLineAspects[aPart]->Aspect(); diff --git a/src/Visualization/TKV3d/Prs3d/Prs3d_Drawer.hxx b/src/Visualization/TKV3d/Prs3d/Prs3d_Drawer.hxx index 556ad9574fb..95fcd7d4381 100644 --- a/src/Visualization/TKV3d/Prs3d/Prs3d_Drawer.hxx +++ b/src/Visualization/TKV3d/Prs3d/Prs3d_Drawer.hxx @@ -728,7 +728,7 @@ public: GeomAbs_Shape FaceBoundaryUpperContinuity() const { return HasOwnFaceBoundaryUpperContinuity() - ? (GeomAbs_Shape)myFaceBoundaryUpperContinuity + ? static_cast(myFaceBoundaryUpperContinuity) : (!myLink.IsNull() ? myLink->FaceBoundaryUpperContinuity() : GeomAbs_CN); } diff --git a/src/Visualization/TKV3d/Prs3d/Prs3d_ShadingAspect.cxx b/src/Visualization/TKV3d/Prs3d/Prs3d_ShadingAspect.cxx index 63e43688ad2..b270dcacdb6 100644 --- a/src/Visualization/TKV3d/Prs3d/Prs3d_ShadingAspect.cxx +++ b/src/Visualization/TKV3d/Prs3d/Prs3d_ShadingAspect.cxx @@ -127,16 +127,16 @@ void Prs3d_ShadingAspect::SetTransparency(const double theValu if (theModel == Aspect_TOFM_FRONT_SIDE || theModel == Aspect_TOFM_BOTH_SIDE) { - myAspect->ChangeFrontMaterial().SetTransparency(float(theValue)); + myAspect->ChangeFrontMaterial().SetTransparency(static_cast(theValue)); myAspect->SetInteriorColor( - Quantity_ColorRGBA(myAspect->InteriorColor(), 1.0f - float(theValue))); + Quantity_ColorRGBA(myAspect->InteriorColor(), 1.0f - static_cast(theValue))); } if (theModel == Aspect_TOFM_BACK_SIDE || theModel == Aspect_TOFM_BOTH_SIDE) { - myAspect->ChangeBackMaterial().SetTransparency(float(theValue)); + myAspect->ChangeBackMaterial().SetTransparency(static_cast(theValue)); myAspect->SetBackInteriorColor( - Quantity_ColorRGBA(myAspect->BackInteriorColor(), 1.0f - float(theValue))); + Quantity_ColorRGBA(myAspect->BackInteriorColor(), 1.0f - static_cast(theValue))); } } diff --git a/src/Visualization/TKV3d/Prs3d/Prs3d_Text.cxx b/src/Visualization/TKV3d/Prs3d/Prs3d_Text.cxx index 3a8ca050125..beb0b4de8e7 100644 --- a/src/Visualization/TKV3d/Prs3d/Prs3d_Text.cxx +++ b/src/Visualization/TKV3d/Prs3d/Prs3d_Text.cxx @@ -32,7 +32,7 @@ occ::handle Prs3d_Text::Draw(const occ::handle& { theGroup->SetPrimitivesAspect(theAspect->Aspect()); - occ::handle aText = new Graphic3d_Text((float)theAspect->Height()); + occ::handle aText = new Graphic3d_Text(static_cast(theAspect->Height())); aText->SetText(theText.ToExtString()); aText->SetPosition(theAttachmentPoint); aText->SetHorizontalAlignment(theAspect->HorizontalJustification()); @@ -51,7 +51,7 @@ occ::handle Prs3d_Text::Draw(const occ::handle& { theGroup->SetPrimitivesAspect(theAspect->Aspect()); - occ::handle aText = new Graphic3d_Text((float)theAspect->Height()); + occ::handle aText = new Graphic3d_Text(static_cast(theAspect->Height())); aText->SetText(theText.ToExtString()); aText->SetOrientation(theOrientation); aText->SetOwnAnchorPoint(theHasOwnAnchor); diff --git a/src/Visualization/TKV3d/PrsDim/PrsDim_AngleDimension.cxx b/src/Visualization/TKV3d/PrsDim/PrsDim_AngleDimension.cxx index 248f8c47238..77254024a5a 100644 --- a/src/Visualization/TKV3d/PrsDim/PrsDim_AngleDimension.cxx +++ b/src/Visualization/TKV3d/PrsDim/PrsDim_AngleDimension.cxx @@ -376,7 +376,7 @@ void PrsDim_AngleDimension::DrawArc(const occ::handle& thePr if (myType == PrsDim_TypeOfAngle_Exterior) anAngle = 2.0 * M_PI - anAngle; // it sets 50 points on PI, and a part of points if angle is less - const int aNbPoints = std::max(4, int(50.0 * anAngle / M_PI)); + const int aNbPoints = std::max(4, static_cast(50.0 * anAngle / M_PI)); GCPnts_UniformAbscissa aMakePnts(anArcAdaptor, aNbPoints); if (!aMakePnts.IsDone()) diff --git a/src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx b/src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx index b511eb8c21c..33a65d1d46d 100644 --- a/src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx +++ b/src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx @@ -299,7 +299,7 @@ TCollection_ExtendedString PrsDim_Dimension::GetValueString(double& theWidth) co Font_FTFontParams aFontParams; const Graphic3d_RenderingParams& aRendParams = GetContext()->CurrentViewer()->DefaultRenderingParams(); - aFontParams.PointSize = (unsigned int)aTextAspect->Height(); + aFontParams.PointSize = static_cast(aTextAspect->Height()); aFontParams.Resolution = aRendParams.Resolution; aFontParams.FontHinting = aRendParams.FontHinting; if (occ::handle aFont = @@ -312,7 +312,7 @@ TCollection_ExtendedString PrsDim_Dimension::GetValueString(double& theWidth) co { char32_t aCurrChar = *anIter; char32_t aNextChar = *(++anIter); - theWidth += (double)aFont->AdvanceX(aCurrChar, aNextChar); + theWidth += static_cast(aFont->AdvanceX(aCurrChar, aNextChar)); } } } @@ -1266,7 +1266,7 @@ void PrsDim_Dimension::ComputeSelection(const occ::handle& return; } - PrsDim_DimensionSelectionMode aSelectionMode = (PrsDim_DimensionSelectionMode)theMode; + PrsDim_DimensionSelectionMode aSelectionMode = static_cast(theMode); // init appropriate entity owner occ::handle aSensitiveOwner; diff --git a/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx b/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx index edd1389fa35..f9d6764b810 100644 --- a/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx +++ b/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx @@ -710,9 +710,9 @@ void PrsMgr_PresentableObject::UnsetMaterial() void PrsMgr_PresentableObject::SetTransparency(const double theValue) { myDrawer->SetupOwnShadingAspect(); - myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency(float(theValue)); - myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial().SetTransparency(float(theValue)); - myDrawer->SetTransparency(float(theValue)); + myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency(static_cast(theValue)); + myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial().SetTransparency(static_cast(theValue)); + myDrawer->SetTransparency(static_cast(theValue)); } //================================================================================================= diff --git a/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.hxx b/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.hxx index db237c01078..c5fb1197856 100644 --- a/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.hxx +++ b/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.hxx @@ -511,7 +511,7 @@ public: //! @name simplified presentation properties API //! Allows you to provide the setting aValue for width. //! Only the Interactive Object knows which Drawer attribute is affected by the width setting. - virtual void SetWidth(const double theWidth) { myOwnWidth = (float)theWidth; } + virtual void SetWidth(const double theWidth) { myOwnWidth = static_cast(theWidth); } //! Reset width to default value. virtual void UnsetWidth() { myOwnWidth = 0.0f; } diff --git a/src/Visualization/TKV3d/Select3D/Select3D_BVHIndexBuffer.hxx b/src/Visualization/TKV3d/Select3D/Select3D_BVHIndexBuffer.hxx index 69a310396bd..9cad2b3e379 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_BVHIndexBuffer.hxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_BVHIndexBuffer.hxx @@ -44,7 +44,7 @@ public: NbElements = theNbElems; NbAttributes = 0; - if (NbElements != 0 && !Allocate(size_t(Stride) * size_t(NbElements))) + if (NbElements != 0 && !Allocate(static_cast(Stride) * static_cast(NbElements))) { release(); return false; @@ -55,29 +55,29 @@ public: //! Access index at specified position int Index(const int theIndex) const { - return int(*reinterpret_cast(value(theIndex))); + return static_cast(*reinterpret_cast(value(theIndex))); } //! Access index at specified position int PatchSize(const int theIndex) const { return myHasPatches - ? int(*reinterpret_cast(value(theIndex) + sizeof(unsigned int))) + ? static_cast(*reinterpret_cast(value(theIndex) + sizeof(unsigned int))) : 1; } //! Change index at specified position void SetIndex(const int theIndex, const int theValue) { - *reinterpret_cast(changeValue(theIndex)) = (unsigned int)theValue; + *reinterpret_cast(changeValue(theIndex)) = static_cast(theValue); } //! Change index at specified position void SetIndex(const int theIndex, const int theValue, const int thePatchSize) { - *reinterpret_cast(changeValue(theIndex)) = (unsigned int)theValue; + *reinterpret_cast(changeValue(theIndex)) = static_cast(theValue); *reinterpret_cast(changeValue(theIndex) + sizeof(unsigned int)) = - (unsigned int)thePatchSize; + static_cast(thePatchSize); } private: diff --git a/src/Visualization/TKV3d/Select3D/Select3D_SensitivePrimitiveArray.cxx b/src/Visualization/TKV3d/Select3D/Select3D_SensitivePrimitiveArray.cxx index d43eb13d990..e5574c670c9 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_SensitivePrimitiveArray.cxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_SensitivePrimitiveArray.cxx @@ -175,7 +175,7 @@ Select3D_SensitivePrimitiveArray::Select3D_SensitivePrimitiveArray( const occ::handle& theOwnerId) : Select3D_SensitiveSet(theOwnerId), myPosData(nullptr), - myPosStride(size_t(-1)), + myPosStride(static_cast(-1)), myPrimType(Graphic3d_TOPA_UNDEFINED), myIndexLower(0), myIndexUpper(0), @@ -256,7 +256,7 @@ bool Select3D_SensitivePrimitiveArray::InitTriangulation( myIndexLower = 0; myIndexUpper = 0; myPosData = nullptr; - myPosStride = size_t(-1); + myPosStride = static_cast(-1); myBvhIndices.release(); myIs3d = false; myInitLocation = theInitLoc; @@ -391,7 +391,7 @@ bool Select3D_SensitivePrimitiveArray::InitTriangulation( { myBvhIndices.SetIndex(myBvhIndices.NbElements++, aTriFrom + aPatchFrom, aPatchSize); } - aCenter /= float(aNbTris); + aCenter /= static_cast(aNbTris); myCDG3D = vecToPnt(aCenter); if (theToEvalMinMax) @@ -421,7 +421,7 @@ bool Select3D_SensitivePrimitiveArray::InitPoints( myIndexLower = 0; myIndexUpper = 0; myPosData = nullptr; - myPosStride = size_t(-1); + myPosStride = static_cast(-1); myBvhIndices.release(); myIs3d = false; myInitLocation = theInitLoc; @@ -567,7 +567,7 @@ bool Select3D_SensitivePrimitiveArray::InitPoints( { myBvhIndices.SetIndex(myBvhIndices.NbElements++, theIndexLower + aPatchFrom, aPatchSize); } - aCenter /= float(aNbPoints); + aCenter /= static_cast(aNbPoints); myCDG3D = vecToPnt(aCenter); if (theToEvalMinMax) diff --git a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveSegment.cxx b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveSegment.cxx index ae194e32527..9cbdb6f7862 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveSegment.cxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveSegment.cxx @@ -112,6 +112,6 @@ void Select3D_SensitiveSegment::DumpJson(Standard_OStream& theOStream, int theDe OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &myStart) OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &myEnd) - Select3D_BndBox3d aBoundingBox = ((Select3D_SensitiveSegment*)this)->BoundingBox(); + Select3D_BndBox3d aBoundingBox = (const_cast(this))->BoundingBox(); OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &aBoundingBox) } diff --git a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveSet.cxx b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveSet.cxx index 81106e907fb..83500076429 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveSet.cxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveSet.cxx @@ -296,6 +296,6 @@ void Select3D_SensitiveSet::DumpJson(Standard_OStream& theOStream, int theDepth) OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myDetectedIdx) - Select3D_BndBox3d aBoundingBox = ((Select3D_SensitiveSet*)this)->BoundingBox(); + Select3D_BndBox3d aBoundingBox = (const_cast(this))->BoundingBox(); OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &aBoundingBox) } diff --git a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveTriangle.cxx b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveTriangle.cxx index 4ab70cbd08a..42bf9ad0f8d 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveTriangle.cxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveTriangle.cxx @@ -108,6 +108,6 @@ void Select3D_SensitiveTriangle::DumpJson(Standard_OStream& theOStream, int theD OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &myPoints[1]) OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &myPoints[2]) - Select3D_BndBox3d aBoundingBox = ((Select3D_SensitiveTriangle*)this)->BoundingBox(); + Select3D_BndBox3d aBoundingBox = (const_cast(this))->BoundingBox(); OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &aBoundingBox) } diff --git a/src/Visualization/TKV3d/SelectBasics/SelectBasics_PickResult.hxx b/src/Visualization/TKV3d/SelectBasics/SelectBasics_PickResult.hxx index 4a98fb62e16..3fc54dcf8f1 100644 --- a/src/Visualization/TKV3d/SelectBasics/SelectBasics_PickResult.hxx +++ b/src/Visualization/TKV3d/SelectBasics/SelectBasics_PickResult.hxx @@ -94,7 +94,7 @@ public: //! Set surface normal at picked point. void SetSurfaceNormal(const gp_Vec& theNormal) { - myNormal.SetValues((float)theNormal.X(), (float)theNormal.Y(), (float)theNormal.Z()); + myNormal.SetValues(static_cast(theNormal.X()), static_cast(theNormal.Y()), static_cast(theNormal.Z())); } private: diff --git a/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectingVolumeManager.cxx b/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectingVolumeManager.cxx index c0f87e0f2e4..dc99200c277 100644 --- a/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectingVolumeManager.cxx +++ b/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectingVolumeManager.cxx @@ -359,7 +359,7 @@ bool SelectMgr_SelectingVolumeManager::OverlapsPolygon( } return myActiveSelectingVolume->OverlapsPolygon(theArrayOfPnts, - (Select3D_TypeOfSensitivity)theSensType, + static_cast(theSensType), myViewClipRange, thePickResult); } @@ -402,7 +402,7 @@ bool SelectMgr_SelectingVolumeManager::OverlapsTriangle( return myActiveSelectingVolume->OverlapsTriangle(thePt1, thePt2, thePt3, - (Select3D_TypeOfSensitivity)theSensType, + static_cast(theSensType), myViewClipRange, thePickResult); } diff --git a/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectionImageFiller.cxx b/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectionImageFiller.cxx index 3f09cedf1b3..cf81124cb58 100644 --- a/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectionImageFiller.cxx +++ b/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectionImageFiller.cxx @@ -155,7 +155,7 @@ class NormalizedDepthFiller : public SelectMgr_SelectionImageFiller } const SelectMgr_SortCriterion& aSortCriterion = myMainSel->PickedData(thePicked); - myUnnormImage.ChangeValue(theRow, theCol) = float(aSortCriterion.Depth); + myUnnormImage.ChangeValue(theRow, theCol) = static_cast(aSortCriterion.Depth); myDepthMin = std::min(myDepthMin, aSortCriterion.Depth); myDepthMax = std::max(myDepthMax, aSortCriterion.Depth); } @@ -167,8 +167,8 @@ class NormalizedDepthFiller : public SelectMgr_SelectionImageFiller float aDelta = 1.0f; if (myDepthMin <= myDepthMax) { - aFrom = float(myDepthMin); - aDelta = float(myDepthMax) - float(myDepthMin); + aFrom = static_cast(myDepthMin); + aDelta = static_cast(myDepthMax) - static_cast(myDepthMin); if (aDelta <= ShortRealEpsilon()) { aDelta = 1.0f; @@ -181,8 +181,8 @@ class NormalizedDepthFiller : public SelectMgr_SelectionImageFiller float aDepth = myUnnormImage.Value(aRowIter, aColIter); if (aDepth <= -ShortRealLast() || aDepth >= ShortRealLast()) { - myImage->SetPixelColor(int(aColIter), - int(aRowIter), + myImage->SetPixelColor(static_cast(aColIter), + static_cast(aRowIter), Quantity_ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f)); continue; } @@ -192,8 +192,8 @@ class NormalizedDepthFiller : public SelectMgr_SelectionImageFiller { aNormDepth = 1.0f - aNormDepth; } - myImage->SetPixelColor(int(aColIter), - int(aRowIter), + myImage->SetPixelColor(static_cast(aColIter), + static_cast(aRowIter), Quantity_ColorRGBA(aNormDepth, aNormDepth, aNormDepth, 1.0f)); } } @@ -224,7 +224,7 @@ class UnnormalizedDepthFiller : public SelectMgr_SelectionImageFiller } const SelectMgr_SortCriterion& aSortCriterion = myMainSel->PickedData(thePicked); - const float aDepth = float(aSortCriterion.Depth); + const float aDepth = static_cast(aSortCriterion.Depth); myImage->SetPixelColor( theCol, theRow, diff --git a/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectionImageFiller.hxx b/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectionImageFiller.hxx index 27e55a81efe..7d2950b171f 100644 --- a/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectionImageFiller.hxx +++ b/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectionImageFiller.hxx @@ -63,9 +63,9 @@ protected: //! Fills the given color as random. void nextRandomPastelColor(Quantity_Color& theColor) { - theColor = Quantity_Color(double(myBullardGenerator.NextInt() % 256) / 255.0, - double(myBullardGenerator.NextInt() % 256) / 255.0, - double(myBullardGenerator.NextInt() % 256) / 255.0, + theColor = Quantity_Color(static_cast(myBullardGenerator.NextInt() % 256) / 255.0, + static_cast(myBullardGenerator.NextInt() % 256) / 255.0, + static_cast(myBullardGenerator.NextInt() % 256) / 255.0, Quantity_TOC_sRGB); } diff --git a/src/Visualization/TKV3d/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/Visualization/TKV3d/SelectMgr/SelectMgr_ViewerSelector.cxx index f4f729e10c0..ac4bf9cf4da 100644 --- a/src/Visualization/TKV3d/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/Visualization/TKV3d/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -693,7 +693,7 @@ void SelectMgr_ViewerSelector::TraverseSensitives(const int theViewId) for (int aBVHSetIt = 0; aBVHSetIt < SelectMgr_SelectableObjectSet::BVHSubsetNb; ++aBVHSetIt) { const SelectMgr_SelectableObjectSet::BVHSubset aBVHSubset = - (SelectMgr_SelectableObjectSet::BVHSubset)aBVHSetIt; + static_cast(aBVHSetIt); if (mySelectableObjects.IsEmpty(aBVHSubset)) { continue; diff --git a/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.cxx b/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.cxx index da1f49d27b9..9f7488c5c2b 100644 --- a/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.cxx +++ b/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.cxx @@ -63,7 +63,7 @@ static const Font_FTFontParams THE_FONT_PARAMS(THE_FONT_SIZE, THE_RESOLUTION_DPI // compute scaling factor for specified font size inline double getScale(const double theSize) { - return theSize / double(THE_FONT_SIZE) * 72.0 / double(THE_RESOLUTION_DPI); + return theSize / static_cast(THE_FONT_SIZE) * 72.0 / static_cast(THE_RESOLUTION_DPI); } #ifdef HAVE_FREETYPE @@ -72,8 +72,8 @@ static gp_XY readFTVec(const FT_Vector& theVec, const double theScaleUnits, const double theWidthScaling = 1.0) { - return gp_XY(theScaleUnits * double(theVec.x) * theWidthScaling / 64.0, - theScaleUnits * double(theVec.y) / 64.0); + return gp_XY(theScaleUnits * static_cast(theVec.x) * theWidthScaling / 64.0, + theScaleUnits * static_cast(theVec.y) / 64.0); } //! Auxiliary method for classification wire theW2 with respect to wire theW1 diff --git a/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.hxx b/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.hxx index 838b33023b7..86534206cfe 100644 --- a/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.hxx +++ b/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.hxx @@ -123,43 +123,43 @@ public: public: //! @return vertical distance from the horizontal baseline to the highest character coordinate. - double Ascender() const { return myScaleUnits * double(myFTFont->Ascender()); } + double Ascender() const { return myScaleUnits * static_cast(myFTFont->Ascender()); } //! @return vertical distance from the horizontal baseline to the lowest character coordinate. - double Descender() const { return myScaleUnits * double(myFTFont->Descender()); } + double Descender() const { return myScaleUnits * static_cast(myFTFont->Descender()); } //! @return default line spacing (the baseline-to-baseline distance). - double LineSpacing() const { return myScaleUnits * double(myFTFont->LineSpacing()); } + double LineSpacing() const { return myScaleUnits * static_cast(myFTFont->LineSpacing()); } //! Configured point size - double PointSize() const { return myScaleUnits * double(myFTFont->PointSize()); } + double PointSize() const { return myScaleUnits * static_cast(myFTFont->PointSize()); } //! Compute advance to the next character with kerning applied when applicable. //! Assuming text rendered horizontally. double AdvanceX(const char32_t theUCharNext) { - return myScaleUnits * double(myFTFont->AdvanceX(theUCharNext)); + return myScaleUnits * static_cast(myFTFont->AdvanceX(theUCharNext)); } //! Compute advance to the next character with kerning applied when applicable. //! Assuming text rendered horizontally. double AdvanceX(const char32_t theUChar, const char32_t theUCharNext) { - return myScaleUnits * double(myFTFont->AdvanceX(theUChar, theUCharNext)); + return myScaleUnits * static_cast(myFTFont->AdvanceX(theUChar, theUCharNext)); } //! Compute advance to the next character with kerning applied when applicable. //! Assuming text rendered vertically. double AdvanceY(const char32_t theUCharNext) { - return myScaleUnits * double(myFTFont->AdvanceY(theUCharNext)); + return myScaleUnits * static_cast(myFTFont->AdvanceY(theUCharNext)); } //! Compute advance to the next character with kerning applied when applicable. //! Assuming text rendered vertically. double AdvanceY(const char32_t theUChar, const char32_t theUCharNext) { - return myScaleUnits * double(myFTFont->AdvanceY(theUChar, theUCharNext)); + return myScaleUnits * static_cast(myFTFont->AdvanceY(theUChar, theUCharNext)); } //! Returns scaling factor for current font size. diff --git a/src/Visualization/TKV3d/StdPrs/StdPrs_Curve.cxx b/src/Visualization/TKV3d/StdPrs/StdPrs_Curve.cxx index d4313bf3197..d1c2e5c0a9f 100644 --- a/src/Visualization/TKV3d/StdPrs/StdPrs_Curve.cxx +++ b/src/Visualization/TKV3d/StdPrs/StdPrs_Curve.cxx @@ -167,7 +167,7 @@ static bool MatchCurve(const double X, const double Radius = aCurve.Circle().Radius(); const double DU = std::sqrt(8.0 * TheDeflection / Radius); const double Er = std::abs(U2 - U1) / DU; - const int N = std::max(2, (int)std::trunc(Er)); + const int N = std::max(2, static_cast(std::trunc(Er))); if (N > 0) { gp_Pnt p1, p2; diff --git a/src/Visualization/TKV3d/StdPrs/StdPrs_DeflectionCurve.cxx b/src/Visualization/TKV3d/StdPrs/StdPrs_DeflectionCurve.cxx index 396dd1d63de..e830b5c6a9c 100644 --- a/src/Visualization/TKV3d/StdPrs/StdPrs_DeflectionCurve.cxx +++ b/src/Visualization/TKV3d/StdPrs/StdPrs_DeflectionCurve.cxx @@ -232,7 +232,7 @@ static bool MatchCurve(const double X, { const double DU = std::sqrt(8.0 * TheDeflection / Radius); const double Er = std::abs(U2 - U1) / DU; - const int N = std::max(2, (int)std::trunc(Er)); + const int N = std::max(2, static_cast(std::trunc(Er))); if (N > 0) { gp_Pnt p1, p2; diff --git a/src/Visualization/TKV3d/StdPrs/StdPrs_Plane.cxx b/src/Visualization/TKV3d/StdPrs/StdPrs_Plane.cxx index 9aa3da71d2a..36065425150 100644 --- a/src/Visualization/TKV3d/StdPrs/StdPrs_Plane.cxx +++ b/src/Visualization/TKV3d/StdPrs/StdPrs_Plane.cxx @@ -41,8 +41,8 @@ void StdPrs_Plane::Add(const occ::handle& aPresentation, gp_Pnt p1; double Xmax, Ymax; - Xmax = 0.5 * double(theaspect->PlaneXLength()); - Ymax = 0.5 * double(theaspect->PlaneYLength()); + Xmax = 0.5 * (theaspect->PlaneXLength()); + Ymax = 0.5 * (theaspect->PlaneYLength()); if (theaspect->DisplayEdges()) { TheGroup->SetPrimitivesAspect(theaspect->EdgesAspect()->Aspect()); @@ -60,8 +60,8 @@ void StdPrs_Plane::Add(const occ::handle& aPresentation, { TheGroup->SetPrimitivesAspect(theaspect->IsoAspect()->Aspect()); const double dist = theaspect->IsoDistance(); - const int nbx = int(std::abs(2. * Xmax) / dist) - 1; - const int nby = int(std::abs(2. * Ymax) / dist) - 1; + const int nbx = static_cast(std::abs(2. * Xmax) / dist) - 1; + const int nby = static_cast(std::abs(2. * Ymax) / dist) - 1; occ::handle aPrims = new Graphic3d_ArrayOfSegments(2 * (nbx + nby)); int i; double cur = -Xmax + dist; @@ -85,7 +85,7 @@ void StdPrs_Plane::Add(const occ::handle& aPresentation, double len = theaspect->ArrowsLength(); double ang = theaspect->ArrowsAngle(); gp_Vec trans(norm); - trans.Scale(double(siz)); + trans.Scale((siz)); TheGroup->SetPrimitivesAspect(theaspect->ArrowAspect()->Aspect()); if (theaspect->DisplayCenterArrow()) diff --git a/src/Visualization/TKV3d/V3d/V3d_CircularGrid.cxx b/src/Visualization/TKV3d/V3d/V3d_CircularGrid.cxx index 7c1ac38ce7a..b7e337271d4 100644 --- a/src/Visualization/TKV3d/V3d/V3d_CircularGrid.cxx +++ b/src/Visualization/TKV3d/V3d/V3d_CircularGrid.cxx @@ -228,7 +228,7 @@ void V3d_CircularGrid::DefineLines() myToComputePrs = false; myGroup->Clear(); - const int Division = (int)((aDivision >= THE_DIVISION ? aDivision : THE_DIVISION)); + const int Division = static_cast((aDivision >= THE_DIVISION ? aDivision : THE_DIVISION)); int nbpnts = 2 * Division; // diametres @@ -292,7 +292,7 @@ void V3d_CircularGrid::DefineLines() } myGroup->SetMinMaxValues(-myRadius, -myRadius, -myOffSet, myRadius, myRadius, -myOffSet); - myCurStep = aStep, myCurDivi = (int)aDivision; + myCurStep = aStep, myCurDivi = static_cast(aDivision); // update bounding box myStructure->CalculateBoundBox(); @@ -323,7 +323,7 @@ void V3d_CircularGrid::DefinePoints() MarkerAttrib->SetType(Aspect_TOM_POINT); MarkerAttrib->SetScale(3.); - const int nbpnts = int(2 * aDivision); + const int nbpnts = static_cast(2 * aDivision); double r, alpha = M_PI / aDivision; // diameters @@ -349,7 +349,7 @@ void V3d_CircularGrid::DefinePoints() } myGroup->SetMinMaxValues(-myRadius, -myRadius, -myOffSet, myRadius, myRadius, -myOffSet); - myCurStep = aStep, myCurDivi = (int)aDivision; + myCurStep = aStep, myCurDivi = static_cast(aDivision); // update bounding box myStructure->CalculateBoundBox(); diff --git a/src/Visualization/TKV3d/V3d/V3d_Plane.cxx b/src/Visualization/TKV3d/V3d/V3d_Plane.cxx index be4f16cb887..9ba1cddea5a 100644 --- a/src/Visualization/TKV3d/V3d/V3d_Plane.cxx +++ b/src/Visualization/TKV3d/V3d/V3d_Plane.cxx @@ -62,7 +62,7 @@ void V3d_Plane::Display(const occ::handle& theView, const Quantity_Col anAsp->SetHatchStyle(new Graphic3d_HatchStyle(Aspect_HS_GRID_DIAGONAL_WIDE)); aGroup->SetGroupPrimitivesAspect(anAsp); - const float aSize = (float)(0.5 * aViewer->DefaultViewSize()); + const float aSize = static_cast(0.5 * aViewer->DefaultViewSize()); const float anOffset = aSize / 5000.0f; occ::handle aPrims = new Graphic3d_ArrayOfQuadrangles(4); diff --git a/src/Visualization/TKV3d/V3d/V3d_View.cxx b/src/Visualization/TKV3d/V3d/V3d_View.cxx index 9ef12c2d646..971d679a5c5 100644 --- a/src/Visualization/TKV3d/V3d/V3d_View.cxx +++ b/src/Visualization/TKV3d/V3d/V3d_View.cxx @@ -1725,7 +1725,7 @@ double V3d_View::Convert(const int Vp) const double aValue; gp_Pnt aViewDims = Camera()->ViewDimensions(); - aValue = aViewDims.X() * (double)Vp / (double)aDxw; + aValue = aViewDims.X() * static_cast(Vp) / static_cast(aDxw); return aValue; } @@ -2420,7 +2420,7 @@ void V3d_View::Zoom(const int theXp1, const int theYp1, const int theXp2, const int aDy = theYp2 - theYp1; if (aDx != 0 || aDy != 0) { - double aCoeff = std::sqrt((double)(aDx * aDx + aDy * aDy)) / 100.0 + 1.0; + double aCoeff = std::sqrt(static_cast(aDx * aDx + aDy * aDy)) / 100.0 + 1.0; aCoeff = (aDx > 0) ? aCoeff : 1.0 / aCoeff; SetZoom(aCoeff, true); } @@ -2444,7 +2444,7 @@ void V3d_View::ZoomAtPoint(const int theMouseStartX, bool wasUpdateEnabled = SetImmediateUpdate(false); // zoom - double aDxy = double((theMouseEndX + theMouseEndY) - (theMouseStartX + theMouseStartY)); + double aDxy = static_cast((theMouseEndX + theMouseEndY) - (theMouseStartX + theMouseStartY)); double aDZoom = std::abs(aDxy) / 100.0 + 1.0; aDZoom = (aDxy > 0.0) ? aDZoom : 1.0 / aDZoom; @@ -2545,8 +2545,8 @@ void V3d_View::StartRotation(const int X, const int Y, const double zRotationThr sy = Y; double x, y; Size(x, y); - rx = double(Convert(x)); - ry = double(Convert(y)); + rx = static_cast(Convert(x)); + ry = static_cast(Convert(y)); myRotateGravity = GravityPoint(); Rotate(0.0, 0.0, 0.0, myRotateGravity.X(), myRotateGravity.Y(), myRotateGravity.Z(), true); myZRotation = false; @@ -2573,12 +2573,12 @@ void V3d_View::Rotation(const int X, const int Y) double dx = 0., dy = 0., dz = 0.; if (myZRotation) { - dz = atan2(double(X) - rx / 2., ry / 2. - double(Y)) - atan2(sx - rx / 2., ry / 2. - sy); + dz = atan2(static_cast(X) - rx / 2., ry / 2. - static_cast(Y)) - atan2(sx - rx / 2., ry / 2. - sy); } else { - dx = (double(X) - sx) * M_PI / rx; - dy = (sy - double(Y)) * M_PI / ry; + dx = (static_cast(X) - sx) * M_PI / rx; + dy = (sy - static_cast(Y)) * M_PI / ry; } Rotate(dx, dy, dz, myRotateGravity.X(), myRotateGravity.Y(), myRotateGravity.Z(), false); @@ -2653,8 +2653,8 @@ bool V3d_View::ToPixMap(Image_PixMap& theImage, const V3d_ImageDumpOptions& theP if (aTargetSize.x() != 0 && aTargetSize.y() != 0) { // allocate image buffer for dumping - if (theImage.IsEmpty() || theImage.SizeX() != size_t(aTargetSize.x()) - || theImage.SizeY() != size_t(aTargetSize.y())) + if (theImage.IsEmpty() || theImage.SizeX() != static_cast(aTargetSize.x()) + || theImage.SizeY() != static_cast(aTargetSize.y())) { Image_Format aFormat = Image_Format_UNKNOWN; switch (theParams.BufferType) @@ -2679,7 +2679,7 @@ bool V3d_View::ToPixMap(Image_PixMap& theImage, const V3d_ImageDumpOptions& theP break; } - if (!theImage.InitZero(aFormat, size_t(aTargetSize.x()), size_t(aTargetSize.y()))) + if (!theImage.InitZero(aFormat, static_cast(aTargetSize.x()), static_cast(aTargetSize.y()))) { Message::SendFail(TCollection_AsciiString("Fail to allocate an image ") + aTargetSize.x() + "x" + aTargetSize.y() + " for view dump"); @@ -2692,8 +2692,8 @@ bool V3d_View::ToPixMap(Image_PixMap& theImage, const V3d_ImageDumpOptions& theP Message::SendFail("V3d_View::ToPixMap() has been called without image dimensions"); return false; } - aTargetSize.x() = (int)theImage.SizeX(); - aTargetSize.y() = (int)theImage.SizeY(); + aTargetSize.x() = static_cast(theImage.SizeX()); + aTargetSize.y() = static_cast(theImage.SizeY()); occ::handle aFBOPtr; occ::handle aPrevFBOPtr = myView->FBO(); @@ -2800,7 +2800,7 @@ bool V3d_View::ToPixMap(Image_PixMap& theImage, const V3d_ImageDumpOptions& theP } if (theParams.ToAdjustAspect) { - aCamera->SetAspect(double(aTargetSize.x()) / double(aTargetSize.y())); + aCamera->SetAspect(static_cast(aTargetSize.x()) / static_cast(aTargetSize.y())); } // apply zlayer rendering parameters to view myView->SetZLayerTarget(theParams.TargetZLayerId); @@ -3472,7 +3472,7 @@ Graphic3d_Vertex V3d_View::Compute(const Graphic3d_Vertex& theVertex) const else if (occ::handle aCircleGrid = occ::down_cast(MyGrid)) { - const double anAlpha = M_PI / double(aCircleGrid->DivisionNumber()); + const double anAlpha = M_PI / static_cast(aCircleGrid->DivisionNumber()); // project point on plane to grid local space const gp_Vec aToPoint(aPnt0, aPointOnPlane); From 89f9f5da6e2bcd157d7dd2f0b2995e7ba4cee849 Mon Sep 17 00:00:00 2001 From: jijinbei Date: Sun, 19 Apr 2026 07:36:10 +0900 Subject: [PATCH 2/3] Coding - Fix CI failures for cast cleanup PR Addresses PR #1206 feedback: 1. macOS Clang build: static_cast(pthread_t) does not compile because pthread_t is a pointer (_opaque_pthread_t*) on macOS, unlike Linux where it is unsigned long. Added #elif defined(__APPLE__) branches in OSD_Thread.cxx using reinterpret_cast for the two sites (line 190 and 365). 2. Check code formatting: applied the CI's format.patch artifact. The clang-tidy google-readability-casting replacements left some lines outside the configured column width; clang-format restores the layout across 213 files. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../BinLDrivers_DocumentSection.cxx | 4 +- .../TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx | 13 +- .../TKCAF/TNaming/TNaming_Tool.cxx | 9 +- .../TKCDF/CDF/CDF_Application.cxx | 3 +- .../TKCDF/LDOM/LDOMBasicString.cxx | 4 +- .../TKCDF/LDOM/LDOM_BasicElement.cxx | 6 +- .../TKCDF/LDOM/LDOM_CharReference.cxx | 8 +- .../TKCDF/LDOM/LDOM_Element.cxx | 6 +- .../TKCDF/LDOM/LDOM_Node.cxx | 2 +- .../TKCDF/LDOM/LDOM_XmlReader.cxx | 16 +- .../TKCDF/LDOM/LDOM_XmlWriter.cxx | 3 +- .../TKCDF/PCDM/PCDM_StorageDriver.cxx | 3 +- .../StdStorage_BacketOfPersistent.cxx | 3 +- .../StdStorage_BacketOfPersistent.hxx | 8 +- .../TKXmlL/XmlObjMgt/XmlObjMgt.cxx | 7 +- .../BinMXCAFDoc_VisMaterialDriver.cxx | 5 +- .../TKDE/DE/DE_ShapeFixConfigurationNode.cxx | 517 +++++++++--------- .../DEBREP/DEBREP_ConfigurationNode.cxx | 12 +- .../DEXCAF/DEXCAF_ConfigurationNode.cxx | 6 +- .../DEIGES/DEIGES_ConfigurationNode.cxx | 55 +- .../TKDEIGES/DEIGES/DEIGES_Parameters.cxx | 32 +- .../TKDEIGES/DEIGES/DEIGES_Provider.cxx | 36 +- .../IGESCAFControl/IGESCAFControl_Writer.cxx | 5 +- .../IGESGraph/IGESGraph_ToolTextFontDef.cxx | 3 +- .../TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx | 15 +- .../TKDEOBJ/RWObj/RWObj_CafReader.cxx | 5 +- .../TKDEOBJ/RWObj/RWObj_CafWriter.cxx | 4 +- .../TKDEOBJ/RWObj/RWObj_Reader.hxx | 5 +- .../TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx | 15 +- .../TKDEPLY/RWPly/RWPly_CafWriter.cxx | 4 +- .../TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx | 10 +- .../DESTEP/DESTEP_ConfigurationNode.cxx | 102 ++-- .../TKDESTEP/DESTEP/DESTEP_Parameters.cxx | 84 +-- .../STEPCAFControl/STEPCAFControl_Reader.cxx | 27 +- .../StepData/StepData_StepReaderData.cxx | 10 +- .../TKDESTL/RWStl/RWStl_Reader.cxx | 3 +- .../DEVRML/DEVRML_ConfigurationNode.cxx | 31 +- .../TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx | 8 +- .../TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx | 10 +- .../TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx | 10 +- .../IFSelect/IFSelect_WorkSession.cxx | 3 +- .../Interface/Interface_FileParameter.cxx | 3 +- .../Interface/Interface_UndefinedContent.cxx | 3 +- .../XSControl/XSControl_TransferReader.cxx | 3 +- .../BSplCLib/BSplCLib_CurveComputation.pxx | 11 +- .../TKMath/BSplSLib/BSplSLib.cxx | 6 +- .../TKMath/Poly/Poly_ArrayOfNodes.hxx | 4 +- .../TKMath/Poly/Poly_MergeNodesTool.hxx | 8 +- .../TKMath/Poly/Poly_Triangulation.cxx | 4 +- .../TKMath/Poly/Poly_Triangulation.hxx | 7 +- .../TKMath/math/math_FunctionAllRoots.cxx | 4 +- .../TKernel/FSD/FSD_Base64.cxx | 7 +- .../Message/Message_AttributeMeter.cxx | 6 +- .../TKernel/Message/Message_ExecStatus.hxx | 3 +- .../TKernel/Message/Message_Msg.cxx | 4 +- .../TKernel/Message/Message_MsgFile.cxx | 2 +- .../TKernel/Message/Message_ProgressScope.hxx | 3 +- .../NCollection/NCollection_AccAllocator.hxx | 10 +- .../NCollection/NCollection_BaseMap.cxx | 6 +- .../NCollection/NCollection_CellFilter.hxx | 7 +- .../NCollection_SparseArrayBase.hxx | 3 +- .../NCollection/NCollection_UtfIterator.lxx | 6 +- .../TKernel/OSD/OSD_DirectoryIterator.cxx | 9 +- .../TKernel/OSD/OSD_File.cxx | 10 +- .../TKernel/OSD/OSD_FileIterator.cxx | 9 +- .../TKernel/OSD/OSD_LocalFileSystem.cxx | 5 +- .../TKernel/OSD/OSD_MemInfo.cxx | 31 +- .../TKernel/OSD/OSD_Thread.cxx | 6 + .../TKernel/OSD/OSD_signal.cxx | 2 +- .../TKernel/Quantity/Quantity_Color.cxx | 31 +- .../TKernel/Quantity/Quantity_Color.hxx | 8 +- .../TKernel/Quantity/Quantity_ColorRGBA.cxx | 5 +- .../TKernel/Resource/Resource_Unicode.cxx | 10 +- .../TKernel/Standard/Standard_Character.hxx | 6 +- .../Standard/Standard_ErrorHandler.cxx | 8 +- .../TKernel/Standard/Standard_HashUtils.lxx | 5 +- .../TKernel/Standard/Standard_MMgrOpt.cxx | 10 +- .../Storage/Storage_BucketOfPersistent.hxx | 6 +- .../TKernel/Storage/Storage_Schema.cxx | 9 +- .../TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx | 6 +- .../TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx | 8 +- .../TKBO/BOPDS/BOPDS_Curve.lxx | 3 +- .../IntTools/IntTools_BeanFaceIntersector.cxx | 10 +- .../TKBO/IntTools/IntTools_Context.cxx | 22 +- .../TKBool/BRepAlgo/BRepAlgo.cxx | 6 +- .../TopOpeBRep/TopOpeBRep_FacesFiller.cxx | 5 +- .../TopOpeBRep_FacesIntersector.cxx | 3 +- .../TopOpeBRepBuild_CorrectFace2d.cxx | 12 +- .../TopOpeBRepBuild_HBuilder.cxx | 5 +- .../TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx | 9 +- .../TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx | 4 +- .../TopOpeBRepDS/TopOpeBRepDS_connex.cxx | 33 +- .../TopOpeBRepDS/TopOpeBRepDS_samdom.cxx | 24 +- .../TopOpeBRepTool_RegularizeW.cxx | 4 +- .../TopOpeBRepTool_SolidClassifier.cxx | 6 +- .../TKFeat/BRepFeat/BRepFeat_Form.cxx | 4 +- .../TKFeat/BRepFeat/BRepFeat_RibSlot.cxx | 4 +- .../TKFeat/LocOpe/LocOpe_CSIntersector.cxx | 24 +- .../TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx | 2 +- .../TKFillet/ChFiDS/ChFiDS_Spine.cxx | 10 +- .../TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx | 3 +- .../ApproxInt/ApproxInt_MultiLine.gxx | 18 +- .../FairCurve/FairCurve_MinimalVariation.cxx | 8 +- .../Geom2dAPI/Geom2dAPI_PointsToBSpline.cxx | 4 +- ...ntersectorOfTheIntConicCurveOfGInter_0.cxx | 5 +- .../GeomPlate/GeomPlate_PlateG0Criterion.cxx | 3 +- .../GeomPlate/GeomPlate_PlateG1Criterion.cxx | 3 +- ...ve_MyImpParToolOfIntImpConicParConic_0.cxx | 4 +- .../IntPatch/IntPatch_LineConstructor.cxx | 8 +- .../IntPatch/IntPatch_PrmPrmIntersection.cxx | 26 +- .../TKHLR/Contap/Contap_HContTool.cxx | 6 +- .../TKHLR/HLRAlgo/HLRAlgo_PolyAlgo.cxx | 15 +- .../TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx | 7 +- .../TKHLR/HLRBRep/HLRBRep_Data.cxx | 12 +- .../TKHLR/HLRBRep/HLRBRep_EdgeData.cxx | 9 +- .../TKHLR/HLRBRep/HLRBRep_Intersector.cxx | 5 +- ...ntersectorOfTheIntConicCurveOfCInter_0.cxx | 8 +- .../BRepMesh_DataStructureOfDelaun.cxx | 3 +- .../TKMesh/BRepMesh/BRepMesh_GeomTool.cxx | 19 +- .../TKMesh/BRepMesh/delabella.cpp | 19 +- .../BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx | 3 +- .../ShapeUpgrade_SplitSurfaceArea.cxx | 5 +- .../BRepCheck/BRepCheck_Analyzer.cxx | 2 +- .../BRepClass3d/BRepClass3d_SolidExplorer.cxx | 3 +- .../BRepExtrema_DistShapeShape.cxx | 10 +- .../BRepTopAdaptor_TopolTool.cxx | 3 +- .../TKBRep/BinTools/BinTools_IStream.cxx | 3 +- .../TKBRep/BinTools/BinTools_ShapeReader.cxx | 2 +- .../TKBRep/TopoDS/TopoDS_Builder.cxx | 48 +- .../Geom2dEval/Geom2dEval_AHTBezierCurve.cxx | 4 +- .../TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx | 8 +- .../AdvApprox/AdvApprox_ApproxAFunction.cxx | 6 +- .../GeomEval/GeomEval_AHTBezierCurve.cxx | 4 +- .../AdvApp2Var/AdvApp2Var_Context.cxx | 4 +- .../AdvApp2Var/AdvApp2Var_Patch.cxx | 56 +- .../AdvApp2Var/AdvApp2Var_SysBase.cxx | 3 +- .../TKGeomBase/AppDef/AppDef_Variational.cxx | 4 +- .../TKGeomBase/AppParCurves/AppParCurves.cxx | 2 +- .../Approx/Approx_BSplComputeLine.gxx | 6 +- .../TKGeomBase/Approx/Approx_ComputeLine.gxx | 3 +- .../Approx/Approx_SameParameter.cxx | 10 +- .../ProjLib/ProjLib_ProjectedCurve.cxx | 4 +- .../TKMeshVS/MeshVS/MeshVS_Buffer.hxx | 15 +- .../TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx | 4 +- .../TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx | 11 +- .../OpenGl/OpenGl_BackgroundArray.cxx | 32 +- .../TKOpenGl/OpenGl/OpenGl_Buffer.cxx | 43 +- .../TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx | 12 +- .../TKOpenGl/OpenGl/OpenGl_Context.cxx | 29 +- .../TKOpenGl/OpenGl/OpenGl_Font.cxx | 19 +- .../TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx | 9 +- .../TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx | 22 +- .../TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx | 3 +- .../OpenGl/OpenGl_GraduatedTrihedron.cxx | 13 +- .../TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx | 3 +- .../TKOpenGl/OpenGl/OpenGl_LayerList.cxx | 10 +- .../TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx | 16 +- .../TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx | 4 +- .../TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx | 6 +- .../TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx | 2 +- .../TKOpenGl/OpenGl/OpenGl_Structure.cxx | 41 +- .../TKOpenGl/OpenGl/OpenGl_Text.cxx | 15 +- .../TKOpenGl/OpenGl/OpenGl_Texture.cxx | 12 +- .../TKOpenGl/OpenGl/OpenGl_TileSampler.cxx | 32 +- .../TKOpenGl/OpenGl/OpenGl_TileSampler.hxx | 7 +- .../TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx | 8 +- .../TKOpenGl/OpenGl/OpenGl_View.cxx | 40 +- .../TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx | 28 +- .../TKOpenGl/OpenGl/OpenGl_Window.cxx | 12 +- .../Aspect/Aspect_DisplayConnection.cxx | 8 +- .../Aspect/Aspect_DisplayConnection.hxx | 5 +- .../TKService/Aspect/Aspect_NeutralWindow.hxx | 4 +- .../TKService/Font/Font_FTFont.cxx | 29 +- .../Graphic3d/Graphic3d_ArrayOfPrimitives.hxx | 11 +- .../TKService/Graphic3d/Graphic3d_Buffer.hxx | 15 +- .../Graphic3d/Graphic3d_FrameStats.cxx | 3 +- .../Graphic3d/Graphic3d_HatchStyle.cxx | 5 +- .../Graphic3d/Graphic3d_MarkerImage.cxx | 18 +- .../Graphic3d/Graphic3d_MediaTexture.cxx | 3 +- .../Graphic3d/Graphic3d_PBRMaterial.cxx | 3 +- .../Graphic3d/Graphic3d_ShaderObject.cxx | 5 +- .../Graphic3d/Graphic3d_Structure.cxx | 13 +- .../Graphic3d/Graphic3d_Texture3D.cxx | 4 +- .../Graphic3d/Graphic3d_TextureSetBits.hxx | 14 +- .../Graphic3d/Graphic3d_TransformPers.hxx | 8 +- .../TKService/Image/Image_DDSParser.cxx | 3 +- .../TKService/Image/Image_Diff.cxx | 37 +- .../TKService/Image/Image_Diff.hxx | 8 +- .../TKService/Image/Image_PixMap.cxx | 126 +++-- .../TKService/Image/Image_PixMap.hxx | 11 +- .../TKService/Image/Image_PixMapData.hxx | 11 +- .../TKService/Media/Media_PlayerContext.cxx | 8 +- src/Visualization/TKService/Xw/Xw_Window.cxx | 27 +- .../TKV3d/AIS/AIS_ColorScale.cxx | 31 +- .../TKV3d/AIS/AIS_ColoredShape.cxx | 7 +- .../TKV3d/AIS/AIS_ExclusionFilter.cxx | 3 +- .../TKV3d/AIS/AIS_LightSource.cxx | 4 +- .../TKV3d/AIS/AIS_MediaPlayer.cxx | 15 +- .../TKV3d/AIS/AIS_RubberBand.cxx | 16 +- src/Visualization/TKV3d/AIS/AIS_Shape.cxx | 4 +- src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx | 12 +- .../TKV3d/AIS/AIS_TexturedShape.cxx | 4 +- src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx | 8 +- .../TKV3d/AIS/AIS_ViewController.cxx | 54 +- src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx | 51 +- .../TKV3d/PrsDim/PrsDim_Dimension.cxx | 3 +- .../TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx | 6 +- .../Select3D/Select3D_BVHIndexBuffer.hxx | 6 +- .../SelectBasics/SelectBasics_PickResult.hxx | 4 +- .../SelectMgr_SelectingVolumeManager.cxx | 22 +- .../TKV3d/StdPrs/StdPrs_BRepFont.cxx | 3 +- .../TKV3d/StdPrs/StdPrs_Plane.cxx | 6 +- src/Visualization/TKV3d/V3d/V3d_View.cxx | 10 +- 213 files changed, 1735 insertions(+), 1335 deletions(-) diff --git a/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentSection.cxx b/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentSection.cxx index 310b73f9d32..e1db2ee528a 100644 --- a/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentSection.cxx +++ b/src/ApplicationFramework/TKBinL/BinLDrivers/BinLDrivers_DocumentSection.cxx @@ -147,7 +147,9 @@ void BinLDrivers_DocumentSection::Write(Standard_OStream& theStream, "BinLDrivers_DocumentSection::Write : file size is too big, needs int64."); // Old documents stored file position as 4-bytes values. - int32_t aValInt[3] = {static_cast(myValue[0]), static_cast(myValue[1]), static_cast(myIsPostRead ? 1 : 0)}; + int32_t aValInt[3] = {static_cast(myValue[0]), + static_cast(myValue[1]), + static_cast(myIsPostRead ? 1 : 0)}; #ifdef DO_INVERSE aValInt[0] = InverseInt(aValInt[0]); aValInt[1] = InverseInt(aValInt[1]); diff --git a/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx b/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx index 70a3072e232..a30f821042d 100644 --- a/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx +++ b/src/ApplicationFramework/TKBinL/BinObjMgt/BinObjMgt_Persistent.cxx @@ -702,7 +702,7 @@ const BinObjMgt_Persistent& BinObjMgt_Persistent::GetExtendedString( int aStartIndex = myIndex; int aStartOffset = myOffset; BinObjMgt_Persistent* me = const_cast(this); - char16_t* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); + char16_t* aData = reinterpret_cast(static_cast(myData(myIndex)) + myOffset); // count the string length while (!noMoreData(1) && *aData++) @@ -1009,7 +1009,7 @@ void BinObjMgt_Persistent::inverseExtCharData(const int theIndex, while (aLen > 0) { int aLenInPiece = std::min(aLen, BP_PIECESIZE - anOffset); - char16_t* aData = reinterpret_cast(static_cast(myData(anIndex)) + anOffset); + char16_t* aData = reinterpret_cast(static_cast(myData(anIndex)) + anOffset); for (int i = 0; i < aLenInPiece / BP_EXTCHARSIZE; i++) aData[i] = FSD_BinaryFile::InverseExtChar(aData[i]); aLen -= aLenInPiece; @@ -1073,14 +1073,15 @@ void BinObjMgt_Persistent::inverseRealData(const int theIndex, { int aLenInPiece = std::min(aLen, BP_PIECESIZE - anOffset); - aWrapUnion.aRealData = reinterpret_cast(static_cast(myData(anIndex)) + anOffset); + aWrapUnion.aRealData = + reinterpret_cast(static_cast(myData(anIndex)) + anOffset); if (aPrevPtr) { int aTmp; - aTmp = FSD_BinaryFile::InverseInt(*static_cast(aPrevPtr)); - *static_cast(aPrevPtr) = FSD_BinaryFile::InverseInt(*aWrapUnion.aIntData); - *aWrapUnion.aIntData = aTmp; + aTmp = FSD_BinaryFile::InverseInt(*static_cast(aPrevPtr)); + *static_cast(aPrevPtr) = FSD_BinaryFile::InverseInt(*aWrapUnion.aIntData); + *aWrapUnion.aIntData = aTmp; aWrapUnion.aIntData++; aPrevPtr = nullptr; } diff --git a/src/ApplicationFramework/TKCAF/TNaming/TNaming_Tool.cxx b/src/ApplicationFramework/TKCAF/TNaming/TNaming_Tool.cxx index 251a848a976..760d53885fb 100644 --- a/src/ApplicationFramework/TKCAF/TNaming/TNaming_Tool.cxx +++ b/src/ApplicationFramework/TKCAF/TNaming/TNaming_Tool.cxx @@ -606,7 +606,9 @@ void TNaming_Tool::FindShape(const NCollection_Map& Valid, // Looking for sub shapes of the result shape NCollection_Map subShapes; - TopExp_Explorer anExpl(Arg->Get(), static_cast(static_cast(aNaming->GetName().ShapeType()) + 1)); + TopExp_Explorer anExpl( + Arg->Get(), + static_cast(static_cast(aNaming->GetName().ShapeType()) + 1)); for (; anExpl.More(); anExpl.Next()) subShapes.Add(anExpl.Current()); #ifdef OCCT_DEBUG @@ -676,8 +678,9 @@ void TNaming_Tool::FindShape(const NCollection_Map& Valid, int DoesCoincide = 0; const TopoDS_Shape& possibleResult = explC.Current(); NCollection_Map subShapesOfResult; - for (explSubC.Init(possibleResult, - static_cast(static_cast(aNaming->GetName().ShapeType()) + 1)); + for (explSubC.Init( + possibleResult, + static_cast(static_cast(aNaming->GetName().ShapeType()) + 1)); explSubC.More(); explSubC.Next()) { diff --git a/src/ApplicationFramework/TKCDF/CDF/CDF_Application.cxx b/src/ApplicationFramework/TKCDF/CDF/CDF_Application.cxx index 1e3b2ad649b..b2083716342 100644 --- a/src/ApplicationFramework/TKCDF/CDF/CDF_Application.cxx +++ b/src/ApplicationFramework/TKCDF/CDF/CDF_Application.cxx @@ -278,7 +278,8 @@ occ::handle CDF_Application::Retrieve(const occ::handleFileName(), aFormat)) { Standard_SStream aMsg; - aMsg << "Could not determine format for the file " << aMetaData->FileName() << static_cast(0); + aMsg << "Could not determine format for the file " << aMetaData->FileName() + << static_cast(0); throw Standard_NoSuchObject(aMsg.str().c_str()); } occ::handle theReader = ReaderFromFormat(aFormat); diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.cxx index baf09111353..bdba83c9a54 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOMBasicString.cxx @@ -210,7 +210,9 @@ bool LDOMBasicString::equals(const LDOMBasicString& anOther) const case LDOM_AsciiDoc: case LDOM_AsciiDocClear: case LDOM_AsciiHashed: - return (strcmp(static_cast(myVal.ptr), static_cast(anOther.myVal.ptr)) == 0); + return ( + strcmp(static_cast(myVal.ptr), static_cast(anOther.myVal.ptr)) + == 0); case LDOM_NULL: default:; } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicElement.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicElement.cxx index d97acef8af5..7c33e5dcd8d 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicElement.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_BasicElement.cxx @@ -262,8 +262,8 @@ const LDOM_BasicNode* LDOM_BasicElement::RemoveAttribute(const LDOMBasicString& const LDOM_BasicNode* aLastCh) const { // Check attribute hash value against the current mask - const char* const aNameStr = aName.GetString(); - const int aHash = LDOM_MemManager::Hash(aNameStr, static_cast(strlen(aNameStr))); + const char* const aNameStr = aName.GetString(); + const int aHash = LDOM_MemManager::Hash(aNameStr, static_cast(strlen(aNameStr))); const unsigned int anAttrMaskValue = aHash & (8 * sizeof(myAttributeMask) - 1); const unsigned long anAttributeMask = (1 << anAttrMaskValue); #ifdef OCCT_DEBUG_MASK @@ -303,7 +303,7 @@ void LDOM_BasicElement::RemoveChild(const LDOM_BasicNode* aChild) const break; if (aNode == aChild) { - *aPrevNode = aNode->GetSibling(); + *aPrevNode = aNode->GetSibling(); *const_cast(aChild) = nullptr; break; } diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharReference.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharReference.cxx index 284c2810880..7b6df2c8057 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharReference.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_CharReference.cxx @@ -167,7 +167,8 @@ char* LDOM_CharReference::Encode(const char* theSrc, int& theLen, const bool isA // Analyse if there is a non-standard character in the string for (;;) { - const unsigned int iSrc = static_cast(*reinterpret_cast(ptrSrc)); + const unsigned int iSrc = + static_cast(*reinterpret_cast(ptrSrc)); if (iSrc == 0) { endSrc = ptrSrc; @@ -187,8 +188,9 @@ char* LDOM_CharReference::Encode(const char* theSrc, int& theLen, const bool isA aDest = ptrDest; for (ptrSrc = theSrc; ptrSrc < endSrc; ptrSrc++) { - const unsigned int iSrc = static_cast(*reinterpret_cast(ptrSrc)); - const int aCode = myTab[iSrc]; + const unsigned int iSrc = + static_cast(*reinterpret_cast(ptrSrc)); + const int aCode = myTab[iSrc]; if (aCode == NORMAL_C) // normal (regular) character *ptrDest++ = *ptrSrc; else if (aCode == CHAR_REF) diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Element.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Element.cxx index 90d72c8ac10..6d3934cc931 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Element.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Element.cxx @@ -206,9 +206,9 @@ void LDOM_Element::ReplaceElement(const LDOM_Element& anOther) const LDOM_BasicElement& anOtherElem = (const LDOM_BasicElement&)anOther.Origin(); if (myDocument == anOther.myDocument) { - anElem.myTagName = anOtherElem.myTagName; - anElem.myAttributeMask = anOtherElem.myAttributeMask; - anElem.myFirstChild = anOtherElem.myFirstChild; + anElem.myTagName = anOtherElem.myTagName; + anElem.myAttributeMask = anOtherElem.myAttributeMask; + anElem.myFirstChild = anOtherElem.myFirstChild; const_cast(myLastChild) = anOther.myLastChild; } else diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.cxx index 65142c56174..a296378d0ed 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_Node.cxx @@ -150,7 +150,7 @@ LDOM_Node LDOM_Node::getLastChild() const { if (myLastChild == nullptr) { - const LDOM_BasicElement& anElement = *(const LDOM_BasicElement*)myOrigin; + const LDOM_BasicElement& anElement = *(const LDOM_BasicElement*)myOrigin; const_cast(myLastChild) = anElement.GetLastChild(); } return LDOM_Node(*myLastChild, myDocument); diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlReader.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlReader.cxx index d1e83ed5b70..2188f80c059 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlReader.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlReader.cxx @@ -311,8 +311,9 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre myPtr = aNameEnd; if (myPtr < myEndPtr) { - myElement = - &LDOM_BasicElement::Create(aStartData, static_cast(myPtr - aStartData), myDocument); + myElement = &LDOM_BasicElement::Create(aStartData, + static_cast(myPtr - aStartData), + myDocument); myLastChild = nullptr; aState = STATE_ATTRIBUTE_NAME; aStartData = nullptr; @@ -608,13 +609,14 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord(Standard_IStream& theIStre } // Limitation: we do not take into account that '<' and '&' // are not allowed in attribute values - aPtr = static_cast(memchr(aStartData, anAttDelimiter, myEndPtr - aStartData)); + aPtr = + static_cast(memchr(aStartData, anAttDelimiter, myEndPtr - aStartData)); if (aPtr) { - const_cast(aPtr[0]) = '\0'; - anAttDelimiter = '\0'; - char* aDataString = const_cast(aStartData); - const char* ePtr = aPtr; + const_cast(aPtr[0]) = '\0'; + anAttDelimiter = '\0'; + char* aDataString = const_cast(aStartData); + const char* ePtr = aPtr; // Append the end of the string to previously taken data if (theData.Length() > 0) diff --git a/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlWriter.cxx b/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlWriter.cxx index e88fa9dd13a..fb69c878f53 100644 --- a/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlWriter.cxx +++ b/src/ApplicationFramework/TKCDF/LDOM/LDOM_XmlWriter.cxx @@ -315,7 +315,8 @@ void LDOM_XmlWriter::Write(Standard_OStream& theOStream, const LDOM_Node& theNod } default: #ifndef _MSC_VER - std::cerr << "Unrecognized node type = " << static_cast(theNode.getNodeType()) << std::endl + std::cerr << "Unrecognized node type = " << static_cast(theNode.getNodeType()) + << std::endl #endif ; } diff --git a/src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx b/src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx index d03ee8e570a..c8c89df8e89 100644 --- a/src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx +++ b/src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx @@ -116,7 +116,8 @@ occ::handle PCDM_StorageDriver::Make(const occ::handle voidDocument; Standard_SStream aMsg; - aMsg << "No Make method were implemented in this Driver" << DynamicType()->Name() << static_cast(0); + aMsg << "No Make method were implemented in this Driver" << DynamicType()->Name() + << static_cast(0); throw Standard_NotImplemented(aMsg.str().c_str()); } diff --git a/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.cxx b/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.cxx index c1797650815..1137b43f89c 100644 --- a/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.cxx +++ b/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.cxx @@ -52,7 +52,8 @@ StdStorage_BucketOfPersistent::StdStorage_BucketOfPersistent(const int theBucket myNumberOfBucketAllocated(theBucketNumber), myBucketSize(theBucketSize) { - myBuckets = static_cast(Standard::Allocate(sizeof(StdStorage_Bucket*) * theBucketNumber)); + myBuckets = static_cast( + Standard::Allocate(sizeof(StdStorage_Bucket*) * theBucketNumber)); myBuckets[0] = new StdStorage_Bucket(myBucketSize); myCurrentBucket = myBuckets[0]; myLength = 0; diff --git a/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.hxx b/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.hxx index bdb9d5928df..993890a491c 100644 --- a/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.hxx +++ b/src/ApplicationFramework/TKStd/StdStorage/StdStorage_BacketOfPersistent.hxx @@ -39,8 +39,8 @@ public: mySpaceSize(200000), myCurrentSpace(-1) { - mySpace = - static_cast(Standard::Allocate(sizeof(StdObjMgt_Persistent*) * mySpaceSize)); + mySpace = static_cast( + Standard::Allocate(sizeof(StdObjMgt_Persistent*) * mySpaceSize)); } StdStorage_Bucket(const int theSpaceSize) @@ -48,8 +48,8 @@ public: mySpaceSize(theSpaceSize), myCurrentSpace(-1) { - mySpace = - static_cast(Standard::Allocate(sizeof(StdObjMgt_Persistent*) * mySpaceSize)); + mySpace = static_cast( + Standard::Allocate(sizeof(StdObjMgt_Persistent*) * mySpaceSize)); } void Clear(); diff --git a/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt.cxx b/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt.cxx index 61054e6fe40..8081cdf8c7f 100644 --- a/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlObjMgt/XmlObjMgt.cxx @@ -149,7 +149,8 @@ bool XmlObjMgt::GetTagEntryString(const XmlObjMgt_DOMString& theSource, return false; // Begin aTagEntry string - char* aTagEntry = static_cast(Standard::Allocate(strlen(aSource) / 2)); // quite enough to hold it + char* aTagEntry = + static_cast(Standard::Allocate(strlen(aSource) / 2)); // quite enough to hold it char* aTagEntryPtr = aTagEntry + 1; *aTagEntry = '0'; aSource += aPrefixSize; @@ -209,8 +210,8 @@ void XmlObjMgt::SetTagEntryString(XmlObjMgt_DOMString& theTarget, // Create a buffer to accumulate the XPath reference const size_t anElem1Size = sizeof(aRefElem1) - 1; const size_t anElem2Size = sizeof(aRefElem2) - 1; - char* aTarget = - static_cast(Standard::Allocate(sizeof(aRefPrefix) + aTagCount * (anElem1Size + anElem2Size + 12))); + char* aTarget = static_cast( + Standard::Allocate(sizeof(aRefPrefix) + aTagCount * (anElem1Size + anElem2Size + 12))); memcpy(aTarget, aRefPrefix, sizeof(aRefPrefix) - 1); char* aTargetPtr = aTarget + (sizeof(aRefPrefix) - 1); diff --git a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx index 796792570a1..27213f9287e 100644 --- a/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx +++ b/src/DataExchange/TKBinXCAF/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx @@ -231,8 +231,9 @@ bool BinMXCAFDoc_VisMaterialDriver::Paste(const BinObjMgt_Persistent& theS if (aVerMaj < 1 || aVerMaj > MaterialVersionMajor) { myMessageDriver->Send( - TCollection_AsciiString("Skipping XCAFDoc_VisMaterial of unknown version ") + static_cast(aVerMaj) - + "." + static_cast(aVerMin) + " (supported version: " + static_cast(MaterialVersionMajor) + "." + TCollection_AsciiString("Skipping XCAFDoc_VisMaterial of unknown version ") + + static_cast(aVerMaj) + "." + static_cast(aVerMin) + + " (supported version: " + static_cast(MaterialVersionMajor) + "." + static_cast(MaterialVersionMinor) + ")"); return false; } diff --git a/src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx b/src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx index 58f2cf9edae..06439caada7 100644 --- a/src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx +++ b/src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx @@ -55,215 +55,193 @@ bool DE_ShapeFixConfigurationNode::Load(const occ::handleRealVal("max.tolerance3d", ShapeFixParameters.MaxTolerance3d, aScope); ShapeFixParameters.MinTolerance3d = theResource->RealVal("min.tolerance3d", ShapeFixParameters.MinTolerance3d, aScope); - ShapeFixParameters.FixFreeShellMode = static_cast(theResource->IntegerVal( - "free.shell", - static_cast(ShapeFixParameters.FixFreeShellMode), - aScope)); - ShapeFixParameters.FixFreeFaceMode = - static_cast(theResource->IntegerVal("free.face", - static_cast(ShapeFixParameters.FixFreeFaceMode), - aScope)); - ShapeFixParameters.FixFreeWireMode = - static_cast(theResource->IntegerVal("free.wire", - static_cast(ShapeFixParameters.FixFreeWireMode), - aScope)); - ShapeFixParameters.FixSameParameterMode = static_cast(theResource->IntegerVal( - "same.parameter", - static_cast(ShapeFixParameters.FixSameParameterMode), - aScope)); - ShapeFixParameters.FixSolidMode = - static_cast(theResource->IntegerVal("solid", - static_cast(ShapeFixParameters.FixSolidMode), - aScope)); - ShapeFixParameters.FixShellOrientationMode = - static_cast(theResource->IntegerVal( - "shell.orientation", - static_cast(ShapeFixParameters.FixShellOrientationMode), - aScope)); - ShapeFixParameters.CreateOpenSolidMode = static_cast(theResource->IntegerVal( - "create.open.solid", - static_cast(ShapeFixParameters.CreateOpenSolidMode), - aScope)); - ShapeFixParameters.FixShellMode = - static_cast(theResource->IntegerVal("shell", - static_cast(ShapeFixParameters.FixShellMode), - aScope)); - ShapeFixParameters.FixFaceOrientationMode = - static_cast(theResource->IntegerVal( - "face.orientation", - static_cast(ShapeFixParameters.FixFaceOrientationMode), - aScope)); - ShapeFixParameters.FixFaceMode = - static_cast(theResource->IntegerVal("face", - static_cast(ShapeFixParameters.FixFaceMode), - aScope)); - ShapeFixParameters.FixWireMode = - static_cast(theResource->IntegerVal("wire", - static_cast(ShapeFixParameters.FixWireMode), - aScope)); - ShapeFixParameters.FixOrientationMode = static_cast(theResource->IntegerVal( - "orientation", - static_cast(ShapeFixParameters.FixOrientationMode), - aScope)); - ShapeFixParameters.FixAddNaturalBoundMode = - static_cast(theResource->IntegerVal( - "add.natural.bound", - static_cast(ShapeFixParameters.FixAddNaturalBoundMode), - aScope)); - ShapeFixParameters.FixMissingSeamMode = static_cast(theResource->IntegerVal( - "missing.seam", - static_cast(ShapeFixParameters.FixMissingSeamMode), - aScope)); - ShapeFixParameters.FixSmallAreaWireMode = static_cast(theResource->IntegerVal( - "small.area.wire", - static_cast(ShapeFixParameters.FixSmallAreaWireMode), - aScope)); - ShapeFixParameters.RemoveSmallAreaFaceMode = - static_cast(theResource->IntegerVal( - "remove.small.area.face", - static_cast(ShapeFixParameters.RemoveSmallAreaFaceMode), - aScope)); - ShapeFixParameters.FixIntersectingWiresMode = - static_cast(theResource->IntegerVal( - "intersecting.wires", - static_cast(ShapeFixParameters.FixIntersectingWiresMode), - aScope)); - ShapeFixParameters.FixLoopWiresMode = static_cast(theResource->IntegerVal( - "loop.wires", - static_cast(ShapeFixParameters.FixLoopWiresMode), - aScope)); - ShapeFixParameters.FixSplitFaceMode = static_cast(theResource->IntegerVal( - "split.face", - static_cast(ShapeFixParameters.FixSplitFaceMode), - aScope)); - ShapeFixParameters.AutoCorrectPrecisionMode = - static_cast(theResource->IntegerVal( - "auto.correct.precision", - static_cast(ShapeFixParameters.AutoCorrectPrecisionMode), - aScope)); - ShapeFixParameters.ModifyTopologyMode = static_cast(theResource->IntegerVal( - "modify.topology", - static_cast(ShapeFixParameters.ModifyTopologyMode), - aScope)); - ShapeFixParameters.ModifyGeometryMode = static_cast(theResource->IntegerVal( - "modify.geometry", - static_cast(ShapeFixParameters.ModifyGeometryMode), - aScope)); - ShapeFixParameters.ClosedWireMode = - static_cast(theResource->IntegerVal("closed.wire", - static_cast(ShapeFixParameters.ClosedWireMode), - aScope)); - ShapeFixParameters.PreferencePCurveMode = static_cast(theResource->IntegerVal( - "preference.pcurve", - static_cast(ShapeFixParameters.PreferencePCurveMode), - aScope)); - ShapeFixParameters.FixReorderMode = - static_cast(theResource->IntegerVal("reorder.edges", - static_cast(ShapeFixParameters.FixReorderMode), - aScope)); - ShapeFixParameters.FixSmallMode = - static_cast(theResource->IntegerVal("remove.small.edges", - static_cast(ShapeFixParameters.FixSmallMode), - aScope)); - ShapeFixParameters.FixConnectedMode = static_cast(theResource->IntegerVal( - "connected.edges", - static_cast(ShapeFixParameters.FixConnectedMode), - aScope)); - ShapeFixParameters.FixEdgeCurvesMode = static_cast(theResource->IntegerVal( - "edge.curves", - static_cast(ShapeFixParameters.FixEdgeCurvesMode), - aScope)); - ShapeFixParameters.FixDegeneratedMode = static_cast(theResource->IntegerVal( - "add.degenerated.edges", - static_cast(ShapeFixParameters.FixDegeneratedMode), - aScope)); - ShapeFixParameters.FixLackingMode = - static_cast(theResource->IntegerVal("add.lacking.edges", - static_cast(ShapeFixParameters.FixLackingMode), - aScope)); - ShapeFixParameters.FixSelfIntersectionMode = - static_cast(theResource->IntegerVal( - "selfintersection", - static_cast(ShapeFixParameters.FixSelfIntersectionMode), - aScope)); - ShapeFixParameters.RemoveLoopMode = - static_cast(theResource->IntegerVal("remove.loop", - static_cast(ShapeFixParameters.RemoveLoopMode), - aScope)); - ShapeFixParameters.FixReversed2dMode = static_cast(theResource->IntegerVal( - "reversed2d", - static_cast(ShapeFixParameters.FixReversed2dMode), - aScope)); - ShapeFixParameters.FixRemovePCurveMode = static_cast(theResource->IntegerVal( - "remove.pcurve", - static_cast(ShapeFixParameters.FixRemovePCurveMode), - aScope)); - ShapeFixParameters.FixRemoveCurve3dMode = static_cast(theResource->IntegerVal( - "remove.curve3d", - static_cast(ShapeFixParameters.FixRemoveCurve3dMode), - aScope)); - ShapeFixParameters.FixAddPCurveMode = static_cast(theResource->IntegerVal( - "add.pcurve", - static_cast(ShapeFixParameters.FixAddPCurveMode), - aScope)); - ShapeFixParameters.FixAddCurve3dMode = static_cast(theResource->IntegerVal( - "add.curve3d", - static_cast(ShapeFixParameters.FixAddCurve3dMode), - aScope)); - ShapeFixParameters.FixSeamMode = - static_cast(theResource->IntegerVal("correct.order.in.seam", - static_cast(ShapeFixParameters.FixSeamMode), - aScope)); - ShapeFixParameters.FixShiftedMode = - static_cast(theResource->IntegerVal("shifted", - static_cast(ShapeFixParameters.FixShiftedMode), - aScope)); - ShapeFixParameters.FixEdgeSameParameterMode = - static_cast(theResource->IntegerVal( - "edge.same.parameter", - static_cast(ShapeFixParameters.FixEdgeSameParameterMode), - aScope)); - ShapeFixParameters.FixNotchedEdgesMode = static_cast(theResource->IntegerVal( - "notched.edges", - static_cast(ShapeFixParameters.FixNotchedEdgesMode), - aScope)); - ShapeFixParameters.FixTailMode = - static_cast(theResource->IntegerVal("tail", - static_cast(ShapeFixParameters.FixTailMode), - aScope)); - ShapeFixParameters.MaxTailAngle = - static_cast(theResource->IntegerVal("max.tail.angle", - static_cast(ShapeFixParameters.MaxTailAngle), - aScope)); - ShapeFixParameters.MaxTailWidth = - static_cast(theResource->IntegerVal("max.tail.width", - static_cast(ShapeFixParameters.MaxTailWidth), - aScope)); - ShapeFixParameters.FixSelfIntersectingEdgeMode = - static_cast(theResource->IntegerVal( - "selfintersecting.edge", - static_cast(ShapeFixParameters.FixSelfIntersectingEdgeMode), - aScope)); - ShapeFixParameters.FixIntersectingEdgesMode = - static_cast(theResource->IntegerVal( - "intersecting.edges", - static_cast(ShapeFixParameters.FixIntersectingEdgesMode), - aScope)); + ShapeFixParameters.FixFreeShellMode = static_cast( + theResource->IntegerVal("free.shell", + static_cast(ShapeFixParameters.FixFreeShellMode), + aScope)); + ShapeFixParameters.FixFreeFaceMode = static_cast( + theResource->IntegerVal("free.face", + static_cast(ShapeFixParameters.FixFreeFaceMode), + aScope)); + ShapeFixParameters.FixFreeWireMode = static_cast( + theResource->IntegerVal("free.wire", + static_cast(ShapeFixParameters.FixFreeWireMode), + aScope)); + ShapeFixParameters.FixSameParameterMode = static_cast( + theResource->IntegerVal("same.parameter", + static_cast(ShapeFixParameters.FixSameParameterMode), + aScope)); + ShapeFixParameters.FixSolidMode = static_cast( + theResource->IntegerVal("solid", static_cast(ShapeFixParameters.FixSolidMode), aScope)); + ShapeFixParameters.FixShellOrientationMode = static_cast( + theResource->IntegerVal("shell.orientation", + static_cast(ShapeFixParameters.FixShellOrientationMode), + aScope)); + ShapeFixParameters.CreateOpenSolidMode = static_cast( + theResource->IntegerVal("create.open.solid", + static_cast(ShapeFixParameters.CreateOpenSolidMode), + aScope)); + ShapeFixParameters.FixShellMode = static_cast( + theResource->IntegerVal("shell", static_cast(ShapeFixParameters.FixShellMode), aScope)); + ShapeFixParameters.FixFaceOrientationMode = static_cast( + theResource->IntegerVal("face.orientation", + static_cast(ShapeFixParameters.FixFaceOrientationMode), + aScope)); + ShapeFixParameters.FixFaceMode = static_cast( + theResource->IntegerVal("face", static_cast(ShapeFixParameters.FixFaceMode), aScope)); + ShapeFixParameters.FixWireMode = static_cast( + theResource->IntegerVal("wire", static_cast(ShapeFixParameters.FixWireMode), aScope)); + ShapeFixParameters.FixOrientationMode = static_cast( + theResource->IntegerVal("orientation", + static_cast(ShapeFixParameters.FixOrientationMode), + aScope)); + ShapeFixParameters.FixAddNaturalBoundMode = static_cast( + theResource->IntegerVal("add.natural.bound", + static_cast(ShapeFixParameters.FixAddNaturalBoundMode), + aScope)); + ShapeFixParameters.FixMissingSeamMode = static_cast( + theResource->IntegerVal("missing.seam", + static_cast(ShapeFixParameters.FixMissingSeamMode), + aScope)); + ShapeFixParameters.FixSmallAreaWireMode = static_cast( + theResource->IntegerVal("small.area.wire", + static_cast(ShapeFixParameters.FixSmallAreaWireMode), + aScope)); + ShapeFixParameters.RemoveSmallAreaFaceMode = static_cast( + theResource->IntegerVal("remove.small.area.face", + static_cast(ShapeFixParameters.RemoveSmallAreaFaceMode), + aScope)); + ShapeFixParameters.FixIntersectingWiresMode = static_cast( + theResource->IntegerVal("intersecting.wires", + static_cast(ShapeFixParameters.FixIntersectingWiresMode), + aScope)); + ShapeFixParameters.FixLoopWiresMode = static_cast( + theResource->IntegerVal("loop.wires", + static_cast(ShapeFixParameters.FixLoopWiresMode), + aScope)); + ShapeFixParameters.FixSplitFaceMode = static_cast( + theResource->IntegerVal("split.face", + static_cast(ShapeFixParameters.FixSplitFaceMode), + aScope)); + ShapeFixParameters.AutoCorrectPrecisionMode = static_cast( + theResource->IntegerVal("auto.correct.precision", + static_cast(ShapeFixParameters.AutoCorrectPrecisionMode), + aScope)); + ShapeFixParameters.ModifyTopologyMode = static_cast( + theResource->IntegerVal("modify.topology", + static_cast(ShapeFixParameters.ModifyTopologyMode), + aScope)); + ShapeFixParameters.ModifyGeometryMode = static_cast( + theResource->IntegerVal("modify.geometry", + static_cast(ShapeFixParameters.ModifyGeometryMode), + aScope)); + ShapeFixParameters.ClosedWireMode = static_cast( + theResource->IntegerVal("closed.wire", + static_cast(ShapeFixParameters.ClosedWireMode), + aScope)); + ShapeFixParameters.PreferencePCurveMode = static_cast( + theResource->IntegerVal("preference.pcurve", + static_cast(ShapeFixParameters.PreferencePCurveMode), + aScope)); + ShapeFixParameters.FixReorderMode = static_cast( + theResource->IntegerVal("reorder.edges", + static_cast(ShapeFixParameters.FixReorderMode), + aScope)); + ShapeFixParameters.FixSmallMode = static_cast( + theResource->IntegerVal("remove.small.edges", + static_cast(ShapeFixParameters.FixSmallMode), + aScope)); + ShapeFixParameters.FixConnectedMode = static_cast( + theResource->IntegerVal("connected.edges", + static_cast(ShapeFixParameters.FixConnectedMode), + aScope)); + ShapeFixParameters.FixEdgeCurvesMode = static_cast( + theResource->IntegerVal("edge.curves", + static_cast(ShapeFixParameters.FixEdgeCurvesMode), + aScope)); + ShapeFixParameters.FixDegeneratedMode = static_cast( + theResource->IntegerVal("add.degenerated.edges", + static_cast(ShapeFixParameters.FixDegeneratedMode), + aScope)); + ShapeFixParameters.FixLackingMode = static_cast( + theResource->IntegerVal("add.lacking.edges", + static_cast(ShapeFixParameters.FixLackingMode), + aScope)); + ShapeFixParameters.FixSelfIntersectionMode = static_cast( + theResource->IntegerVal("selfintersection", + static_cast(ShapeFixParameters.FixSelfIntersectionMode), + aScope)); + ShapeFixParameters.RemoveLoopMode = static_cast( + theResource->IntegerVal("remove.loop", + static_cast(ShapeFixParameters.RemoveLoopMode), + aScope)); + ShapeFixParameters.FixReversed2dMode = static_cast( + theResource->IntegerVal("reversed2d", + static_cast(ShapeFixParameters.FixReversed2dMode), + aScope)); + ShapeFixParameters.FixRemovePCurveMode = static_cast( + theResource->IntegerVal("remove.pcurve", + static_cast(ShapeFixParameters.FixRemovePCurveMode), + aScope)); + ShapeFixParameters.FixRemoveCurve3dMode = static_cast( + theResource->IntegerVal("remove.curve3d", + static_cast(ShapeFixParameters.FixRemoveCurve3dMode), + aScope)); + ShapeFixParameters.FixAddPCurveMode = static_cast( + theResource->IntegerVal("add.pcurve", + static_cast(ShapeFixParameters.FixAddPCurveMode), + aScope)); + ShapeFixParameters.FixAddCurve3dMode = static_cast( + theResource->IntegerVal("add.curve3d", + static_cast(ShapeFixParameters.FixAddCurve3dMode), + aScope)); + ShapeFixParameters.FixSeamMode = static_cast( + theResource->IntegerVal("correct.order.in.seam", + static_cast(ShapeFixParameters.FixSeamMode), + aScope)); + ShapeFixParameters.FixShiftedMode = static_cast( + theResource->IntegerVal("shifted", + static_cast(ShapeFixParameters.FixShiftedMode), + aScope)); + ShapeFixParameters.FixEdgeSameParameterMode = static_cast( + theResource->IntegerVal("edge.same.parameter", + static_cast(ShapeFixParameters.FixEdgeSameParameterMode), + aScope)); + ShapeFixParameters.FixNotchedEdgesMode = static_cast( + theResource->IntegerVal("notched.edges", + static_cast(ShapeFixParameters.FixNotchedEdgesMode), + aScope)); + ShapeFixParameters.FixTailMode = static_cast( + theResource->IntegerVal("tail", static_cast(ShapeFixParameters.FixTailMode), aScope)); + ShapeFixParameters.MaxTailAngle = static_cast( + theResource->IntegerVal("max.tail.angle", + static_cast(ShapeFixParameters.MaxTailAngle), + aScope)); + ShapeFixParameters.MaxTailWidth = static_cast( + theResource->IntegerVal("max.tail.width", + static_cast(ShapeFixParameters.MaxTailWidth), + aScope)); + ShapeFixParameters.FixSelfIntersectingEdgeMode = static_cast( + theResource->IntegerVal("selfintersecting.edge", + static_cast(ShapeFixParameters.FixSelfIntersectingEdgeMode), + aScope)); + ShapeFixParameters.FixIntersectingEdgesMode = static_cast( + theResource->IntegerVal("intersecting.edges", + static_cast(ShapeFixParameters.FixIntersectingEdgesMode), + aScope)); ShapeFixParameters.FixNonAdjacentIntersectingEdgesMode = static_cast(theResource->IntegerVal( "nonadjacent.intersecting.edges", static_cast(ShapeFixParameters.FixNonAdjacentIntersectingEdgesMode), aScope)); - ShapeFixParameters.FixVertexPositionMode = - static_cast(theResource->IntegerVal( - "vertex.position", - static_cast(ShapeFixParameters.FixVertexPositionMode), - aScope)); - ShapeFixParameters.FixVertexToleranceMode = - static_cast(theResource->IntegerVal( - "vertex.tolerance", - static_cast(ShapeFixParameters.FixVertexToleranceMode), - aScope)); + ShapeFixParameters.FixVertexPositionMode = static_cast( + theResource->IntegerVal("vertex.position", + static_cast(ShapeFixParameters.FixVertexPositionMode), + aScope)); + ShapeFixParameters.FixVertexToleranceMode = static_cast( + theResource->IntegerVal("vertex.tolerance", + static_cast(ShapeFixParameters.FixVertexToleranceMode), + aScope)); return true; } @@ -302,28 +280,32 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Defines the mode for applying fixes of ShapeFix_Shell for ShapeFix_Shape\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "free.shell :\t " + static_cast(ShapeFixParameters.FixFreeShellMode) + "\n"; + aResult += + aScope + "free.shell :\t " + static_cast(ShapeFixParameters.FixFreeShellMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying fixes of ShapeFix_Face for ShapeFix_Shape\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "free.face :\t " + static_cast(ShapeFixParameters.FixFreeFaceMode) + "\n"; + aResult += + aScope + "free.face :\t " + static_cast(ShapeFixParameters.FixFreeFaceMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying fixes of ShapeFix_Wire for ShapeFix_Shape\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "free.wire :\t " + static_cast(ShapeFixParameters.FixFreeWireMode) + "\n"; + aResult += + aScope + "free.wire :\t " + static_cast(ShapeFixParameters.FixFreeWireMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for applying ShapeFix::SameParameter after all fixes\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "same.parameter :\t " + static_cast(ShapeFixParameters.FixSameParameterMode) + "\n"; + aResult += aScope + "same.parameter :\t " + + static_cast(ShapeFixParameters.FixSameParameterMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -338,8 +320,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "!Defines the mode for applying analysis and fixes of orientation of shells in the solid\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "shell.orientation :\t " + static_cast(ShapeFixParameters.FixShellOrientationMode) + "\n"; + aResult += aScope + "shell.orientation :\t " + + static_cast(ShapeFixParameters.FixShellOrientationMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -348,7 +330,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "else solids are created from closed shells only\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "create.open.solid :\t " + static_cast(ShapeFixParameters.CreateOpenSolidMode) + "\n"; + aResult += aScope + "create.open.solid :\t " + + static_cast(ShapeFixParameters.CreateOpenSolidMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -363,8 +346,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "!Defines the mode for applying analysis and fixes of orientation of faces in the shell\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "face.orientation :\t " + static_cast(ShapeFixParameters.FixFaceOrientationMode) + "\n"; + aResult += aScope + "face.orientation :\t " + + static_cast(ShapeFixParameters.FixFaceOrientationMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -385,7 +368,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Defines the mode for applying a fix for the orientation of faces in the shell\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "orientation :\t " + static_cast(ShapeFixParameters.FixOrientationMode) + "\n"; + aResult += + aScope + "orientation :\t " + static_cast(ShapeFixParameters.FixOrientationMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -393,52 +377,56 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "is added on faces that miss them\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "add.natural.bound :\t " + static_cast(ShapeFixParameters.FixAddNaturalBoundMode) + "\n"; + aResult += aScope + "add.natural.bound :\t " + + static_cast(ShapeFixParameters.FixAddNaturalBoundMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix missing seam mode (tries to insert seam is missed)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "missing.seam :\t " + static_cast(ShapeFixParameters.FixMissingSeamMode) + "\n"; + aResult += + aScope + "missing.seam :\t " + static_cast(ShapeFixParameters.FixMissingSeamMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix small area wire mode (drops small wires)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "small.area.wire :\t " + static_cast(ShapeFixParameters.FixSmallAreaWireMode) + "\n"; + aResult += aScope + "small.area.wire :\t " + + static_cast(ShapeFixParameters.FixSmallAreaWireMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the remove face with small area (drops faces with small outer wires)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "remove.small.area.face :\t " + static_cast(ShapeFixParameters.RemoveSmallAreaFaceMode) + "\n"; + aResult += aScope + "remove.small.area.face :\t " + + static_cast(ShapeFixParameters.RemoveSmallAreaFaceMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix intersecting wires mode in ShapeFix_Face\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "intersecting.wires :\t " + static_cast(ShapeFixParameters.FixIntersectingWiresMode) + "\n"; + aResult += aScope + "intersecting.wires :\t " + + static_cast(ShapeFixParameters.FixIntersectingWiresMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix loop wires mode in ShapeFix_Face\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "loop.wires :\t " + static_cast(ShapeFixParameters.FixLoopWiresMode) + "\n"; + aResult += + aScope + "loop.wires :\t " + static_cast(ShapeFixParameters.FixLoopWiresMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the fix split face mode in ShapeFix_Face\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "split.face :\t " + static_cast(ShapeFixParameters.FixSplitFaceMode) + "\n"; + aResult += + aScope + "split.face :\t " + static_cast(ShapeFixParameters.FixSplitFaceMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -454,14 +442,16 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "(adding/removing edges etc.)\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "modify.topology :\t " + static_cast(ShapeFixParameters.ModifyTopologyMode) + "\n"; + aResult += aScope + "modify.topology :\t " + + static_cast(ShapeFixParameters.ModifyTopologyMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to modify geometry of the edges and vertices\n"; aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n"; - aResult += aScope + "modify.geometry :\t " + static_cast(ShapeFixParameters.ModifyGeometryMode) + "\n"; + aResult += aScope + "modify.geometry :\t " + + static_cast(ShapeFixParameters.ModifyGeometryMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -470,7 +460,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!and FixConnected() for lastand first edges\n"; aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n"; - aResult += aScope + "closed.wire :\t " + static_cast(ShapeFixParameters.ClosedWireMode) + "\n"; + aResult += + aScope + "closed.wire :\t " + static_cast(ShapeFixParameters.ClosedWireMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -480,73 +471,80 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!and FixConnected() for lastand first edges\n"; aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n"; - aResult += - aScope + "preference.pcurve :\t " + static_cast(ShapeFixParameters.PreferencePCurveMode) + "\n"; + aResult += aScope + "preference.pcurve :\t " + + static_cast(ShapeFixParameters.PreferencePCurveMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to reorder edges in the wire\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "reorder.edges :\t " + static_cast(ShapeFixParameters.FixReorderMode) + "\n"; + aResult += + aScope + "reorder.edges :\t " + static_cast(ShapeFixParameters.FixReorderMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to remove small edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "remove.small.edges :\t " + static_cast(ShapeFixParameters.FixSmallMode) + "\n"; + aResult += + aScope + "remove.small.edges :\t " + static_cast(ShapeFixParameters.FixSmallMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for fix connecting edges in the wire\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "connected.edges :\t " + static_cast(ShapeFixParameters.FixConnectedMode) + "\n"; + aResult += + aScope + "connected.edges :\t " + static_cast(ShapeFixParameters.FixConnectedMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for fix edges (3Dcurves and 2D curves)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "edge.curves :\t " + static_cast(ShapeFixParameters.FixEdgeCurvesMode) + "\n"; + aResult += + aScope + "edge.curves :\t " + static_cast(ShapeFixParameters.FixEdgeCurvesMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for add degenerated edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "add.degenerated.edges :\t " + static_cast(ShapeFixParameters.FixDegeneratedMode) + "\n"; + aResult += aScope + "add.degenerated.edges :\t " + + static_cast(ShapeFixParameters.FixDegeneratedMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for add lacking edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "add.lacking.edges :\t " + static_cast(ShapeFixParameters.FixLackingMode) + "\n"; + aResult += + aScope + "add.lacking.edges :\t " + static_cast(ShapeFixParameters.FixLackingMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for fix selfintersection edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "selfintersection :\t " + static_cast(ShapeFixParameters.FixSelfIntersectionMode) + "\n"; + aResult += aScope + "selfintersection :\t " + + static_cast(ShapeFixParameters.FixSelfIntersectionMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to remove loop\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "remove.loop :\t " + static_cast(ShapeFixParameters.RemoveLoopMode) + "\n"; + aResult += + aScope + "remove.loop :\t " + static_cast(ShapeFixParameters.RemoveLoopMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to fix edge if pcurve is directed opposite to 3d curve\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "reversed2d :\t " + static_cast(ShapeFixParameters.FixReversed2dMode) + "\n"; + aResult += + aScope + "reversed2d :\t " + static_cast(ShapeFixParameters.FixReversed2dMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -554,7 +552,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "the vertices\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "remove.pcurve :\t " + static_cast(ShapeFixParameters.FixRemovePCurveMode) + "\n"; + aResult += + aScope + "remove.pcurve :\t " + static_cast(ShapeFixParameters.FixRemovePCurveMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -562,7 +561,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "!Defines the mode allowed to remove 3d curve of the edge if it does not match the vertices\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "remove.curve3d :\t " + static_cast(ShapeFixParameters.FixRemoveCurve3dMode) + "\n"; + aResult += aScope + "remove.curve3d :\t " + + static_cast(ShapeFixParameters.FixRemoveCurve3dMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -570,14 +570,16 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "!Defines the mode allowed to add pcurve(s) of the edge if missing (by projecting 3d curve)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "add.pcurve :\t " + static_cast(ShapeFixParameters.FixAddPCurveMode) + "\n"; + aResult += + aScope + "add.pcurve :\t " + static_cast(ShapeFixParameters.FixAddPCurveMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode allowed to build 3d curve of the edge if missing\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "add.curve3d :\t " + static_cast(ShapeFixParameters.FixAddCurve3dMode) + "\n"; + aResult += + aScope + "add.curve3d :\t " + static_cast(ShapeFixParameters.FixAddCurve3dMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -585,7 +587,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "its orientation\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "correct.order.in.seam :\t " + static_cast(ShapeFixParameters.FixSeamMode) + "\n"; + aResult += + aScope + "correct.order.in.seam :\t " + static_cast(ShapeFixParameters.FixSeamMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -600,15 +603,16 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Defines the mode for applying EdgeSameParameter\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "edge.same.parameter :\t " + static_cast(ShapeFixParameters.FixEdgeSameParameterMode) + "\n"; + aResult += aScope + "edge.same.parameter :\t " + + static_cast(ShapeFixParameters.FixEdgeSameParameterMode) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for fix notched edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "notched.edges :\t " + static_cast(ShapeFixParameters.FixNotchedEdgesMode) + "\n"; + aResult += + aScope + "notched.edges :\t " + static_cast(ShapeFixParameters.FixNotchedEdgesMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -622,14 +626,16 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Defines the mode for max angle of the tails\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "max.tail.angle :\t " + static_cast(ShapeFixParameters.MaxTailAngle) + "\n"; + aResult += + aScope + "max.tail.angle :\t " + static_cast(ShapeFixParameters.MaxTailAngle) + "\n"; aResult += "!\n"; aResult += "!\n"; aResult += "!Defines the mode for max tail width\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "max.tail.width :\t " + static_cast(ShapeFixParameters.MaxTailWidth) + "\n"; + aResult += + aScope + "max.tail.width :\t " + static_cast(ShapeFixParameters.MaxTailWidth) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -644,8 +650,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Defines the mode for fix intersecting edges\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "intersecting.edges :\t " + static_cast(ShapeFixParameters.FixIntersectingEdgesMode) + "\n"; + aResult += aScope + "intersecting.edges :\t " + + static_cast(ShapeFixParameters.FixIntersectingEdgesMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -660,7 +666,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const aResult += "!Defines the mode for applying ShapeFix::FixVertexPosition before all fixes\n"; aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += aScope + "vertex.position :\t " + static_cast(ShapeFixParameters.FixVertexPositionMode) + "\n"; + aResult += aScope + "vertex.position :\t " + + static_cast(ShapeFixParameters.FixVertexPositionMode) + "\n"; aResult += "!\n"; aResult += "!\n"; @@ -669,8 +676,8 @@ TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const "stored in an edge (second one)\n"; aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), " "\"Fix\"(1)\n"; - aResult += - aScope + "vertex.tolerance :\t " + static_cast(ShapeFixParameters.FixVertexToleranceMode) + "\n"; + aResult += aScope + "vertex.tolerance :\t " + + static_cast(ShapeFixParameters.FixVertexToleranceMode) + "\n"; aResult += "!\n"; return aResult; diff --git a/src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx b/src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx index 6a17ed1a167..58516003380 100644 --- a/src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx +++ b/src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx @@ -53,14 +53,10 @@ bool DEBREP_ConfigurationNode::Load(const occ::handle& InternalParameters.WriteBinary = theResource->BooleanVal("write.binary", InternalParameters.WriteBinary, aScope); - InternalParameters.WriteVersionBin = - static_cast(theResource->IntegerVal("write.version.binary", - InternalParameters.WriteVersionBin, - aScope)); - InternalParameters.WriteVersionAscii = - static_cast(theResource->IntegerVal("write.version.ascii", - InternalParameters.WriteVersionAscii, - aScope)); + InternalParameters.WriteVersionBin = static_cast( + theResource->IntegerVal("write.version.binary", InternalParameters.WriteVersionBin, aScope)); + InternalParameters.WriteVersionAscii = static_cast( + theResource->IntegerVal("write.version.ascii", InternalParameters.WriteVersionAscii, aScope)); InternalParameters.WriteTriangles = theResource->BooleanVal("write.triangles", InternalParameters.WriteTriangles, aScope); InternalParameters.WriteNormals = diff --git a/src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx b/src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx index 38162d1ea81..37a336821f8 100644 --- a/src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx +++ b/src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx @@ -51,10 +51,8 @@ bool DEXCAF_ConfigurationNode::Load(const occ::handle& TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); - InternalParameters.ReadAppendMode = - static_cast(theResource->IntegerVal("read.append.mode", - InternalParameters.ReadAppendMode, - aScope)); + InternalParameters.ReadAppendMode = static_cast( + theResource->IntegerVal("read.append.mode", InternalParameters.ReadAppendMode, aScope)); theResource->GetStringSeq("read.skip.values", InternalParameters.ReadSkipValues, aScope); theResource->GetStringSeq("read.values", InternalParameters.ReadValues, aScope); diff --git a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx index 2d2a21d0f42..9829425766e 100644 --- a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx +++ b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx @@ -55,30 +55,28 @@ bool DEIGES_ConfigurationNode::Load(const occ::handle& THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); InternalParameters.ReadBSplineContinuity = - static_cast(theResource->IntegerVal( - "read.iges.bspline.continuity", - InternalParameters.ReadBSplineContinuity, - aScope)); - InternalParameters.ReadPrecisionMode = - static_cast(theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope)); + static_cast( + theResource->IntegerVal("read.iges.bspline.continuity", + InternalParameters.ReadBSplineContinuity, + aScope)); + InternalParameters.ReadPrecisionMode = static_cast( + theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope)); InternalParameters.ReadPrecisionVal = theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope); - InternalParameters.ReadMaxPrecisionMode = - static_cast(theResource->IntegerVal( - "read.maxprecision.mode", - InternalParameters.ReadMaxPrecisionMode, - aScope)); + InternalParameters.ReadMaxPrecisionMode = static_cast( + theResource->IntegerVal("read.maxprecision.mode", + InternalParameters.ReadMaxPrecisionMode, + aScope)); InternalParameters.ReadMaxPrecisionVal = theResource->RealVal("read.maxprecision.val", InternalParameters.ReadMaxPrecisionVal, aScope); InternalParameters.ReadSameParamMode = theResource->BooleanVal("read.stdsameparameter.mode", InternalParameters.ReadSameParamMode, aScope); - InternalParameters.ReadSurfaceCurveMode = - static_cast(theResource->IntegerVal( - "read.surfacecurve.mode", - InternalParameters.ReadSurfaceCurveMode, - aScope)); + InternalParameters.ReadSurfaceCurveMode = static_cast( + theResource->IntegerVal("read.surfacecurve.mode", + InternalParameters.ReadSurfaceCurveMode, + aScope)); InternalParameters.EncodeRegAngle = theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope); @@ -95,15 +93,13 @@ bool DEIGES_ConfigurationNode::Load(const occ::handle& InternalParameters.ReadLayer = theResource->BooleanVal("read.layer", InternalParameters.ReadLayer, aScope); - InternalParameters.WriteBRepMode = - static_cast(theResource->IntegerVal("write.brep.mode", - InternalParameters.WriteBRepMode, - aScope)); + InternalParameters.WriteBRepMode = static_cast( + theResource->IntegerVal("write.brep.mode", InternalParameters.WriteBRepMode, aScope)); InternalParameters.WriteConvertSurfaceMode = - static_cast(theResource->IntegerVal( - "write.convertsurface.mode", - InternalParameters.WriteConvertSurfaceMode, - aScope)); + static_cast( + theResource->IntegerVal("write.convertsurface.mode", + InternalParameters.WriteConvertSurfaceMode, + aScope)); InternalParameters.WriteHeaderAuthor = theResource->StringVal("write.header.author", InternalParameters.WriteHeaderAuthor, aScope); InternalParameters.WriteHeaderCompany = @@ -112,15 +108,12 @@ bool DEIGES_ConfigurationNode::Load(const occ::handle& theResource->StringVal("write.header.product", InternalParameters.WriteHeaderProduct, aScope); InternalParameters.WriteHeaderReciever = theResource->StringVal("write.header.receiver", InternalParameters.WriteHeaderReciever, aScope); - InternalParameters.WritePrecisionMode = - static_cast(theResource->IntegerVal( - "write.precision.mode", - InternalParameters.WritePrecisionMode, - aScope)); + InternalParameters.WritePrecisionMode = static_cast( + theResource->IntegerVal("write.precision.mode", InternalParameters.WritePrecisionMode, aScope)); InternalParameters.WritePrecisionVal = theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope); - InternalParameters.WritePlaneMode = - static_cast(theResource->IntegerVal("write.plane.mode", InternalParameters.WritePlaneMode, aScope)); + InternalParameters.WritePlaneMode = static_cast( + theResource->IntegerVal("write.plane.mode", InternalParameters.WritePlaneMode, aScope)); InternalParameters.WriteOffsetMode = theResource->BooleanVal("write.offset", InternalParameters.WriteOffsetMode, aScope); InternalParameters.WriteColor = diff --git a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Parameters.cxx b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Parameters.cxx index 6f5b27b31cd..67be72cf008 100644 --- a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Parameters.cxx +++ b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Parameters.cxx @@ -21,13 +21,16 @@ void DEIGES_Parameters::InitFromStatic() { ReadBSplineContinuity = static_cast(Interface_Static::IVal("read.iges.bspline.continuity")); - ReadPrecisionMode = static_cast(Interface_Static::IVal("read.precision.mode")); - ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); - ReadMaxPrecisionMode = static_cast(Interface_Static::IVal("read.maxprecision.mode")); - ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); - ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; - ReadSurfaceCurveMode = static_cast(Interface_Static::IVal("read.surfacecurve.mode")); - EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle"); + ReadPrecisionMode = + static_cast(Interface_Static::IVal("read.precision.mode")); + ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); + ReadMaxPrecisionMode = + static_cast(Interface_Static::IVal("read.maxprecision.mode")); + ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); + ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; + ReadSurfaceCurveMode = + static_cast(Interface_Static::IVal("read.surfacecurve.mode")); + EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle"); ReadApproxd1 = Interface_Static::IVal("read.bspline.approxd1.mode") == 1; ReadFaultyEntities = Interface_Static::IVal("read.fau_lty.entities") == 1; @@ -43,13 +46,14 @@ void DEIGES_Parameters::InitFromStatic() WriteHeaderCompany = Interface_Static::CVal("write.header.company"); WriteHeaderProduct = Interface_Static::CVal("write.header.product"); WriteHeaderReciever = Interface_Static::CVal("write.header.receiver"); - WritePrecisionMode = static_cast(Interface_Static::IVal("write.precision.mode")); - WritePrecisionVal = Interface_Static::RVal("write.precision.val"); - WritePlaneMode = static_cast(Interface_Static::IVal("write.plane.mode")); - WriteOffsetMode = Interface_Static::IVal("write.offset") == 1; - WriteColor = Interface_Static::IVal("write.color") == 1; - WriteName = Interface_Static::IVal("write.name") == 1; - WriteLayer = Interface_Static::IVal("write.layer") == 1; + WritePrecisionMode = + static_cast(Interface_Static::IVal("write.precision.mode")); + WritePrecisionVal = Interface_Static::RVal("write.precision.val"); + WritePlaneMode = static_cast(Interface_Static::IVal("write.plane.mode")); + WriteOffsetMode = Interface_Static::IVal("write.offset") == 1; + WriteColor = Interface_Static::IVal("write.color") == 1; + WriteName = Interface_Static::IVal("write.name") == 1; + WriteLayer = Interface_Static::IVal("write.layer") == 1; } //================================================================================================= diff --git a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Provider.cxx b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Provider.cxx index fb8cb78ee52..14296e4580d 100644 --- a/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Provider.cxx +++ b/src/DataExchange/TKDEIGES/DEIGES/DEIGES_Provider.cxx @@ -184,18 +184,17 @@ void DEIGES_Provider::initStatic(const occ::handle& theNod IGESData::Init(); // Get previous values - myOldValues.ReadBSplineContinuity = - static_cast(Interface_Static::IVal( - "read.iges.bspline.continuity")); - myOldValues.ReadPrecisionMode = - static_cast(Interface_Static::IVal("read.precision.mode")); - myOldValues.ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); - myOldValues.ReadMaxPrecisionMode = - static_cast(Interface_Static::IVal("read.maxprecision.mode")); - myOldValues.ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); - myOldValues.ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; - myOldValues.ReadSurfaceCurveMode = - static_cast(Interface_Static::IVal("read.surfacecurve.mode")); + myOldValues.ReadBSplineContinuity = static_cast( + Interface_Static::IVal("read.iges.bspline.continuity")); + myOldValues.ReadPrecisionMode = static_cast( + Interface_Static::IVal("read.precision.mode")); + myOldValues.ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); + myOldValues.ReadMaxPrecisionMode = static_cast( + Interface_Static::IVal("read.maxprecision.mode")); + myOldValues.ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); + myOldValues.ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; + myOldValues.ReadSurfaceCurveMode = static_cast( + Interface_Static::IVal("read.surfacecurve.mode")); myOldValues.EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI; myOldValues.ReadApproxd1 = Interface_Static::IVal("read.iges.bspline.approxd1.mode") == 1; @@ -204,18 +203,17 @@ void DEIGES_Provider::initStatic(const occ::handle& theNod myOldValues.WriteBRepMode = static_cast(Interface_Static::IVal("write.iges.brep.mode")); - myOldValues.WriteConvertSurfaceMode = - static_cast(Interface_Static::IVal( - "write.convertsurface.mode")); + myOldValues.WriteConvertSurfaceMode = static_cast( + Interface_Static::IVal("write.convertsurface.mode")); myOldValues.WriteHeaderAuthor = Interface_Static::CVal("write.iges.header.author"); myOldValues.WriteHeaderCompany = Interface_Static::CVal("write.iges.header.company"); myOldValues.WriteHeaderProduct = Interface_Static::CVal("write.iges.header.product"); myOldValues.WriteHeaderReciever = Interface_Static::CVal("write.iges.header.receiver"); - myOldValues.WritePrecisionMode = - static_cast(Interface_Static::IVal("write.precision.mode")); + myOldValues.WritePrecisionMode = static_cast( + Interface_Static::IVal("write.precision.mode")); myOldValues.WritePrecisionVal = Interface_Static::RVal("write.precision.val"); - myOldValues.WritePlaneMode = - static_cast(Interface_Static::IVal("write.iges.plane.mode")); + myOldValues.WritePlaneMode = static_cast( + Interface_Static::IVal("write.iges.plane.mode")); myOldValues.WriteOffsetMode = Interface_Static::IVal("write.iges.offset.mode") == 1; myOldLengthUnit = Interface_Static::IVal("xstep.cascade.unit"); diff --git a/src/DataExchange/TKDEIGES/IGESCAFControl/IGESCAFControl_Writer.cxx b/src/DataExchange/TKDEIGES/IGESCAFControl/IGESCAFControl_Writer.cxx index 2bf3834d57f..c32500e6f05 100644 --- a/src/DataExchange/TKDEIGES/IGESCAFControl/IGESCAFControl_Writer.cxx +++ b/src/DataExchange/TKDEIGES/IGESCAFControl/IGESCAFControl_Writer.cxx @@ -579,8 +579,9 @@ bool IGESCAFControl_Writer::WriteNames(const NCollection_Sequence& th aNameLength = 0; for (int aCharPos = 1; aNameLength < 8; aCharPos++, aNameLength++) { - anAsciiName->SetValue(aNameLength + 1, - IsAnAscii(aName.Value(aCharPos)) ? static_cast(aName.Value(aCharPos)) : '?'); + anAsciiName->SetValue( + aNameLength + 1, + IsAnAscii(aName.Value(aCharPos)) ? static_cast(aName.Value(aCharPos)) : '?'); } anIGESEntity->SetLabel(anAsciiName); diff --git a/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_ToolTextFontDef.cxx b/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_ToolTextFontDef.cxx index 8a320bd94ad..374b3652413 100644 --- a/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_ToolTextFontDef.cxx +++ b/src/DataExchange/TKDEIGES/IGESGraph/IGESGraph_ToolTextFontDef.cxx @@ -375,7 +375,8 @@ void IGESGraph_ToolTextFontDef::OwnDump(const occ::handle S << "\n"; for (J = 1; J <= nbmotions; J++) { - S << "Pen up(1) / down(0) flag : " << static_cast(ent->IsPenUp(I, J)) << " Next Pen Position : "; + S << "Pen up(1) / down(0) flag : " << static_cast(ent->IsPenUp(I, J)) + << " Next Pen Position : "; ent->NextPenPosition(I, J, IX, IY); S << " X=" << IX << " Y=" << IY << "\n"; } diff --git a/src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx b/src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx index bece148ead2..0ad213d3928 100644 --- a/src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx +++ b/src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx @@ -51,16 +51,11 @@ bool DEOBJ_ConfigurationNode::Load(const occ::handle& t THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); InternalParameters.FileLengthUnit = theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope); - InternalParameters.SystemCS = - static_cast(theResource->IntegerVal("system.cs", - static_cast(InternalParameters.SystemCS), - aScope) - % 2); - InternalParameters.FileCS = - static_cast(theResource->IntegerVal("file.cs", - static_cast(InternalParameters.FileCS), - aScope) - % 2); + InternalParameters.SystemCS = static_cast( + theResource->IntegerVal("system.cs", static_cast(InternalParameters.SystemCS), aScope) + % 2); + InternalParameters.FileCS = static_cast( + theResource->IntegerVal("file.cs", static_cast(InternalParameters.FileCS), aScope) % 2); InternalParameters.ReadSinglePrecision = theResource->BooleanVal("read.single.precision", diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafReader.cxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafReader.cxx index 8fcb717fdc8..a792b5e2cad 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafReader.cxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafReader.cxx @@ -98,8 +98,9 @@ bool RWObj_CafReader::performMesh(std::istream& theStream, aCtx->SetCreateShapes(true); aCtx->SetShapeReceiver(this); aCtx->SetTransformation(myCoordSysConverter); - aCtx->SetMemoryLimit(myMemoryLimitMiB == -1 ? static_cast(-1) - : static_cast(myMemoryLimitMiB * 1024 * 1024)); + aCtx->SetMemoryLimit(myMemoryLimitMiB == -1 + ? static_cast(-1) + : static_cast(myMemoryLimitMiB * 1024 * 1024)); bool isDone = false; if (theToProbe) { diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafWriter.cxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafWriter.cxx index dd214355a78..03e90ded000 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafWriter.cxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_CafWriter.cxx @@ -34,7 +34,9 @@ namespace //! Trivial cast. inline NCollection_Vec3 objXyzToVec(const gp_XYZ& thePnt) { - return NCollection_Vec3(static_cast(thePnt.X()), static_cast(thePnt.Y()), static_cast(thePnt.Z())); + return NCollection_Vec3(static_cast(thePnt.X()), + static_cast(thePnt.Y()), + static_cast(thePnt.Z())); } //! Trivial cast. diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.hxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.hxx index 9afa86ae0e5..defd3b5d6d1 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.hxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.hxx @@ -339,8 +339,9 @@ protected: { if (myIsSinglePrecision) { - myVec3Vec->Append( - NCollection_Vec3(static_cast(thePnt.X()), static_cast(thePnt.Y()), static_cast(thePnt.Z()))); + myVec3Vec->Append(NCollection_Vec3(static_cast(thePnt.X()), + static_cast(thePnt.Y()), + static_cast(thePnt.Z()))); } else { diff --git a/src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx b/src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx index 2b73b647644..e00a61838b8 100644 --- a/src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx +++ b/src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx @@ -52,16 +52,11 @@ bool DEPLY_ConfigurationNode::Load(const occ::handle& t THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); InternalParameters.FileLengthUnit = theResource->RealVal("file.length.unit", InternalParameters.FileLengthUnit, aScope); - InternalParameters.SystemCS = - static_cast(theResource->IntegerVal("system.cs", - static_cast(InternalParameters.SystemCS), - aScope) - % 2); - InternalParameters.FileCS = - static_cast(theResource->IntegerVal("file.cs", - static_cast(InternalParameters.FileCS), - aScope) - % 2); + InternalParameters.SystemCS = static_cast( + theResource->IntegerVal("system.cs", static_cast(InternalParameters.SystemCS), aScope) + % 2); + InternalParameters.FileCS = static_cast( + theResource->IntegerVal("file.cs", static_cast(InternalParameters.FileCS), aScope) % 2); InternalParameters.WriteNormals = theResource->BooleanVal("write.normals", InternalParameters.WriteNormals, aScope); diff --git a/src/DataExchange/TKDEPLY/RWPly/RWPly_CafWriter.cxx b/src/DataExchange/TKDEPLY/RWPly/RWPly_CafWriter.cxx index 3f0abcdd30a..93a81ddf808 100644 --- a/src/DataExchange/TKDEPLY/RWPly/RWPly_CafWriter.cxx +++ b/src/DataExchange/TKDEPLY/RWPly/RWPly_CafWriter.cxx @@ -249,7 +249,9 @@ bool RWPly_CafWriter::writeNodes(RWPly_PlyWriterContext& theWriter, if (theFace.HasNormals()) { gp_Dir aNorm = theFace.NormalTransformed(aNodeIter); - aNormVec.SetValues(static_cast(aNorm.X()), static_cast(aNorm.Y()), static_cast(aNorm.Z())); + aNormVec.SetValues(static_cast(aNorm.X()), + static_cast(aNorm.Y()), + static_cast(aNorm.Z())); myCSTrsf.TransformNormal(aNormVec); } if (theFace.HasTexCoords()) diff --git a/src/DataExchange/TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx b/src/DataExchange/TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx index 8a24db09e6a..0ad41753919 100644 --- a/src/DataExchange/TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx +++ b/src/DataExchange/TKDEPLY/RWPly/RWPly_PlyWriterContext.cxx @@ -240,12 +240,13 @@ bool RWPly_PlyWriterContext::WriteVertex(const gp_Pnt& thePoi } else { - *myStream << static_cast(thePoint.X()) << " " << static_cast(thePoint.Y()) << " " << static_cast(thePoint.Z()); + *myStream << static_cast(thePoint.X()) << " " << static_cast(thePoint.Y()) << " " + << static_cast(thePoint.Z()); } if (myHasNormals) { - *myStream << " " << static_cast(theNorm.x()) << " " << static_cast(theNorm.y()) << " " - << static_cast(theNorm.z()); + *myStream << " " << static_cast(theNorm.x()) << " " << static_cast(theNorm.y()) + << " " << static_cast(theNorm.z()); } if (myHasTexCoords) { @@ -253,7 +254,8 @@ bool RWPly_PlyWriterContext::WriteVertex(const gp_Pnt& thePoi } if (myHasColors) { - *myStream << " " << static_cast(theColor.r()) << " " << static_cast(theColor.g()) << " " << static_cast(theColor.b()); + *myStream << " " << static_cast(theColor.r()) << " " << static_cast(theColor.g()) + << " " << static_cast(theColor.b()); } *myStream << "\n"; if (++myNbVerts > myNbHeaderVerts) diff --git a/src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx b/src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx index 13ac75e42c4..a5438f12d43 100644 --- a/src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx +++ b/src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx @@ -55,52 +55,43 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor(); InternalParameters.ReadBSplineContinuity = - static_cast(theResource->IntegerVal( - "read.iges.bspline.continuity", - InternalParameters.ReadBSplineContinuity, - aScope)); - InternalParameters.ReadPrecisionMode = - static_cast(theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope)); + static_cast( + theResource->IntegerVal("read.iges.bspline.continuity", + InternalParameters.ReadBSplineContinuity, + aScope)); + InternalParameters.ReadPrecisionMode = static_cast( + theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope)); InternalParameters.ReadPrecisionVal = theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope); - InternalParameters.ReadMaxPrecisionMode = - static_cast(theResource->IntegerVal( - "read.maxprecision.mode", - InternalParameters.ReadMaxPrecisionMode, - aScope)); + InternalParameters.ReadMaxPrecisionMode = static_cast( + theResource->IntegerVal("read.maxprecision.mode", + InternalParameters.ReadMaxPrecisionMode, + aScope)); InternalParameters.ReadMaxPrecisionVal = theResource->RealVal("read.maxprecision.val", InternalParameters.ReadMaxPrecisionVal, aScope); InternalParameters.ReadSameParamMode = theResource->BooleanVal("read.stdsameparameter.mode", InternalParameters.ReadSameParamMode, aScope); - InternalParameters.ReadSurfaceCurveMode = - static_cast(theResource->IntegerVal( - "read.surfacecurve.mode", - InternalParameters.ReadSurfaceCurveMode, - aScope)); + InternalParameters.ReadSurfaceCurveMode = static_cast( + theResource->IntegerVal("read.surfacecurve.mode", + InternalParameters.ReadSurfaceCurveMode, + aScope)); InternalParameters.EncodeRegAngle = theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope); - InternalParameters.AngleUnit = - static_cast(theResource->IntegerVal("angleunit.mode", - InternalParameters.AngleUnit, - aScope)); + InternalParameters.AngleUnit = static_cast( + theResource->IntegerVal("angleunit.mode", InternalParameters.AngleUnit, aScope)); InternalParameters.ReadProductMode = theResource->BooleanVal("read.product.mode", InternalParameters.ReadProductMode, aScope); - InternalParameters.ReadProductContext = - static_cast(theResource->IntegerVal( - "read.product.context", - InternalParameters.ReadProductContext, - aScope)); - InternalParameters.ReadShapeRepr = - static_cast(theResource->IntegerVal("read.shape.repr", - InternalParameters.ReadShapeRepr, - aScope)); - InternalParameters.ReadTessellated = - static_cast(theResource->IntegerVal("read.tessellated", InternalParameters.ReadTessellated, aScope)); - InternalParameters.ReadAssemblyLevel = - static_cast(theResource->IntegerVal("read.assembly.level", InternalParameters.ReadAssemblyLevel, aScope)); + InternalParameters.ReadProductContext = static_cast( + theResource->IntegerVal("read.product.context", InternalParameters.ReadProductContext, aScope)); + InternalParameters.ReadShapeRepr = static_cast( + theResource->IntegerVal("read.shape.repr", InternalParameters.ReadShapeRepr, aScope)); + InternalParameters.ReadTessellated = static_cast( + theResource->IntegerVal("read.tessellated", InternalParameters.ReadTessellated, aScope)); + InternalParameters.ReadAssemblyLevel = static_cast( + theResource->IntegerVal("read.assembly.level", InternalParameters.ReadAssemblyLevel, aScope)); InternalParameters.ReadRelationship = theResource->BooleanVal("read.shape.relationship", InternalParameters.ReadRelationship, aScope); InternalParameters.ReadShapeAspect = @@ -113,10 +104,8 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& theResource->BooleanVal("read.stepcaf.subshapes.name", InternalParameters.ReadSubshapeNames, aScope); - InternalParameters.ReadCodePage = - static_cast(theResource->IntegerVal("read.codepage", - InternalParameters.ReadCodePage, - aScope)); + InternalParameters.ReadCodePage = static_cast( + theResource->IntegerVal("read.codepage", InternalParameters.ReadCodePage, aScope)); InternalParameters.ReadNonmanifold = theResource->BooleanVal("read.nonmanifold", InternalParameters.ReadNonmanifold, aScope); InternalParameters.ReadIdeas = @@ -140,35 +129,26 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& InternalParameters.ReadProductMetadata = theResource->BooleanVal("read.productmetadata", InternalParameters.ReadProductMetadata, aScope); - InternalParameters.WritePrecisionMode = - static_cast(theResource->IntegerVal( - "write.precision.mode", - InternalParameters.WritePrecisionMode, - aScope)); + InternalParameters.WritePrecisionMode = static_cast( + theResource->IntegerVal("write.precision.mode", InternalParameters.WritePrecisionMode, aScope)); InternalParameters.WritePrecisionVal = theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope); - InternalParameters.WriteAssembly = - static_cast(theResource->IntegerVal("write.assembly", - InternalParameters.WriteAssembly, - aScope)); - InternalParameters.WriteSchema = - static_cast(theResource->IntegerVal("write.schema", - InternalParameters.WriteSchema, - aScope)); - InternalParameters.WriteTessellated = - static_cast(theResource->IntegerVal("write.tessellated", InternalParameters.WriteTessellated, aScope)); + InternalParameters.WriteAssembly = static_cast( + theResource->IntegerVal("write.assembly", InternalParameters.WriteAssembly, aScope)); + InternalParameters.WriteSchema = static_cast( + theResource->IntegerVal("write.schema", InternalParameters.WriteSchema, aScope)); + InternalParameters.WriteTessellated = static_cast( + theResource->IntegerVal("write.tessellated", InternalParameters.WriteTessellated, aScope)); InternalParameters.WriteProductName = theResource->StringVal("write.product.name", InternalParameters.WriteProductName, aScope); InternalParameters.WriteSurfaceCurMode = theResource->BooleanVal("write.surfacecurve.mode", InternalParameters.WriteSurfaceCurMode, aScope); - InternalParameters.WriteUnit = - static_cast(theResource->IntegerVal("write.unit", - InternalParameters.WriteUnit, - aScope)); - InternalParameters.WriteVertexMode = - static_cast(theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope)); + InternalParameters.WriteUnit = static_cast( + theResource->IntegerVal("write.unit", InternalParameters.WriteUnit, aScope)); + InternalParameters.WriteVertexMode = static_cast( + theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope)); InternalParameters.WriteSubshapeNames = theResource->BooleanVal("write.stepcaf.subshapes.name", InternalParameters.WriteSubshapeNames, @@ -189,10 +169,8 @@ bool DESTEP_ConfigurationNode::Load(const occ::handle& theResource->BooleanVal("write.material", InternalParameters.WriteMaterial, aScope); InternalParameters.WriteVisMaterial = theResource->BooleanVal("write.vismaterial", InternalParameters.WriteVisMaterial, aScope); - InternalParameters.WriteModelType = - static_cast(theResource->IntegerVal("write.model.type", - InternalParameters.WriteModelType, - aScope)); + InternalParameters.WriteModelType = static_cast( + theResource->IntegerVal("write.model.type", InternalParameters.WriteModelType, aScope)); InternalParameters.CleanDuplicates = theResource->BooleanVal("write.cleanduplicates", InternalParameters.CleanDuplicates, aScope); InternalParameters.WriteScalingTrsf = diff --git a/src/DataExchange/TKDESTEP/DESTEP/DESTEP_Parameters.cxx b/src/DataExchange/TKDESTEP/DESTEP/DESTEP_Parameters.cxx index 500051a18e6..b49c0f5f981 100644 --- a/src/DataExchange/TKDESTEP/DESTEP/DESTEP_Parameters.cxx +++ b/src/DataExchange/TKDESTEP/DESTEP/DESTEP_Parameters.cxx @@ -23,60 +23,62 @@ DESTEP_Parameters::DESTEP_Parameters() = default; void DESTEP_Parameters::InitFromStatic() { - ReadBSplineContinuity = static_cast(Interface_Static::IVal( - "read.iges.bspline.continuity")); - ReadPrecisionMode = - static_cast(Interface_Static::IVal("read.precision.mode")); - ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); - ReadMaxPrecisionMode = - static_cast(Interface_Static::IVal("read.maxprecision.mode")); - ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); - ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; - ReadSurfaceCurveMode = - static_cast(Interface_Static::IVal("read.surfacecurve.mode")); + ReadBSplineContinuity = static_cast( + Interface_Static::IVal("read.iges.bspline.continuity")); + ReadPrecisionMode = static_cast( + Interface_Static::IVal("read.precision.mode")); + ReadPrecisionVal = Interface_Static::RVal("read.precision.val"); + ReadMaxPrecisionMode = static_cast( + Interface_Static::IVal("read.maxprecision.mode")); + ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val"); + ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1; + ReadSurfaceCurveMode = static_cast( + Interface_Static::IVal("read.surfacecurve.mode")); EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI; - AngleUnit = static_cast(Interface_Static::IVal("step.angleunit.mode")); + AngleUnit = + static_cast(Interface_Static::IVal("step.angleunit.mode")); - ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1; - ReadProductContext = - static_cast(Interface_Static::IVal("read.step.product.context")); - ReadShapeRepr = - static_cast(Interface_Static::IVal("read.step.shape.repr")); - ReadTessellated = - static_cast(Interface_Static::IVal("read.step.tessellated")); - ReadAssemblyLevel = - static_cast(Interface_Static::IVal("read.step.assembly.level")); - ReadRelationship = Interface_Static::IVal("read.step.shape.relationship") == 1; - ReadShapeAspect = Interface_Static::IVal("read.step.shape.aspect") == 1; - ReadConstrRelation = Interface_Static::IVal("read.step.constructivegeom.relationship") == 1; - ReadSubshapeNames = Interface_Static::IVal("read.stepcaf.subshapes.name") == 1; - ReadCodePage = static_cast(Interface_Static::IVal("read.step.codepage")); - ReadNonmanifold = Interface_Static::IVal("read.step.nonmanifold") == 1; - ReadIdeas = Interface_Static::IVal("read.step.ideas") == 1; - ReadAllShapes = Interface_Static::IVal("read.step.all.shapes") == 1; + ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1; + ReadProductContext = static_cast( + Interface_Static::IVal("read.step.product.context")); + ReadShapeRepr = static_cast( + Interface_Static::IVal("read.step.shape.repr")); + ReadTessellated = static_cast( + Interface_Static::IVal("read.step.tessellated")); + ReadAssemblyLevel = static_cast( + Interface_Static::IVal("read.step.assembly.level")); + ReadRelationship = Interface_Static::IVal("read.step.shape.relationship") == 1; + ReadShapeAspect = Interface_Static::IVal("read.step.shape.aspect") == 1; + ReadConstrRelation = Interface_Static::IVal("read.step.constructivegeom.relationship") == 1; + ReadSubshapeNames = Interface_Static::IVal("read.stepcaf.subshapes.name") == 1; + ReadCodePage = static_cast(Interface_Static::IVal("read.step.codepage")); + ReadNonmanifold = Interface_Static::IVal("read.step.nonmanifold") == 1; + ReadIdeas = Interface_Static::IVal("read.step.ideas") == 1; + ReadAllShapes = Interface_Static::IVal("read.step.all.shapes") == 1; ReadRootTransformation = Interface_Static::IVal("read.step.root.transformation") == 1; - WritePrecisionMode = - static_cast(Interface_Static::IVal("write.precision.mode")); + WritePrecisionMode = static_cast( + Interface_Static::IVal("write.precision.mode")); WritePrecisionVal = Interface_Static::RVal("write.precision.val"); - WriteAssembly = - static_cast(Interface_Static::IVal("write.step.assembly")); - WriteSchema = - static_cast(Interface_Static::IVal("write.step.schema")); - WriteTessellated = - static_cast(Interface_Static::IVal("write.step.tessellated")); + WriteAssembly = static_cast( + Interface_Static::IVal("write.step.assembly")); + WriteSchema = static_cast( + Interface_Static::IVal("write.step.schema")); + WriteTessellated = static_cast( + Interface_Static::IVal("write.step.tessellated")); WriteProductName = Interface_Static::CVal("write.step.product.name"); WriteSurfaceCurMode = Interface_Static::IVal("write.surfacecurve.mode") == 1; - WriteUnit = static_cast(Interface_Static::IVal("write.step.unit")); - WriteVertexMode = - static_cast(Interface_Static::IVal("write.step.vertex.mode")); + WriteUnit = static_cast(Interface_Static::IVal("write.step.unit")); + WriteVertexMode = static_cast( + Interface_Static::IVal("write.step.vertex.mode")); WriteSubshapeNames = Interface_Static::IVal("write.stepcaf.subshapes.name") == 1; WriteColor = Interface_Static::IVal("write.color") == 1; WriteNonmanifold = Interface_Static::IVal("write.step.nonmanifold") == 1; WriteName = Interface_Static::IVal("write.name") == 1; WriteLayer = Interface_Static::IVal("write.layer") == 1; WriteProps = Interface_Static::IVal("write.props") == 1; - WriteModelType = static_cast(Interface_Static::IVal("write.model.type")); + WriteModelType = + static_cast(Interface_Static::IVal("write.model.type")); } //================================================================================================= diff --git a/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Reader.cxx index c21bbf32415..10b84938212 100644 --- a/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -3334,16 +3334,12 @@ bool STEPCAFControl_Reader::readDatumsAP242(const occ::handleLower(); m <= aModif->Upper(); m++) { if (aModif->Value(m).CaseNumber() == 2) - aXCAFModifiers.Append(static_cast(aModif->Value(m) - .SimpleDatumReferenceModifierMember() - ->Value())); + aXCAFModifiers.Append(static_cast( + aModif->Value(m).SimpleDatumReferenceModifierMember()->Value())); else if (aModif->Value(m).CaseNumber() == 1) { - aXCAFModifWithVal = - static_cast(aModif->Value(m) - .DatumReferenceModifierWithValue() - ->ModifierType() - + 1); + aXCAFModifWithVal = static_cast( + aModif->Value(m).DatumReferenceModifierWithValue()->ModifierType() + 1); double aVal = aModif->Value(m) .DatumReferenceModifierWithValue() ->ModifierValue() @@ -3394,16 +3390,12 @@ bool STEPCAFControl_Reader::readDatumsAP242(const occ::handleLower(); k <= aModifE->Upper(); k++) { if (aModifE->Value(k).CaseNumber() == 2) - aXCAFModifiers.Append(static_cast(aModifE->Value(k) - .SimpleDatumReferenceModifierMember() - ->Value())); + aXCAFModifiers.Append(static_cast( + aModifE->Value(k).SimpleDatumReferenceModifierMember()->Value())); else if (aModifE->Value(k).CaseNumber() == 1) { - aXCAFModifWithVal = - static_cast(aModifE->Value(k) - .DatumReferenceModifierWithValue() - ->ModifierType() - + 1); + aXCAFModifWithVal = static_cast( + aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierType() + 1); double aVal = aModifE->Value(k) .DatumReferenceModifierWithValue() ->ModifierValue() @@ -4688,7 +4680,8 @@ static void setGeomTolObjectToXCAF(const occ::handle& the else if (aModifiers->Value(i) == StepDimTol_GTMMaximumMaterialRequirement) aTolObj->SetMaterialRequirementModifier(XCAFDimTolObjects_GeomToleranceMatReqModif_M); else - aTolObj->AddModifier(static_cast(aModifiers->Value(i))); + aTolObj->AddModifier( + static_cast(aModifiers->Value(i))); } } double aVal = 0; diff --git a/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderData.cxx b/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderData.cxx index d86b72748e0..62d688dd80f 100644 --- a/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderData.cxx +++ b/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderData.cxx @@ -149,7 +149,8 @@ void StepData_StepReaderData::cleanText(const occ::handle(aResString.Value(aStringInd + 2) & 255)); if (aPageId >= 'A' && aPageId <= 'I') { - aLocalFormatType = static_cast(Resource_FormatType_iso8859_1 + (aPageId - 'A')); + aLocalFormatType = + static_cast(Resource_FormatType_iso8859_1 + (aPageId - 'A')); } else { @@ -175,9 +176,10 @@ void StepData_StepReaderData::cleanText(const occ::handle(convertCharacterTo16bit(aResString.Value(aStringInd + 3))); - aResChar = - (aResChar << 4) | static_cast(convertCharacterTo16bit(aResString.Value(aStringInd + 4))); + char aResChar = + static_cast(convertCharacterTo16bit(aResString.Value(aStringInd + 3))); + aResChar = (aResChar << 4) + | static_cast(convertCharacterTo16bit(aResString.Value(aStringInd + 4))); const char aStrForConvert[2] = {aResChar, '\0'}; // clang-format off aTempExtString = TCollection_ExtendedString(aStrForConvert, false); // pass through without conversion diff --git a/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.cxx b/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.cxx index 63e6c9bb029..3de25a654be 100644 --- a/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.cxx +++ b/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.cxx @@ -413,7 +413,8 @@ bool RWStl_Reader::ReadBinary(Standard_IStream& theStream, const Message_Progres // read file header at first char aHeader[THE_STL_HEADER_SIZE + 1]; - if (theStream.read(aHeader, THE_STL_HEADER_SIZE).gcount() != static_cast(THE_STL_HEADER_SIZE)) + if (theStream.read(aHeader, THE_STL_HEADER_SIZE).gcount() + != static_cast(THE_STL_HEADER_SIZE)) { Message::SendFail("Error: Corrupted binary STL file"); return false; diff --git a/src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx b/src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx index a785a5154bb..638dcc64c20 100644 --- a/src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx +++ b/src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx @@ -52,26 +52,23 @@ bool DEVRML_ConfigurationNode::Load(const occ::handle& InternalParameters.ReadFileUnit = theResource->RealVal("read.file.unit", InternalParameters.ReadFileUnit, aScope); - InternalParameters.ReadFileCoordinateSys = - static_cast(theResource->IntegerVal("read.file.coordinate.system", - InternalParameters.ReadFileCoordinateSys, - aScope)); - InternalParameters.ReadSystemCoordinateSys = - static_cast(theResource->IntegerVal("read.system.coordinate.system", - InternalParameters.ReadSystemCoordinateSys, - aScope)); + InternalParameters.ReadFileCoordinateSys = static_cast( + theResource->IntegerVal("read.file.coordinate.system", + InternalParameters.ReadFileCoordinateSys, + aScope)); + InternalParameters.ReadSystemCoordinateSys = static_cast( + theResource->IntegerVal("read.system.coordinate.system", + InternalParameters.ReadSystemCoordinateSys, + aScope)); InternalParameters.ReadFillIncomplete = theResource->BooleanVal("read.fill.incomplete", InternalParameters.ReadFillIncomplete, aScope); - InternalParameters.WriterVersion = - static_cast(theResource->IntegerVal("writer.version", - InternalParameters.WriterVersion, - aScope)); - InternalParameters.WriteRepresentationType = - static_cast(theResource->IntegerVal( - "write.representation.type", - InternalParameters.WriteRepresentationType, - aScope)); + InternalParameters.WriterVersion = static_cast( + theResource->IntegerVal("writer.version", InternalParameters.WriterVersion, aScope)); + InternalParameters.WriteRepresentationType = static_cast( + theResource->IntegerVal("write.representation.type", + InternalParameters.WriteRepresentationType, + aScope)); return true; } diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx index e286643673d..f48345303f8 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Datum.cxx @@ -358,8 +358,9 @@ occ::handle XCAFDoc_Datum::GetObject() const .FindChild(ChildLab_ModifierWithValue) .FindAttribute(TDataStd_Real::GetID(), aModifierWithValueV)) { - anObj->SetModifierWithValue(static_cast(aModifierWithValueM->Get()), - aModifierWithValueV->Get()); + anObj->SetModifierWithValue( + static_cast(aModifierWithValueM->Get()), + aModifierWithValueV->Get()); } } @@ -423,7 +424,8 @@ occ::handle XCAFDoc_Datum::GetObject() const .FindChild(ChildLab_DTargetType) .FindAttribute(TDataStd_Integer::GetID(), aDTargetType)) { - anObj->SetDatumTargetType(static_cast(aDTargetType->Get())); + anObj->SetDatumTargetType( + static_cast(aDTargetType->Get())); if (anObj->GetDatumTargetType() == XCAFDimTolObjects_DatumTargetType_Area) { occ::handle aDatumTarget; diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx index 7a2c879d69d..e34573e3e15 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_Dimension.cxx @@ -361,16 +361,18 @@ occ::handle XCAFDoc_Dimension::GetObject() co .FindChild(ChildLab_AngularQualifier) .FindAttribute(TDataStd_Integer::GetID(), anAngularQualifier)) { - anObj->SetAngularQualifier(static_cast(anAngularQualifier->Get())); + anObj->SetAngularQualifier( + static_cast(anAngularQualifier->Get())); } occ::handle aClass; if (Label().FindChild(ChildLab_Class).FindAttribute(TDataStd_IntegerArray::GetID(), aClass) && !aClass->Array().IsNull() && aClass->Array()->Length() > 0) { - anObj->SetClassOfTolerance(aClass->Array()->Value(1) != 0, - static_cast(aClass->Array()->Value(2)), - static_cast(aClass->Array()->Value(3))); + anObj->SetClassOfTolerance( + aClass->Array()->Value(1) != 0, + static_cast(aClass->Array()->Value(2)), + static_cast(aClass->Array()->Value(3))); } occ::handle aDec; diff --git a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx index bafa68c8d23..4921010d31b 100644 --- a/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx +++ b/src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_GeomTolerance.cxx @@ -277,7 +277,8 @@ occ::handle XCAFDoc_GeomTolerance::GetObj .FindChild(ChildLab_TypeOfValue) .FindAttribute(TDataStd_Integer::GetID(), aTypeOfValue)) { - anObj->SetTypeOfValue(static_cast(aTypeOfValue->Get())); + anObj->SetTypeOfValue( + static_cast(aTypeOfValue->Get())); } occ::handle aValue; @@ -298,7 +299,8 @@ occ::handle XCAFDoc_GeomTolerance::GetObj occ::handle aZoneModif; if (Label().FindChild(ChildLab_ZoneModif).FindAttribute(TDataStd_Integer::GetID(), aZoneModif)) { - anObj->SetZoneModifier(static_cast(aZoneModif->Get())); + anObj->SetZoneModifier( + static_cast(aZoneModif->Get())); } occ::handle aValueOfZoneModif; @@ -413,7 +415,9 @@ occ::handle XCAFDoc_GeomTolerance::GetObj TDataXtd_Geometry::Plane(anAffectedPlaneAttr->Label(), aPlane); occ::handle aTypeAttr; Label().FindChild(ChildLab_AffectedPlane).FindAttribute(TDataStd_Integer::GetID(), aTypeAttr); - anObj->SetAffectedPlane(aPlane, static_cast(aTypeAttr->Get())); + anObj->SetAffectedPlane( + aPlane, + static_cast(aTypeAttr->Get())); } return anObj; diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx index d2058db2b14..6561b15f365 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx @@ -562,7 +562,8 @@ Interface_CheckIterator IFSelect_WorkSession::ModelCheckList(const bool complete } Interface_CheckTool cht(Graph()); checks = (complete ? cht.CompleteCheckList() : cht.AnalyseCheckList()); - checks.SetName(const_cast(complete ? "Model Complete Check List" : "Model Syntactic Check List")); + checks.SetName( + const_cast(complete ? "Model Complete Check List" : "Model Syntactic Check List")); return checks; } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_FileParameter.cxx b/src/DataExchange/TKXSBase/Interface/Interface_FileParameter.cxx index 59894d22b54..ed700c7b4f2 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_FileParameter.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_FileParameter.cxx @@ -37,7 +37,8 @@ void Interface_FileParameter::Init(const TCollection_AsciiString& val, void Interface_FileParameter::Init(const char* const val, const Interface_ParamType typ) { - theval = const_cast(val); // Principle: Allocation managed by container (ParamSet) + theval = + const_cast(val); // Principle: Allocation managed by container (ParamSet) thetype = typ; thenum = 0; } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_UndefinedContent.cxx b/src/DataExchange/TKXSBase/Interface/Interface_UndefinedContent.cxx index 37766799dd7..7c7bfd08e4e 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_UndefinedContent.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_UndefinedContent.cxx @@ -271,7 +271,8 @@ void Interface_UndefinedContent::SetEntity(const int else theentities.SetValue(rang, ent); - desc = static_cast(ptype) + (Content_LocalRef << Content_LocalShift) + (rang << Content_NumberShift); + desc = static_cast(ptype) + (Content_LocalRef << Content_LocalShift) + + (rang << Content_NumberShift); theparams->SetValue(num, desc); } diff --git a/src/DataExchange/TKXSBase/XSControl/XSControl_TransferReader.cxx b/src/DataExchange/TKXSBase/XSControl/XSControl_TransferReader.cxx index 0137afc293d..c1a5da8d92a 100644 --- a/src/DataExchange/TKXSBase/XSControl/XSControl_TransferReader.cxx +++ b/src/DataExchange/TKXSBase/XSControl/XSControl_TransferReader.cxx @@ -815,7 +815,8 @@ int XSControl_TransferReader::TransferOne(const occ::handle& << " Ident : " << lab->ToCString() << Interface_MSG::Blanks(14 - lab->Length()) << "******\n"; sout << "****** Type : " << myModel->TypeName(ent, false) - << Interface_MSG::Blanks(static_cast(44 - strlen(myModel->TypeName(ent, false)))) << "******"; + << Interface_MSG::Blanks(static_cast(44 - strlen(myModel->TypeName(ent, false)))) + << "******"; sout << "\n*******************************************************************\n"; } diff --git a/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_CurveComputation.pxx b/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_CurveComputation.pxx index 2f1c28f49ce..4c0b362883b 100644 --- a/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_CurveComputation.pxx +++ b/src/FoundationClasses/TKMath/BSplCLib/BSplCLib_CurveComputation.pxx @@ -1208,7 +1208,7 @@ void BSplCLib_CacheD0(const double Parameter, if (WeightsArray != NULL) { const NCollection_Array1& refWeights = *WeightsArray; - double* WArray = const_cast(&refWeights(refWeights.Lower())); + double* WArray = const_cast(&refWeights(refWeights.Lower())); PLib::NoDerivativeEvalPolynomial(NewParameter, Degree, 1, Degree, WArray[0], Inverse); Inverse = 1.0e0 / Inverse; @@ -1251,7 +1251,7 @@ void BSplCLib_CacheD1(const double Parameter, if (WeightsArray != NULL) { const NCollection_Array1& refWeights = *WeightsArray; - double* WArray = const_cast(&refWeights(refWeights.Lower())); + double* WArray = const_cast(&refWeights(refWeights.Lower())); PLib::EvalPolynomial(NewParameter, 1, Degree, 1, WArray[0], LocalWDerivatives[0]); LocalWDerivatives[1] /= SpanLenght; @@ -1321,7 +1321,7 @@ void BSplCLib_CacheD2(const double Parameter, if (WeightsArray != NULL) { const NCollection_Array1& refWeights = *WeightsArray; - double* WArray = const_cast(&refWeights(refWeights.Lower())); + double* WArray = const_cast(&refWeights(refWeights.Lower())); PLib::EvalPolynomial(NewParameter, 2, Degree, 1, WArray[0], LocalWDerivatives[0]); @@ -1406,7 +1406,7 @@ void BSplCLib_CacheD3(const double Parameter, if (WeightsArray != NULL) { const NCollection_Array1& refWeights = *WeightsArray; - double* WArray = const_cast(&refWeights(refWeights.Lower())); + double* WArray = const_cast(&refWeights(refWeights.Lower())); PLib::EvalPolynomial(NewParameter, 3, Degree, 1, WArray[0], LocalWDerivatives[0]); @@ -1564,7 +1564,8 @@ void BSplCLib_BuildCache(const double theParameter, BSplCLib::Bohm(aParam, theDegree, theDegree, *dc.knots, aDimension, *dc.poles); double aCoeff = 1.0; - double* aCache = static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); + double* aCache = + static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); double* aPolyCoeffs = dc.poles; for (int i = 0; i <= theDegree; i++) diff --git a/src/FoundationClasses/TKMath/BSplSLib/BSplSLib.cxx b/src/FoundationClasses/TKMath/BSplSLib/BSplSLib.cxx index b8b29e19c1c..34b35531760 100644 --- a/src/FoundationClasses/TKMath/BSplSLib/BSplSLib.cxx +++ b/src/FoundationClasses/TKMath/BSplSLib/BSplSLib.cxx @@ -2405,7 +2405,8 @@ void BSplSLib::BuildCache(const double theU, for (int kk = 0; kk <= d1; kk++) BSplCLib::Bohm(u2, d2, d2, *dc.knots2, aDimension, *(dc.poles + kk * aDimension * d2p1)); - double* aCache = static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); + double* aCache = + static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); double aFactors[2]; // aFactors[0] corresponds to variable with minimal degree @@ -2431,7 +2432,8 @@ void BSplSLib::BuildCache(const double theU, // Fill the weights for the surface which is not locally polynomial if (aCacheShift > aDimension) { - aCache = static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); + aCache = + static_cast(&(theCacheArray(theCacheArray.LowerRow(), theCacheArray.LowerCol()))); aCache += aCacheShift - 1; for (aRow = 0; aRow <= d2; aRow++) for (aCol = 0; aCol <= d1; aCol++) diff --git a/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfNodes.hxx b/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfNodes.hxx index bb48a956d6b..ecd60ab5b03 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfNodes.hxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_ArrayOfNodes.hxx @@ -137,7 +137,9 @@ inline void Poly_ArrayOfNodes::SetValue(int theIndex, const gp_Pnt& theValue) { NCollection_Vec3& aVec3 = NCollection_AliasedArray::ChangeValue>(theIndex); - aVec3.SetValues(static_cast(theValue.X()), static_cast(theValue.Y()), static_cast(theValue.Z())); + aVec3.SetValues(static_cast(theValue.X()), + static_cast(theValue.Y()), + static_cast(theValue.Z())); } } diff --git a/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.hxx b/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.hxx index 3bf0ac7d2e9..58026db63f4 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.hxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.hxx @@ -92,7 +92,9 @@ public: const gp_XYZ aVec01 = myPlaces[1] - myPlaces[0]; const gp_XYZ aVec02 = myPlaces[2] - myPlaces[0]; const gp_XYZ aCross = aVec01 ^ aVec02; - NCollection_Vec3 aNorm(static_cast(aCross.X()), static_cast(aCross.Y()), static_cast(aCross.Z())); + NCollection_Vec3 aNorm(static_cast(aCross.X()), + static_cast(aCross.Y()), + static_cast(aCross.Z())); return aNorm.Normalized(); } @@ -161,7 +163,9 @@ private: { int aNodeIndex = myNbNodes; const gp_XYZ& aPlace = myPlaces[theTriNode]; - const NCollection_Vec3 aVec3(static_cast(aPlace.X()), static_cast(aPlace.Y()), static_cast(aPlace.Z())); + const NCollection_Vec3 aVec3(static_cast(aPlace.X()), + static_cast(aPlace.Y()), + static_cast(aPlace.Z())); if (myNodeIndexMap.Bind(aNodeIndex, theIsOpposite, aVec3, myTriNormal)) { ++myNbNodes; diff --git a/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.cxx b/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.cxx index 3d96a4e38bd..e61980711e7 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.cxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.cxx @@ -452,7 +452,9 @@ void Poly_Triangulation::ComputeNormals() const gp_XYZ aVec02 = aNode2.XYZ() - aNode0.XYZ(); const gp_XYZ aTriNorm = aVec01 ^ aVec02; const NCollection_Vec3 aNorm3f = - NCollection_Vec3(static_cast(aTriNorm.X()), static_cast(aTriNorm.Y()), static_cast(aTriNorm.Z())); + NCollection_Vec3(static_cast(aTriNorm.X()), + static_cast(aTriNorm.Y()), + static_cast(aTriNorm.Z())); for (int aNodeIter = 0; aNodeIter < 3; ++aNodeIter) { myNormals.ChangeValue(anElem[aNodeIter] - 1) += aNorm3f; diff --git a/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.hxx b/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.hxx index 98faf74f2b3..dd79e71c319 100644 --- a/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.hxx +++ b/src/FoundationClasses/TKMath/Poly/Poly_Triangulation.hxx @@ -203,9 +203,10 @@ public: //! @param[in] theNormal normalized 3D vector defining a surface normal void SetNormal(const int theIndex, const gp_Dir& theNormal) { - SetNormal( - theIndex, - NCollection_Vec3(static_cast(theNormal.X()), static_cast(theNormal.Y()), static_cast(theNormal.Z()))); + SetNormal(theIndex, + NCollection_Vec3(static_cast(theNormal.X()), + static_cast(theNormal.Y()), + static_cast(theNormal.Z()))); } //! Returns mesh purpose bits. diff --git a/src/FoundationClasses/TKMath/math/math_FunctionAllRoots.cxx b/src/FoundationClasses/TKMath/math/math_FunctionAllRoots.cxx index f4d40c6e015..00b2f786c5b 100644 --- a/src/FoundationClasses/TKMath/math/math_FunctionAllRoots.cxx +++ b/src/FoundationClasses/TKMath/math/math_FunctionAllRoots.cxx @@ -216,8 +216,8 @@ math_FunctionAllRoots::math_FunctionAllRoots(math_FunctionWithDerivative& F, // dernier intervalle nul et Value(Nbp). Nbrpt = static_cast(std::trunc(std::abs((S.GetParameter(Nbp) - pfin.Value(pdeb.Length())) - / (S.GetParameter(Nbp) - S.GetParameter(1))) - * Nbp)); + / (S.GetParameter(Nbp) - S.GetParameter(1))) + * Nbp)); math_FunctionRoots Res(F, pfin.Value(pdeb.Length()), S.GetParameter(Nbp), diff --git a/src/FoundationClasses/TKernel/FSD/FSD_Base64.cxx b/src/FoundationClasses/TKernel/FSD/FSD_Base64.cxx index d7ecdadac0f..04733ed1db2 100644 --- a/src/FoundationClasses/TKernel/FSD/FSD_Base64.cxx +++ b/src/FoundationClasses/TKernel/FSD/FSD_Base64.cxx @@ -42,8 +42,8 @@ size_t FSD_Base64::Encode(char* theEncodedStr, size_t iStr = 0; for (size_t i = 0; i < theDataLen - aPad; i += 3) { - uint32_t aWord = - (static_cast(theData[i]) << 16) + (static_cast(theData[i + 1]) << 8) + theData[i + 2]; + uint32_t aWord = (static_cast(theData[i]) << 16) + + (static_cast(theData[i + 1]) << 8) + theData[i + 2]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 18]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 12 & 0x3F]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 6 & 0x3F]; @@ -53,7 +53,8 @@ size_t FSD_Base64::Encode(char* theEncodedStr, { if (aPad != 0) { - uint32_t aWord = static_cast(theData[theDataLen - 2]) << 8 | theData[theDataLen - 1]; + uint32_t aWord = + static_cast(theData[theDataLen - 2]) << 8 | theData[theDataLen - 1]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 10]; theEncodedStr[iStr++] = aBase64Chars[aWord >> 4 & 0x03F]; theEncodedStr[iStr++] = aBase64Chars[(aWord & 0xF) << 2]; diff --git a/src/FoundationClasses/TKernel/Message/Message_AttributeMeter.cxx b/src/FoundationClasses/TKernel/Message/Message_AttributeMeter.cxx index 4192aa52df6..1f04d644b34 100644 --- a/src/FoundationClasses/TKernel/Message/Message_AttributeMeter.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_AttributeMeter.cxx @@ -223,13 +223,11 @@ void Message_AttributeMeter::SetAlertMetrics(const occ::handleSetStartValue(aMetricType, - aMemInfo.ValuePreciseMiB(anIterator.Value())); + aMeterAttribute->SetStartValue(aMetricType, aMemInfo.ValuePreciseMiB(anIterator.Value())); } else { - aMeterAttribute->SetStopValue(aMetricType, - aMemInfo.ValuePreciseMiB(anIterator.Value())); + aMeterAttribute->SetStopValue(aMetricType, aMemInfo.ValuePreciseMiB(anIterator.Value())); } } } diff --git a/src/FoundationClasses/TKernel/Message/Message_ExecStatus.hxx b/src/FoundationClasses/TKernel/Message/Message_ExecStatus.hxx index 661c4c146f5..fa429129926 100644 --- a/src/FoundationClasses/TKernel/Message/Message_ExecStatus.hxx +++ b/src/FoundationClasses/TKernel/Message/Message_ExecStatus.hxx @@ -236,7 +236,8 @@ public: //! Returns status type (DONE, WARN, ALARM, or FAIL) static Message_StatusType TypeOfStatus(Message_Status theStatus) { - return static_cast(static_cast(theStatus) & static_cast(MType)); + return static_cast(static_cast(theStatus) + & static_cast(MType)); } //! Returns status with index theIndex in whole range [FirstStatus, LastStatus] diff --git a/src/FoundationClasses/TKernel/Message/Message_Msg.cxx b/src/FoundationClasses/TKernel/Message/Message_Msg.cxx index c3831462e70..c172064a70d 100644 --- a/src/FoundationClasses/TKernel/Message/Message_Msg.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_Msg.cxx @@ -125,8 +125,8 @@ void Message_Msg::Set(const TCollection_ExtendedString& theMsg) continue; } mySeqOfFormats.Append(static_cast(aFormatType)); // type - mySeqOfFormats.Append(aStart); // beginning pos - mySeqOfFormats.Append(i + 1 - aStart); // length + mySeqOfFormats.Append(aStart); // beginning pos + mySeqOfFormats.Append(i + 1 - aStart); // length } } myOriginal = myMessageBody; diff --git a/src/FoundationClasses/TKernel/Message/Message_MsgFile.cxx b/src/FoundationClasses/TKernel/Message/Message_MsgFile.cxx index 1021ce982a6..74eed03a80a 100644 --- a/src/FoundationClasses/TKernel/Message/Message_MsgFile.cxx +++ b/src/FoundationClasses/TKernel/Message/Message_MsgFile.cxx @@ -342,7 +342,7 @@ bool Message_MsgFile::LoadFromEnv(const char* const theEnvName, bool Message_MsgFile::LoadFromString(const char* const theContent, const int theLength) { - int aStringSize = theLength >= 0 ? theLength : static_cast(strlen(theContent)); + int aStringSize = theLength >= 0 ? theLength : static_cast(strlen(theContent)); NCollection_Buffer aBuffer(NCollection_BaseAllocator::CommonBaseAllocator()); if (aStringSize <= 0 || !aBuffer.Allocate(aStringSize + 2)) { diff --git a/src/FoundationClasses/TKernel/Message/Message_ProgressScope.hxx b/src/FoundationClasses/TKernel/Message/Message_ProgressScope.hxx index f5bed749e9f..1a6d23e5b9f 100644 --- a/src/FoundationClasses/TKernel/Message/Message_ProgressScope.hxx +++ b/src/FoundationClasses/TKernel/Message/Message_ProgressScope.hxx @@ -275,7 +275,8 @@ public: //! @name Preparation methods if (!theName.IsEmpty()) { myIsOwnName = true; - myName = static_cast(Standard::AllocateOptimal(static_cast(theName.Length()) + static_cast(1))); + myName = static_cast( + Standard::AllocateOptimal(static_cast(theName.Length()) + static_cast(1))); char* aName = const_cast(myName); memcpy(aName, theName.ToCString(), theName.Length()); aName[theName.Length()] = '\0'; diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.hxx index cab92cae016..72b71cde406 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_AccAllocator.hxx @@ -156,9 +156,15 @@ protected: SetFreeSize(theSize); } - void SetFreeSize(const size_t theSize) noexcept { allocStart = static_cast(address) + theSize; } + void SetFreeSize(const size_t theSize) noexcept + { + allocStart = static_cast(address) + theSize; + } - size_t FreeSize() const noexcept { return (uint8_t*)allocStart - static_cast(address); } + size_t FreeSize() const noexcept + { + return (uint8_t*)allocStart - static_cast(address); + } AlignedPtr Allocate(const AlignedSize theSize) noexcept { diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_BaseMap.cxx b/src/FoundationClasses/TKernel/NCollection/NCollection_BaseMap.cxx index ba9682a747c..428ade13a0c 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_BaseMap.cxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_BaseMap.cxx @@ -34,10 +34,12 @@ bool NCollection_BaseMap::BeginResize(const int NbBuckets, else return false; } - data1 = static_cast(Standard::Allocate((N + 1) * sizeof(NCollection_ListNode*))); + data1 = static_cast( + Standard::Allocate((N + 1) * sizeof(NCollection_ListNode*))); if (isDouble) { - data2 = static_cast(Standard::Allocate((N + 1) * sizeof(NCollection_ListNode*))); + data2 = static_cast( + Standard::Allocate((N + 1) * sizeof(NCollection_ListNode*))); } else data2 = nullptr; diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_CellFilter.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_CellFilter.hxx index 8afaac6fa5c..6190440064a 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_CellFilter.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_CellFilter.hxx @@ -260,9 +260,10 @@ protected: // INT_MAX it is decreased correspondingly for the value of INT_MAX. If the value // of index is less than INT_MIN it is increased correspondingly for the absolute // value of INT_MIN. - index[i] = static_cast((aVal > INT_MAX - 1) ? fmod(aVal, static_cast(INT_MAX)) - : (aVal < INT_MIN + 1) ? fmod(aVal, static_castINT_MIN) - : aVal); + index[i] = static_cast( + (aVal > INT_MAX - 1) ? fmod(aVal, static_cast(INT_MAX)) + : (aVal < INT_MIN + 1) ? fmod(aVal, static_cast INT_MIN) + : aVal); } } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.hxx index 572784ab3e5..c85b511bc00 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.hxx @@ -83,7 +83,8 @@ private: Block(void* const theAddr, const size_t theNbItems, const size_t theItemSize) : Count(static_cast(theAddr)), Array(static_cast(theAddr) + sizeof(size_t)), - Bits(reinterpret_cast(static_cast(theAddr) + sizeof(size_t) + theNbItems * theItemSize)) + Bits(reinterpret_cast(static_cast(theAddr) + sizeof(size_t) + + theNbItems * theItemSize)) { } diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.lxx b/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.lxx index 69b5850ec4a..845f71ae389 100755 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.lxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_UtfIterator.lxx @@ -256,8 +256,10 @@ inline char16_t* NCollection_UtfIterator::GetUtf16(char16_t* theBuffer) co { // surrogate pair char32_t aChar = myCharUtf32 - UTF16_SURROGATE_LOW_BASE; - *theBuffer++ = static_cast((aChar >> UTF16_SURROGATE_HIGH_SHIFT) + UTF16_SURROGATE_HIGH_START); - *theBuffer++ = static_cast((aChar & UTF16_SURROGATE_LOW_MASK) + UTF16_SURROGATE_LOW_START); + *theBuffer++ = + static_cast((aChar >> UTF16_SURROGATE_HIGH_SHIFT) + UTF16_SURROGATE_HIGH_START); + *theBuffer++ = + static_cast((aChar & UTF16_SURROGATE_LOW_MASK) + UTF16_SURROGATE_LOW_START); return theBuffer; } } diff --git a/src/FoundationClasses/TKernel/OSD/OSD_DirectoryIterator.cxx b/src/FoundationClasses/TKernel/OSD/OSD_DirectoryIterator.cxx index 3e318221c08..fc43d92a121 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_DirectoryIterator.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_DirectoryIterator.cxx @@ -117,9 +117,9 @@ void OSD_DirectoryIterator::Next() myEntry = readdir(static_cast(myDescr)); if (!myEntry) - { // No file found - myEntry = nullptr; // Keep pointer clean - myFlag = false; // No more files/directory + { // No file found + myEntry = nullptr; // Keep pointer clean + myFlag = false; // No more files/directory closedir(static_cast(myDescr)); // so close directory myDescr = nullptr; again = 0; @@ -130,7 +130,8 @@ void OSD_DirectoryIterator::Next() // if (!strcmp(entry->d_name,"..")) continue; 2 directories. // Is it a directory ? - const TCollection_AsciiString aFullName = myPlace + "/" + (static_cast(myEntry))->d_name; + const TCollection_AsciiString aFullName = + myPlace + "/" + (static_cast(myEntry))->d_name; stat(aFullName.ToCString(), &stat_buf); if (S_ISDIR(stat_buf.st_mode)) // Ensure me it's not a file if (strcmp_joker(myMask.ToCString(), (static_cast(myEntry))->d_name)) diff --git a/src/FoundationClasses/TKernel/OSD/OSD_File.cxx b/src/FoundationClasses/TKernel/OSD/OSD_File.cxx index f11f7459b20..c1d886c8e16 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_File.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_File.cxx @@ -989,7 +989,7 @@ void OSD_File::ReadLine(TCollection_AsciiString& theBuffer, } #else NCollection_Array1 aBuffer(0, theNbBytes); - char* aBufferGets = fgets(&aBuffer.ChangeFirst(), theNbBytes, static_cast(myFILE)); + char* aBufferGets = fgets(&aBuffer.ChangeFirst(), theNbBytes, static_cast(myFILE)); if (aBufferGets == nullptr) { if (!feof(static_cast(myFILE))) @@ -1115,8 +1115,9 @@ void OSD_File::Read(void* const theBuffer, const int theNbBytes, int& theNbReadB theNbReadBytes = (int)aNbReadBytes; #else - theNbReadBytes = 0; - int aNbReadBytes = static_cast(read(myFileChannel, static_cast(theBuffer), theNbBytes)); + theNbReadBytes = 0; + int aNbReadBytes = + static_cast(read(myFileChannel, static_cast(theBuffer), theNbBytes)); if (aNbReadBytes == -1) { myError.SetValue(errno, Iam, "Read"); @@ -1165,7 +1166,8 @@ void OSD_File::Write(void* const theBuffer, const int theNbBytes) _osd_wnt_set_error(myError, OSD_WFile); } #else - const int aNbWritten = static_cast(write(myFileChannel, static_cast(theBuffer), theNbBytes)); + const int aNbWritten = + static_cast(write(myFileChannel, static_cast(theBuffer), theNbBytes)); if (aNbWritten == -1) { myError.SetValue(errno, Iam, "Write"); diff --git a/src/FoundationClasses/TKernel/OSD/OSD_FileIterator.cxx b/src/FoundationClasses/TKernel/OSD/OSD_FileIterator.cxx index 50da116f7c8..23279324803 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_FileIterator.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_FileIterator.cxx @@ -138,9 +138,9 @@ void OSD_FileIterator::Next() myEntry = readdir(static_cast(myDescr)); if (!myEntry) - { // No file found - myEntry = nullptr; // Keep pointer clean - myFlag = false; // No more files/directory + { // No file found + myEntry = nullptr; // Keep pointer clean + myFlag = false; // No more files/directory closedir(static_cast(myDescr)); // so close directory myDescr = nullptr; again = 0; @@ -153,7 +153,8 @@ void OSD_FileIterator::Next() continue; // Is it a file ? - const TCollection_AsciiString aFullName = myPlace + "/" + (static_cast(myEntry))->d_name; + const TCollection_AsciiString aFullName = + myPlace + "/" + (static_cast(myEntry))->d_name; stat(aFullName.ToCString(), &stat_buf); if (S_ISREG(stat_buf.st_mode)) // LD : Ensure me it's a regular file if (strcmp_joker(myMask.ToCString(), (static_cast(myEntry))->d_name)) diff --git a/src/FoundationClasses/TKernel/OSD/OSD_LocalFileSystem.cxx b/src/FoundationClasses/TKernel/OSD/OSD_LocalFileSystem.cxx index d4d34488152..3c6522b6077 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_LocalFileSystem.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_LocalFileSystem.cxx @@ -72,7 +72,10 @@ std::shared_ptr OSD_LocalFileSystem::OpenStreamBuffer( if (theOutBufSize && ((theMode & std::ios::in) != 0)) { *theOutBufSize = (int64_t)aNewBuf->pubseekoff(0, std::ios_base::end, std::ios_base::in); - if (aNewBuf->pubseekoff(static_cast(theOffset), std::ios_base::beg, std::ios_base::in) < 0) + if (aNewBuf->pubseekoff(static_cast(theOffset), + std::ios_base::beg, + std::ios_base::in) + < 0) { *theOutBufSize = 0; return std::shared_ptr(); diff --git a/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx b/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx index d4b2b47e9eb..eb75c22be06 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_MemInfo.cxx @@ -270,38 +270,40 @@ TCollection_AsciiString OSD_MemInfo::ToString() const TCollection_AsciiString anInfo; if (hasValue(MemPrivate)) { - anInfo += - TCollection_AsciiString(" Private memory: ") + static_cast(ValueMiB(MemPrivate)) + " MiB\n"; + anInfo += TCollection_AsciiString(" Private memory: ") + + static_cast(ValueMiB(MemPrivate)) + " MiB\n"; } if (hasValue(MemWorkingSet)) { - anInfo += - TCollection_AsciiString(" Working Set: ") + static_cast(ValueMiB(MemWorkingSet)) + " MiB"; + anInfo += TCollection_AsciiString(" Working Set: ") + + static_cast(ValueMiB(MemWorkingSet)) + " MiB"; if (hasValue(MemWorkingSetPeak)) { - anInfo += TCollection_AsciiString(" (peak: ") + static_cast(ValueMiB(MemWorkingSetPeak)) + " MiB)"; + anInfo += TCollection_AsciiString(" (peak: ") + static_cast(ValueMiB(MemWorkingSetPeak)) + + " MiB)"; } anInfo += "\n"; } if (hasValue(MemSwapUsage)) { - anInfo += - TCollection_AsciiString(" Pagefile usage: ") + static_cast(ValueMiB(MemSwapUsage)) + " MiB"; + anInfo += TCollection_AsciiString(" Pagefile usage: ") + + static_cast(ValueMiB(MemSwapUsage)) + " MiB"; if (hasValue(MemSwapUsagePeak)) { - anInfo += TCollection_AsciiString(" (peak: ") + static_cast(ValueMiB(MemSwapUsagePeak)) + " MiB)"; + anInfo += TCollection_AsciiString(" (peak: ") + static_cast(ValueMiB(MemSwapUsagePeak)) + + " MiB)"; } anInfo += "\n"; } if (hasValue(MemVirtual)) { - anInfo += - TCollection_AsciiString(" Virtual memory: ") + static_cast(ValueMiB(MemVirtual)) + " MiB\n"; + anInfo += TCollection_AsciiString(" Virtual memory: ") + + static_cast(ValueMiB(MemVirtual)) + " MiB\n"; } if (hasValue(MemHeapUsage)) { - anInfo += - TCollection_AsciiString(" Heap memory: ") + static_cast(ValueMiB(MemHeapUsage)) + " MiB\n"; + anInfo += TCollection_AsciiString(" Heap memory: ") + + static_cast(ValueMiB(MemHeapUsage)) + " MiB\n"; } return anInfo; } @@ -325,8 +327,9 @@ size_t OSD_MemInfo::ValueMiB(const OSD_MemInfo::Counter theCounter) const { return static_cast(-1); } - return (myCounters[theCounter] == static_cast(-1)) ? static_cast(-1) - : (myCounters[theCounter] / (1024 * 1024)); + return (myCounters[theCounter] == static_cast(-1)) + ? static_cast(-1) + : (myCounters[theCounter] / (1024 * 1024)); } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx index 36bd0b38211..24608a78d05 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx @@ -187,7 +187,11 @@ bool OSD_Thread::Run(void* const data, } else { +#ifdef __APPLE__ + myThreadId = reinterpret_cast(myThread); +#else myThreadId = static_cast(myThread); +#endif } #endif return myThread != OSD_PTHREAD_NULL; @@ -357,6 +361,8 @@ Standard_ThreadId OSD_Thread::Current() { #ifdef _WIN32 return GetCurrentThreadId(); +#elif defined(__APPLE__) + return reinterpret_cast(pthread_self()); #else return static_cast(pthread_self()); #endif diff --git a/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx b/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx index 33fa6c4a0ef..9d9d974d5f4 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx @@ -935,7 +935,7 @@ static void SegvHandler(const int theSignal, siginfo_t* theSigInfo, void* const const int aStackLength = OSD_SignalStackTraceLength; const int aStackBufLen = std::max(aStackLength * 200, 2048); - char* aStackBuffer = aStackLength != 0 ? static_cast(alloca(aStackBufLen)) : nullptr; + char* aStackBuffer = aStackLength != 0 ? static_cast(alloca(aStackBufLen)) : nullptr; if (aStackBuffer != nullptr) { memset(aStackBuffer, 0, aStackBufLen); diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_Color.cxx b/src/FoundationClasses/TKernel/Quantity/Quantity_Color.cxx index 0731b4c5dd6..66fd77dcb44 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_Color.cxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_Color.cxx @@ -339,7 +339,9 @@ void Quantity_Color::SetValues(const double theC1, { case Quantity_TOC_RGB: { validateRgbRange(theC1, theC2, theC3); - myRgb.SetValues(static_cast(theC1), static_cast(theC2), static_cast(theC3)); + myRgb.SetValues(static_cast(theC1), + static_cast(theC2), + static_cast(theC3)); break; } case Quantity_TOC_sRGB: { @@ -351,20 +353,24 @@ void Quantity_Color::SetValues(const double theC1, } case Quantity_TOC_HLS: { validateHlsRange(theC1, theC2, theC3); - myRgb = - Convert_HLS_To_LinearRGB(NCollection_Vec3(static_cast(theC1), static_cast(theC2), static_cast(theC3))); + myRgb = Convert_HLS_To_LinearRGB(NCollection_Vec3(static_cast(theC1), + static_cast(theC2), + static_cast(theC3))); break; } case Quantity_TOC_CIELab: { validateLabRange(theC1, theC2, theC3); - myRgb = - Convert_Lab_To_LinearRGB(NCollection_Vec3(static_cast(theC1), static_cast(theC2), static_cast(theC3))); + myRgb = Convert_Lab_To_LinearRGB(NCollection_Vec3(static_cast(theC1), + static_cast(theC2), + static_cast(theC3))); break; } case Quantity_TOC_CIELch: { validateLchRange(theC1, theC2, theC3); myRgb = Convert_Lab_To_LinearRGB( - Convert_Lch_To_Lab(NCollection_Vec3(static_cast(theC1), static_cast(theC2), static_cast(theC3)))); + Convert_Lch_To_Lab(NCollection_Vec3(static_cast(theC1), + static_cast(theC2), + static_cast(theC3)))); break; } } @@ -666,7 +672,9 @@ NCollection_Vec3 Quantity_Color::Convert_LinearRGB_To_Lab( double aa = CIELAB_A_COEFF * (afX - afY); double ab = CIELAB_B_COEFF * (afY - afZ); - return NCollection_Vec3(static_cast(aL), static_cast(aa), static_cast(ab)); + return NCollection_Vec3(static_cast(aL), + static_cast(aa), + static_cast(ab)); } // ======================================================================= @@ -709,7 +717,9 @@ NCollection_Vec3 Quantity_Color::Convert_Lab_To_LinearRGB( // exit if we are in range or at zero C if (aRate == 0 || (aR >= 0. && aR <= 1. && aG >= 0. && aG <= 1. && aB >= 0. && aB <= 1.)) { - return NCollection_Vec3(static_cast(aR), static_cast(aG), static_cast(aB)); + return NCollection_Vec3(static_cast(aR), + static_cast(aG), + static_cast(aB)); } } } @@ -768,6 +778,9 @@ bool Quantity_Color::InitFromJson(const Standard_SStream& theSStream, int& theSt double aRed, aGreen, aBlue; OCCT_INIT_VECTOR_CLASS(Standard_Dump::Text(theSStream), "RGB", aPos, 3, &aRed, &aGreen, &aBlue) - SetValues(static_cast(aRed), static_cast(aGreen), static_cast(aBlue), Quantity_TOC_RGB); + SetValues(static_cast(aRed), + static_cast(aGreen), + static_cast(aBlue), + Quantity_TOC_RGB); return true; } diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_Color.hxx b/src/FoundationClasses/TKernel/Quantity/Quantity_Color.hxx index d965b369eb4..dc7cc065420 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_Color.hxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_Color.hxx @@ -381,7 +381,9 @@ public: double& theB) noexcept { const NCollection_Vec3 anRgb = - Convert_HLS_To_sRGB(NCollection_Vec3(static_cast(theH), static_cast(theL), static_cast(theS))); + Convert_HLS_To_sRGB(NCollection_Vec3(static_cast(theH), + static_cast(theL), + static_cast(theS))); theR = anRgb[0]; theG = anRgb[1]; theB = anRgb[2]; @@ -396,7 +398,9 @@ public: double& theS) noexcept { const NCollection_Vec3 aHls = - Convert_sRGB_To_HLS(NCollection_Vec3(static_cast(theR), static_cast(theG), static_cast(theB))); + Convert_sRGB_To_HLS(NCollection_Vec3(static_cast(theR), + static_cast(theG), + static_cast(theB))); theH = aHls[0]; theL = aHls[1]; theS = aHls[2]; diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.cxx b/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.cxx index 1cc586bfbe1..b8b513a13eb 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.cxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_ColorRGBA.cxx @@ -237,6 +237,9 @@ bool Quantity_ColorRGBA::InitFromJson(const Standard_SStream& theSStream, int& t &aBlue, &anAlpha) - SetValues(static_cast(aRed), static_cast(aGreen), static_cast(aBlue), static_cast(anAlpha)); + SetValues(static_cast(aRed), + static_cast(aGreen), + static_cast(aBlue), + static_cast(anAlpha)); return true; } diff --git a/src/FoundationClasses/TKernel/Resource/Resource_Unicode.cxx b/src/FoundationClasses/TKernel/Resource/Resource_Unicode.cxx index cfb5f17f390..784693f67b5 100644 --- a/src/FoundationClasses/TKernel/Resource/Resource_Unicode.cxx +++ b/src/FoundationClasses/TKernel/Resource/Resource_Unicode.cxx @@ -684,8 +684,9 @@ void Resource_Unicode::ConvertFormatToUnicode(const Resource_FormatType theFor case Resource_FormatType_iso8859_8: case Resource_FormatType_iso8859_9: case Resource_FormatType_CP850: { - const int aCodePageIndex = static_cast(theFormat) - static_cast(Resource_FormatType_CP1250); - const char16_t* const aCodePage = THE_CODEPAGES_ANSI[aCodePageIndex]; + const int aCodePageIndex = + static_cast(theFormat) - static_cast(Resource_FormatType_CP1250); + const char16_t* const aCodePage = THE_CODEPAGES_ANSI[aCodePageIndex]; theToStr.Clear(); for (const char* anInputPntr = theFromStr; *anInputPntr != '\0'; ++anInputPntr) { @@ -762,8 +763,9 @@ bool Resource_Unicode::ConvertUnicodeToFormat(const Resource_FormatType { return false; } - const int aCodePageIndex = static_cast(theFormat) - static_cast(Resource_FormatType_CP1250); - const char16_t* const aCodePage = THE_CODEPAGES_ANSI[aCodePageIndex]; + const int aCodePageIndex = + static_cast(theFormat) - static_cast(Resource_FormatType_CP1250); + const char16_t* const aCodePage = THE_CODEPAGES_ANSI[aCodePageIndex]; for (int aToCharInd = 0; aToCharInd < theMaxSize - 1; ++aToCharInd) { bool isFind = false; diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Character.hxx b/src/FoundationClasses/TKernel/Standard/Standard_Character.hxx index 50fe20cc8f7..0393f63d4f3 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Character.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Character.hxx @@ -136,7 +136,8 @@ inline bool IsUpperCase(const char me) // ================================================================== inline char LowerCase(const char me) { - return static_cast(static_cast(std::tolower(static_cast(me)))); + return static_cast( + static_cast(std::tolower(static_cast(me)))); } // ================================================================== @@ -144,7 +145,8 @@ inline char LowerCase(const char me) // ================================================================== inline char UpperCase(const char me) { - return static_cast(static_cast(std::toupper(static_cast(me)))); + return static_cast( + static_cast(std::toupper(static_cast(me)))); } #endif diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx b/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx index e499b37f558..c4d1e25bd1d 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx @@ -58,8 +58,9 @@ void Standard_ErrorHandler::Unlink() myCallbackPtr = nullptr; while (aPtr) { - Standard_ErrorHandler::Callback* aCallback = static_cast(aPtr); - aPtr = aCallback->myNext; + Standard_ErrorHandler::Callback* aCallback = + static_cast(aPtr); + aPtr = aCallback->myNext; // Call destructor explicitly, as we know that it will not be called automatically aCallback->DestroyCallback(); } @@ -140,7 +141,8 @@ void Standard_ErrorHandler::Callback::UnregisterCallback() if (myPrev) (static_cast(myPrev))->myNext = myNext; else if ((static_cast(myHandler))->myCallbackPtr == this) - (static_cast(myHandler))->myCallbackPtr = static_cast(myNext); + (static_cast(myHandler))->myCallbackPtr = + static_cast(myNext); myHandler = myNext = myPrev = nullptr; } #endif diff --git a/src/FoundationClasses/TKernel/Standard/Standard_HashUtils.lxx b/src/FoundationClasses/TKernel/Standard/Standard_HashUtils.lxx index 3dc61ee2906..816e2e5c9a8 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_HashUtils.lxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_HashUtils.lxx @@ -74,8 +74,9 @@ inline T unaligned_load(const char* thePnt) noexcept inline uint64_t MurmurHash64A(const void* theKey, int theLen, uint64_t theSeed) noexcept { - static constexpr uint64_t aMul = ((static_cast(0xc6a4a793UL)) << 32UL) + static_cast(0x5bd1e995UL); - const char* const aBuf = static_cast(theKey); + static constexpr uint64_t aMul = + ((static_cast(0xc6a4a793UL)) << 32UL) + static_cast(0x5bd1e995UL); + const char* const aBuf = static_cast(theKey); // Remove the bytes not divisible by the sizeof(uint64_t). This // allows the main loop to process the data as 64-bit integers. diff --git a/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx b/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx index 93bab3b3506..0457c57a843 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx @@ -364,7 +364,7 @@ void* Standard_MMgrOpt::Allocate(const size_t aSize) { myMutex.lock(); *reinterpret_cast(myNextAddr) = myFreeList[aPIndex]; - myFreeList[aPIndex] = myNextAddr; + myFreeList[aPIndex] = myNextAddr; myMutex.unlock(); } } @@ -394,8 +394,9 @@ void* Standard_MMgrOpt::Allocate(const size_t aSize) myMutex.unlock(); // we use operator ?: instead of if() since it is faster - size_t* aBlock = static_cast(myClear ? calloc(RoundSizeN + BLOCK_SHIFT, sizeof(size_t)) - : malloc((RoundSizeN + BLOCK_SHIFT) * sizeof(size_t))); + size_t* aBlock = + static_cast(myClear ? calloc(RoundSizeN + BLOCK_SHIFT, sizeof(size_t)) + : malloc((RoundSizeN + BLOCK_SHIFT) * sizeof(size_t))); // if allocation failed, try to free some memory by purging free lists, and retry if (!aBlock) @@ -728,7 +729,8 @@ size_t* Standard_MMgrOpt::AllocMemory(size_t& Size) // allocate memory // note that on UNIX myMMap is file descriptor for /dev/null - aBlock = static_cast(mmap((char*)MMAP_BASE_ADDRESS, AlignedSize, PROT_READ | PROT_WRITE, MMAP_FLAGS, myMMap, 0)); + aBlock = static_cast( + mmap((char*)MMAP_BASE_ADDRESS, AlignedSize, PROT_READ | PROT_WRITE, MMAP_FLAGS, myMMap, 0)); if (aBlock == MAP_FAILED /* -1 */) { int errcode = errno; diff --git a/src/FoundationClasses/TKernel/Storage/Storage_BucketOfPersistent.hxx b/src/FoundationClasses/TKernel/Storage/Storage_BucketOfPersistent.hxx index abac6cbf410..9022afeb741 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_BucketOfPersistent.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_BucketOfPersistent.hxx @@ -42,7 +42,8 @@ public: mySpaceSize(200000), myCurrentSpace(-1) { - mySpace = static_cast(Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize)); + mySpace = static_cast( + Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize)); } Storage_Bucket(const int theSpaceSize) @@ -50,7 +51,8 @@ public: mySpaceSize(theSpaceSize), myCurrentSpace(-1) { - mySpace = static_cast(Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize)); + mySpace = static_cast( + Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize)); } void Clear(); diff --git a/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx b/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx index 7e240cc1829..bd9306ff499 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx @@ -88,10 +88,11 @@ Storage_BucketOfPersistent::Storage_BucketOfPersistent(const int theBucketSize, myNumberOfBucketAllocated(theBucketNumber), myBucketSize(theBucketSize) { - myBuckets = static_cast(Standard::Allocate(sizeof(Storage_Bucket*) * theBucketNumber)); - myBuckets[0] = new Storage_Bucket(myBucketSize); - myCurrentBucket = myBuckets[0]; - myLength = 0; + myBuckets = + static_cast(Standard::Allocate(sizeof(Storage_Bucket*) * theBucketNumber)); + myBuckets[0] = new Storage_Bucket(myBucketSize); + myCurrentBucket = myBuckets[0]; + myLength = 0; myCurrentBucketNumber = 0; } diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx index 5e85366034b..62b3aefe02b 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -205,7 +205,8 @@ void BOPAlgo_CheckerSI::PostTreat() int i, aNb, n1, n2; BOPDS_Pair aPK; // - NCollection_Map& aMPK = *(const_cast*>(&myDS->Interferences())); + NCollection_Map& aMPK = + *(const_cast*>(&myDS->Interferences())); // 0 NCollection_Vector& aVVs = myDS->InterfVV(); @@ -407,7 +408,8 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection(const Message_ProgressRange& t BOPDS_Pair aPK; - NCollection_Map& aMPK = *(const_cast*>(&myDS->Interferences())); + NCollection_Map& aMPK = + *(const_cast*>(&myDS->Interferences())); aMPK.Clear(); BOPAlgo_VectorOfFaceSelfIntersect aVFace; diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx index 59ca71894c2..2add60969cd 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_RemoveFeatures.cxx @@ -375,8 +375,8 @@ class FillGap TopTools_ShapeMapHasher>& theEFMap) { myEFMap = const_cast, - TopTools_ShapeMapHasher>*>(&theEFMap); + NCollection_List, + TopTools_ShapeMapHasher>*>(&theEFMap); } //! Sets the FS connection map @@ -385,8 +385,8 @@ class FillGap TopTools_ShapeMapHasher>& theFSMap) { myFSMap = const_cast, - TopTools_ShapeMapHasher>*>(&theFSMap); + NCollection_List, + TopTools_ShapeMapHasher>*>(&theFSMap); } //! Defines the parallel processing mode diff --git a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Curve.lxx b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Curve.lxx index be1871085d4..faba78e7e4b 100644 --- a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Curve.lxx +++ b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_Curve.lxx @@ -95,7 +95,8 @@ inline void BOPDS_Curve::InitPaveBlock1() inline occ::handle& BOPDS_Curve::ChangePaveBlock1() { - occ::handle* pPB = static_cast*>(&myPaveBlocks.First()); + occ::handle* pPB = + static_cast*>(&myPaveBlocks.First()); return *pPB; } diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx index eb346b3c68b..49b81e22596 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx @@ -2500,7 +2500,9 @@ static void CheckSampling(const IntTools_CurveRangeSample& theCurveRange int aSamplesNb = theCurveRange.GetDepth() == 0 ? 1 : theCurveData.GetNbSample(); // check - if ((pow(static_cast(theCurveData.GetNbSample()), static_cast(theCurveRange.GetDepth() + 1)) > dLimit) + if ((pow(static_cast(theCurveData.GetNbSample()), + static_cast(theCurveRange.GetDepth() + 1)) + > dLimit) || ((DiffC / static_cast(aSamplesNb)) < theCurveData.GetMinRange())) { bAllowSamplingC = false; @@ -2508,7 +2510,8 @@ static void CheckSampling(const IntTools_CurveRangeSample& theCurveRange aSamplesNb = theSurfaceRange.GetDepthU() == 0 ? 1 : theSurfaceData.GetNbSampleU(); - if ((pow(static_cast(theSurfaceData.GetNbSampleU()), static_cast(theSurfaceRange.GetDepthU() + 1)) + if ((pow(static_cast(theSurfaceData.GetNbSampleU()), + static_cast(theSurfaceRange.GetDepthU() + 1)) > dLimit) || ((DiffU / static_cast(aSamplesNb)) < theSurfaceData.GetMinRangeU())) { @@ -2517,7 +2520,8 @@ static void CheckSampling(const IntTools_CurveRangeSample& theCurveRange aSamplesNb = theSurfaceRange.GetDepthV() == 0 ? 1 : theSurfaceData.GetNbSampleV(); - if ((pow(static_cast(theSurfaceData.GetNbSampleV()), static_cast(theSurfaceRange.GetDepthV() + 1)) + if ((pow(static_cast(theSurfaceData.GetNbSampleV()), + static_cast(theSurfaceRange.GetDepthV() + 1)) > dLimit) || ((DiffV / static_cast(aSamplesNb)) < theSurfaceData.GetMinRangeV())) { diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Context.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Context.cxx index cb4d53b83f6..39a5569cb13 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Context.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_Context.cxx @@ -253,8 +253,8 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF) UVBounds(aF, Umin, Usup, Vmin, Vsup); const occ::handle& aS = BRep_Tool::Surface(aF); // - pProjPS = - static_cast(myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf))); + pProjPS = static_cast( + myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf))); new (pProjPS) GeomAPI_ProjectPointOnSurf(); pProjPS->Init(aS, Umin, Usup, Vmin, Vsup, myPOnSTolerance); pProjPS->SetExtremaFlag(Extrema_ExtFlag_MIN); /// @@ -275,8 +275,8 @@ GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPC(const TopoDS_Edge& aE) // occ::handle aC3D = BRep_Tool::Curve(aE, f, l); // - pProjPC = - static_cast(myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve))); + pProjPC = static_cast( + myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve))); new (pProjPC) GeomAPI_ProjectPointOnCurve(); pProjPC->Init(aC3D, f, l); // @@ -297,8 +297,8 @@ GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPT(const occ::handleFirstParameter(); l = aC3D->LastParameter(); // - pProjPT = - static_cast(myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve))); + pProjPT = static_cast( + myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnCurve))); new (pProjPT) GeomAPI_ProjectPointOnCurve(); pProjPT->Init(aC3D, f, l); // @@ -314,7 +314,8 @@ BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier(const TopoDS_Soli BRepClass3d_SolidClassifier* pSC = nullptr; if (!mySClassMap.Find(aSolid, pSC)) { - pSC = static_cast(myAllocator->Allocate(sizeof(BRepClass3d_SolidClassifier))); + pSC = static_cast( + myAllocator->Allocate(sizeof(BRepClass3d_SolidClassifier))); new (pSC) BRepClass3d_SolidClassifier(aSolid); // mySClassMap.Bind(aSolid, pSC); @@ -361,7 +362,8 @@ Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF) aEpsT = Precision::PConfusion(); // Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr); - pHatcher = static_cast(myAllocator->Allocate(sizeof(Geom2dHatch_Hatcher))); + pHatcher = + static_cast(myAllocator->Allocate(sizeof(Geom2dHatch_Hatcher))); new (pHatcher) Geom2dHatch_Hatcher(aIntr, aTolHatch2D, aTolHatch3D, true, false); // aFF = aF; @@ -420,8 +422,8 @@ IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData(const TopoDS_Fa IntTools_SurfaceRangeLocalizeData* pSData = nullptr; if (!myProjSDataMap.Find(aF, pSData)) { - pSData = static_cast(myAllocator->Allocate( - sizeof(IntTools_SurfaceRangeLocalizeData))); + pSData = static_cast( + myAllocator->Allocate(sizeof(IntTools_SurfaceRangeLocalizeData))); new (pSData) IntTools_SurfaceRangeLocalizeData(3, 3, 10. * Precision::PConfusion(), diff --git a/src/ModelingAlgorithms/TKBool/BRepAlgo/BRepAlgo.cxx b/src/ModelingAlgorithms/TKBool/BRepAlgo/BRepAlgo.cxx index df626125f31..b38b3aa3848 100644 --- a/src/ModelingAlgorithms/TKBool/BRepAlgo/BRepAlgo.cxx +++ b/src/ModelingAlgorithms/TKBool/BRepAlgo/BRepAlgo.cxx @@ -668,7 +668,8 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire) for (i = 1; i <= nb_curve; i++) { if (CurveSeq(i)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - CurveSeq(i) = (*(reinterpret_cast*>(&(CurveSeq(i)))))->BasisCurve(); + CurveSeq(i) = + (*(reinterpret_cast*>(&(CurveSeq(i)))))->BasisCurve(); occ::handle aTrCurve = new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i)); @@ -746,7 +747,8 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire) else { if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) - CurveSeq(1) = (*(reinterpret_cast*>(&(CurveSeq(1)))))->BasisCurve(); + CurveSeq(1) = + (*(reinterpret_cast*>(&(CurveSeq(1)))))->BasisCurve(); occ::handle aCopyCurve = occ::down_cast(CurveSeq(1)->Copy()); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesFiller.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesFiller.cxx index 0a5d56a44fb..51c33579d3e 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesFiller.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesFiller.cxx @@ -403,8 +403,9 @@ void TopOpeBRep_FacesFiller::VP_PositionOnL(TopOpeBRep_LineInter& L) const gp_Pnt& P3D = VP.Value(); bool VPequalVPONRESTRICTION = false; - TopOpeBRep_FacesIntersector& FI = *(static_cast((void*)myFacesIntersector)); - int iOL = 1, n = FI.NbLines(); + TopOpeBRep_FacesIntersector& FI = + *(static_cast((void*)myFacesIntersector)); + int iOL = 1, n = FI.NbLines(); for (iOL = 1; iOL <= n; iOL++) { if (iOL == Lindex) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx index 83007c97a4c..987cbb2b24a 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx @@ -944,7 +944,8 @@ static occ::handle BuildRLine( } int ParamMinOnLine = static_cast(atmpWLine->Vertex(1).ParameterOnLine()); - int ParamMaxOnLine = static_cast(atmpWLine->Vertex(atmpWLine->NbVertex()).ParameterOnLine()); + int ParamMaxOnLine = + static_cast(atmpWLine->Vertex(atmpWLine->NbVertex()).ParameterOnLine()); for (int k = ParamMinOnLine; k <= ParamMaxOnLine; k++) { diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx index 2049846436f..fec6b1a4c95 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx @@ -79,7 +79,8 @@ void TopOpeBRepBuild_CorrectFace2d::SetMapOfTrans2dInfo( NCollection_IndexedDataMap& TopOpeBRepBuild_CorrectFace2d::MapOfTrans2dInfo() { - return *static_cast*>(myMap); + return *static_cast< + NCollection_IndexedDataMap*>(myMap); } //================================================================================================= @@ -124,7 +125,8 @@ void TopOpeBRepBuild_CorrectFace2d::BuildCopyData( BRep_Builder BB; NCollection_IndexedDataMap* pMap = - static_cast*>(myMap); + static_cast*>( + myMap); // // 1. Copy myFace =>> myCopyFace TopoDS_Shape aLocalShape = aFace.EmptyCopied(); @@ -995,7 +997,8 @@ void TopOpeBRepBuild_CorrectFace2d::UpdateEdge(const TopoDS_Edge& BRep_Builder BB; NCollection_IndexedDataMap* pMap = - static_cast*>(myMap); + static_cast*>( + myMap); // E is the Original Edge from Original Face. if (myEdMapInversed.Contains(ECopy)) @@ -1041,7 +1044,8 @@ void TopOpeBRepBuild_CorrectFace2d::UpdateEdge(const TopoDS_Edge& BRep_Builder BB; NCollection_IndexedDataMap* pMap = - static_cast*>(myMap); + static_cast*>( + myMap); // E is the Original Edge from Original Face. if (myEdMapInversed.Contains(ECopy)) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_HBuilder.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_HBuilder.cxx index d603faed25d..a3256489dc9 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_HBuilder.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_HBuilder.cxx @@ -301,8 +301,9 @@ void TopOpeBRepBuild_HBuilder::MakeEdgeAncestorMap() re = DS.AncestorRank(ShaSpl); if (!re) continue; - TopOpeBRepDS_ListOfShapeOn1State& losos1s = (*const_cast(&it.Value())); - NCollection_List& los = losos1s.ChangeListOnState(); + TopOpeBRepDS_ListOfShapeOn1State& losos1s = + (*const_cast(&it.Value())); + NCollection_List& los = losos1s.ChangeListOnState(); its.Initialize(los); if (re == 1) for (; its.More(); its.Next()) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx index 1b2179d4284..c96c72e9e47 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_ffsfs.cxx @@ -326,7 +326,8 @@ void TopOpeBRepBuild_Builder::GFillFaceSFS(const TopoDS_Shape& if (GLOBAL_lfrtoprocess) { if (GLOBAL_lfr1 == nullptr) - GLOBAL_lfr1 = static_cast*>(new NCollection_List()); + GLOBAL_lfr1 = + static_cast*>(new NCollection_List()); GLOBAL_lfr1->Clear(); } } @@ -336,10 +337,8 @@ void TopOpeBRepBuild_Builder::GFillFaceSFS(const TopoDS_Shape& // . fanc hsdm is the unique ancestor face if (GLOBAL_SplitAnc == nullptr) GLOBAL_SplitAnc = - static_cast*>(new NCollection_DataMap< - TopoDS_Shape, - int, - TopTools_ShapeMapHasher>()); + static_cast*>( + new NCollection_DataMap()); GLOBAL_SplitAnc->Clear(); NCollection_List LFSO, LFDO, LFSO1, LFDO1, LFSO2, LFDO2; diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx index 1674aa8b1bd..92053603968 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx @@ -744,14 +744,14 @@ void TopOpeBRepDS_BuildTool::PutPCurves(const TopOpeBRepDS_Curve& newC, const bool comppc2) const { - TopoDS_Face& F1 = *(static_cast((void*)&(TopoDS::Face(newC.Shape1())))); + TopoDS_Face& F1 = *(static_cast((void*)&(TopoDS::Face(newC.Shape1())))); const occ::handle& PC1 = newC.Curve1(); if (!PC1.IsNull() && comppc1) { PCurve(F1, E, PC1); } - TopoDS_Face& F2 = *(static_cast((void*)&(TopoDS::Face(newC.Shape2())))); + TopoDS_Face& F2 = *(static_cast((void*)&(TopoDS::Face(newC.Shape2())))); const occ::handle& PC2 = newC.Curve2(); if (!PC2.IsNull() && comppc2) { diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_connex.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_connex.cxx index 55ce83f19de..ef32c3e7a63 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_connex.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_connex.cxx @@ -123,26 +123,23 @@ Standard_EXPORT void FDSCNX_Prepare(const TopoDS_Shape& /*S1*/, } const TopOpeBRepDS_DataStructure& BDS = HDS->DS(); if (GLOBAL_elf1 == nullptr) - GLOBAL_elf1 = static_cast, - TopTools_ShapeMapHasher>*>(new NCollection_DataMap, - TopTools_ShapeMapHasher>()); + GLOBAL_elf1 = static_cast< + NCollection_DataMap, TopTools_ShapeMapHasher>*>( + new NCollection_DataMap, + TopTools_ShapeMapHasher>()); if (GLOBAL_elf2 == nullptr) - GLOBAL_elf2 = static_cast, - TopTools_ShapeMapHasher>*>(new NCollection_DataMap, - TopTools_ShapeMapHasher>()); + GLOBAL_elf2 = static_cast< + NCollection_DataMap, TopTools_ShapeMapHasher>*>( + new NCollection_DataMap, + TopTools_ShapeMapHasher>()); if (GLOBAL_fle == nullptr) - GLOBAL_fle = static_cast, - TopTools_ShapeMapHasher>*>(new NCollection_DataMap, - TopTools_ShapeMapHasher>()); + GLOBAL_fle = static_cast< + NCollection_DataMap, TopTools_ShapeMapHasher>*>( + new NCollection_DataMap, + TopTools_ShapeMapHasher>()); if (GLOBAL_los == nullptr) GLOBAL_los = static_cast*>(new NCollection_List()); GLOBAL_elf1->Clear(); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_samdom.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_samdom.cxx index 95e18b47b87..6b8a5815565 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_samdom.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_samdom.cxx @@ -51,21 +51,21 @@ Standard_EXPORT void FDSSDM_prepare(const occ::handle, - TopTools_ShapeMapHasher>*>(new NCollection_IndexedDataMap, - TopTools_ShapeMapHasher>()); + Gps1 = static_cast, + TopTools_ShapeMapHasher>*>( + new NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>()); } if (Gps2 == nullptr) { - Gps2 = static_cast, - TopTools_ShapeMapHasher>*>(new NCollection_IndexedDataMap, - TopTools_ShapeMapHasher>()); + Gps2 = static_cast, + TopTools_ShapeMapHasher>*>( + new NCollection_IndexedDataMap, + TopTools_ShapeMapHasher>()); } // modified by NIZNHY-PKV Sun Dec 15 17:58:28 2002 f // Ghds = HDS; diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_RegularizeW.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_RegularizeW.cxx index e6a6b314328..fa065b8635a 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_RegularizeW.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_RegularizeW.cxx @@ -679,8 +679,8 @@ Standard_EXPORT bool FUN_tool_ClassifW( } // itm(mapOwNw) NCollection_Map mapdone; - int nOw = noldW; - int nite = 0, nitemax = (nOw * (nOw - 1) / 2); + int nOw = noldW; + int nite = 0, nitemax = (nOw * (nOw - 1) / 2); while (nite <= nitemax) { nOw = lOws.Extent(); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_SolidClassifier.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_SolidClassifier.cxx index 1bb861eae9c..2fce0bd9758 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_SolidClassifier.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepTool/TopOpeBRepTool_SolidClassifier.cxx @@ -55,7 +55,8 @@ void TopOpeBRepTool_SolidClassifier::LoadSolid(const TopoDS_Solid& SOL) } else { - myPClassifier = static_cast(myShapeClassifierMap.ChangeFromKey(SOL)); + myPClassifier = + static_cast(myShapeClassifierMap.ChangeFromKey(SOL)); } } @@ -74,7 +75,8 @@ void TopOpeBRepTool_SolidClassifier::LoadShell(const TopoDS_Shell& SHE) } else { - myPClassifier = static_cast(myShapeClassifierMap.ChangeFromKey(SHE)); + myPClassifier = + static_cast(myShapeClassifierMap.ChangeFromKey(SHE)); } } diff --git a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_Form.cxx b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_Form.cxx index d25c03f524f..528a668c161 100644 --- a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_Form.cxx +++ b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_Form.cxx @@ -1511,8 +1511,8 @@ void BRepFeat_Form::UpdateDescendants(const BRepAlgoAPI_BooleanOperation& aBOP, } if (!exp.More()) { - BRepAlgoAPI_BooleanOperation* pBOP = const_cast(&aBOP); - const NCollection_List& aLM = pBOP->Modified(fdsc); + BRepAlgoAPI_BooleanOperation* pBOP = const_cast(&aBOP); + const NCollection_List& aLM = pBOP->Modified(fdsc); it2.Initialize(aLM); for (; it2.More(); it2.Next()) { diff --git a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_RibSlot.cxx b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_RibSlot.cxx index 9686fa561bc..408e16d5d76 100644 --- a/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_RibSlot.cxx +++ b/src/ModelingAlgorithms/TKFeat/BRepFeat/BRepFeat_RibSlot.cxx @@ -2570,8 +2570,8 @@ void BRepFeat_RibSlot::UpdateDescendants(const BRepAlgoAPI_BooleanOperation& aBO } if (!exp.More()) { - BRepAlgoAPI_BooleanOperation* pBOP = const_cast(&aBOP); - const NCollection_List& aLM = pBOP->Modified(fdsc); + BRepAlgoAPI_BooleanOperation* pBOP = const_cast(&aBOP); + const NCollection_List& aLM = pBOP->Modified(fdsc); it2.Initialize(aLM); for (; it2.More(); it2.Next()) { diff --git a/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_CSIntersector.cxx b/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_CSIntersector.cxx index 6b8c83aadf4..b67958ba8cb 100644 --- a/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_CSIntersector.cxx +++ b/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_CSIntersector.cxx @@ -76,8 +76,8 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence& Slin) myNbelem = Slin.Length(); delete[] static_cast*>(myPoints); - myPoints = - static_cast*>(new NCollection_Sequence[myNbelem]); + myPoints = static_cast*>( + new NCollection_Sequence[myNbelem]); constexpr double binf = RealFirst(); constexpr double bsup = RealLast(); @@ -91,7 +91,9 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence& Slin) theInt.Perform(Slin(i), binf, bsup); if (theInt.IsDone()) { - AddPoints(theInt, ((static_cast*>(myPoints))[i - 1]), theface); + AddPoints(theInt, + ((static_cast*>(myPoints))[i - 1]), + theface); } } } @@ -110,8 +112,8 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence& Scir) myNbelem = Scir.Length(); delete[] static_cast*>(myPoints); - myPoints = - static_cast*>(new NCollection_Sequence[myNbelem]); + myPoints = static_cast*>( + new NCollection_Sequence[myNbelem]); TopExp_Explorer exp(myShape, TopAbs_FACE); occ::handle HC = new GeomAdaptor_Curve(); @@ -129,7 +131,9 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence& Scir) theInt.Perform(HC, binf, bsup); if (theInt.IsDone()) { - AddPoints(theInt, ((static_cast*>(myPoints))[i - 1]), theface); + AddPoints(theInt, + ((static_cast*>(myPoints))[i - 1]), + theface); } } } @@ -148,8 +152,8 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence*>(myPoints); - myPoints = - static_cast*>(new NCollection_Sequence[myNbelem]); + myPoints = static_cast*>( + new NCollection_Sequence[myNbelem]); TopExp_Explorer exp(myShape, TopAbs_FACE); occ::handle HC = new GeomAdaptor_Curve(); @@ -169,7 +173,9 @@ void LocOpe_CSIntersector::Perform(const NCollection_Sequence*>(myPoints))[i - 1]), theface); + AddPoints(theInt, + ((static_cast*>(myPoints))[i - 1]), + theface); } } } diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx index 0f3e018dc8f..644fe013b6f 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_SpKP.cxx @@ -549,7 +549,7 @@ static bool Tri(const Geom2dHatch_Hatcher& H, #endif return false; } - HatchGen_Domain* Dom = (static_cast((void*)&H.Domain(iH, Ind(iSansFirst)))); + HatchGen_Domain* Dom = (static_cast((void*)&H.Domain(iH, Ind(iSansFirst)))); HatchGen_PointOnHatching* PH = (static_cast((void*)&H.Domain(iH, Ind(iSansLast)).FirstPoint())); double NewPar = H.HatchingCurve(iH).FirstParameter() - period diff --git a/src/ModelingAlgorithms/TKFillet/ChFiDS/ChFiDS_Spine.cxx b/src/ModelingAlgorithms/TKFillet/ChFiDS/ChFiDS_Spine.cxx index 790c8fd8d55..0225549d3a4 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFiDS/ChFiDS_Spine.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFiDS/ChFiDS_Spine.cxx @@ -500,7 +500,7 @@ double ChFiDS_Spine::Absc(const double U, const int I) if (indexofcurve != I) { - void* p = (void*)this; + void* p = (void*)this; (static_cast(p))->indexofcurve = I; (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(I))); } @@ -536,7 +536,7 @@ void ChFiDS_Spine::Parameter(const int Index, const double AbsC, double& U, cons if (Index != indexofcurve) { - void* p = (void*)this; + void* p = (void*)this; (static_cast(p))->indexofcurve = Index; (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); } @@ -670,7 +670,7 @@ gp_Pnt ChFiDS_Spine::Value(const double AbsC) } if (Index != indexofcurve) { - void* p = (void*)this; + void* p = (void*)this; (static_cast(p))->indexofcurve = Index; (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); } @@ -718,7 +718,7 @@ void ChFiDS_Spine::D1(const double AbsC, gp_Pnt& P, gp_Vec& V1) { if (Index != indexofcurve) { - void* p = (void*)this; + void* p = (void*)this; (static_cast(p))->indexofcurve = Index; (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); } @@ -767,7 +767,7 @@ void ChFiDS_Spine::D2(const double AbsC, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) { if (Index != indexofcurve) { - void* p = (void*)this; + void* p = (void*)this; (static_cast(p))->indexofcurve = Index; (static_cast(p))->myCurve.Initialize(TopoDS::Edge(spine.Value(Index))); } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx b/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx index 220ce2e0fd3..2614cbd9c9e 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_Approx.gxx @@ -156,7 +156,8 @@ void ApproxInt_Approx::Parameters(const ApproxInt_TheMultiLine& Line, { for (i = firstP; i <= lastP; i++) { - TheParameters(i) = (static_cast(i) - firstP) / (static_cast(lastP) - static_cast(firstP)); + TheParameters(i) = (static_cast(i) - firstP) + / (static_cast(lastP) - static_cast(firstP)); } } } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_MultiLine.gxx b/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_MultiLine.gxx index 0906bb2e3a2..72253ee48cd 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_MultiLine.gxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/ApproxInt/ApproxInt_MultiLine.gxx @@ -255,23 +255,26 @@ bool ApproxInt_MultiLine::Tangency(const int Index, NCollection_Array1 { if (p2donfirst) { - ret = (static_cast(PtrOnmySvSurfaces))->TangencyOnSurf1(u1, v1, u2, v2, TabVec2d(1)); + ret = (static_cast(PtrOnmySvSurfaces)) + ->TangencyOnSurf1(u1, v1, u2, v2, TabVec2d(1)); } else { - ret = (static_cast(PtrOnmySvSurfaces))->TangencyOnSurf2(u1, v1, u2, v2, TabVec2d(1)); + ret = (static_cast(PtrOnmySvSurfaces)) + ->TangencyOnSurf2(u1, v1, u2, v2, TabVec2d(1)); } } else { - ret = (static_cast(PtrOnmySvSurfaces))->TangencyOnSurf1(u1, v1, u2, v2, TabVec2d(1)); + ret = (static_cast(PtrOnmySvSurfaces)) + ->TangencyOnSurf1(u1, v1, u2, v2, TabVec2d(1)); if (ret) { if (TabVec2d.Length() >= 2) { - ret = - (ret - && (static_cast(PtrOnmySvSurfaces))->TangencyOnSurf2(u1, v1, u2, v2, TabVec2d(2))); + ret = (ret + && (static_cast(PtrOnmySvSurfaces)) + ->TangencyOnSurf2(u1, v1, u2, v2, TabVec2d(2))); } } } @@ -672,7 +675,8 @@ bool ApproxInt_MultiLine::MakeMLOneMorePoint(const int theLow, IsNewPointInvalid = myApproxU2V2 && std::abs(ucur2 - umid2) <= tolerance(1) && std::abs(vcur2 - vmid2) <= tolerance(2); if (!IsNewPointInvalid - && (static_cast(PtrOnmySvSurfaces))->SeekPoint(umid1, vmid1, umid2, vmid2, MidPoint)) + && (static_cast(PtrOnmySvSurfaces)) + ->SeekPoint(umid1, vmid1, umid2, vmid2, MidPoint)) { const gp_Pnt& NewPnt = MidPoint.Value(); double SqDistNewPrev = NewPnt.SquareDistance(PrevPnt); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/FairCurve/FairCurve_MinimalVariation.cxx b/src/ModelingAlgorithms/TKGeomAlgo/FairCurve/FairCurve_MinimalVariation.cxx index d72ea67d281..a72fb09b367 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/FairCurve/FairCurve_MinimalVariation.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/FairCurve/FairCurve_MinimalVariation.cxx @@ -381,8 +381,8 @@ bool FairCurve_MinimalVariation::Compute(const gp_Vec2d& DeltaP1, PseudoNormale.SetXY(Poles->Value(Poles->Lower()).XY() - 2 * Poles->Value(Poles->Lower() + 1).XY() + Poles->Value(Poles->Lower() + 2).XY()); - OldCurvature1 = ((static_cast(Degree) - 1) / Degree) * (Tangente.Normalized() ^ PseudoNormale) - / Tangente.SquareMagnitude(); + OldCurvature1 = ((static_cast(Degree) - 1) / Degree) + * (Tangente.Normalized() ^ PseudoNormale) / Tangente.SquareMagnitude(); } else { @@ -402,8 +402,8 @@ bool FairCurve_MinimalVariation::Compute(const gp_Vec2d& DeltaP1, PseudoNormale.SetXY(Poles->Value(Poles->Upper()).XY() - 2 * Poles->Value(Poles->Upper() - 1).XY() + Poles->Value(Poles->Upper() - 2).XY()); - OldCurvature2 = ((static_cast(Degree) - 1) / Degree) * (Tangente.Normalized() ^ PseudoNormale) - / Tangente.SquareMagnitude(); + OldCurvature2 = ((static_cast(Degree) - 1) / Degree) + * (Tangente.Normalized() ^ PseudoNormale) / Tangente.SquareMagnitude(); } else { diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dAPI/Geom2dAPI_PointsToBSpline.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dAPI/Geom2dAPI_PointsToBSpline.cxx index b057ba73757..cae8a280e2b 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dAPI/Geom2dAPI_PointsToBSpline.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dAPI/Geom2dAPI_PointsToBSpline.cxx @@ -194,7 +194,9 @@ void Geom2dAPI_PointsToBSpline::Init(const NCollection_Array1& YValues, } else { - Param(i) = (aParamSpan > 0) ? static_cast(i - YValues.Lower()) / static_cast(aParamSpan) : 0.0; + Param(i) = (aParamSpan > 0) + ? static_cast(i - YValues.Lower()) / static_cast(aParamSpan) + : 0.0; } Points(i).SetCoord(0.0, YValues(i)); } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dInt/Geom2dInt_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfGInter_0.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dInt/Geom2dInt_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfGInter_0.cxx index e008cea3eaf..39bf88164fd 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dInt/Geom2dInt_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfGInter_0.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dInt/Geom2dInt_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfGInter_0.cxx @@ -46,7 +46,10 @@ bool Geom2dInt_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfGInter::Derivativ gp_Vec2d TanParCurve; gp_Vec2d Grad = TheImpTool.GradDistance( Geom2dInt_Geom2dCurveTool::Value((*(static_cast(TheParCurve))), Param)); - Geom2dInt_Geom2dCurveTool::D1((*(static_cast(TheParCurve))), Param, Pt, TanParCurve); + Geom2dInt_Geom2dCurveTool::D1((*(static_cast(TheParCurve))), + Param, + Pt, + TanParCurve); D_ApproxDistance_DV = Grad.Dot(TanParCurve); return (true); } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_PlateG0Criterion.cxx b/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_PlateG0Criterion.cxx index b9127629900..fde61feee52 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_PlateG0Criterion.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_PlateG0Criterion.cxx @@ -53,7 +53,8 @@ void GeomPlate_PlateG0Criterion::Value(AdvApp2Var_Patch& P, const AdvApp2Var_Con double UInt[2], VInt[2]; int MaxNbCoeff[2], NbCoeff[2]; double* adrCoeff = nullptr; - adrCoeff = static_cast(&P.Coefficients(1, C)->ChangeArray1()(P.Coefficients(1, C)->Lower())); + adrCoeff = + static_cast(&P.Coefficients(1, C)->ChangeArray1()(P.Coefficients(1, C)->Lower())); MaxNbCoeff[0] = C.ULimit(); MaxNbCoeff[1] = C.VLimit(); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_PlateG1Criterion.cxx b/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_PlateG1Criterion.cxx index 3b5d3112e0a..a1bd7ef75c8 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_PlateG1Criterion.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_PlateG1Criterion.cxx @@ -48,7 +48,8 @@ void GeomPlate_PlateG1Criterion::Value(AdvApp2Var_Patch& P, const AdvApp2Var_Con double UInt[2], VInt[2]; int MaxNbCoeff[2], NbCoeff[2]; double* adrCoeff = nullptr; - adrCoeff = static_cast(&P.Coefficients(1, C)->ChangeArray1()(P.Coefficients(1, C)->Lower())); + adrCoeff = + static_cast(&P.Coefficients(1, C)->ChangeArray1()(P.Coefficients(1, C)->Lower())); MaxNbCoeff[0] = C.ULimit(); MaxNbCoeff[1] = C.VLimit(); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntCurve/IntCurve_MyImpParToolOfIntImpConicParConic_0.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntCurve/IntCurve_MyImpParToolOfIntImpConicParConic_0.cxx index 86f777c87d2..9ce0e38ee70 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntCurve/IntCurve_MyImpParToolOfIntImpConicParConic_0.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntCurve/IntCurve_MyImpParToolOfIntImpConicParConic_0.cxx @@ -32,8 +32,8 @@ IntCurve_MyImpParToolOfIntImpConicParConic::IntCurve_MyImpParToolOfIntImpConicPa bool IntCurve_MyImpParToolOfIntImpConicParConic::Value(const double Param, double& ApproxDistance) { - ApproxDistance = - TheImpTool.Distance(IntCurve_PConicTool::Value((*(static_cast(TheParCurve))), Param)); + ApproxDistance = TheImpTool.Distance( + IntCurve_PConicTool::Value((*(static_cast(TheParCurve))), Param)); return (true); } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_LineConstructor.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_LineConstructor.cxx index 4851a100727..7295c81b0dc 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_LineConstructor.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_LineConstructor.cxx @@ -619,10 +619,10 @@ static void AddLine(const occ::handle& L, } case IntPatch_Walking: { //-- **************************************** occ::handle WLine(occ::down_cast(L)); - const occ::handle& Lori = WLine->Curve(); - occ::handle LineOn2S = new IntSurf_LineOn2S(); - int ParamMinOnLine = static_cast(WLine->Vertex(i).ParameterOnLine()); - int ParamMaxOnLine = static_cast(WLine->Vertex(j).ParameterOnLine()); + const occ::handle& Lori = WLine->Curve(); + occ::handle LineOn2S = new IntSurf_LineOn2S(); + int ParamMinOnLine = static_cast(WLine->Vertex(i).ParameterOnLine()); + int ParamMaxOnLine = static_cast(WLine->Vertex(j).ParameterOnLine()); for (int k = ParamMinOnLine; k <= ParamMaxOnLine; k++) { LineOn2S->Add(Lori->Value(k)); diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection.cxx index 117f81a74ab..fcf3b78fcb1 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_PrmPrmIntersection.cxx @@ -134,10 +134,10 @@ static void SeveralWlinesProcessing(const occ::handle& theSur { const occ::handle& aSLine = theSLin.Value(WLDMin); const occ::handle aWLine = occ::down_cast(aSLine); - int tiVpar = static_cast(aWLine->Vertex(VDMin).ParameterOnLine()); - int ciVpar = static_cast(theWLline->Vertex(ciV).ParameterOnLine()); - double u11 = 0., u12 = 0., v11 = 0., v12 = 0.; - double u21 = 0., u22 = 0., v21 = 0., v22 = 0.; + int tiVpar = static_cast(aWLine->Vertex(VDMin).ParameterOnLine()); + int ciVpar = static_cast(theWLline->Vertex(ciV).ParameterOnLine()); + double u11 = 0., u12 = 0., v11 = 0., v12 = 0.; + double u21 = 0., u22 = 0., v21 = 0., v22 = 0.; theWLline->Point(ciVpar).Parameters(u11, v11, u12, v12); aWLine->Point(tiVpar).Parameters(u21, v21, u22, v22); @@ -3470,10 +3470,11 @@ void IntPatch_PrmPrmIntersection::PointDepart(occ::handle& { for (j = 0; j < SV1; j++) { - aIPD.xIP1(i, j) = -1; - const gp_Pnt& P = aIPD.xP1(i, j); - aIPD.xP1DS2(i, j) = static_cast(CodeReject(x20, y20, z20, x21, y21, z21, P.X(), P.Y(), P.Z())); - int ix = static_cast((P.X() - x0 + dx2) / dx); + aIPD.xIP1(i, j) = -1; + const gp_Pnt& P = aIPD.xP1(i, j); + aIPD.xP1DS2(i, j) = + static_cast(CodeReject(x20, y20, z20, x21, y21, z21, P.X(), P.Y(), P.Z())); + int ix = static_cast((P.X() - x0 + dx2) / dx); if (DansGrille(ix)) { int iy = static_cast((P.Y() - y0 + dy2) / dy); @@ -3493,10 +3494,11 @@ void IntPatch_PrmPrmIntersection::PointDepart(occ::handle& { for (j = 0; j < SV2; j++) { - aIPD.xIP2(i, j) = -1; - const gp_Pnt& P = aIPD.xP2(i, j); - aIPD.xP2DS1(i, j) = static_cast(CodeReject(x10, y10, z10, x11, y11, z11, P.X(), P.Y(), P.Z())); - int ix = static_cast((P.X() - x0 + dx2) / dx); + aIPD.xIP2(i, j) = -1; + const gp_Pnt& P = aIPD.xP2(i, j); + aIPD.xP2DS1(i, j) = + static_cast(CodeReject(x10, y10, z10, x11, y11, z11, P.X(), P.Y(), P.Z())); + int ix = static_cast((P.X() - x0 + dx2) / dx); if (DansGrille(ix)) { int iy = static_cast((P.Y() - y0 + dy2) / dy); diff --git a/src/ModelingAlgorithms/TKHLR/Contap/Contap_HContTool.cxx b/src/ModelingAlgorithms/TKHLR/Contap/Contap_HContTool.cxx index 2fd6aee0909..51a1ba863b0 100644 --- a/src/ModelingAlgorithms/TKHLR/Contap/Contap_HContTool.cxx +++ b/src/ModelingAlgorithms/TKHLR/Contap/Contap_HContTool.cxx @@ -182,8 +182,10 @@ void Contap_HContTool::SamplePoint(const occ::handle& S, int indU = (Index - 1) / nbIntU; //---- 0 --> nbIntV int indV = (Index - 1) - indU * nbIntU; //---- 0 --> nbIntU - U = uinf + ((usup - uinf) / (static_cast(nbIntU + 1))) * static_cast(indU + 1); - V = vinf + ((vsup - vinf) / (static_cast(nbIntV + 2))) * static_cast(indV + 1); + U = + uinf + ((usup - uinf) / (static_cast(nbIntU + 1))) * static_cast(indU + 1); + V = + vinf + ((vsup - vinf) / (static_cast(nbIntV + 2))) * static_cast(indV + 1); //-- std::cout<<"Index :"<(myTriangle.TolParam), 1.0, static_cast(myTriangle.TolParam)); - theIndex = anIndices.ShapeIndex; - theReg1 = aBP.Rg1Line(); - theRegn = aBP.RgNLine(); - theOutl = aBP.OutLine(); - theIntl = aBP.IntLine(); + theStatus = HLRAlgo_EdgeStatus(0.0, + static_cast(myTriangle.TolParam), + 1.0, + static_cast(myTriangle.TolParam)); + theIndex = anIndices.ShapeIndex; + theReg1 = aBP.Rg1Line(); + theRegn = aBP.RgNLine(); + theOutl = aBP.OutLine(); + theIntl = aBP.IntLine(); if (aBP.Hidden()) { theStatus.HideAll(); diff --git a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx index b8a3f4366d1..2461c8c2d1b 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyData.cxx @@ -904,5 +904,10 @@ void HLRAlgo_PolyData::hideByOneTriangle(const HLRAlgo_BiPoint::PointsT& thePoin if (total) status.HideAll(); else - status.Hide(psta, static_cast(theTriangle.TolParam), pend, static_cast(theTriangle.TolParam), false, false); + status.Hide(psta, + static_cast(theTriangle.TolParam), + pend, + static_cast(theTriangle.TolParam), + false, + false); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx index 6141fa22e68..3c02c98a8c6 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Data.cxx @@ -1081,8 +1081,7 @@ void HLRBRep_Data::NextEdge(const bool skip) myLEMinMax = &myLEData->MinMax(); myLETol = myLEData->Tolerance(); myLEType = myLEGeom->GetType(); - if ((myLEData)->Vertical() - || (myLEDouble && (myLEData)->HideCount() == myHideCount - 1)) + if ((myLEData)->Vertical() || (myLEDouble && (myLEData)->HideCount() == myHideCount - 1)) NextEdge(); (myLEData)->HideCount(myHideCount - 1); return; @@ -1348,8 +1347,7 @@ void HLRBRep_Data::NextInterference() { if (myIntersector.NbPoints() == 1 && myIntersector.NbSegments() == 0) { - (myReject) - ->SetIntersection(myLE, myFE, myIntersector.Point(1)); + (myReject)->SetIntersection(myLE, myFE, myIntersector.Point(1)); } } } @@ -2458,8 +2456,7 @@ bool HLRBRep_Data::SameVertex(const bool h1, const bool h2) bool otherCase = true; - if ((h1 && (myLEData)->OutLVSta()) - || (!h1 && (myLEData)->OutLVEnd())) + if ((h1 && (myLEData)->OutLVSta()) || (!h1 && (myLEData)->OutLVEnd())) { if (iFaceTest || myLEInternal) otherCase = false; @@ -2469,8 +2466,7 @@ bool HLRBRep_Data::SameVertex(const bool h1, const bool h2) if (otherCase) { - if ((h1 && (myLEData)->CutAtSta()) - || (!h1 && (myLEData)->CutAtEnd())) + if ((h1 && (myLEData)->CutAtSta()) || (!h1 && (myLEData)->CutAtEnd())) { myIntersected = false; // two connected OutLines do not } // intersect themselves. diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeData.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeData.cxx index 56816d1c72c..85ebf0fad24 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeData.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_EdgeData.cxx @@ -45,8 +45,9 @@ void HLRBRep_EdgeData::Set(const bool Rg1L, OutLVEnd(Out2); CutAtSta(Cut1); CutAtEnd(Cut2); - Status().Initialize(Start, - static_cast(ChangeGeometry().Curve().Resolution(static_cast(TolStart))), - End, - static_cast(ChangeGeometry().Curve().Resolution(static_cast(TolEnd)))); + Status().Initialize( + Start, + static_cast(ChangeGeometry().Curve().Resolution(static_cast(TolStart))), + End, + static_cast(ChangeGeometry().Curve().Resolution(static_cast(TolEnd)))); } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx index c95abd8661a..62f9bddc7e5 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_Intersector.cxx @@ -574,10 +574,7 @@ void HLRBRep_Intersector::Perform(const gp_Lin& L, const double P) pmax = P + 0.0000001; } HLRBRep_ThePolygonOfInterCSurf Polygon(L, pmin, pmax, 3); - myCSIntersector.Perform(L, - Polygon, - mySurface, - *(myPolyhedron)); + myCSIntersector.Perform(L, Polygon, mySurface, *(myPolyhedron)); break; } diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter_0.cxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter_0.cxx index 0c5da1b1418..b4a236e29fd 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter_0.cxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter_0.cxx @@ -32,8 +32,8 @@ HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter:: bool HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter::Value(const double Param, double& ApproxDistance) { - ApproxDistance = - TheImpTool.Distance(HLRBRep_CurveTool::Value((*(static_cast(TheParCurve))), Param)); + ApproxDistance = TheImpTool.Distance( + HLRBRep_CurveTool::Value((*(static_cast(TheParCurve))), Param)); return (true); } @@ -43,8 +43,8 @@ bool HLRBRep_MyImpParToolOfTheIntersectorOfTheIntConicCurveOfCInter::Derivative( { gp_Pnt2d Pt; gp_Vec2d TanParCurve; - gp_Vec2d Grad = - TheImpTool.GradDistance(HLRBRep_CurveTool::Value((*(static_cast(TheParCurve))), Param)); + gp_Vec2d Grad = TheImpTool.GradDistance( + HLRBRep_CurveTool::Value((*(static_cast(TheParCurve))), Param)); HLRBRep_CurveTool::D1((*(static_cast(TheParCurve))), Param, Pt, TanParCurve); D_ApproxDistance_DV = Grad.Dot(TanParCurve); return (true); diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx index bb3113ac951..e5a6da8a687 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx @@ -364,7 +364,8 @@ void BRepMesh_DataStructureOfDelaun::clearDeletedLinks() void BRepMesh_DataStructureOfDelaun::clearDeletedNodes() { - IMeshData::ListOfInteger& aDelNodes = const_cast(myNodes->GetListOfDelNodes()); + IMeshData::ListOfInteger& aDelNodes = + const_cast(myNodes->GetListOfDelNodes()); int aLastLiveItem = NbNodes(); while (!aDelNodes.IsEmpty()) diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_GeomTool.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_GeomTool.cxx index 3d7c043498a..8620b1907d0 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_GeomTool.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_GeomTool.cxx @@ -99,7 +99,8 @@ void AdjustCellsCounts(const occ::handle& theFace, double aSqNbVert = theNbVertices; if (aType == GeomAbs_Plane) { - theCellsCountU = theCellsCountV = static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); + theCellsCountU = theCellsCountV = + static_cast(std::ceil(std::pow(2, std::log10(aSqNbVert)))); } else if (aType == GeomAbs_Cylinder || aType == GeomAbs_Cone) { @@ -441,19 +442,19 @@ std::pair BRepMesh_GeomTool::CellsCount( int aCellsCountU, aCellsCountV; if (aType == GeomAbs_Torus) { - aCellsCountU = - static_cast(std::ceil(std::pow(2, std::log10((aRangeU.second - aRangeU.first) / aDelta.first)))); - aCellsCountV = - static_cast(std::ceil(std::pow(2, std::log10((aRangeV.second - aRangeV.first) / aDelta.second)))); + aCellsCountU = static_cast( + std::ceil(std::pow(2, std::log10((aRangeU.second - aRangeU.first) / aDelta.first)))); + aCellsCountV = static_cast( + std::ceil(std::pow(2, std::log10((aRangeV.second - aRangeV.first) / aDelta.second)))); } else if (aType == GeomAbs_Cylinder) { aCellsCountU = static_cast(std::ceil(std::pow(2, - std::log10((aRangeU.second - aRangeU.first) / aDelta.first - / (aRangeV.second - aRangeV.first))))); - aCellsCountV = - static_cast(std::ceil(std::pow(2, std::log10((aRangeV.second - aRangeV.first) / anErrFactorV)))); + std::log10((aRangeU.second - aRangeU.first) / aDelta.first + / (aRangeV.second - aRangeV.first))))); + aCellsCountV = static_cast( + std::ceil(std::pow(2, std::log10((aRangeV.second - aRangeV.first) / anErrFactorV)))); } else { diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.cpp b/src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.cpp index 82eb8a1f29a..e737bfce740 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.cpp +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.cpp @@ -176,7 +176,8 @@ struct CDelaBella : IDelaBella Signed62 dot(const Vert& p) const // dot { Vect d = p - *(Vert*)v[0]; - return static_cast(n.x) * d.x + static_cast(n.y) * d.y + static_cast(n.z) * d.z; + return static_cast(n.x) * d.x + static_cast(n.y) * d.y + + static_cast(n.z) * d.z; } Norm cross() const // cross of diffs @@ -833,9 +834,11 @@ struct CDelaBella : IDelaBella { Vert* v = vert_alloc + i; v->i = i; - v->x = static_cast(* reinterpret_cast(reinterpret_cast(x) + i * advance_bytes)); - v->y = static_cast(* reinterpret_cast(reinterpret_cast(y) + i * advance_bytes)); - v->z = s14sqr(v->x) + s14sqr(v->y); + v->x = static_cast( + *reinterpret_cast(reinterpret_cast(x) + i * advance_bytes)); + v->y = static_cast( + *reinterpret_cast(reinterpret_cast(y) + i * advance_bytes)); + v->z = s14sqr(v->x) + s14sqr(v->y); } out_verts = Triangulate(); @@ -860,9 +863,11 @@ struct CDelaBella : IDelaBella { Vert* v = vert_alloc + i; v->i = i; - v->x = static_cast(* reinterpret_cast(reinterpret_cast(x) + i * advance_bytes)); - v->y = static_cast(* reinterpret_cast(reinterpret_cast(y) + i * advance_bytes)); - v->z = s14sqr(v->x) + s14sqr(v->y); + v->x = static_cast( + *reinterpret_cast(reinterpret_cast(x) + i * advance_bytes)); + v->y = static_cast( + *reinterpret_cast(reinterpret_cast(y) + i * advance_bytes)); + v->z = s14sqr(v->x) + s14sqr(v->y); } out_verts = Triangulate(); diff --git a/src/ModelingAlgorithms/TKPrim/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx b/src/ModelingAlgorithms/TKPrim/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx index 03fd1241bd5..ed7034efa13 100644 --- a/src/ModelingAlgorithms/TKPrim/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx +++ b/src/ModelingAlgorithms/TKPrim/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx @@ -35,7 +35,8 @@ void BRepPreviewAPI_MakeBox::Build(const Message_ProgressRange& /*theRange*/) bool aThinOnY = std::abs(aFirstPoint.Y() - aSecondPoint.Y()) < Precision::Confusion(); bool aThinOnZ = std::abs(aFirstPoint.Z() - aSecondPoint.Z()) < Precision::Confusion(); - int aPreviewType = static_cast(aThinOnX) + static_cast(aThinOnY) + static_cast(aThinOnZ); + int aPreviewType = + static_cast(aThinOnX) + static_cast(aThinOnY) + static_cast(aThinOnZ); if (aPreviewType == 3) // thin box in all directions is a point { diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceArea.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceArea.cxx index ee6d3d6e8c4..f9aeefaa3db 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceArea.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_SplitSurfaceArea.cxx @@ -87,7 +87,10 @@ void ShapeUpgrade_SplitSurfaceArea::Compute(const bool /*Segment*/) else { nbSplitF = (aNbUV >= myNbParts ? myNbParts : RealToInt(ceil(sqrt(myNbParts * ceil(aNbUV))))); - nbSplitS = (aNbUV >= myNbParts ? 0 : RealToInt(ceil(static_cast(myNbParts) / static_cast(nbSplitF)))); + nbSplitS = + (aNbUV >= myNbParts + ? 0 + : RealToInt(ceil(static_cast(myNbParts) / static_cast(nbSplitF)))); } if (nbSplitS == 1 && !anIsFixedUVnbSplits) nbSplitS++; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Analyzer.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Analyzer.cxx index 11b39de1546..c0fe031e765 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Analyzer.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepCheck/BRepCheck_Analyzer.cxx @@ -424,7 +424,7 @@ void BRepCheck_Analyzer::Perform() const occ::handle& aThreadPool = OSD_ThreadPool::DefaultPool(); const int aNbThreads = aThreadPool->NbThreads(); int aNbTasks = aNbThreads * 10; - int aTaskSize = static_cast(std::ceil(static_cast(aMapSize) / aNbTasks)); + int aTaskSize = static_cast(std::ceil(static_cast(aMapSize) / aNbTasks)); if (aTaskSize < aMinTaskSize) { aTaskSize = aMinTaskSize; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx index 7acd0e78c76..bb800fe3209 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx @@ -266,7 +266,8 @@ bool BRepClass3d_SolidExplorer::PointInTheFace(const TopoDS_Face& } if (ptr) { - const IntCurvesFace_Intersector& TheIntersector = (*(static_cast(ptr))); + const IntCurvesFace_Intersector& TheIntersector = + (*(static_cast(ptr))); // Check if the point is already in the face if (IsInside && (ClassifyUVPoint(TheIntersector, surf, gp_Pnt2d(u_, v_)) == TopAbs_IN)) { diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistShapeShape.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistShapeShape.cxx index 1992c35cbd4..66a983b3329 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistShapeShape.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_DistShapeShape.cxx @@ -240,7 +240,7 @@ bool BRepExtrema_DistShapeShape::DistanceVertVert( const occ::handle& aThreadPool = OSD_ThreadPool::DefaultPool(); const int aNbThreads = aThreadPool->NbThreads(); int aNbTasks = aNbThreads; - int aTaskSize = static_cast(std::ceil(static_cast(aCount1) / aNbTasks)); + int aTaskSize = static_cast(std::ceil(static_cast(aCount1) / aNbTasks)); if (aTaskSize < aMinTaskSize) { aTaskSize = aMinTaskSize; @@ -483,7 +483,7 @@ bool BRepExtrema_DistShapeShape::DistanceMapMap( const int aNbThreads = aThreadPool->NbThreads(); const int aMinPairTaskSize = aCount1 < 10 ? aCount1 : 10; int aNbPairTasks = aNbThreads; - int aPairTaskSize = static_cast(std::ceil(static_cast(aCount1) / aNbPairTasks)); + int aPairTaskSize = static_cast(std::ceil(static_cast(aCount1) / aNbPairTasks)); if (aPairTaskSize < aMinPairTaskSize) { aPairTaskSize = aMinPairTaskSize; @@ -767,7 +767,7 @@ bool BRepExtrema_DistShapeShape::SolidTreatment( const occ::handle& aThreadPool = OSD_ThreadPool::DefaultPool(); const int aNbThreads = aThreadPool->NbThreads(); int aNbTasks = aNbThreads * 10; - int aTaskSize = static_cast(std::ceil(static_cast(aMapSize) / aNbTasks)); + int aTaskSize = static_cast(std::ceil(static_cast(aMapSize) / aNbTasks)); if (aTaskSize < aMinTaskSize) { aTaskSize = aMinTaskSize; @@ -1092,8 +1092,8 @@ void BRepExtrema_DistShapeShape::Dump(Standard_OStream& o) const o << "solution number " << i << ": " << std::endl; o << "the type of the solution on the first shape is " << static_cast(SupportTypeShape1(i)) << std::endl; - o << "the type of the solution on the second shape is " << static_cast(SupportTypeShape2(i)) - << std::endl; + o << "the type of the solution on the second shape is " + << static_cast(SupportTypeShape2(i)) << std::endl; o << "the coordinates of the point on the first shape are: " << std::endl; o << "X=" << PointOnShape1(i).X() << " Y=" << PointOnShape1(i).Y() << " Z=" << PointOnShape1(i).Z() << std::endl; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx index ee3f6ef8b1a..949ab1dbfa5 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepTopAdaptor/BRepTopAdaptor_TopolTool.cxx @@ -195,7 +195,8 @@ bool BRepTopAdaptor_TopolTool::IsThePointOn(const gp_Pnt2d& P, myFClass2d = (void*)new BRepTopAdaptor_FClass2d(myFace, Tol); } return (TopAbs_ON - == (static_cast(myFClass2d))->TestOnRestriction(P, Tol, RecadreOnPeriodic)); + == (static_cast(myFClass2d)) + ->TestOnRestriction(P, Tol, RecadreOnPeriodic)); } //================================================================================================= diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_IStream.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_IStream.cxx index 1cfbe3d05ec..33cc3330fb7 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_IStream.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_IStream.cxx @@ -88,7 +88,8 @@ uint64_t BinTools_IStream::ReadReference() if (aDelta == 0) { Standard_SStream aMsg; - aMsg << "BinTools_IStream::ReadReference: invalid reference " << static_cast(myLastType) << std::endl; + aMsg << "BinTools_IStream::ReadReference: invalid reference " << static_cast(myLastType) + << std::endl; throw Standard_Failure(aMsg.str().c_str()); } return aCurrentPos - aDelta - 1; // add a type-byte diff --git a/src/ModelingData/TKBRep/BinTools/BinTools_ShapeReader.cxx b/src/ModelingData/TKBRep/BinTools/BinTools_ShapeReader.cxx index 942778cf914..b15d00d0999 100644 --- a/src/ModelingData/TKBRep/BinTools/BinTools_ShapeReader.cxx +++ b/src/ModelingData/TKBRep/BinTools/BinTools_ShapeReader.cxx @@ -210,7 +210,7 @@ TopoDS_Shape BinTools_ShapeReader::ReadShape(BinTools_IStream& theStream) } case 4: // -4- Regularity { - GeomAbs_Shape aReg = static_cast(theStream.ReadByte()); + GeomAbs_Shape aReg = static_cast(theStream.ReadByte()); occ::handle aSurface1 = ReadSurface(theStream); const TopLoc_Location* aLoc1 = ReadLocation(theStream); occ::handle aSurface2 = ReadSurface(theStream); diff --git a/src/ModelingData/TKBRep/TopoDS/TopoDS_Builder.cxx b/src/ModelingData/TKBRep/TopoDS/TopoDS_Builder.cxx index 849d3e433d3..8de862c25e0 100644 --- a/src/ModelingData/TKBRep/TopoDS/TopoDS_Builder.cxx +++ b/src/ModelingData/TKBRep/TopoDS/TopoDS_Builder.cxx @@ -44,27 +44,33 @@ void TopoDS_Builder::Add(TopoDS_Shape& aShape, const TopoDS_Shape& aComponent) c // but aShape will be frozen when the Exception is raised if (aShape.Free()) { - static const unsigned int aTb[9] = { - // COMPOUND to: - (1 << (static_cast(TopAbs_COMPOUND))), - // COMPSOLID to: - (1 << (static_cast(TopAbs_COMPOUND))), - // SOLID to: - (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_COMPSOLID))), - // SHELL to: - (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_SOLID))), - // FACE to: - (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_SHELL))), - // WIRE to: - (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_FACE))), - // EDGE to: - (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_SOLID))) - | (1 << (static_cast(TopAbs_WIRE))), - // VERTEX to: - (1 << (static_cast(TopAbs_COMPOUND))) | (1 << (static_cast(TopAbs_SOLID))) - | (1 << (static_cast(TopAbs_FACE))) | (1 << (static_cast(TopAbs_EDGE))), - // SHAPE to: - 0}; + static const unsigned int aTb[9] = {// COMPOUND to: + (1 << (static_cast(TopAbs_COMPOUND))), + // COMPSOLID to: + (1 << (static_cast(TopAbs_COMPOUND))), + // SOLID to: + (1 << (static_cast(TopAbs_COMPOUND))) + | (1 << (static_cast(TopAbs_COMPSOLID))), + // SHELL to: + (1 << (static_cast(TopAbs_COMPOUND))) + | (1 << (static_cast(TopAbs_SOLID))), + // FACE to: + (1 << (static_cast(TopAbs_COMPOUND))) + | (1 << (static_cast(TopAbs_SHELL))), + // WIRE to: + (1 << (static_cast(TopAbs_COMPOUND))) + | (1 << (static_cast(TopAbs_FACE))), + // EDGE to: + (1 << (static_cast(TopAbs_COMPOUND))) + | (1 << (static_cast(TopAbs_SOLID))) + | (1 << (static_cast(TopAbs_WIRE))), + // VERTEX to: + (1 << (static_cast(TopAbs_COMPOUND))) + | (1 << (static_cast(TopAbs_SOLID))) + | (1 << (static_cast(TopAbs_FACE))) + | (1 << (static_cast(TopAbs_EDGE))), + // SHAPE to: + 0}; const unsigned int iC = static_cast(aComponent.ShapeType()); const unsigned int iS = static_cast(aShape.ShapeType()); diff --git a/src/ModelingData/TKG2d/Geom2dEval/Geom2dEval_AHTBezierCurve.cxx b/src/ModelingData/TKG2d/Geom2dEval/Geom2dEval_AHTBezierCurve.cxx index 0aa40912421..ad6ed630f08 100644 --- a/src/ModelingData/TKG2d/Geom2dEval/Geom2dEval_AHTBezierCurve.cxx +++ b/src/ModelingData/TKG2d/Geom2dEval/Geom2dEval_AHTBezierCurve.cxx @@ -168,7 +168,9 @@ void evalMixedAHT(const NCollection_Array1& thePoles, } if constexpr (theMaxOrder >= 3) { - aB3 = (k >= 3) ? static_cast(k) * static_cast(k - 1) * static_cast(k - 2) * aPowM3 : 0.0; + aB3 = (k >= 3) ? static_cast(k) * static_cast(k - 1) + * static_cast(k - 2) * aPowM3 + : 0.0; } if constexpr (theIsRational) diff --git a/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx b/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx index 5792076cdda..9626c2da42c 100644 --- a/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx +++ b/src/ModelingData/TKG3d/Adaptor3d/Adaptor3d_TopolTool.cxx @@ -1183,15 +1183,15 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const double theDefl, int aNb; if (nbsu < nbsv) { - aNb = static_cast(nbsv * (static_cast(theNUmin)) / (static_cast(nbsu))); - aNb = std::min(aNb, 30); + aNb = static_cast(nbsv * (static_cast(theNUmin)) / (static_cast(nbsu))); + aNb = std::min(aNb, 30); bVuniform = (aNb > nbsv) ? true : bVuniform; nbsv = bVuniform ? aNb : nbsv; } else { - aNb = static_cast(nbsu * (static_cast(theNVmin)) / (static_cast(nbsv))); - aNb = std::min(aNb, 30); + aNb = static_cast(nbsu * (static_cast(theNVmin)) / (static_cast(nbsv))); + aNb = std::min(aNb, 30); bUuniform = (aNb > nbsu) ? true : bUuniform; nbsu = bUuniform ? aNb : nbsu; } diff --git a/src/ModelingData/TKG3d/AdvApprox/AdvApprox_ApproxAFunction.cxx b/src/ModelingData/TKG3d/AdvApprox/AdvApprox_ApproxAFunction.cxx index 2d003bf8b71..3fa3d2ac38d 100644 --- a/src/ModelingData/TKG3d/AdvApprox/AdvApprox_ApproxAFunction.cxx +++ b/src/ModelingData/TKG3d/AdvApprox/AdvApprox_ApproxAFunction.cxx @@ -161,9 +161,9 @@ static void PrepareConvert(const int NumCurves, for (icurve = 1; icurve < NumCurves; icurve++) { // Init and positioning at the node - isCi = true; - Coef1 = - const_cast(&(Coefficients.Value((icurve - 1) * Dimension * RealDegree + Coefficients.Lower()))); + isCi = true; + Coef1 = const_cast( + &(Coefficients.Value((icurve - 1) * Dimension * RealDegree + Coefficients.Lower()))); Coef2 = Coef1 + Dimension * RealDegree; int Deg1 = NumCoeffPerCurve(NumCoeffPerCurve.Lower() + icurve - 1) - 1; PLib::EvalPolynomial(PolynomialIntervals(icurve, 2), diff --git a/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierCurve.cxx b/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierCurve.cxx index 75eef3a7927..0c02808fc59 100644 --- a/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierCurve.cxx +++ b/src/ModelingData/TKG3d/GeomEval/GeomEval_AHTBezierCurve.cxx @@ -164,7 +164,9 @@ void evalMixedAHT(const NCollection_Array1& thePoles, } if constexpr (theMaxOrder >= 3) { - aB3 = (k >= 3) ? static_cast(k) * static_cast(k - 1) * static_cast(k - 2) * aPowM3 : 0.0; + aB3 = (k >= 3) ? static_cast(k) * static_cast(k - 1) + * static_cast(k - 2) * aPowM3 + : 0.0; } if constexpr (theIsRational) diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Context.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Context.cxx index a1fee620007..3db5b2ed821 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Context.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Context.cxx @@ -183,7 +183,7 @@ AdvApp2Var_Context::AdvApp2Var_Context(const int // myJMaxU int aSize = JDegU - 2 * iu - 1; occ::handle> JMaxU = new NCollection_HArray1(1, aSize); - double* JU_array = static_cast(&JMaxU->ChangeArray1()(JMaxU->Lower())); + double* JU_array = static_cast(&JMaxU->ChangeArray1()(JMaxU->Lower())); AdvApp2Var_ApproxF2var::mma2jmx_(&JDegU, &anOrderU, JU_array); myJMaxU = JMaxU; @@ -203,7 +203,7 @@ AdvApp2Var_Context::AdvApp2Var_Context(const int // myJMaxV aSize = JDegV - 2 * iv - 1; occ::handle> JMaxV = new NCollection_HArray1(1, aSize); - double* JV_array = static_cast(&JMaxV->ChangeArray1()(JMaxV->Lower())); + double* JV_array = static_cast(&JMaxV->ChangeArray1()(JMaxV->Lower())); AdvApp2Var_ApproxF2var::mma2jmx_(&JDegV, &anOrderV, JV_array); myJMaxV = JMaxV; diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Patch.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Patch.cxx index a856ce78468..509eae80e4b 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Patch.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_Patch.cxx @@ -268,11 +268,11 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions SIZE = (1 + NBPNTU / 2) * (1 + NBPNTV / 2) * NDIMEN; - occ::handle> HSOSO = new NCollection_HArray1(1, SIZE); - double* SOSOTB = static_cast(&HSOSO->ChangeArray1()(HSOSO->Lower())); + occ::handle> HSOSO = new NCollection_HArray1(1, SIZE); + double* SOSOTB = static_cast(&HSOSO->ChangeArray1()(HSOSO->Lower())); HSOSO->Init(0.); - occ::handle> HDIDI = new NCollection_HArray1(1, SIZE); - double* DIDITB = static_cast(&HDIDI->ChangeArray1()(HDIDI->Lower())); + occ::handle> HDIDI = new NCollection_HArray1(1, SIZE); + double* DIDITB = static_cast(&HDIDI->ChangeArray1()(HDIDI->Lower())); HDIDI->Init(0.); // SODITB and DISOTB are dimensioned in FORTRAN at @@ -280,11 +280,11 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions SIZE = (NBPNTU / 2) * (NBPNTV / 2) * NDIMEN; - occ::handle> HSODI = new NCollection_HArray1(1, SIZE); - double* SODITB = static_cast(&HSODI->ChangeArray1()(HSODI->Lower())); + occ::handle> HSODI = new NCollection_HArray1(1, SIZE); + double* SODITB = static_cast(&HSODI->ChangeArray1()(HSODI->Lower())); HSODI->Init(0.); - occ::handle> HDISO = new NCollection_HArray1(1, SIZE); - double* DISOTB = static_cast(&HDISO->ChangeArray1()(HDISO->Lower())); + occ::handle> HDISO = new NCollection_HArray1(1, SIZE); + double* DISOTB = static_cast(&HDISO->ChangeArray1()(HDISO->Lower())); HDISO->Init(0.); int IERCOD = 0; @@ -324,7 +324,7 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions SIZE = std::max(NBPNTU, NBPNTV); occ::handle> HTABLE = new NCollection_HArray1(1, SIZE); - double* TAB = static_cast(&HTABLE->ChangeArray1()(HTABLE->Lower())); + double* TAB = static_cast(&HTABLE->ChangeArray1()(HTABLE->Lower())); occ::handle> HPOINTS = new NCollection_HArray1(1, SIZE * NDIMEN); @@ -403,17 +403,17 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, occ::handle> HIsoU0 = new NCollection_HArray1(1, SIZE * (IORDRU + 1)); HIsoU0->ChangeArray1() = (Constraints.IsoU(myU0, myV0, myV1)).Polynom()->Array1(); - double* IsoU0 = static_cast(&HIsoU0->ChangeArray1()(HIsoU0->Lower())); + double* IsoU0 = static_cast(&HIsoU0->ChangeArray1()(HIsoU0->Lower())); occ::handle> HCFU0 = new NCollection_HArray1(1, IORDRU + 1); - int* NCFU0 = static_cast(&HCFU0->ChangeArray1()(HCFU0->Lower())); + int* NCFU0 = static_cast(&HCFU0->ChangeArray1()(HCFU0->Lower())); HCFU0->Init((Constraints.IsoU(myU0, myV0, myV1)).NbCoeff()); occ::handle> HIsoU1 = new NCollection_HArray1(1, SIZE * (IORDRU + 1)); HIsoU1->ChangeArray1() = (Constraints.IsoU(myU1, myV0, myV1)).Polynom()->Array1(); - double* IsoU1 = static_cast(&HIsoU1->ChangeArray1()(HIsoU1->Lower())); + double* IsoU1 = static_cast(&HIsoU1->ChangeArray1()(HIsoU1->Lower())); occ::handle> HCFU1 = new NCollection_HArray1(1, IORDRU + 1); - int* NCFU1 = static_cast(&HCFU1->ChangeArray1()(HCFU1->Lower())); + int* NCFU1 = static_cast(&HCFU1->ChangeArray1()(HCFU1->Lower())); HCFU1->Init((Constraints.IsoU(myU1, myV0, myV1)).NbCoeff()); // normalization of Isos U @@ -438,17 +438,17 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, occ::handle> HIsoV0 = new NCollection_HArray1(1, SIZE * (IORDRV + 1)); HIsoV0->ChangeArray1() = (Constraints.IsoV(myU0, myU1, myV0)).Polynom()->Array1(); - double* IsoV0 = static_cast(&HIsoV0->ChangeArray1()(HIsoV0->Lower())); + double* IsoV0 = static_cast(&HIsoV0->ChangeArray1()(HIsoV0->Lower())); occ::handle> HCFV0 = new NCollection_HArray1(1, IORDRV + 1); - int* NCFV0 = static_cast(&HCFV0->ChangeArray1()(HCFV0->Lower())); + int* NCFV0 = static_cast(&HCFV0->ChangeArray1()(HCFV0->Lower())); HCFV0->Init((Constraints.IsoV(myU0, myU1, myV0)).NbCoeff()); occ::handle> HIsoV1 = new NCollection_HArray1(1, SIZE * (IORDRV + 1)); HIsoV1->ChangeArray1() = (Constraints.IsoV(myU0, myU1, myV1)).Polynom()->Array1(); - double* IsoV1 = static_cast(&HIsoV1->ChangeArray1()(HIsoV1->Lower())); + double* IsoV1 = static_cast(&HIsoV1->ChangeArray1()(HIsoV1->Lower())); occ::handle> HCFV1 = new NCollection_HArray1(1, IORDRV + 1); - int* NCFV1 = static_cast(&HCFV1->ChangeArray1()(HCFV1->Lower())); + int* NCFV1 = static_cast(&HCFV1->ChangeArray1()(HCFV1->Lower())); HCFV1->Init((Constraints.IsoV(myU0, myU1, myV1)).NbCoeff()); // normalization of Isos V @@ -565,9 +565,9 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions, int IORDMX = std::max(IORDRU, IORDRV); occ::handle> HEXTR = new NCollection_HArray1(1, 2 * IORDMX + 2); - double* EXTR = static_cast(&HEXTR->ChangeArray1()(HEXTR->Lower())); + double* EXTR = static_cast(&HEXTR->ChangeArray1()(HEXTR->Lower())); occ::handle> HFACT = new NCollection_HArray1(1, IORDMX + 1); - double* FACT = static_cast(&HFACT->ChangeArray1()(HFACT->Lower())); + double* FACT = static_cast(&HFACT->ChangeArray1()(HFACT->Lower())); int idim, ncf0, ncf1, iun = 1; double* Is; @@ -819,15 +819,15 @@ void AdvApp2Var_Patch::MakeApprox(const AdvApp2Var_Context& Conditions, double* EPSAPR = static_cast(&HEPSAPR->ChangeArray1()(HEPSAPR->Lower())); double* EPSFRO = static_cast(&HEPSFRO->ChangeArray1()(HEPSFRO->Lower())); - int SIZE = (1 + NDJACU) * (1 + NDJACV) * NDIMEN; - occ::handle> HPJAC = new NCollection_HArray1(1, SIZE); - double* PATJAC = static_cast(&HPJAC->ChangeArray1()(HPJAC->Lower())); - SIZE = 2 * SIZE; - occ::handle> HPAUX = new NCollection_HArray1(1, SIZE); - double* PATAUX = static_cast(&HPAUX->ChangeArray1()(HPAUX->Lower())); - SIZE = NCFLMU * NCFLMV * NDIMEN; - occ::handle> HPCAN = new NCollection_HArray1(1, SIZE); - double* PATCAN = static_cast(&HPCAN->ChangeArray1()(HPCAN->Lower())); + int SIZE = (1 + NDJACU) * (1 + NDJACV) * NDIMEN; + occ::handle> HPJAC = new NCollection_HArray1(1, SIZE); + double* PATJAC = static_cast(&HPJAC->ChangeArray1()(HPJAC->Lower())); + SIZE = 2 * SIZE; + occ::handle> HPAUX = new NCollection_HArray1(1, SIZE); + double* PATAUX = static_cast(&HPAUX->ChangeArray1()(HPAUX->Lower())); + SIZE = NCFLMU * NCFLMV * NDIMEN; + occ::handle> HPCAN = new NCollection_HArray1(1, SIZE); + double* PATCAN = static_cast(&HPCAN->ChangeArray1()(HPCAN->Lower())); occ::handle> HERRMAX = new NCollection_HArray1(1, NBSESP); double* ERRMAX = static_cast(&HERRMAX->ChangeArray1()(HERRMAX->Lower())); occ::handle> HERRMOY = new NCollection_HArray1(1, NBSESP); diff --git a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_SysBase.cxx b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_SysBase.cxx index 9cfabbf3858..41f80f9c67b 100644 --- a/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_SysBase.cxx +++ b/src/ModelingData/TKGeomBase/AdvApp2Var/AdvApp2Var_SysBase.cxx @@ -1671,7 +1671,8 @@ int maoverf_(int* nbentr, double* dtable) /* Loop. The upper limit is the int value of the logarithm of base 2 */ /* of NBENTR/NLONGR. */ - i__1 = static_cast(std::log(static_cast(*nbentr) / static_cast(63.)) / std::log(static_cast(2.))); + i__1 = static_cast(std::log(static_cast(*nbentr) / static_cast(63.)) + / std::log(static_cast(2.))); for (ibid = 1; ibid <= i__1; ++ibid) { diff --git a/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx b/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx index 6d319c10a54..2b7d3b2f6ac 100644 --- a/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx +++ b/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx @@ -2716,8 +2716,8 @@ void AppDef_Variational::AssemblingConstraints(const occ::handle& int MxDeg = Curve->Base().WorkDegree(), NbElm = Curve->NbElements(), NbDim = Curve->Dimension(); NCollection_Array1 G0(0, MxDeg), G1(0, MxDeg), G2(0, MxDeg); - math_Vector V0(static_cast(&G0(0)), 0, MxDeg), V1(static_cast(&G1(0)), 0, MxDeg), - V2(static_cast(&G2(0)), 0, MxDeg); + math_Vector V0(static_cast(&G0(0)), 0, MxDeg), + V1(static_cast(&G1(0)), 0, MxDeg), V2(static_cast(&G2(0)), 0, MxDeg); int IndexOfConstraint, Ng3d, Ng2d, NBeg2d, NPass, NgPC1, NTang3d, NTang2d, Point, TypOfConstr, p0 = Parameters.Lower() - myFirstPoint, curel = 1, el, i, ipnt, ityp, j, k, pnt, curdim, jt, diff --git a/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves.cxx b/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves.cxx index 5c7f5c9be06..11ea0ac3529 100644 --- a/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves.cxx +++ b/src/ModelingData/TKGeomBase/AppParCurves/AppParCurves.cxx @@ -227,7 +227,7 @@ void AppParCurves::SplineFunction(const int nbpoles, locpoles(pp) *= (flatknots(kindex + pp) - U) * Inverse; locpoles(pp) += locqq; locqq = Saved; - LocalInverse = static_cast(deg)*Inverse; + LocalInverse = static_cast(deg) * Inverse; Saved = LocalInverse * locdpoles(pp); locdpoles(pp) *= -LocalInverse; locdpoles(pp) += locdqq; diff --git a/src/ModelingData/TKGeomBase/Approx/Approx_BSplComputeLine.gxx b/src/ModelingData/TKGeomBase/Approx/Approx_BSplComputeLine.gxx index a1c01360485..94c6be900fa 100644 --- a/src/ModelingData/TKGeomBase/Approx/Approx_BSplComputeLine.gxx +++ b/src/ModelingData/TKGeomBase/Approx/Approx_BSplComputeLine.gxx @@ -763,7 +763,8 @@ void Approx_BSplComputeLine::Perform(const MultiLine& Line) for (i = 2; i <= nbknots - 1; i++) { - l = (mylastpt - myfirstpt) * static_cast(i - 1) / static_cast(nbknots - 1); + l = + (mylastpt - myfirstpt) * static_cast(i - 1) / static_cast(nbknots - 1); int ll = static_cast(l); double a = l - ll; double p1 = TheParam(ll + myfirstpt); @@ -888,7 +889,8 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line, { for (i = firstP + 1; i <= lastP; i++) { - TheParameters(i) = (static_cast(i) - firstP) / ((lastP - static_cast(firstP))); + TheParameters(i) = + (static_cast(i) - firstP) / ((lastP - static_cast(firstP))); } } } diff --git a/src/ModelingData/TKGeomBase/Approx/Approx_ComputeLine.gxx b/src/ModelingData/TKGeomBase/Approx/Approx_ComputeLine.gxx index 9b3fc9503b2..d1160031aaf 100644 --- a/src/ModelingData/TKGeomBase/Approx/Approx_ComputeLine.gxx +++ b/src/ModelingData/TKGeomBase/Approx/Approx_ComputeLine.gxx @@ -1316,7 +1316,8 @@ void Approx_ComputeLine::Parameters(const MultiLine& Line, { for (i = firstP; i <= lastP; i++) { - TheParameters(i) = (static_cast(i) - firstP) / (static_cast(lastP) - static_cast(firstP)); + TheParameters(i) = (static_cast(i) - firstP) + / (static_cast(lastP) - static_cast(firstP)); } } } diff --git a/src/ModelingData/TKGeomBase/Approx/Approx_SameParameter.cxx b/src/ModelingData/TKGeomBase/Approx/Approx_SameParameter.cxx index 5745b5e2841..72fa0a49313 100644 --- a/src/ModelingData/TKGeomBase/Approx/Approx_SameParameter.cxx +++ b/src/ModelingData/TKGeomBase/Approx/Approx_SameParameter.cxx @@ -227,7 +227,15 @@ static bool Check(const NCollection_Array1& FlatKnots, double tc3d = pc3d[0] * (1.0 - t) + pc3d[nbp - 1] * t; // weight function. gp_Pnt Pc3d = c3d->Value(tc3d); double tcons; - BSplCLib::Eval(tc3d, false, 0, extrap_mode[0], aDegree, FlatKnots, 1, const_cast(Poles(1)), tcons); + BSplCLib::Eval(tc3d, + false, + 0, + extrap_mode[0], + aDegree, + FlatKnots, + 1, + const_cast(Poles(1)), + tcons); if (tcons < tprev || tcons > aParamLast) { diff --git a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectedCurve.cxx b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectedCurve.cxx index 5a870c1c0d4..2f809e6cbc3 100644 --- a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectedCurve.cxx +++ b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ProjectedCurve.cxx @@ -811,8 +811,8 @@ void ProjLib_ProjectedCurve::Perform(const occ::handle& C) gp_Pnt2d aPnt2d; aRes->D0(aCurrParam, aPnt2d); - int aMapKey = - static_cast((aPnt2d.Coord(anIdx) - aSurfFirstPar[anIdx - 1]) / aSurfPeriod[anIdx - 1]); + int aMapKey = static_cast((aPnt2d.Coord(anIdx) - aSurfFirstPar[anIdx - 1]) + / aSurfPeriod[anIdx - 1]); if (aPnt2d.Coord(anIdx) - aSurfFirstPar[anIdx - 1] < 0.0) aMapKey--; diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_Buffer.hxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_Buffer.hxx index 93219946d4d..3dccb429b53 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_Buffer.hxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_Buffer.hxx @@ -52,13 +52,22 @@ public: operator void*() { return myDynData ? myDynData : (void*)myAutoData; } //! Interpret the buffer as a reference to double - operator double&() { return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); } + operator double&() + { + return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); + } //! Interpret the buffer as a reference to int - operator int&() { return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); } + operator int&() + { + return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); + } //! Interpret the buffer as a reference to gp_Pnt - operator gp_Pnt&() { return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); } + operator gp_Pnt&() + { + return *(myDynData ? static_cast(myDynData) : reinterpret_cast(myAutoData)); + } private: //! Deprecate copy constructor diff --git a/src/Visualization/TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx b/src/Visualization/TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx index ccff8c37a4e..3b3ae57b44a 100644 --- a/src/Visualization/TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx +++ b/src/Visualization/TKMeshVS/MeshVS/MeshVS_TextPrsBuilder.cxx @@ -230,7 +230,9 @@ void MeshVS_TextPrsBuilder::Build(const occ::handle& Prs, continue; } - aPnts.Append(NCollection_Vec3(static_cast(X), static_cast(Y), static_cast(Z))); + aPnts.Append(NCollection_Vec3(static_cast(X), + static_cast(Y), + static_cast(Z))); occ::handle aText = new Graphic3d_Text(static_cast(aHeight)); aText->SetText(aStr); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx index 4b3244b0b29..013b7f090d9 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx @@ -252,7 +252,8 @@ void OpenGl_AspectsSprite::build(const occ::handle& theCt { // Creating texture resource for using it with point sprites occ::handle anImage = aNewMarkerImage->GetImage(); - theMarkerSize = std::max(static_cast(anImage->Width()), static_cast(anImage->Height())); + theMarkerSize = + std::max(static_cast(anImage->Width()), static_cast(anImage->Height())); if (!hadAlreadyRGBA) { @@ -292,12 +293,14 @@ void OpenGl_AspectsSprite::build(const occ::handle& theCt theCtx->core11fwd->glPixelStorei(GL_UNPACK_ALIGNMENT, anAligment); const GLint anExtraBytes = static_cast(anImage->RowExtraBytes()); - const GLint aPixelsWidth = static_cast(anImage->SizeRowBytes() / anImage->SizePixelBytes()); - const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0; + const GLint aPixelsWidth = + static_cast(anImage->SizeRowBytes() / anImage->SizePixelBytes()); + const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0; theCtx->core11fwd->glPixelStorei(GL_UNPACK_ROW_LENGTH, aRowLength); theCtx->core11ffp->glNewList(aBitmapList, GL_COMPILE); - const int aWidth = static_cast(anImage->Width()), aHeight = static_cast(anImage->Height()); + const int aWidth = static_cast(anImage->Width()), + aHeight = static_cast(anImage->Height()); // clang-format off theCtx->core11ffp->glBitmap (0, 0, 0, 0, static_cast(-0.5f * aWidth), static_cast(-0.5f * aHeight), nullptr); // make offsets that will be added to the current raster position // clang-format on diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_BackgroundArray.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_BackgroundArray.cxx index 02571777930..cd98bde05f4 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_BackgroundArray.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_BackgroundArray.cxx @@ -75,10 +75,16 @@ void OpenGl_BackgroundArray::SetGradientParameters(const Quantity_Color& double anR, aG, aB; theColor1.Values(anR, aG, aB, Quantity_TOC_RGB); - myGradientParams.color1 = NCollection_Vec4(static_cast(anR), static_cast(aG), static_cast(aB), 0.0f); + myGradientParams.color1 = NCollection_Vec4(static_cast(anR), + static_cast(aG), + static_cast(aB), + 0.0f); theColor2.Values(anR, aG, aB, Quantity_TOC_RGB); - myGradientParams.color2 = NCollection_Vec4(static_cast(anR), static_cast(aG), static_cast(aB), 0.0f); + myGradientParams.color2 = NCollection_Vec4(static_cast(anR), + static_cast(aG), + static_cast(aB), + 0.0f); myGradientParams.type = theType; invalidateData(); @@ -286,15 +292,16 @@ bool OpenGl_BackgroundArray::createGradientArray(const occ::handle anEllipVerts[aSubdiv + 2]; - anEllipVerts[0] = - NCollection_Vec2(static_cast(myViewWidth) / 2.0f, static_cast(myViewHeight) / 2.0f); - double aTetta = (M_PI * 2.0) / aSubdiv; - double aParam = 0.0; + anEllipVerts[0] = NCollection_Vec2(static_cast(myViewWidth) / 2.0f, + static_cast(myViewHeight) / 2.0f); + double aTetta = (M_PI * 2.0) / aSubdiv; + double aParam = 0.0; for (int anIt = 1; anIt < aSubdiv + 2; ++anIt) { anEllipVerts[anIt] = NCollection_Vec2( static_cast(std::cos(aParam) * M_SQRT2 * myViewWidth / 2.0 + myViewWidth / 2.0f), - static_cast(std::sin(aParam) * M_SQRT2 * myViewHeight / 2.0 + myViewHeight / 2.0f)); + static_cast(std::sin(aParam) * M_SQRT2 * myViewHeight / 2.0 + + myViewHeight / 2.0f)); aParam += aTetta; } @@ -558,11 +565,12 @@ void OpenGl_BackgroundArray::Render(const occ::handle& theWork { aWorldView.SetColumn( 3, - NCollection_Vec4( - -1.0f + static_cast(aViewSizeX) / aTileSize.x() - 2.0f * aTileOffset.x() / aTileSize.x(), - -1.0f + static_cast(aViewSizeY) / aTileSize.y() - 2.0f * aTileOffset.y() / aTileSize.y(), - 0.0f, - 1.0f)); + NCollection_Vec4(-1.0f + static_cast(aViewSizeX) / aTileSize.x() + - 2.0f * aTileOffset.x() / aTileSize.x(), + -1.0f + static_cast(aViewSizeY) / aTileSize.y() + - 2.0f * aTileOffset.y() / aTileSize.y(), + 0.0f, + 1.0f)); } } else diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.cxx index a24c2358d9b..49b0bf0e0bb 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Buffer.cxx @@ -250,15 +250,15 @@ bool OpenGl_Buffer::init(const occ::handle& theGlCtx, if (anErr != GL_NO_ERROR && anErr != GL_OUT_OF_MEMORY) // pass-through out-of-memory error, but log unexpected errors { - theGlCtx->PushMessage(GL_DEBUG_SOURCE_APPLICATION, - GL_DEBUG_TYPE_ERROR, - 0, - GL_DEBUG_SEVERITY_HIGH, - TCollection_AsciiString("Error: glBufferData (") - + FormatTarget(GetTarget()) + "," - + OpenGl_Context::FormatSize(static_cast(myElemsNb) * theStride) + "," - + OpenGl_Context::FormatPointer(theData) + ") Id: " + static_cast(myBufferId) - + " failed with " + OpenGl_Context::FormatGlError(anErr)); + theGlCtx->PushMessage( + GL_DEBUG_SOURCE_APPLICATION, + GL_DEBUG_TYPE_ERROR, + 0, + GL_DEBUG_SEVERITY_HIGH, + TCollection_AsciiString("Error: glBufferData (") + FormatTarget(GetTarget()) + "," + + OpenGl_Context::FormatSize(static_cast(myElemsNb) * theStride) + "," + + OpenGl_Context::FormatPointer(theData) + ") Id: " + static_cast(myBufferId) + + " failed with " + OpenGl_Context::FormatGlError(anErr)); } Unbind(theGlCtx); return anErr == GL_NO_ERROR; @@ -322,8 +322,10 @@ bool OpenGl_Buffer::subData(const occ::handle& theGlCtx, const size_t aDataSize = sizeOfGlType(theDataType); theGlCtx->core15fwd->glBufferSubData( GetTarget(), - static_cast(theElemFrom) * static_cast(myComponentsNb) * aDataSize, // offset in bytes - static_cast(theElemsNb) * static_cast(myComponentsNb) * aDataSize, // size in bytes + static_cast(theElemFrom) * static_cast(myComponentsNb) + * aDataSize, // offset in bytes + static_cast(theElemsNb) * static_cast(myComponentsNb) + * aDataSize, // size in bytes theData); const int anErr = theGlCtx->core15fwd->glGetError(); if (anErr != GL_NO_ERROR) @@ -334,10 +336,11 @@ bool OpenGl_Buffer::subData(const occ::handle& theGlCtx, 0, GL_DEBUG_SEVERITY_HIGH, TCollection_AsciiString("Error: glBufferSubData (") + FormatTarget(GetTarget()) + "," - + OpenGl_Context::FormatSize(static_cast(theElemFrom) * static_cast(myComponentsNb) * aDataSize) + + OpenGl_Context::FormatSize(static_cast(theElemFrom) + * static_cast(myComponentsNb) * aDataSize) + "," - + OpenGl_Context::FormatSize(static_cast(theElemsNb) * static_cast(myComponentsNb) - * aDataSize) + + OpenGl_Context::FormatSize(static_cast(theElemsNb) + * static_cast(myComponentsNb) * aDataSize) + "," + OpenGl_Context::FormatPointer(theData) + ") Id: " + static_cast(myBufferId) + " failed with " + OpenGl_Context::FormatGlError(anErr)); } @@ -400,11 +403,13 @@ bool OpenGl_Buffer::getSubData(const occ::handle& theGlCtx, } Bind(theGlCtx); - const size_t aDataSize = sizeOfGlType(theDataType); - const GLintptr anOffset = static_cast(theElemFrom) * static_cast(myComponentsNb) * aDataSize; - const GLsizeiptr aSize = static_cast(theElemsNb) * static_cast(myComponentsNb) * aDataSize; - bool isDone = theGlCtx->GetBufferSubData(GetTarget(), anOffset, aSize, theData); - isDone = isDone && (theGlCtx->core15fwd->glGetError() == GL_NO_ERROR); + const size_t aDataSize = sizeOfGlType(theDataType); + const GLintptr anOffset = + static_cast(theElemFrom) * static_cast(myComponentsNb) * aDataSize; + const GLsizeiptr aSize = + static_cast(theElemsNb) * static_cast(myComponentsNb) * aDataSize; + bool isDone = theGlCtx->GetBufferSubData(GetTarget(), anOffset, aSize, theData); + isDone = isDone && (theGlCtx->core15fwd->glGetError() == GL_NO_ERROR); Unbind(theGlCtx); return isDone; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx index 1b1210fdf0f..0d269d28625 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_BufferCompatT.hxx @@ -213,8 +213,10 @@ bool OpenGl_BufferCompatT::subData(const occ::handle(theElemFrom) * size_t(BaseBufferT::myComponentsNb) * aDataSize; - const size_t aNbBytes = static_cast(theElemsNb) * size_t(BaseBufferT::myComponentsNb) * aDataSize; + const size_t anOffset = + static_cast(theElemFrom) * size_t(BaseBufferT::myComponentsNb) * aDataSize; + const size_t aNbBytes = + static_cast(theElemsNb) * size_t(BaseBufferT::myComponentsNb) * aDataSize; memcpy(myData->ChangeData() + anOffset, theData, aNbBytes); return true; } @@ -235,8 +237,10 @@ bool OpenGl_BufferCompatT::getSubData(const occ::handle(theElemFrom) * size_t(BaseBufferT::myComponentsNb) * aDataSize; - const size_t aNbBytes = static_cast(theElemsNb) * size_t(BaseBufferT::myComponentsNb) * aDataSize; + const size_t anOffset = + static_cast(theElemFrom) * size_t(BaseBufferT::myComponentsNb) * aDataSize; + const size_t aNbBytes = + static_cast(theElemsNb) * size_t(BaseBufferT::myComponentsNb) * aDataSize; memcpy(theData, myData->Data() + anOffset, aNbBytes); return true; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.cxx index 197bebecea5..fb3ad9026bc 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.cxx @@ -728,7 +728,9 @@ bool OpenGl_Context::MakeCurrent() return false; } - if (!glXMakeCurrent(static_cast(myDisplay), static_cast(myWindow), static_cast(myGContext))) + if (!glXMakeCurrent(static_cast(myDisplay), + static_cast(myWindow), + static_cast(myGContext))) { // if there is no current context it might be impossible to use glGetError() correctly PushMessage(GL_DEBUG_SOURCE_WINDOW_SYSTEM, @@ -804,7 +806,8 @@ bool OpenGl_Context::SetSwapInterval(const int theInterval) { typedef int ( *glXSwapIntervalEXT_t_x)(Display* theDisplay, GLXDrawable theDrawable, int theInterval); - glXSwapIntervalEXT_t_x aFuncPtr = reinterpret_cast(myFuncs->glXSwapIntervalEXT); + glXSwapIntervalEXT_t_x aFuncPtr = + reinterpret_cast(myFuncs->glXSwapIntervalEXT); aFuncPtr(static_cast(myDisplay), static_cast(myWindow), theInterval); return true; } @@ -863,7 +866,8 @@ bool OpenGl_Context::CheckExtension(const char* theExtName) const const size_t anExtNameLen = strlen(theExtName); for (GLint anIter = 0; anIter < anExtNb; ++anIter) { - const char* anExtension = reinterpret_cast(myFuncs->glGetStringi(GL_EXTENSIONS, static_cast(anIter))); + const char* anExtension = reinterpret_cast( + myFuncs->glGetStringi(GL_EXTENSIONS, static_cast(anIter))); const size_t aTestExtNameLen = strlen(anExtension); if (aTestExtNameLen == anExtNameLen && strncmp(anExtension, theExtName, anExtNameLen) == 0) { @@ -1826,7 +1830,9 @@ void OpenGl_Context::MemoryInfo( unsigned int aVMemMiB = 0; if (myFuncs->glXQueryCurrentRendererIntegerMESA(GLX_RENDERER_VIDEO_MEMORY_MESA, &aVMemMiB) != 0) { - addInfo(theDict, "GPU memory", TCollection_AsciiString() + static_cast(aVMemMiB) + " MiB"); + addInfo(theDict, + "GPU memory", + TCollection_AsciiString() + static_cast(aVMemMiB) + " MiB"); } } #endif @@ -1939,7 +1945,9 @@ void OpenGl_Context::DiagnosticInformation( int aDriverVer[2] = {}; OpenGl_GlFunctions::readGlVersion(aDriverVer[0], aDriverVer[1]); addInfo(theDict, "GLvendor", reinterpret_cast(core11fwd->glGetString(GL_VENDOR))); - addInfo(theDict, "GLdevice", reinterpret_cast(core11fwd->glGetString(GL_RENDERER))); + addInfo(theDict, + "GLdevice", + reinterpret_cast(core11fwd->glGetString(GL_RENDERER))); #ifdef __EMSCRIPTEN__ if (CheckExtension("GL_WEBGL_debug_renderer_info")) { @@ -1954,7 +1962,9 @@ void OpenGl_Context::DiagnosticInformation( } #endif - addInfo(theDict, "GLversion", reinterpret_cast(core11fwd->glGetString(GL_VERSION))); + addInfo(theDict, + "GLversion", + reinterpret_cast(core11fwd->glGetString(GL_VERSION))); if (myGlVerMajor != aDriverVer[0] || myGlVerMinor != aDriverVer[1]) { addInfo(theDict, @@ -2013,7 +2023,8 @@ void OpenGl_Context::DiagnosticInformation( core11fwd->glGetIntegerv(GL_NUM_EXTENSIONS, &anExtNb); for (GLint anIter = 0; anIter < anExtNb; ++anIter) { - const char* anExtension = reinterpret_cast(myFuncs->glGetStringi(GL_EXTENSIONS, static_cast(anIter))); + const char* anExtension = reinterpret_cast( + myFuncs->glGetStringi(GL_EXTENSIONS, static_cast(anIter))); if (!anExtList.IsEmpty()) { anExtList += " "; @@ -2024,7 +2035,9 @@ void OpenGl_Context::DiagnosticInformation( } else { - addInfo(theDict, "GLextensions", reinterpret_cast(core11fwd->glGetString(GL_EXTENSIONS))); + addInfo(theDict, + "GLextensions", + reinterpret_cast(core11fwd->glGetString(GL_EXTENSIONS))); } } } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Font.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Font.cxx index bd3c034026f..043a7db6331 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Font.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Font.cxx @@ -124,7 +124,8 @@ bool OpenGl_Font::createTexture(const occ::handle& theCtx) const int aTextureSizeX = OpenGl_Context::GetPowerOfTwo(aGlyphsNb * aMaxTileSizeX, aMaxSize); const int aTilesPerRow = aTextureSizeX / aMaxTileSizeX; const int aTextureSizeY = - OpenGl_Context::GetPowerOfTwo(static_cast((aGlyphsNb / aTilesPerRow) + 1) * myTileSizeY, aMaxSize); + OpenGl_Context::GetPowerOfTwo(static_cast((aGlyphsNb / aTilesPerRow) + 1) * myTileSizeY, + aMaxSize); memset(&myLastTilePx, 0, sizeof(myLastTilePx)); myLastTilePx.Bottom = myTileSizeY; @@ -139,7 +140,9 @@ bool OpenGl_Font::createTexture(const occ::handle& theCtx) occ::handle& aTexture = myTextures.ChangeLast(); Image_PixMap aBlackImg; - if (!aBlackImg.InitZero(Image_Format_Alpha, static_cast(aTextureSizeX), static_cast(aTextureSizeY)) + if (!aBlackImg.InitZero(Image_Format_Alpha, + static_cast(aTextureSizeX), + static_cast(aTextureSizeY)) || !aTexture->Init(theCtx, aBlackImg, Graphic3d_TypeOfTexture_2D, true)) // myTextureFormat { theCtx->PushMessage(GL_DEBUG_SOURCE_APPLICATION, @@ -214,11 +217,13 @@ bool OpenGl_Font::renderGlyph(const occ::handle& theCtx, const c anImg.Data()); OpenGl_Font::Tile aTile; - aTile.uv.Left = static_cast(myLastTilePx.Left) / static_cast(aTexture->SizeX()); - aTile.uv.Right = static_cast(myLastTilePx.Right) / static_cast(aTexture->SizeX()); - aTile.uv.Top = static_cast(myLastTilePx.Top) / static_cast(aTexture->SizeY()); - aTile.uv.Bottom = static_cast(myLastTilePx.Top + anImg.SizeY()) / static_cast(aTexture->SizeY()); - aTile.texture = aTexture->TextureId(); + aTile.uv.Left = static_cast(myLastTilePx.Left) / static_cast(aTexture->SizeX()); + aTile.uv.Right = + static_cast(myLastTilePx.Right) / static_cast(aTexture->SizeX()); + aTile.uv.Top = static_cast(myLastTilePx.Top) / static_cast(aTexture->SizeY()); + aTile.uv.Bottom = static_cast(myLastTilePx.Top + anImg.SizeY()) + / static_cast(aTexture->SizeY()); + aTile.texture = aTexture->TextureId(); myFont->GlyphRect(aTile.px); myLastTileId = aTileId; diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx index 42d84d575ee..4e37286e57b 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.cxx @@ -1229,9 +1229,9 @@ bool OpenGl_FrameBuffer::BufferDump(const occ::handle& theGl theGlCtx->core11fwd->glPixelStorei(GL_PACK_ALIGNMENT, anAligment); bool isBatchCopy = !theImage.IsTopDown(); - const GLint anExtraBytes = static_cast(theImage.RowExtraBytes()); - GLint aPixelsWidth = static_cast(theImage.SizeRowBytes() / theImage.SizePixelBytes()); - size_t aSizeRowBytesEstim = getAligned(theImage.SizePixelBytes() * aPixelsWidth, anAligment); + const GLint anExtraBytes = static_cast(theImage.RowExtraBytes()); + GLint aPixelsWidth = static_cast(theImage.SizeRowBytes() / theImage.SizePixelBytes()); + size_t aSizeRowBytesEstim = getAligned(theImage.SizePixelBytes() * aPixelsWidth, anAligment); if (anExtraBytes < anAligment) { aPixelsWidth = 0; @@ -1270,7 +1270,8 @@ bool OpenGl_FrameBuffer::BufferDump(const occ::handle& theGl aFormat, aType, aRowBuffer.ChangeData()); - const Image_ColorRGBA* aRowDataRgba = reinterpret_cast(aRowBuffer.Data()); + const Image_ColorRGBA* aRowDataRgba = + reinterpret_cast(aRowBuffer.Data()); if (theImage.Format() == Image_Format_BGR) { convertRowFromRgba(reinterpret_cast(theImage.ChangeRow(aRow)), diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx index c5e1b6cbe31..61ebb3a4e81 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameStatsPrs.cxx @@ -36,7 +36,8 @@ static TCollection_AsciiString formatTimeMs(double theSeconds) const double aFpsVal = theSeconds != 0.0 ? 1.0 / theSeconds : 0.0; char aFps[50]; Sprintf(aFps, "%.1f", aFpsVal); - return TCollection_AsciiString() + static_cast(theSeconds * 1000.0) + " ms (" + aFps + " FPS)"; + return TCollection_AsciiString() + static_cast(theSeconds * 1000.0) + " ms (" + aFps + + " FPS)"; } } // namespace @@ -197,7 +198,8 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle& theW aCharSize.y() = static_cast(0.15 * aViewSize.y()); } - const NCollection_Vec2 aBinSize(static_cast(aCharSize.x()) / static_cast(aNbBins), + const NCollection_Vec2 aBinSize(static_cast(aCharSize.x()) + / static_cast(aNbBins), 0.15 * aViewSize.y()); NCollection_Vec2 anOffset; if (!myChartTrsfPers.IsNull() && myChartTrsfPers->IsTrihedronOr2d()) @@ -313,10 +315,17 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle& theW { const NCollection_Vec4 aWhite(255, 255, 255, 255); const OpenGl_Vec3Vec4ub aLines[4] = { - {NCollection_Vec3(static_cast(anOffset.x()), static_cast(anOffset.y()), 0.0f), aWhite}, - {NCollection_Vec3(static_cast(anOffset.x() + aCharSize.x()), static_cast(anOffset.y()), 0.0f), + {NCollection_Vec3(static_cast(anOffset.x()), + static_cast(anOffset.y()), + 0.0f), aWhite}, - {NCollection_Vec3(static_cast(anOffset.x()), static_cast(anOffset.y() - aBinSize.y()), 0.0f), + {NCollection_Vec3(static_cast(anOffset.x() + aCharSize.x()), + static_cast(anOffset.y()), + 0.0f), + aWhite}, + {NCollection_Vec3(static_cast(anOffset.x()), + static_cast(anOffset.y() - aBinSize.y()), + 0.0f), aWhite}, {NCollection_Vec3(static_cast(anOffset.x() + aCharSize.x()), static_cast(anOffset.y() - aBinSize.y()), @@ -354,7 +363,8 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle& theW gp_Pnt(aLabX, static_cast(anOffset.y() - aBinSize.y() / 2), 0.0f)); myChartLabels[2].Text()->SetText(aLabels[isTopDown ? 2 : 0].ToCString()); - myChartLabels[2].Text()->SetPosition(gp_Pnt(aLabX, static_cast(anOffset.y() - aBinSize.y()), 0.0f)); + myChartLabels[2].Text()->SetPosition( + gp_Pnt(aLabX, static_cast(anOffset.y() - aBinSize.y()), 0.0f)); for (int i = 0; i < 3; i++) { diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx index 993e8a50695..3d5417ed4a2 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GlFunctions.cxx @@ -2476,7 +2476,8 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile) && FindProcShort(glVertexAttrib4usv) && FindProcShort(glVertexAttribPointer); if (has20) { - const char* aGlslVer = reinterpret_cast(::glGetString(GL_SHADING_LANGUAGE_VERSION)); + const char* aGlslVer = + reinterpret_cast(::glGetString(GL_SHADING_LANGUAGE_VERSION)); if (aGlslVer == nullptr || *aGlslVer == '\0') { // broken context has been detected diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraduatedTrihedron.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraduatedTrihedron.cxx index bac59e7ac87..4d0d30efdb3 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraduatedTrihedron.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraduatedTrihedron.cxx @@ -383,9 +383,10 @@ void OpenGl_GraduatedTrihedron::renderAxis(const occ::handle& // Render arrow NCollection_Vec3 anArrowVec = myMin + anAxis.Direction * (myMax - myMin); - Graphic3d_TransformPers aTransMode( - Graphic3d_TMF_ZoomPers, - gp_Pnt(static_cast(anArrowVec.x()), static_cast(anArrowVec.y()), static_cast(anArrowVec.z()))); + Graphic3d_TransformPers aTransMode(Graphic3d_TMF_ZoomPers, + gp_Pnt(static_cast(anArrowVec.x()), + static_cast(anArrowVec.y()), + static_cast(anArrowVec.z()))); const NCollection_Mat4& aProjection = aContext->ProjectionState.Current(); const NCollection_Mat4& aWorldView = aContext->WorldViewState.Current(); const int aWidth = theWorkspace->Width(); @@ -477,7 +478,8 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels( NCollection_Mat4 aModelMat(theMat); - anAxis.InitTickmark(aContext, aDir * static_cast(aCurAspect.TickmarksLength()) * theDpix); + anAxis.InitTickmark(aContext, + aDir * static_cast(aCurAspect.TickmarksLength()) * theDpix); Graphic3d_TransformUtils::Translate(aModelMat, theGridAxes.Ticks[theIndex].x(), theGridAxes.Ticks[theIndex].y(), @@ -521,8 +523,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels( for (int anIt = 0; anIt <= aCurAspect.TickmarksNumber(); ++anIt) { Sprintf(aTextValue, "%g", theGridAxes.Ticks[theIndex].GetData()[theIndex] + anIt * aStep); - NCollection_Vec3 aPos(theGridAxes.Ticks[theIndex] - + anAxis.Direction * (anIt * aStep) + NCollection_Vec3 aPos(theGridAxes.Ticks[theIndex] + anAxis.Direction * (anIt * aStep) + aDir * static_cast(theDpix * anOffset)); occ::handle aText = myLabelValues.Text(); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx index c9332da53d0..44888c6736d 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_GraphicDriver.cxx @@ -507,7 +507,8 @@ void OpenGl_GraphicDriver::chooseVisualInfo() #endif if (aVisInfo != nullptr) { - myDisplayConnection->SetDefaultVisualInfo(reinterpret_cast(aVisInfo), anFBConfig); + myDisplayConnection->SetDefaultVisualInfo(reinterpret_cast(aVisInfo), + anFBConfig); } else { diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_LayerList.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_LayerList.cxx index 5daa92b20ce..54cfb9f5147 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_LayerList.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_LayerList.cxx @@ -750,9 +750,8 @@ void OpenGl_LayerList::Render(const occ::handle& theWorkspace, // was preallocated before going into this method and has enough space to keep // maximum number of references to layers, therefore it will not increase memory // fragmentation during regular rendering. - const int aPrevFilter = - theWorkspace->RenderFilter() - & ~(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); + const int aPrevFilter = theWorkspace->RenderFilter() + & ~(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); theWorkspace->SetRenderFilter(aPrevFilter | OpenGl_RenderFilter_OpaqueOnly); myTransparentToProcess.Clear(); @@ -923,9 +922,8 @@ void OpenGl_LayerList::renderTransparent(const occ::handle& th Graphic3d_RenderTransparentMethod anOitMode = aView != nullptr ? aView->RenderingParams().TransparencyMethod : Graphic3d_RTM_BLEND_UNORDERED; - const int aPrevFilter = - theWorkspace->RenderFilter() - & ~(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); + const int aPrevFilter = theWorkspace->RenderFilter() + & ~(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly); theWorkspace->SetRenderFilter(aPrevFilter | OpenGl_RenderFilter_TransparentOnly); aCtx->core11fwd->glEnable(GL_BLEND); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx index a94259cf9c8..c2a6dd734d9 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_PBREnvironment.cxx @@ -474,9 +474,10 @@ bool OpenGl_PBREnvironment::processSpecIBLMap(const occ::handle& return false; } - const occ::handle& aProg = theCtx->ActiveProgram(); - const float aSolidAngleSource = - static_cast(4.0 * M_PI / (6.0 * static_cast(theDrawParams->EnvMapSize * theDrawParams->EnvMapSize))); + const occ::handle& aProg = theCtx->ActiveProgram(); + const float aSolidAngleSource = static_cast( + 4.0 * M_PI + / (6.0 * static_cast(theDrawParams->EnvMapSize * theDrawParams->EnvMapSize))); aProg->SetSampler(theCtx, "uEnvMap", theCtx->PBRSpecIBLMapTexUnit()); aProg->SetUniform(theCtx, "uZCoeff", theDrawParams->IsZInverted ? -1 : 1); aProg->SetUniform(theCtx, "uYCoeff", theDrawParams->IsTopDown ? 1 : -1); @@ -502,10 +503,11 @@ bool OpenGl_PBREnvironment::processSpecIBLMap(const occ::handle& theCtx->ResizeViewport(aViewport); if (theDrawParams != nullptr) { - const int aNbSamples = static_cast(Graphic3d_PBRMaterial::SpecIBLMapSamplesFactor( - theDrawParams->Probability, - aLevelIter / static_cast(mySpecMapLevelsNumber - 1)) - * theDrawParams->NbSpecSamples); + const int aNbSamples = + static_cast(Graphic3d_PBRMaterial::SpecIBLMapSamplesFactor( + theDrawParams->Probability, + aLevelIter / static_cast(mySpecMapLevelsNumber - 1)) + * theDrawParams->NbSpecSamples); theCtx->ActiveProgram()->SetUniform(theCtx, "uSamplesNum", aNbSamples); theCtx->ActiveProgram()->SetUniform(theCtx, "uCurrentLevel", aLevelIter); } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx index 4f094b5ecb3..da1f47c7484 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_PrimitiveArray.cxx @@ -1060,8 +1060,8 @@ void OpenGl_PrimitiveArray::Render(const occ::handle& theWorks { const NCollection_Vec2 aViewSize(aCtx->Viewport()[2], aCtx->Viewport()[3]); const int aMin = aViewSize.minComp(); - const GLfloat anEdgeWidth = - static_cast(anAspectFace->Aspect()->EdgeWidth()) * aCtx->LineWidthScale() / static_cast(aMin); + const GLfloat anEdgeWidth = static_cast(anAspectFace->Aspect()->EdgeWidth()) + * aCtx->LineWidthScale() / static_cast(aMin); const GLfloat anOrthoScale = aCtx->Camera()->IsOrthographic() ? static_cast(aCtx->Camera()->Scale()) : -1.0f; diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx index b3d0f65438a..6145ffc1f55 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx @@ -589,9 +589,9 @@ void OpenGl_ShaderManager::pushLightSourceState( NCollection_Vec2 aSizeBias; if (myLightSourceState.HasShadowMaps()) { - aSizeBias.SetValues(1.0f - / static_cast(myLightSourceState.ShadowMaps()->First()->Texture()->SizeX()), - myLightSourceState.ShadowMaps()->First()->ShadowMapBias()); + aSizeBias.SetValues( + 1.0f / static_cast(myLightSourceState.ShadowMaps()->First()->Texture()->SizeX()), + myLightSourceState.ShadowMaps()->First()->ShadowMapBias()); const int aNbShadows = std::min(theProgram->NbShadowMaps(), myLightSourceState.ShadowMaps()->Size()); for (int aShadowIter = 0; aShadowIter < aNbShadows; ++aShadowIter) diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx index 2b06ed990e5..080cca8e2f6 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderProgram.cxx @@ -663,7 +663,7 @@ bool OpenGl_ShaderProgram::Initialize( GetUniformLocation(theCtx, "occShadowMapSamplers")) { std::vector aShadowSamplers(myNbShadowMaps); - const GLint aSamplFrom = static_cast(theCtx->ShadowMapTexUnit()) - myNbShadowMaps + 1; + const GLint aSamplFrom = static_cast(theCtx->ShadowMapTexUnit()) - myNbShadowMaps + 1; for (int aSamplerIter = 0; aSamplerIter < myNbShadowMaps; ++aSamplerIter) { aShadowSamplers[aSamplerIter] = aSamplFrom + aSamplerIter; diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Structure.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Structure.cxx index 78aaa6a499e..00393864907 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Structure.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Structure.cxx @@ -46,14 +46,16 @@ void OpenGl_Structure::renderBoundingBox(const occ::handle& th { const NCollection_Vec3 aCenter = myBndBox.Center() + aMoveVec; const NCollection_Vec3 aSize = myBndBox.Size(); - aCtx->ActiveProgram()->SetUniform( - aCtx, - "occBBoxCenter", - NCollection_Vec3(static_cast(aCenter.x()), static_cast(aCenter.y()), static_cast(aCenter.z()))); - aCtx->ActiveProgram()->SetUniform( - aCtx, - "occBBoxSize", - NCollection_Vec3(static_cast(aSize.x()), static_cast(aSize.y()), static_cast(aSize.z()))); + aCtx->ActiveProgram()->SetUniform(aCtx, + "occBBoxCenter", + NCollection_Vec3(static_cast(aCenter.x()), + static_cast(aCenter.y()), + static_cast(aCenter.z()))); + aCtx->ActiveProgram()->SetUniform(aCtx, + "occBBoxSize", + NCollection_Vec3(static_cast(aSize.x()), + static_cast(aSize.y()), + static_cast(aSize.z()))); aCtx->SetColor4fv(theWorkspace->InteriorColor()); const occ::handle& aBoundBoxVertBuffer = @@ -66,8 +68,12 @@ void OpenGl_Structure::renderBoundingBox(const occ::handle& th { const NCollection_Vec3 aMind = myBndBox.CornerMin() + aMoveVec; const NCollection_Vec3 aMaxd = myBndBox.CornerMax() + aMoveVec; - const NCollection_Vec3 aMin(static_cast(aMind.x()), static_cast(aMind.y()), static_cast(aMind.z())); - const NCollection_Vec3 aMax(static_cast(aMaxd.x()), static_cast(aMaxd.y()), static_cast(aMaxd.z())); + const NCollection_Vec3 aMin(static_cast(aMind.x()), + static_cast(aMind.y()), + static_cast(aMind.z())); + const NCollection_Vec3 aMax(static_cast(aMaxd.x()), + static_cast(aMaxd.y()), + static_cast(aMaxd.z())); const NCollection_Vec3 aVerts[16] = { NCollection_Vec3(aMin.x(), aMin.y(), aMin.z()), NCollection_Vec3(aMin.x(), aMin.y(), aMax.z()), @@ -675,13 +681,14 @@ void OpenGl_Structure::applyPersistence(const occ::handle& { // move anchor point to presentation location theCtx->ModelWorldState.Push(); - NCollection_Mat4& aModelWorld = theCtx->ModelWorldState.ChangeCurrent(); - gp_Pnt aStartPnt = theTrsfPers->AnchorPoint(); - NCollection_Vec4 anAnchorPoint = aModelWorld - * NCollection_Vec4(static_cast(aStartPnt.X()), - static_cast(aStartPnt.Y()), - static_cast(aStartPnt.Z()), - 1.0f); + NCollection_Mat4& aModelWorld = theCtx->ModelWorldState.ChangeCurrent(); + gp_Pnt aStartPnt = theTrsfPers->AnchorPoint(); + NCollection_Vec4 anAnchorPoint = + aModelWorld + * NCollection_Vec4(static_cast(aStartPnt.X()), + static_cast(aStartPnt.Y()), + static_cast(aStartPnt.Z()), + 1.0f); // clang-format off aModelWorld.SetColumn (3, NCollection_Vec4 (NCollection_Vec3 (0.0), 1.0)); // reset translation part // clang-format on diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Text.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Text.cxx index 59175268ade..defc792e9cb 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Text.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Text.cxx @@ -240,8 +240,12 @@ void OpenGl_Text::StringSize(const occ::handle& theCtx, theDescent = 0.0f; const TCollection_AsciiString aFontKey = FontKey(theTextAspect, static_cast(theHeight), theResolution, theFontHinting); - occ::handle aFont = - FindFont(theCtx, theTextAspect, static_cast(theHeight), theResolution, theFontHinting, aFontKey); + occ::handle aFont = FindFont(theCtx, + theTextAspect, + static_cast(theHeight), + theResolution, + theFontHinting, + aFontKey); if (aFont.IsNull() || !aFont->IsValid()) { return; @@ -540,7 +544,12 @@ TCollection_AsciiString OpenGl_Text::FontKey(const OpenGl_Aspects& theAspect, : THE_DEFAULT_FONT; char aSuff[64]; - Sprintf(aSuff, ":%d:%d:%d:%d", static_cast(anAspect), static_cast(theResolution), theHeight, static_cast(theFontHinting)); + Sprintf(aSuff, + ":%d:%d:%d:%d", + static_cast(anAspect), + static_cast(theResolution), + theHeight, + static_cast(theFontHinting)); return aFont + aSuff; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.cxx index 4615ae7c9af..f19f1358612 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.cxx @@ -351,7 +351,8 @@ bool OpenGl_Texture::Init(const occ::handle& theCtx, // clang-format on theCtx->core11fwd->glPixelStorei(GL_UNPACK_ALIGNMENT, anAligment); const GLint anExtraBytes = static_cast(theImage->RowExtraBytes()); - const GLint aPixelsWidth = static_cast(theImage->SizeRowBytes() / theImage->SizePixelBytes()); + const GLint aPixelsWidth = + static_cast(theImage->SizeRowBytes() / theImage->SizePixelBytes()); if (theCtx->hasUnpackRowLength) { theCtx->core11fwd->glPixelStorei(GL_UNPACK_ROW_LENGTH, @@ -1412,8 +1413,9 @@ bool OpenGl_Texture::InitCubeMap(const occ::handle& theCtx, const GLint anAligment = std::min(static_cast(anImage->MaxRowAligmentBytes()), 8); // OpenGL supports alignment upto 8 bytes // clang-format on const GLint anExtraBytes = static_cast(anImage->RowExtraBytes()); - const GLint aPixelsWidth = static_cast(anImage->SizeRowBytes() / anImage->SizePixelBytes()); - const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0; + const GLint aPixelsWidth = + static_cast(anImage->SizeRowBytes() / anImage->SizePixelBytes()); + const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0; if (theCtx->hasUnpackRowLength) { theCtx->core11fwd->glPixelStorei(GL_UNPACK_ROW_LENGTH, aRowLength); @@ -1477,8 +1479,8 @@ bool OpenGl_Texture::InitCubeMap(const occ::handle& theCtx, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, - TCollection_AsciiString("Error: cubemap side ") + static_cast(theSize) + "x" + static_cast(theSize) - + " IF: " + OpenGl_TextureFormat::FormatFormat(anIntFormat) + TCollection_AsciiString("Error: cubemap side ") + static_cast(theSize) + "x" + + static_cast(theSize) + " IF: " + OpenGl_TextureFormat::FormatFormat(anIntFormat) + " PF: " + OpenGl_TextureFormat::FormatFormat(aFormat.PixelFormat()) + " DT: " + OpenGl_TextureFormat::FormatDataType(aFormat.DataType()) + " can not be created with error " + OpenGl_Context::FormatGlError(anErr) + "."); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.cxx index 6d55ae9fd20..bc801ce9e85 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.cxx @@ -76,7 +76,9 @@ void OpenGl_TileSampler::GrabVarianceMap(const occ::handle& theC float& aTile = myVarianceMap.ChangeValue(aRowIter, aColIter); aTile = aFactor * static_cast(aRawValue); - aTile *= 1.0f / tileArea(static_cast(aColIter), static_cast(aRowIter)); // average error over the tile + aTile *= 1.0f + / tileArea(static_cast(aColIter), + static_cast(aRowIter)); // average error over the tile if (aRowIter != 0) { aTile += myVarianceMap.Value(aRowIter - 1, aColIter); @@ -162,7 +164,8 @@ void OpenGl_TileSampler::SetSize(const Graphic3d_RenderingParams& theParams, std::max(1, static_cast(ceilf(static_cast(theSize.x()) / aTileSize))); const int aNbTilesY = std::max(1, static_cast(ceilf(static_cast(theSize.y()) / aTileSize))); - if (myTileSize != aTileSize || static_cast(myTiles.SizeX) != aNbTilesX || static_cast(myTiles.SizeY) != aNbTilesY) + if (myTileSize != aTileSize || static_cast(myTiles.SizeX) != aNbTilesX + || static_cast(myTiles.SizeY) != aNbTilesY) { myTileSize = aTileSize; myScaleFactor = 1.0e6f * (1024.0f / static_cast(myTileSize * myTileSize)); @@ -194,7 +197,8 @@ void OpenGl_TileSampler::SetSize(const Graphic3d_RenderingParams& theParams, } // calculate a size of compact offsets texture optimal for rendering reduced number of tiles - int aNbShunkTilesX = static_cast(myTiles.SizeX), aNbShunkTilesY = static_cast(myTiles.SizeY); + int aNbShunkTilesX = static_cast(myTiles.SizeX), + aNbShunkTilesY = static_cast(myTiles.SizeY); if (theParams.NbRayTracingTiles > 0) { aNbShunkTilesX = 8; @@ -204,7 +208,8 @@ void OpenGl_TileSampler::SetSize(const Graphic3d_RenderingParams& theParams, (anIdx % 2 == 0 ? aNbShunkTilesX : aNbShunkTilesY) <<= 1; } } - if (static_cast(myOffsetsShrunk.SizeX) != aNbShunkTilesX || static_cast(myOffsetsShrunk.SizeY) != aNbShunkTilesY) + if (static_cast(myOffsetsShrunk.SizeX) != aNbShunkTilesX + || static_cast(myOffsetsShrunk.SizeY) != aNbShunkTilesY) { myOffsetsShrunk.SetTopDown(true); myOffsetsShrunk.Init(myTiles.Allocator(), aNbShunkTilesX, aNbShunkTilesY); @@ -244,7 +249,8 @@ bool OpenGl_TileSampler::upload(const occ::handle& theContext, { NCollection_Vec2& aRedirectTile = anOffsets.ChangeValue(aRowIter, aColIter); aRedirectTile = - theAdaptive ? nextTileToSample() : NCollection_Vec2(static_cast(aColIter), static_cast(aRowIter)); + theAdaptive ? nextTileToSample() + : NCollection_Vec2(static_cast(aColIter), static_cast(aRowIter)); myTiles.ChangeValue(aRedirectTile.y(), aRedirectTile.x()) += 1; } } @@ -263,7 +269,8 @@ bool OpenGl_TileSampler::upload(const occ::handle& theContext, for (size_t aColIter = 0; aColIter < myTiles.SizeX; ++aColIter) { myTileSamples.ChangeValue(aRowIter, aColIter) = - tileArea(static_cast(aColIter), static_cast(aRowIter)) * myTiles.Value(aRowIter, aColIter); + tileArea(static_cast(aColIter), static_cast(aRowIter)) + * myTiles.Value(aRowIter, aColIter); } } @@ -309,14 +316,15 @@ bool OpenGl_TileSampler::upload(const occ::handle& theContext, if (!theOffsetsTexture.IsNull()) { if (theOffsetsTexture->SizeX() != static_cast(anOffsets.SizeX) - || theOffsetsTexture->SizeY() != static_cast(anOffsets.SizeY) || !theOffsetsTexture->IsValid()) + || theOffsetsTexture->SizeY() != static_cast(anOffsets.SizeY) + || !theOffsetsTexture->IsValid()) { theOffsetsTexture->Release(theContext.get()); - if (!theOffsetsTexture->Init( - theContext, - OpenGl_TextureFormat::FindSizedFormat(theContext, GL_RG32I), - NCollection_Vec2(static_cast(anOffsets.SizeX), static_cast(anOffsets.SizeY)), - Graphic3d_TypeOfTexture_2D)) + if (!theOffsetsTexture->Init(theContext, + OpenGl_TextureFormat::FindSizedFormat(theContext, GL_RG32I), + NCollection_Vec2(static_cast(anOffsets.SizeX), + static_cast(anOffsets.SizeY)), + Graphic3d_TypeOfTexture_2D)) { hasErrors = true; } diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.hxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.hxx index f1198319058..22765e21937 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.hxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_TileSampler.hxx @@ -60,9 +60,10 @@ public: //! Number of tiles within offsets texture. NCollection_Vec2 NbOffsetTiles(bool theAdaptive) const { - return theAdaptive - ? NCollection_Vec2(static_cast(myOffsetsShrunk.SizeX), static_cast(myOffsetsShrunk.SizeY)) - : NCollection_Vec2(static_cast(myOffsets.SizeX), static_cast(myOffsets.SizeY)); + return theAdaptive ? NCollection_Vec2(static_cast(myOffsetsShrunk.SizeX), + static_cast(myOffsetsShrunk.SizeY)) + : NCollection_Vec2(static_cast(myOffsets.SizeX), + static_cast(myOffsets.SizeY)); } //! Maximum number of tiles within offsets texture. diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx index 50bb1005a1d..b1f1255442a 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_VertexBuffer.cxx @@ -44,8 +44,12 @@ void OpenGl_VertexBuffer::BindVertexAttrib(const occ::handle& th } Bind(theGlCtx); theGlCtx->core20fwd->glEnableVertexAttribArray(theAttribLoc); - theGlCtx->core20fwd - ->glVertexAttribPointer(theAttribLoc, static_cast(myComponentsNb), myDataType, GL_FALSE, 0, myOffset); + theGlCtx->core20fwd->glVertexAttribPointer(theAttribLoc, + static_cast(myComponentsNb), + myDataType, + GL_FALSE, + 0, + myOffset); } //================================================================================================= diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx index 4820d1b2674..bacaaa27bd8 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx @@ -456,8 +456,12 @@ static void SetMinMaxValuesCallback(Graphic3d_CView* theView) gp_Pnt aMin = aBox.CornerMin(); gp_Pnt aMax = aBox.CornerMax(); - NCollection_Vec3 aMinVec(static_cast(aMin.X()), static_cast(aMin.Y()), static_cast(aMin.Z())); - NCollection_Vec3 aMaxVec(static_cast(aMax.X()), static_cast(aMax.Y()), static_cast(aMax.Z())); + NCollection_Vec3 aMinVec(static_cast(aMin.X()), + static_cast(aMin.Y()), + static_cast(aMin.Z())); + NCollection_Vec3 aMaxVec(static_cast(aMax.X()), + static_cast(aMax.Y()), + static_cast(aMax.Z())); aView->GraduatedTrihedronMinMaxValues(aMinVec, aMaxVec); } } @@ -873,8 +877,12 @@ Bnd_Box OpenGl_View::MinMaxValues(const bool theToIncludeAuxiliary) const if (theToIncludeAuxiliary && myRenderParams.ToShowStats && !myWorkspace->GetGlContext()->arbDepthClamp) { - Bnd_Box aStatsBox(gp_Pnt(static_cast(myWindow->Width() / 2.0), static_cast(myWindow->Height() / 2.0), 0.0), - gp_Pnt(static_cast(myWindow->Width() / 2.0), static_cast(myWindow->Height() / 2.0), 0.0)); + Bnd_Box aStatsBox(gp_Pnt(static_cast(myWindow->Width() / 2.0), + static_cast(myWindow->Height() / 2.0), + 0.0), + gp_Pnt(static_cast(myWindow->Width() / 2.0), + static_cast(myWindow->Height() / 2.0), + 0.0)); myRenderParams.StatsPosition->Apply(myCamera, myCamera->ProjectionMatrix(), myCamera->OrientationMatrix(), @@ -1173,8 +1181,9 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj) aSizeY = myWindow->Height(); } - const NCollection_Vec2 aRendSize(static_cast(myRenderParams.RenderResolutionScale * aSizeX + 0.5f), - static_cast(myRenderParams.RenderResolutionScale * aSizeY + 0.5f)); + const NCollection_Vec2 aRendSize( + static_cast(myRenderParams.RenderResolutionScale * aSizeX + 0.5f), + static_cast(myRenderParams.RenderResolutionScale * aSizeY + 0.5f)); if (aSizeX < 1 || aSizeY < 1 || aRendSize.x() < 1 || aRendSize.y() < 1) { myBackBufferRestored = false; @@ -1655,7 +1664,8 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj) myShadowMaps->Resize(0, myLights->NbCastShadows() - 1, true); } - const GLint aSamplFrom = static_cast(aCtx->ShadowMapTexUnit()) - myLights->NbCastShadows() + 1; + const GLint aSamplFrom = + static_cast(aCtx->ShadowMapTexUnit()) - myLights->NbCastShadows() + 1; for (int aShadowIter = 0; aShadowIter < myShadowMaps->Size(); ++aShadowIter) { occ::handle& aShadow = myShadowMaps->ChangeValue(aShadowIter); @@ -3256,8 +3266,9 @@ void OpenGl_View::drawStereoPair(OpenGl_FrameBuffer* theDrawFbo) for (int anEyeIter = 0; anEyeIter < 2; ++anEyeIter) { OpenGl_FrameBuffer* anEyeFbo = aPair[anEyeIter]; - anEyeFbo->ColorTexture()->Bind(aCtx, - static_cast(Graphic3d_TextureUnit_0 + anEyeIter)); + anEyeFbo->ColorTexture()->Bind( + aCtx, + static_cast(Graphic3d_TextureUnit_0 + anEyeIter)); if (anEyeFbo->ColorTexture()->Sampler()->Parameters()->Filter() != Graphic3d_TOTF_BILINEAR) { // force filtering @@ -3404,11 +3415,12 @@ void OpenGl_View::updateSkydomeBg(const occ::handle& theCtx) theCtx->BindProgram(aProg); // Setup uniforms - aProg->SetUniform(theCtx, - "uSunDir", - NCollection_Vec3(static_cast(mySkydomeAspect.SunDirection().X()), - static_cast(mySkydomeAspect.SunDirection().Y()), - static_cast(mySkydomeAspect.SunDirection().Z()))); + aProg->SetUniform( + theCtx, + "uSunDir", + NCollection_Vec3(static_cast(mySkydomeAspect.SunDirection().X()), + static_cast(mySkydomeAspect.SunDirection().Y()), + static_cast(mySkydomeAspect.SunDirection().Z()))); aProg->SetUniform(theCtx, "uCloudy", mySkydomeAspect.Cloudiness()); aProg->SetUniform(theCtx, "uTime", mySkydomeAspect.TimeParameter()); aProg->SetUniform(theCtx, "uFog", mySkydomeAspect.Fogginess()); diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx index a00ba1af0ce..017ff0ee76c 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx @@ -2094,7 +2094,10 @@ void OpenGl_View::updateCamera(const NCollection_Mat4& theOrientation, { for (int aX = -1; aX <= 1; aX += 2) { - NCollection_Vec4 aOrigin(static_cast(aX), static_cast(aY), -1.0f, 1.0f); + NCollection_Vec4 aOrigin(static_cast(aX), + static_cast(aY), + -1.0f, + 1.0f); aOrigin = theUnview * aOrigin; @@ -2102,7 +2105,10 @@ void OpenGl_View::updateCamera(const NCollection_Mat4& theOrientation, aOrigin.y() = aOrigin.y() / aOrigin.w(); aOrigin.z() = aOrigin.z() / aOrigin.w(); - NCollection_Vec4 aDirect(static_cast(aX), static_cast(aY), 1.0f, 1.0f); + NCollection_Vec4 aDirect(static_cast(aX), + static_cast(aY), + 1.0f, + 1.0f); aDirect = theUnview * aDirect; @@ -2509,10 +2515,11 @@ bool OpenGl_View::uploadRaytraceData(const occ::handle& theGlCon if (myRaytraceGeometry.Materials.size() != 0) { - aResult &= myRaytraceMaterialTexture->Init(theGlContext, - 4, - static_cast(myRaytraceGeometry.Materials.size() * 19), - myRaytraceGeometry.Materials.front().Packed()); + aResult &= myRaytraceMaterialTexture->Init( + theGlContext, + 4, + static_cast(myRaytraceGeometry.Materials.size() * 19), + myRaytraceGeometry.Materials.front().Packed()); if (!aResult) { @@ -2675,10 +2682,11 @@ bool OpenGl_View::updateRaytraceLightSources(const NCollection_Mat4& if (myRaytraceGeometry.Sources.size() != 0 && wasUpdated) { const GLfloat* aDataPtr = myRaytraceGeometry.Sources.front().Packed(); - if (!myRaytraceLightSrcTexture->Init(theGlContext, - 4, - static_cast(myRaytraceGeometry.Sources.size() * 2), - aDataPtr)) + if (!myRaytraceLightSrcTexture->Init( + theGlContext, + 4, + static_cast(myRaytraceGeometry.Sources.size() * 2), + aDataPtr)) { Message::SendTrace() << "Error: Failed to upload light source buffer"; return false; diff --git a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Window.cxx b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Window.cxx index 9f49874c65c..50944cab6cd 100644 --- a/src/Visualization/TKOpenGl/OpenGl/OpenGl_Window.cxx +++ b/src/Visualization/TKOpenGl/OpenGl/OpenGl_Window.cxx @@ -601,10 +601,12 @@ void OpenGl_Window::Init(const occ::handle& theDriver, (Aspect_RenderingContext)aGContext, isCoreProfile); #elif defined(HAVE_XLIB) - Window aWindow = static_cast(myPlatformWindow->NativeHandle()); - Display* aDisp = reinterpret_cast(theDriver->GetDisplayConnection()->GetDisplayAspect()); + Window aWindow = static_cast(myPlatformWindow->NativeHandle()); + Display* aDisp = + reinterpret_cast(theDriver->GetDisplayConnection()->GetDisplayAspect()); GLXContext aGContext = static_cast(theGContext); - GLXContext aSlaveCtx = !theShareCtx.IsNull() ? static_cast(theShareCtx->myGContext) : nullptr; + GLXContext aSlaveCtx = + !theShareCtx.IsNull() ? static_cast(theShareCtx->myGContext) : nullptr; XWindowAttributes aWinAttribs; XGetWindowAttributes(aDisp, aWindow, &aWinAttribs); @@ -644,8 +646,8 @@ void OpenGl_Window::Init(const occ::handle& theDriver, GLXContext share_context, Bool direct, const int* attrib_list); - glXCreateContextAttribsARB_t aCreateCtxProc = - reinterpret_cast(glXGetProcAddress(reinterpret_cast("glXCreateContextAttribsARB"))); + glXCreateContextAttribsARB_t aCreateCtxProc = reinterpret_cast( + glXGetProcAddress(reinterpret_cast("glXCreateContextAttribsARB"))); if (!theCaps->contextCompatible) { int aCoreCtxAttribs[] = {GLX_CONTEXT_MAJOR_VERSION_ARB, diff --git a/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.cxx b/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.cxx index 26f746f4884..6e25c3f164c 100644 --- a/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.cxx +++ b/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.cxx @@ -104,8 +104,9 @@ void Aspect_DisplayConnection::Init(Aspect_XDisplay* theDisplay) myIsOwnDisplay = false; myAtoms.Clear(); - myDisplay = - theDisplay != nullptr ? theDisplay : reinterpret_cast(XOpenDisplay(myDisplayName.ToCString())); + myDisplay = theDisplay != nullptr + ? theDisplay + : reinterpret_cast(XOpenDisplay(myDisplayName.ToCString())); if (myDisplay == nullptr) { TCollection_AsciiString aMessage; @@ -117,7 +118,8 @@ void Aspect_DisplayConnection::Init(Aspect_XDisplay* theDisplay) { myIsOwnDisplay = theDisplay == nullptr; myAtoms.Bind(Aspect_XA_DELETE_WINDOW, - static_cast(XInternAtom(reinterpret_cast(myDisplay), "WM_DELETE_WINDOW", False))); + static_cast( + XInternAtom(reinterpret_cast(myDisplay), "WM_DELETE_WINDOW", False))); } #else myDisplay = theDisplay; diff --git a/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.hxx b/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.hxx index 699c889abe6..9e4e1a1a27a 100644 --- a/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_DisplayConnection.hxx @@ -99,7 +99,10 @@ public: Display* GetDisplay() { return reinterpret_cast(myDisplay); } //! Return default window visual or NULL when undefined. - XVisualInfo* GetDefaultVisualInfoX() const { return reinterpret_cast(myDefVisualInfo); } + XVisualInfo* GetDefaultVisualInfoX() const + { + return reinterpret_cast(myDefVisualInfo); + } //! Set default window visual; the visual will be deallocated using XFree(). void SetDefaultVisualInfo(XVisualInfo* theVisual, Aspect_FBConfig theFBConfig) diff --git a/src/Visualization/TKService/Aspect/Aspect_NeutralWindow.hxx b/src/Visualization/TKService/Aspect/Aspect_NeutralWindow.hxx index 9aa9b229bfb..0b8943308e5 100644 --- a/src/Visualization/TKService/Aspect/Aspect_NeutralWindow.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_NeutralWindow.hxx @@ -69,7 +69,9 @@ public: //! Returns window ratio equal to the physical width/height dimensions. double Ratio() const override { - return (myWidth != 0 && myHeight != 0) ? static_cast(myWidth) / static_cast(myHeight) : 1.0; + return (myWidth != 0 && myHeight != 0) + ? static_cast(myWidth) / static_cast(myHeight) + : 1.0; } //! Return the window position. diff --git a/src/Visualization/TKService/Font/Font_FTFont.cxx b/src/Visualization/TKService/Font/Font_FTFont.cxx index c5b4cff6805..58f101151fa 100644 --- a/src/Visualization/TKService/Font/Font_FTFont.cxx +++ b/src/Visualization/TKService/Font/Font_FTFont.cxx @@ -139,7 +139,10 @@ bool Font_FTFont::Init(const occ::handle& theData, } else { - if (FT_New_Face(myFTLib->Instance(), myFontPath.ToCString(), static_cast(theFaceId), &myFTFace) + if (FT_New_Face(myFTLib->Instance(), + myFontPath.ToCString(), + static_cast(theFaceId), + &myFTFace) != 0) { // Message::SendTrace (TCollection_AsciiString("Font '") + myFontPath + "' failed to load from @@ -391,7 +394,8 @@ bool Font_FTFont::RenderGlyph(const char32_t theUChar) } if (theUChar == 0 - || FT_Load_Char(myActiveFTFace, theUChar, static_cast(myLoadFlags | FT_LOAD_RENDER)) != 0 + || FT_Load_Char(myActiveFTFace, theUChar, static_cast(myLoadFlags | FT_LOAD_RENDER)) + != 0 || myActiveFTFace->glyph == nullptr || myActiveFTFace->glyph->format != FT_GLYPH_FORMAT_BITMAP) { @@ -457,7 +461,8 @@ unsigned int Font_FTFont::GlyphMaxSizeX(bool theToIncludeFallback) const { float aWidth = (FT_IS_SCALABLE(myFTFace) != 0) ? static_cast(myFTFace->bbox.xMax - myFTFace->bbox.xMin) - * (static_cast(myFTFace->size->metrics.x_ppem) / static_cast(myFTFace->units_per_EM)) + * (static_cast(myFTFace->size->metrics.x_ppem) + / static_cast(myFTFace->units_per_EM)) : fromFTPoints(myFTFace->size->metrics.max_advance); return static_cast(aWidth + 0.5f); } @@ -489,7 +494,8 @@ unsigned int Font_FTFont::GlyphMaxSizeY(bool theToIncludeFallback) const { float aHeight = (FT_IS_SCALABLE(myFTFace) != 0) ? static_cast(myFTFace->bbox.yMax - myFTFace->bbox.yMin) - * (static_cast(myFTFace->size->metrics.y_ppem) / static_cast(myFTFace->units_per_EM)) + * (static_cast(myFTFace->size->metrics.y_ppem) + / static_cast(myFTFace->units_per_EM)) : fromFTPoints(myFTFace->size->metrics.height); return static_cast(aHeight + 0.5f); } @@ -518,7 +524,8 @@ float Font_FTFont::Ascender() const { #ifdef HAVE_FREETYPE return static_cast(myFTFace->ascender) - * (static_cast(myFTFace->size->metrics.y_ppem) / static_cast(myFTFace->units_per_EM)); + * (static_cast(myFTFace->size->metrics.y_ppem) + / static_cast(myFTFace->units_per_EM)); #else return 0.0f; #endif @@ -530,7 +537,8 @@ float Font_FTFont::Descender() const { #ifdef HAVE_FREETYPE return static_cast(myFTFace->descender) - * (static_cast(myFTFace->size->metrics.y_ppem) / static_cast(myFTFace->units_per_EM)); + * (static_cast(myFTFace->size->metrics.y_ppem) + / static_cast(myFTFace->units_per_EM)); #else return 0.0f; #endif @@ -542,7 +550,8 @@ float Font_FTFont::LineSpacing() const { #ifdef HAVE_FREETYPE return static_cast(myFTFace->height) - * (static_cast(myFTFace->size->metrics.y_ppem) / static_cast(myFTFace->units_per_EM)); + * (static_cast(myFTFace->size->metrics.y_ppem) + / static_cast(myFTFace->units_per_EM)); #else return 0.0f; #endif @@ -664,8 +673,10 @@ void Font_FTFont::GlyphRect(Font_Rect& theRect) const const FT_Bitmap& aBitmap = myActiveFTFace->glyph->bitmap; theRect.Left = static_cast(myActiveFTFace->glyph->bitmap_left); theRect.Top = static_cast(myActiveFTFace->glyph->bitmap_top); - theRect.Right = static_cast(myActiveFTFace->glyph->bitmap_left + static_cast(aBitmap.width)); - theRect.Bottom = static_cast(myActiveFTFace->glyph->bitmap_top - static_cast(aBitmap.rows)); + theRect.Right = + static_cast(myActiveFTFace->glyph->bitmap_left + static_cast(aBitmap.width)); + theRect.Bottom = + static_cast(myActiveFTFace->glyph->bitmap_top - static_cast(aBitmap.rows)); #else (void)theRect; #endif diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx index 44b0bcc01b0..874ec922fec 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx @@ -356,7 +356,10 @@ public: //! @param[in] theVertex 3D coordinates void SetVertice(const int theIndex, const gp_Pnt& theVertex) { - SetVertice(theIndex, static_cast(theVertex.X()), static_cast(theVertex.Y()), static_cast(theVertex.Z())); + SetVertice(theIndex, + static_cast(theVertex.X()), + static_cast(theVertex.Y()), + static_cast(theVertex.Z())); } //! Change the vertice in the array. @@ -436,7 +439,8 @@ public: "BAD VERTEX index"); if (myColData != nullptr) { - *reinterpret_cast(myColData + myColStride * (static_cast(theIndex) - 1)) = theColor32; + *reinterpret_cast(myColData + myColStride * (static_cast(theIndex) - 1)) = + theColor32; } } @@ -576,7 +580,8 @@ public: "BAD VERTEX index"); if (myColData != nullptr) { - theColor = *reinterpret_cast(myColData + myColStride * (static_cast(theRank) - 1)); + theColor = + *reinterpret_cast(myColData + myColStride * (static_cast(theRank) - 1)); } } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Buffer.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Buffer.hxx index 63ddaf63e45..11e3a71cb91 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Buffer.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Buffer.hxx @@ -101,7 +101,10 @@ public: //! Return number of initially allocated elements which can fit into this buffer, //! while NbElements can be overwritten to smaller value. - int NbMaxElements() const { return Stride != 0 ? static_cast(mySize / static_cast(Stride)) : 0; } + int NbMaxElements() const + { + return Stride != 0 ? static_cast(mySize / static_cast(Stride)) : 0; + } //! @return array of attributes definitions const Graphic3d_Attribute* AttributesArray() const @@ -160,10 +163,16 @@ public: uint8_t* ChangeData(const int theAttribIndex) { return myData + AttributeOffset(theAttribIndex); } //! Access specified element. - inline const uint8_t* value(const int theElem) const { return myData + Stride * static_cast(theElem); } + inline const uint8_t* value(const int theElem) const + { + return myData + Stride * static_cast(theElem); + } //! Access specified element. - inline uint8_t* changeValue(const int theElem) { return myData + Stride * static_cast(theElem); } + inline uint8_t* changeValue(const int theElem) + { + return myData + Stride * static_cast(theElem); + } //! Access element with specified position and type. template diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStats.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStats.cxx index e5ad104ee47..767abac67c2 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStats.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_FrameStats.cxx @@ -794,7 +794,8 @@ void Graphic3d_FrameStats::FrameEnd(const occ::handle& theView, <= Graphic3d_FrameStatsCounter_RENDERED_UPPER; ++aCntIter) { - myCountersTmp.ChangeCounterValue(static_cast(aCntIter + anImmShift)) = + myCountersTmp.ChangeCounterValue( + static_cast(aCntIter + anImmShift)) = myCountersTmp.CounterValue(static_cast(aCntIter)); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx index 5e299a6519b..3439df28e6a 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_HatchStyle.cxx @@ -117,8 +117,9 @@ const uint8_t* Graphic3d_HatchStyle::Pattern() const { return !myPattern.IsNull() ? myPattern->Data() - : (myHatchType < Aspect_HS_NB ? reinterpret_cast(myPredefinedPatterns[myHatchType]) - : nullptr); + : (myHatchType < Aspect_HS_NB + ? reinterpret_cast(myPredefinedPatterns[myHatchType]) + : nullptr); } //================================================================================================= diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx index c92f61f6f5a..9f3411518fe 100755 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_MarkerImage.cxx @@ -54,7 +54,7 @@ static void getMarkerBitMapParam(const Aspect_TypeOfMarker theMarkerType, int& theOffset, int& theNumOfBytes) { - const int aType = static_cast(theMarkerType > Aspect_TOM_O ? Aspect_TOM_O : theMarkerType); + const int aType = static_cast(theMarkerType > Aspect_TOM_O ? Aspect_TOM_O : theMarkerType); const double anIndex = static_cast(TEL_NO_OF_SIZES - 1) * (theScale - TEL_PM_START_SIZE) / (TEL_PM_END_SIZE - TEL_PM_START_SIZE); int anId = static_cast(anIndex + 0.5); @@ -266,10 +266,11 @@ occ::handle> Graphic3d_MarkerImage::GetBitMapArray( return myBitMap; } - const int aNumOfBytesInRow = static_cast(myImage->Width() / 8) + (myImage->Width() % 8 ? 1 : 0); - const int aNumOfBytes = static_cast(aNumOfBytesInRow * myImage->Height()); - const int aHeight = static_cast(myImage->Height()); - const int aWidth = static_cast(myImage->Width()); + const int aNumOfBytesInRow = + static_cast(myImage->Width() / 8) + (myImage->Width() % 8 ? 1 : 0); + const int aNumOfBytes = static_cast(aNumOfBytesInRow * myImage->Height()); + const int aHeight = static_cast(myImage->Height()); + const int aWidth = static_cast(myImage->Width()); occ::handle> aBitMap = new NCollection_HArray1(0, aNumOfBytes - 1); aBitMap->Init(0); @@ -359,8 +360,9 @@ const occ::handle& Graphic3d_MarkerImage::GetImageAlpha() uint8_t* anImageRow = myImageAlpha->ChangeRow(aRowIter); for (size_t aColumnIter = 0; aColumnIter < myImage->Width(); aColumnIter++) { - const Quantity_ColorRGBA aColor = myImage->PixelColor(static_cast(aColumnIter), static_cast(aRowIter)); - anImageRow[aColumnIter] = static_cast(255.0 * aColor.Alpha()); + const Quantity_ColorRGBA aColor = + myImage->PixelColor(static_cast(aColumnIter), static_cast(aRowIter)); + anImageRow[aColumnIter] = static_cast(255.0 * aColor.Alpha()); } } } @@ -432,7 +434,7 @@ occ::handle Graphic3d_MarkerImage::StandardMarker( if (theMarkerType == Aspect_TOM_O_POINT) { // draw inner point as filled rectangle - const int aSize = theScale > 7 ? 7 : static_cast(theScale + 0.5F); + const int aSize = theScale > 7 ? 7 : static_cast(theScale + 0.5F); occ::handle> aBitMap = fillPointBitmap(aSize); aMarkerImage2 = new Graphic3d_MarkerImage(aBitMap, aSize, aSize); } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_MediaTexture.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_MediaTexture.cxx index 3ed5eed5d4d..a593040b135 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_MediaTexture.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_MediaTexture.cxx @@ -46,7 +46,8 @@ Graphic3d_MediaTexture::Graphic3d_MediaTexture(std::mutex& theMutex, int thePlan myParams->SetModulate(false); myParams->SetRepeat(false); myParams->SetFilter(Graphic3d_TOTF_BILINEAR); - myParams->SetTextureUnit(Graphic3d_TextureUnit(static_cast(Graphic3d_TextureUnit_0) + thePlane)); + myParams->SetTextureUnit( + Graphic3d_TextureUnit(static_cast(Graphic3d_TextureUnit_0) + thePlane)); } //================================================================================================= diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.cxx index a0df2bf5cee..5d1d8dbc7c0 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_PBRMaterial.cxx @@ -220,7 +220,8 @@ void Graphic3d_PBRMaterial::GenerateEnvLUT(const occ::handle& theL float Graphic3d_PBRMaterial::SpecIBLMapSamplesFactor(float theProbability, float theRoughness) { - return acosf(lutGenImportanceSampleCosTheta(theProbability, theRoughness)) * 2.f / static_cast(M_PI); + return acosf(lutGenImportanceSampleCosTheta(theProbability, theRoughness)) * 2.f + / static_cast(M_PI); } //================================================================================================= diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx index 860b402a1be..d639277ad8e 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.cxx @@ -122,8 +122,9 @@ occ::handle Graphic3d_ShaderObject::CreateFromSource( { const ShaderVariable& aVar = aVarListIter.Value(); int aStageLower = IntegerLast(), aStageUpper = IntegerFirst(); - for (int aStageIter = Graphic3d_TOS_VERTEX; aStageIter <= static_cast(Graphic3d_TOS_COMPUTE); - aStageIter = aStageIter << 1) + for (int aStageIter = Graphic3d_TOS_VERTEX; + aStageIter <= static_cast(Graphic3d_TOS_COMPUTE); + aStageIter = aStageIter << 1) { if ((aVar.Stages & aStageIter) != 0) { diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.cxx index b3aae1506cd..731c0d75893 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Structure.cxx @@ -724,12 +724,13 @@ void Graphic3d_Structure::getBox(Graphic3d_BndBox3d& theBox, Graphic3d_BndBox4f aBoxF = minMaxCoord(); if (aBoxF.IsValid()) { - theBox = Graphic3d_BndBox3d(NCollection_Vec3(static_cast(aBoxF.CornerMin().x()), - static_cast(aBoxF.CornerMin().y()), - static_cast(aBoxF.CornerMin().z())), - NCollection_Vec3(static_cast(aBoxF.CornerMax().x()), - static_cast(aBoxF.CornerMax().y()), - static_cast(aBoxF.CornerMax().z()))); + theBox = + Graphic3d_BndBox3d(NCollection_Vec3(static_cast(aBoxF.CornerMin().x()), + static_cast(aBoxF.CornerMin().y()), + static_cast(aBoxF.CornerMin().z())), + NCollection_Vec3(static_cast(aBoxF.CornerMax().x()), + static_cast(aBoxF.CornerMax().y()), + static_cast(aBoxF.CornerMax().z()))); if (IsInfinite() && !theToIgnoreInfiniteFlag) { const NCollection_Vec3 aDiagVec = theBox.CornerMax() - theBox.CornerMin(); diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_Texture3D.cxx b/src/Visualization/TKService/Graphic3d/Graphic3d_Texture3D.cxx index 5abb4d60a24..39c7bde5d09 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_Texture3D.cxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_Texture3D.cxx @@ -96,8 +96,8 @@ occ::handle Graphic3d_Texture3D::GetImage( anImage->SizeRowBytes())) { Message::SendFail() << "Graphic3d_Texture3D::GetImage() failed to allocate 3D image " - << static_cast(anImage->SizeX()) << "x" << static_cast(anImage->SizeY()) << "x" - << aNbSlices; + << static_cast(anImage->SizeX()) << "x" + << static_cast(anImage->SizeY()) << "x" << aNbSlices; return occ::handle(); } } diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_TextureSetBits.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_TextureSetBits.hxx index 9d26eac30b9..1fdbf367231 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_TextureSetBits.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_TextureSetBits.hxx @@ -19,11 +19,15 @@ //! Standard texture units combination bits. enum Graphic3d_TextureSetBits { - Graphic3d_TextureSetBits_NONE = 0, - Graphic3d_TextureSetBits_BaseColor = static_cast(1 << static_cast(Graphic3d_TextureUnit_BaseColor)), - Graphic3d_TextureSetBits_Emissive = static_cast(1 << static_cast(Graphic3d_TextureUnit_Emissive)), - Graphic3d_TextureSetBits_Occlusion = static_cast(1 << static_cast(Graphic3d_TextureUnit_Occlusion)), - Graphic3d_TextureSetBits_Normal = static_cast(1 << static_cast(Graphic3d_TextureUnit_Normal)), + Graphic3d_TextureSetBits_NONE = 0, + Graphic3d_TextureSetBits_BaseColor = + static_cast(1 << static_cast(Graphic3d_TextureUnit_BaseColor)), + Graphic3d_TextureSetBits_Emissive = + static_cast(1 << static_cast(Graphic3d_TextureUnit_Emissive)), + Graphic3d_TextureSetBits_Occlusion = + static_cast(1 << static_cast(Graphic3d_TextureUnit_Occlusion)), + Graphic3d_TextureSetBits_Normal = + static_cast(1 << static_cast(Graphic3d_TextureUnit_Normal)), Graphic3d_TextureSetBits_MetallicRoughness = static_cast(1 << static_cast(Graphic3d_TextureUnit_MetallicRoughness)), }; diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_TransformPers.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_TransformPers.hxx index e9b57946cd5..91cb1b620f4 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_TransformPers.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_TransformPers.hxx @@ -406,8 +406,9 @@ public: aProxyCamera->Center().XYZ() + aForward.XYZ() * (aFocus - aProxyCamera->Distance()); if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0) { - const double anOffsetX = (static_cast(myParams.Params2d.OffsetX) + aJitterComp) * aScale; - const gp_Dir aSide = aForward.Crossed(aProxyCamera->Up()); + const double anOffsetX = + (static_cast(myParams.Params2d.OffsetX) + aJitterComp) * aScale; + const gp_Dir aSide = aForward.Crossed(aProxyCamera->Up()); const gp_XYZ aDeltaX = aSide.XYZ() * (std::abs(aViewDim.X()) * aProxyCamera->NDC2dOffsetX() - anOffsetX); if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0) @@ -421,7 +422,8 @@ public: } if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0) { - const double anOffsetY = (static_cast(myParams.Params2d.OffsetY) + aJitterComp) * aScale; + const double anOffsetY = + (static_cast(myParams.Params2d.OffsetY) + aJitterComp) * aScale; const gp_XYZ aDeltaY = aProxyCamera->Up().XYZ() * (std::abs(aViewDim.Y()) * aProxyCamera->NDC2dOffsetY() - anOffsetY); diff --git a/src/Visualization/TKService/Image/Image_DDSParser.cxx b/src/Visualization/TKService/Image/Image_DDSParser.cxx index 89beea78b02..674a03d00ad 100644 --- a/src/Visualization/TKService/Image/Image_DDSParser.cxx +++ b/src/Visualization/TKService/Image/Image_DDSParser.cxx @@ -91,7 +91,8 @@ occ::handle Image_DDSParser::Load( return occ::handle(); } - occ::handle aDef = parseHeader(*reinterpret_cast(aHeader + 4)); + occ::handle aDef = + parseHeader(*reinterpret_cast(aHeader + 4)); if (aDef.IsNull()) { return occ::handle(); diff --git a/src/Visualization/TKService/Image/Image_Diff.cxx b/src/Visualization/TKService/Image/Image_Diff.cxx index 9949d4750af..6491119a9ef 100644 --- a/src/Visualization/TKService/Image/Image_Diff.cxx +++ b/src/Visualization/TKService/Image/Image_Diff.cxx @@ -53,8 +53,9 @@ static bool isBlackPixel(const Image_PixMap& theData, size_t theY, size_t theX) return aColor[0] == 0 && aColor[1] == 0 && aColor[2] == 0; } default: { - const Quantity_ColorRGBA aPixelRgba = theData.PixelColor(static_cast(theY), static_cast(theX)); - const NCollection_Vec4& aPixel = aPixelRgba; + const Quantity_ColorRGBA aPixelRgba = + theData.PixelColor(static_cast(theY), static_cast(theX)); + const NCollection_Vec4& aPixel = aPixelRgba; return aPixel.r() == 0.0f && aPixel.g() == 0.0f && aPixel.b() == 0.0f; } } @@ -187,11 +188,12 @@ int Image_Diff::Compare() // compute Chebyshev distance between two colors const uint8_t* aColorRef = myImageRef->RawValue(aRow, aCol); const uint8_t* aColorNew = myImageNew->RawValue(aRow, aCol); - const int aDiff = NCollection_Vec3(static_cast(aColorRef[0]) - static_cast(aColorNew[0]), - static_cast(aColorRef[1]) - static_cast(aColorNew[1]), - static_cast(aColorRef[2]) - static_cast(aColorNew[2])) - .cwiseAbs() - .maxComp(); + const int aDiff = + NCollection_Vec3(static_cast(aColorRef[0]) - static_cast(aColorNew[0]), + static_cast(aColorRef[1]) - static_cast(aColorNew[1]), + static_cast(aColorRef[2]) - static_cast(aColorNew[2])) + .cwiseAbs() + .maxComp(); if (aDiff > aDiffThreshold) { myDiffPixels.Append(PackXY(static_cast(aCol), static_cast(aRow))); @@ -210,11 +212,13 @@ int Image_Diff::Compare() for (size_t aCol = 0; aCol < myImageRef->SizeX(); ++aCol) { // compute Chebyshev distance between two colors - const Quantity_ColorRGBA aPixel1Rgba = myImageRef->PixelColor(static_cast(aCol), static_cast(aRow)); - const Quantity_ColorRGBA aPixel2Rgba = myImageNew->PixelColor(static_cast(aCol), static_cast(aRow)); - const NCollection_Vec3& aPixel1 = aPixel1Rgba.GetRGB(); - const NCollection_Vec3& aPixel2 = aPixel2Rgba.GetRGB(); - const float aDiff = (aPixel2 - aPixel1).cwiseAbs().maxComp(); + const Quantity_ColorRGBA aPixel1Rgba = + myImageRef->PixelColor(static_cast(aCol), static_cast(aRow)); + const Quantity_ColorRGBA aPixel2Rgba = + myImageNew->PixelColor(static_cast(aCol), static_cast(aRow)); + const NCollection_Vec3& aPixel1 = aPixel1Rgba.GetRGB(); + const NCollection_Vec3& aPixel2 = aPixel2Rgba.GetRGB(); + const float aDiff = (aPixel2 - aPixel1).cwiseAbs().maxComp(); if (aDiff > aDiffThreshold) { myDiffPixels.Append(PackXY(static_cast(aCol), static_cast(aRow))); @@ -474,9 +478,11 @@ int Image_Diff::ignoreBorderEffect() { int anX = UnpackX(aDiffPixel) + Image_Diff_NEIGHBOR_PIXELS[aNgbrIter][0]; int anY = UnpackY(aDiffPixel) + Image_Diff_NEIGHBOR_PIXELS[aNgbrIter][1]; - if (static_cast(anX) < myImageRef->SizeX() // this unsigned math checks size_t(-1) at-once + if (static_cast(anX) + < myImageRef->SizeX() // this unsigned math checks size_t(-1) at-once && static_cast(anY) < myImageRef->SizeY() - && aGroup->Map().Contains(PackXY(static_cast(anX), static_cast(anY)))) + && aGroup->Map().Contains( + PackXY(static_cast(anX), static_cast(anY)))) { ++aNeighboursNb; } @@ -500,7 +506,8 @@ int Image_Diff::ignoreBorderEffect() { int anX = UnpackX(aDiffPixel) + Image_Diff_NEIGHBOR_PIXELS[aNgbrIter][0]; int anY = UnpackY(aDiffPixel) + Image_Diff_NEIGHBOR_PIXELS[aNgbrIter][1]; - if (static_cast(anX) < myImageRef->SizeX() // this unsigned math checks size_t(-1) at-once + if (static_cast(anX) + < myImageRef->SizeX() // this unsigned math checks size_t(-1) at-once && static_cast(anY) < myImageRef->SizeY() && !isBlackPixel(*myImageRef, static_cast(anY), static_cast(anX))) { diff --git a/src/Visualization/TKService/Image/Image_Diff.hxx b/src/Visualization/TKService/Image/Image_Diff.hxx index d51b12764b0..611db66cb02 100644 --- a/src/Visualization/TKService/Image/Image_Diff.hxx +++ b/src/Visualization/TKService/Image/Image_Diff.hxx @@ -119,7 +119,8 @@ protected: //! Map two pixel coordinates to 32-bit integer static int PackXY(uint16_t theX, uint16_t theY) { - return static_cast(static_cast(theY) | (static_cast(theX) << 16)); + return static_cast(static_cast(theY) + | (static_cast(theX) << 16)); } //! Get pixel X coordinate from 32-bit packed integer @@ -129,7 +130,10 @@ protected: } //! Get pixel Y coordinate from 32-bit packed integer - static uint16_t UnpackY(int theXY) { return static_cast(static_cast(theXY) & 0xffff); } + static uint16_t UnpackY(int theXY) + { + return static_cast(static_cast(theXY) & 0xffff); + } protected: occ::handle myImageRef; //!< reference image to compare (from) diff --git a/src/Visualization/TKService/Image/Image_PixMap.cxx b/src/Visualization/TKService/Image/Image_PixMap.cxx index 43ef73e3763..720c8fdd4bf 100644 --- a/src/Visualization/TKService/Image/Image_PixMap.cxx +++ b/src/Visualization/TKService/Image/Image_PixMap.cxx @@ -361,81 +361,87 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel(const uint8_t* theRawValu } case Image_Format_RGBA: { const Image_ColorRGBA& aPixel = *reinterpret_cast(theRawValue); - return theToLinearize - ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), - static_cast(aPixel.a()) / 255.0f) - : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, - static_cast(aPixel.g()) / 255.0f, - static_cast(aPixel.b()) / 255.0f, - static_cast(aPixel.a()) / 255.0f); + return theToLinearize ? Quantity_ColorRGBA(Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.b()) / 255.0f), + static_cast(aPixel.a()) / 255.0f) + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, + static_cast(aPixel.a()) / 255.0f); } case Image_Format_BGRA: { const Image_ColorBGRA& aPixel = *reinterpret_cast(theRawValue); - return theToLinearize - ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), - static_cast(aPixel.a()) / 255.0f) - : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, - static_cast(aPixel.g()) / 255.0f, - static_cast(aPixel.b()) / 255.0f, - static_cast(aPixel.a()) / 255.0f); + return theToLinearize ? Quantity_ColorRGBA(Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.b()) / 255.0f), + static_cast(aPixel.a()) / 255.0f) + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, + static_cast(aPixel.a()) / 255.0f); } case Image_Format_RGB32: { const Image_ColorRGB32& aPixel = *reinterpret_cast(theRawValue); - return theToLinearize - ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), - 1.0f) - : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, - static_cast(aPixel.g()) / 255.0f, - static_cast(aPixel.b()) / 255.0f, - 1.0f); + return theToLinearize ? Quantity_ColorRGBA(Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.b()) / 255.0f), + 1.0f) + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, + 1.0f); } case Image_Format_BGR32: { const Image_ColorBGR32& aPixel = *reinterpret_cast(theRawValue); - return theToLinearize - ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), - 1.0f) - : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, - static_cast(aPixel.g()) / 255.0f, - static_cast(aPixel.b()) / 255.0f, - 1.0f); + return theToLinearize ? Quantity_ColorRGBA(Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.b()) / 255.0f), + 1.0f) + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, + 1.0f); } case Image_Format_RGB: { const Image_ColorRGB& aPixel = *reinterpret_cast(theRawValue); - return theToLinearize - ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), - 1.0f) - : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, - static_cast(aPixel.g()) / 255.0f, - static_cast(aPixel.b()) / 255.0f, - 1.0f); + return theToLinearize ? Quantity_ColorRGBA(Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.b()) / 255.0f), + 1.0f) + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, + 1.0f); } case Image_Format_BGR: { const Image_ColorBGR& aPixel = *reinterpret_cast(theRawValue); - return theToLinearize - ? Quantity_ColorRGBA( - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.r()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.g()) / 255.0f), - Quantity_Color::Convert_sRGB_To_LinearRGB(static_cast(aPixel.b()) / 255.0f), - 1.0f) - : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, - static_cast(aPixel.g()) / 255.0f, - static_cast(aPixel.b()) / 255.0f, - 1.0f); + return theToLinearize ? Quantity_ColorRGBA(Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.r()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.g()) / 255.0f), + Quantity_Color::Convert_sRGB_To_LinearRGB( + static_cast(aPixel.b()) / 255.0f), + 1.0f) + : Quantity_ColorRGBA(static_cast(aPixel.r()) / 255.0f, + static_cast(aPixel.g()) / 255.0f, + static_cast(aPixel.b()) / 255.0f, + 1.0f); } case Image_Format_Gray: { const uint8_t& aPixel = *reinterpret_cast(theRawValue); diff --git a/src/Visualization/TKService/Image/Image_PixMap.hxx b/src/Visualization/TKService/Image/Image_PixMap.hxx index 97f43171fa3..0a298d36dbf 100644 --- a/src/Visualization/TKService/Image/Image_PixMap.hxx +++ b/src/Visualization/TKService/Image/Image_PixMap.hxx @@ -122,7 +122,10 @@ public: // high-level API } //! Return width / height. - double Ratio() const { return (SizeY() > 0) ? (static_cast(SizeX()) / static_cast(SizeY())) : 1.0; } + double Ratio() const + { + return (SizeY() > 0) ? (static_cast(SizeX()) / static_cast(SizeY())) : 1.0; + } //! Return true if data is NULL. bool IsEmpty() const { return myData.IsEmpty(); } @@ -143,7 +146,8 @@ public: // high-level API //! @return the pixel color Quantity_ColorRGBA PixelColor(int theX, int theY, bool theToLinearize = false) const { - if (IsEmpty() || theX < 0 || static_cast(theX) >= SizeX() || theY < 0 || static_cast(theY) >= SizeY()) + if (IsEmpty() || theX < 0 || static_cast(theX) >= SizeX() || theY < 0 + || static_cast(theY) >= SizeY()) { return Quantity_ColorRGBA(0.0f, 0.0f, 0.0f, 0.0f); // transparent } @@ -181,7 +185,8 @@ public: // high-level API const Quantity_ColorRGBA& theColor, const bool theToDeLinearize = false) { - if (IsEmpty() || theX < 0 || static_cast(theX) >= SizeX() || theY < 0 || static_cast(theY) >= SizeY()) + if (IsEmpty() || theX < 0 || static_cast(theX) >= SizeX() || theY < 0 + || static_cast(theY) >= SizeY()) { return; } diff --git a/src/Visualization/TKService/Image/Image_PixMapData.hxx b/src/Visualization/TKService/Image/Image_PixMapData.hxx index 759d64c09df..75fd065e90d 100644 --- a/src/Visualization/TKService/Image/Image_PixMapData.hxx +++ b/src/Visualization/TKService/Image/Image_PixMapData.hxx @@ -104,13 +104,15 @@ public: //! Return data pointer to requested position. const uint8_t* Value(const size_t theRow, const size_t theCol) const { - return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol; + return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown) + + SizeBPP * theCol; } //! Return data pointer to requested position. uint8_t* ChangeValue(size_t theRow, size_t theCol) { - return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol; + return myTopRowPtr + static_cast(SizeRowBytes * theRow * TopToDown) + + SizeBPP * theCol; } //! Return data pointer to requested position. @@ -133,7 +135,10 @@ public: } //! Return data pointer to requested 2D slice. - uint8_t* ChangeSlice(size_t theSlice) { return myData + static_cast(SizeSliceBytes * theSlice); } + uint8_t* ChangeSlice(size_t theSlice) + { + return myData + static_cast(SizeSliceBytes * theSlice); + } //! Return data pointer to requested row (first column). const uint8_t* SliceRow(size_t theSlice, size_t theRow) const diff --git a/src/Visualization/TKService/Media/Media_PlayerContext.cxx b/src/Visualization/TKService/Media/Media_PlayerContext.cxx index e769ade9962..b9e75aba2d8 100644 --- a/src/Visualization/TKService/Media/Media_PlayerContext.cxx +++ b/src/Visualization/TKService/Media/Media_PlayerContext.cxx @@ -187,12 +187,16 @@ bool Media_PlayerContext::DumpFirstFrame(const TCollection_AsciiString& theSrcVi if (aResSizeX > aResSizeY) { aResSizeX = theMaxSize; - aResSizeY = static_cast((static_cast(aFrame->SizeY()) / static_cast(aFrame->SizeX())) * static_cast(aResSizeX)); + aResSizeY = static_cast( + (static_cast(aFrame->SizeY()) / static_cast(aFrame->SizeX())) + * static_cast(aResSizeX)); } else { aResSizeY = theMaxSize; - aResSizeX = static_cast((static_cast(aFrame->SizeX()) / static_cast(aFrame->SizeY())) * static_cast(aResSizeY)); + aResSizeX = static_cast( + (static_cast(aFrame->SizeX()) / static_cast(aFrame->SizeY())) + * static_cast(aResSizeY)); } } if (!aPixMap->InitZero(Image_Format_RGB, aResSizeX, aResSizeY)) diff --git a/src/Visualization/TKService/Xw/Xw_Window.cxx b/src/Visualization/TKService/Xw/Xw_Window.cxx index b48c5415f7a..56074ebba67 100644 --- a/src/Visualization/TKService/Xw/Xw_Window.cxx +++ b/src/Visualization/TKService/Xw/Xw_Window.cxx @@ -76,17 +76,17 @@ Xw_Window::Xw_Window(const occ::handle& theXDisplay, aWinAttr.override_redirect = False; myXWindow = XCreateWindow(aDisp, - aParent, - myXLeft, - myYTop, - thePxWidth, - thePxHeight, - 0, - aVisInfo != nullptr ? aVisInfo->depth : CopyFromParent, - InputOutput, - aVisInfo != nullptr ? aVisInfo->visual : CopyFromParent, - CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, - &aWinAttr); + aParent, + myXLeft, + myYTop, + thePxWidth, + thePxHeight, + 0, + aVisInfo != nullptr ? aVisInfo->depth : CopyFromParent, + InputOutput, + aVisInfo != nullptr ? aVisInfo->visual : CopyFromParent, + CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, + &aWinAttr); if (myXWindow == 0) { throw Aspect_WindowDefinitionError("Xw_Window, Unable to create window"); @@ -628,7 +628,10 @@ bool Xw_Window::ProcessMessage(Aspect_WindowInputListener& theListener, // remove all the StructureNotifyMask and process them at once for (int aNbMaxEvents = XPending(aDisplay); aNbMaxEvents > 0; --aNbMaxEvents) { - if (!XCheckWindowEvent(aDisplay, static_cast(myXWindow), StructureNotifyMask, &theMsg)) + if (!XCheckWindowEvent(aDisplay, + static_cast(myXWindow), + StructureNotifyMask, + &theMsg)) { break; } diff --git a/src/Visualization/TKV3d/AIS/AIS_ColorScale.cxx b/src/Visualization/TKV3d/AIS/AIS_ColorScale.cxx index 5e89a43a63f..9d732fb6c67 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ColorScale.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ColorScale.cxx @@ -92,8 +92,9 @@ static int colorDiscreteInterval(double theValue, double theMin, double theMax, return 1; } - int anInterval = - 1 + static_cast(std::floor(static_cast(theNbIntervals) * (theValue - theMin) / (theMax - theMin))); + int anInterval = 1 + + static_cast(std::floor(static_cast(theNbIntervals) + * (theValue - theMin) / (theMax - theMin))); // map the very upper value (theValue==theMax) to the largest color interval anInterval = std::min(anInterval, theNbIntervals); return anInterval; @@ -372,8 +373,9 @@ void AIS_ColorScale::SizeHint(int& theWidth, int& theHeight) const } } - const int aScaleWidth = aColorWidth + aTextWidth + (aTextWidth ? 3 : 2) * mySpacing; - const int aScaleHeight = static_cast(1.5 * (myNbIntervals + (myIsLabelAtBorder ? 2 : 1)) * aTextHeight); + const int aScaleWidth = aColorWidth + aTextWidth + (aTextWidth ? 3 : 2) * mySpacing; + const int aScaleHeight = + static_cast(1.5 * (myNbIntervals + (myIsLabelAtBorder ? 2 : 1)) * aTextHeight); int aTitleWidth = 0; int aTitleHeight = 0; @@ -696,7 +698,7 @@ void AIS_ColorScale::drawColorBar(const occ::handle& thePrs, for (int aColorIter = 0; aColorIter < myNbIntervals; ++aColorIter) { const Quantity_Color& aColor = aColors.Value(aColorIter + 1); - const int aSizeY = theBarBottom + static_cast((aColorIter + 1) * aStepY) - anYBottomIter; + const int aSizeY = theBarBottom + static_cast((aColorIter + 1) * aStepY) - anYBottomIter; addColoredQuad(aTriangles, anXLeft, anYBottomIter, theColorBreadth, aSizeY, aColor, aColor); anYBottomIter += aSizeY; } @@ -771,11 +773,12 @@ void AIS_ColorScale::drawLabels(const occ::handle& } } - int i1 = 0; - int i2 = aNbLabels - 1; - int aLast1 = i1; - int aLast2 = i2; - const int anYBottom = myIsLabelAtBorder ? theBarBottom : theBarBottom + static_cast(aStepY / 2); + int i1 = 0; + int i2 = aNbLabels - 1; + int aLast1 = i1; + int aLast2 = i2; + const int anYBottom = + myIsLabelAtBorder ? theBarBottom : theBarBottom + static_cast(aStepY / 2); while (i2 - i1 >= aFilter || (i2 == 0 && i1 == 0)) { int aPos1 = i1; @@ -897,8 +900,12 @@ void AIS_ColorScale::TextSize(const TCollection_ExtendedString& theText, const TCollection_AsciiString aText(theText); const occ::handle& aViewer = GetContext()->CurrentViewer(); const occ::handle& aView = aViewer->ActiveViewIterator().Value()->View(); - aViewer->Driver() - ->TextSize(aView, aText.ToCString(), static_cast(theHeight), aWidth, anAscent, aDescent); + aViewer->Driver()->TextSize(aView, + aText.ToCString(), + static_cast(theHeight), + aWidth, + anAscent, + aDescent); } theWidth = static_cast(aWidth); theAscent = static_cast(anAscent); diff --git a/src/Visualization/TKV3d/AIS/AIS_ColoredShape.cxx b/src/Visualization/TKV3d/AIS/AIS_ColoredShape.cxx index c157e619858..f7891bec9bb 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ColoredShape.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ColoredShape.cxx @@ -795,9 +795,10 @@ bool AIS_ColoredShape::dispatchColors( && !(isOverriden || isSubOverride))) // bind original shape to default color { TopoDS_Compound aCompound; - DataMapOfDrawerCompd& aDrawerShapeMap = theIsParentClosed && aShapeType == TopAbs_FACE - ? theDrawerClosedFaces - : theDrawerOpenedShapePerType[static_cast(aShapeType)]; + DataMapOfDrawerCompd& aDrawerShapeMap = + theIsParentClosed && aShapeType == TopAbs_FACE + ? theDrawerClosedFaces + : theDrawerOpenedShapePerType[static_cast(aShapeType)]; if (!aDrawerShapeMap.FindFromKey(aDrawer, aCompound)) { aBBuilder.MakeCompound(aCompound); diff --git a/src/Visualization/TKV3d/AIS/AIS_ExclusionFilter.cxx b/src/Visualization/TKV3d/AIS/AIS_ExclusionFilter.cxx index 30a18e7e1e0..69f7d700836 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ExclusionFilter.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ExclusionFilter.cxx @@ -126,7 +126,8 @@ bool AIS_ExclusionFilter::IsSignatureIn(const AIS_KindOfInteractive aType, { if (!myStoredTypes.IsBound(aType)) return false; - for (NCollection_List::Iterator Lit(myStoredTypes(static_cast(aType))); Lit.More(); Lit.Next()) + for (NCollection_List::Iterator Lit(myStoredTypes(static_cast(aType))); Lit.More(); + Lit.Next()) { if (Lit.Value() == SignatureInType) return true; diff --git a/src/Visualization/TKV3d/AIS/AIS_LightSource.cxx b/src/Visualization/TKV3d/AIS/AIS_LightSource.cxx index ed4562c1673..b19f6828867 100644 --- a/src/Visualization/TKV3d/AIS/AIS_LightSource.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_LightSource.cxx @@ -98,8 +98,8 @@ void AIS_LightSourceOwner::HilightWithColor(const occ::handleSetGroupPrimitivesAspect(aPointAspect->Aspect()); aGroup->AddPrimitiveArray(aPoints); - const double aRadius = aLightSource->Size() * 0.5; - const int aNbPnts = static_cast(aLightSource->ArcSize() * 180 / (M_PI * aRadius)); + const double aRadius = aLightSource->Size() * 0.5; + const int aNbPnts = static_cast(aLightSource->ArcSize() * 180 / (M_PI * aRadius)); NCollection_Array1 aCircPoints(0, aNbPnts); const gp_Dir aDirNorm(gp_Vec(gp::Origin(), aDetPnt)); gp_Dir aDirNormToPln(gp::DY()); diff --git a/src/Visualization/TKV3d/AIS/AIS_MediaPlayer.cxx b/src/Visualization/TKV3d/AIS/AIS_MediaPlayer.cxx index ebce4e12de4..8c83f3cabcb 100644 --- a/src/Visualization/TKV3d/AIS/AIS_MediaPlayer.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_MediaPlayer.cxx @@ -136,9 +136,11 @@ bool AIS_MediaPlayer::updateSize(const NCollection_Vec2& theLeftCorner, NCollection_Vec2 aNewSize = myFrameSize; if (aFrameSize.x() > 0 && aFrameSize.y() > 0) { - const double anAspect = static_cast(theMaxSize.x()) / static_cast(theMaxSize.y()); - const double aFitAspect = static_cast(aFrameSize.x()) / static_cast(aFrameSize.y()); - aNewSize = aFrameSize; + const double anAspect = + static_cast(theMaxSize.x()) / static_cast(theMaxSize.y()); + const double aFitAspect = + static_cast(aFrameSize.x()) / static_cast(aFrameSize.y()); + aNewSize = aFrameSize; if (aFitAspect >= anAspect) { aNewSize.y() = static_cast(static_cast(aFrameSize.x()) / aFitAspect); @@ -152,9 +154,10 @@ bool AIS_MediaPlayer::updateSize(const NCollection_Vec2& theLeftCorner, { if (aNewSize[aCoord] > theMaxSize[aCoord]) { - const double aScale = static_cast(theMaxSize[aCoord]) / static_cast(aNewSize[aCoord]); - aNewSize.x() = static_cast(static_cast(aNewSize.x()) * aScale); - aNewSize.y() = static_cast(static_cast(aNewSize.y()) * aScale); + const double aScale = + static_cast(theMaxSize[aCoord]) / static_cast(aNewSize[aCoord]); + aNewSize.x() = static_cast(static_cast(aNewSize.x()) * aScale); + aNewSize.y() = static_cast(static_cast(aNewSize.y()) * aScale); } } diff --git a/src/Visualization/TKV3d/AIS/AIS_RubberBand.cxx b/src/Visualization/TKV3d/AIS/AIS_RubberBand.cxx index c6f95caac58..a9847c77b5d 100644 --- a/src/Visualization/TKV3d/AIS/AIS_RubberBand.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_RubberBand.cxx @@ -258,7 +258,8 @@ bool AIS_RubberBand::fillTriangles() IMeshData::VectorOfInteger anIndexes(myPoints.Length(), anAllocator); for (int aPtIdx = aPtsLower; aPtIdx <= aPtsUpper; ++aPtIdx) { - gp_XY aP(static_cast(myPoints.Value(aPtIdx).x()), static_cast(myPoints.Value(aPtIdx).y())); + gp_XY aP(static_cast(myPoints.Value(aPtIdx).x()), + static_cast(myPoints.Value(aPtIdx).y())); BRepMesh_Vertex aVertex(aP, aPtIdx, BRepMesh_Frontier); anIndexes.Append(aMeshStructure->AddNode(aVertex)); } @@ -325,7 +326,10 @@ bool AIS_RubberBand::fillTriangles() { for (int anIt = 0; anIt < 3; ++anIt) { - myTriangles->SetVertice(aVertexIndex++, static_cast(aPts[anIt].X()), static_cast(aPts[anIt].Y()), 0.0f); + myTriangles->SetVertice(aVertexIndex++, + static_cast(aPts[anIt].X()), + static_cast(aPts[anIt].Y()), + 0.0f); } } } @@ -362,12 +366,16 @@ void AIS_RubberBand::Compute(const occ::handle&, myBorders = new Graphic3d_ArrayOfPolylines(myPoints.Length() + (myIsPolygonClosed ? 1 : 0)); for (int anIt = 1; anIt <= myPoints.Length(); anIt++) { - myBorders->AddVertex(static_cast(myPoints.Value(anIt).x()), static_cast(myPoints.Value(anIt).y()), 0.0); + myBorders->AddVertex(static_cast(myPoints.Value(anIt).x()), + static_cast(myPoints.Value(anIt).y()), + 0.0); } if (myIsPolygonClosed) { - myBorders->AddVertex(static_cast(myPoints.Value(1).x()), static_cast(myPoints.Value(1).y()), 0.0); + myBorders->AddVertex(static_cast(myPoints.Value(1).x()), + static_cast(myPoints.Value(1).y()), + 0.0); } } else diff --git a/src/Visualization/TKV3d/AIS/AIS_Shape.cxx b/src/Visualization/TKV3d/AIS/AIS_Shape.cxx index 4e2b159f362..9360c1aa820 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Shape.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Shape.cxx @@ -109,8 +109,8 @@ void AIS_Shape::Compute(const occ::handle&, if (myshape.ShapeType() >= TopAbs_WIRE && myshape.ShapeType() <= TopAbs_VERTEX) { // TopAbs_WIRE -> 7, TopAbs_EDGE -> 8, TopAbs_VERTEX -> 9 (Graphic3d_DisplayPriority_Highlight) - const int aPrior = - static_cast(Graphic3d_DisplayPriority_Above1) + static_cast(myshape.ShapeType()) - TopAbs_WIRE; + const int aPrior = static_cast(Graphic3d_DisplayPriority_Above1) + + static_cast(myshape.ShapeType()) - TopAbs_WIRE; thePrs->SetVisual(Graphic3d_TOS_ALL); thePrs->SetDisplayPriority(static_cast(aPrior)); } diff --git a/src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx b/src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx index 65059816089..4d3c2f275de 100644 --- a/src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_TextLabel.cxx @@ -287,10 +287,14 @@ void AIS_TextLabel::Compute(const occ::handle&, gp_Pnt aMaxPnt = gp_Pnt(aDx, aDy, 0.0).Transformed(aLabelPlane); Graphic3d_BndBox4f& aBox = thePrs->CurrentGroup()->ChangeBoundingBox(); - aBox.Add( - NCollection_Vec4(static_cast(aMinPnt.X()), static_cast(aMinPnt.Y()), static_cast(aMinPnt.Z()), 1.0)); - aBox.Add( - NCollection_Vec4(static_cast(aMaxPnt.X()), static_cast(aMaxPnt.Y()), static_cast(aMaxPnt.Z()), 1.0)); + aBox.Add(NCollection_Vec4(static_cast(aMinPnt.X()), + static_cast(aMinPnt.Y()), + static_cast(aMinPnt.Z()), + 1.0)); + aBox.Add(NCollection_Vec4(static_cast(aMaxPnt.X()), + static_cast(aMaxPnt.Y()), + static_cast(aMaxPnt.Z()), + 1.0)); } break; diff --git a/src/Visualization/TKV3d/AIS/AIS_TexturedShape.cxx b/src/Visualization/TKV3d/AIS/AIS_TexturedShape.cxx index e7e3a295280..080c0e3594c 100644 --- a/src/Visualization/TKV3d/AIS/AIS_TexturedShape.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_TexturedShape.cxx @@ -312,8 +312,8 @@ void AIS_TexturedShape::Compute(const occ::handle&, if (myshape.ShapeType() >= TopAbs_WIRE && myshape.ShapeType() <= TopAbs_VERTEX) { // TopAbs_WIRE -> 7, TopAbs_EDGE -> 8, TopAbs_VERTEX -> 9 (Graphic3d_DisplayPriority_Highlight) - const int aPrior = - static_cast(Graphic3d_DisplayPriority_Above1) + static_cast(myshape.ShapeType()) - TopAbs_WIRE; + const int aPrior = static_cast(Graphic3d_DisplayPriority_Above1) + + static_cast(myshape.ShapeType()) - TopAbs_WIRE; thePrs->SetVisual(Graphic3d_TOS_ALL); thePrs->SetDisplayPriority(static_cast(aPrior)); } diff --git a/src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx b/src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx index ee0674a53ed..5762a1bfd4c 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Trihedron.cxx @@ -640,8 +640,12 @@ void AIS_Trihedron::SetArrowColor(const Quantity_Color& theColor) for (int anAxisIter = Prs3d_DatumParts_XArrow; anAxisIter <= Prs3d_DatumParts_ZArrow; ++anAxisIter) { - myDrawer->DatumAspect()->ShadingAspect(static_cast(anAxisIter))->SetColor(theColor); - myDrawer->DatumAspect()->LineAspect(static_cast(anAxisIter))->SetColor(theColor); + myDrawer->DatumAspect() + ->ShadingAspect(static_cast(anAxisIter)) + ->SetColor(theColor); + myDrawer->DatumAspect() + ->LineAspect(static_cast(anAxisIter)) + ->SetColor(theColor); } } diff --git a/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx b/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx index daaa6774d03..84c43eed8d6 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx @@ -118,7 +118,8 @@ AIS_ViewController::AIS_ViewController() myRubberBand->SetDisplayMode(0); myRubberBand->SetMutable(true); - myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_LeftButton), AIS_MouseGesture_RotateOrbit); + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_LeftButton), + AIS_MouseGesture_RotateOrbit); myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_LeftButton) | static_cast(Aspect_VKeyFlags_CTRL), AIS_MouseGesture_Zoom); @@ -146,12 +147,14 @@ AIS_ViewController::AIS_ViewController() | static_cast(Aspect_VKeyFlags_SHIFT), AIS_SelectionScheme_XOR); - myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_RightButton), AIS_MouseGesture_Zoom); + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_RightButton), + AIS_MouseGesture_Zoom); myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_RightButton) | static_cast(Aspect_VKeyFlags_CTRL), AIS_MouseGesture_RotateOrbit); - myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_MiddleButton), AIS_MouseGesture_Pan); + myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_MiddleButton), + AIS_MouseGesture_Pan); myMouseGestureMap.Bind(static_cast(Aspect_VKeyMouse_MiddleButton) | static_cast(Aspect_VKeyFlags_CTRL), AIS_MouseGesture_Pan); @@ -425,7 +428,8 @@ void AIS_ViewController::flushGestures(const occ::handle myGL.OrbitRotation.ToRotate = true; myGL.OrbitRotation.PointTo = myGL.OrbitRotation.PointStart + aRotDelta * aRotAccel; myGL.Dragging.ToMove = true; - myGL.Dragging.PointTo.SetValues(static_cast(aTouch.To.x()), static_cast(aTouch.To.y())); + myGL.Dragging.PointTo.SetValues(static_cast(aTouch.To.x()), + static_cast(aTouch.To.y())); } else { @@ -433,7 +437,8 @@ void AIS_ViewController::flushGestures(const occ::handle myGL.ViewRotation.ToRotate = true; myGL.ViewRotation.PointTo = myGL.ViewRotation.PointStart + aRotDelta * aRotAccel; myGL.Dragging.ToMove = true; - myGL.Dragging.PointTo.SetValues(static_cast(aTouch.To.x()), static_cast(aTouch.To.y())); + myGL.Dragging.PointTo.SetValues(static_cast(aTouch.To.x()), + static_cast(aTouch.To.y())); } aTouch.From = aTouch.To; @@ -982,7 +987,8 @@ bool AIS_ViewController::UpdateMousePosition(const NCollection_Vec2& thePoi } const double aRotTol = - theIsEmulated ? static_cast(myTouchToleranceScale) * myTouchRotationThresholdPx : 0.0; + theIsEmulated ? static_cast(myTouchToleranceScale) * myTouchRotationThresholdPx + : 0.0; const NCollection_Vec2 aDeltaF(aDelta); if (std::abs(aDeltaF.x()) + std::abs(aDeltaF.y()) > aRotTol) { @@ -1080,7 +1086,8 @@ bool AIS_ViewController::UpdateMousePosition(const NCollection_Vec2& thePoi } const double aDragTol = - theIsEmulated ? static_cast(myTouchToleranceScale) * myTouchDraggingThresholdPx : 0.0; + theIsEmulated ? static_cast(myTouchToleranceScale) * myTouchDraggingThresholdPx + : 0.0; if (static_cast(std::abs(aDelta.x()) + std::abs(aDelta.y())) > aDragTol) { const double aRotAccel = @@ -1131,7 +1138,8 @@ void AIS_ViewController::AddTouchPoint(size_t theId, if (myToAllowDragging) { myUI.Dragging.ToStart = true; - myUI.Dragging.PointStart.SetValues(static_cast(thePnt.x()), static_cast(thePnt.y())); + myUI.Dragging.PointStart.SetValues(static_cast(thePnt.x()), + static_cast(thePnt.y())); } } else if (myTouchPoints.Extent() == 2) @@ -1213,7 +1221,8 @@ void AIS_ViewController::UpdateTouchPoint(size_t theId, const NCollection_Vec2(myTouchToleranceScale) * static_cast(myTouchClickThresholdPx); + const double aTouchTol = + static_cast(myTouchToleranceScale) * static_cast(myTouchClickThresholdPx); if (myTouchPoints.Extent() == 1 && (myTouchClick.From - thePnt).cwiseAbs().maxComp() > aTouchTol) { myTouchClick.From.SetValues(-1.0, -1.0); @@ -1659,12 +1668,12 @@ void AIS_ViewController::handleOrbitRotation(const occ::handle& theVie theView->Window()->Size(aWinXY.x(), aWinXY.y()); // Calculate deltas exactly as in original - double aYawAngleDelta = - ((myGL.OrbitRotation.PointStart.x() - myGL.OrbitRotation.PointTo.x()) / static_cast(aWinXY.x())) - * (M_PI * 0.5); - double aPitchAngleDelta = - ((myGL.OrbitRotation.PointTo.y() - myGL.OrbitRotation.PointStart.y()) / static_cast(aWinXY.y())) - * (M_PI * 0.5); + double aYawAngleDelta = ((myGL.OrbitRotation.PointStart.x() - myGL.OrbitRotation.PointTo.x()) + / static_cast(aWinXY.x())) + * (M_PI * 0.5); + double aPitchAngleDelta = ((myGL.OrbitRotation.PointTo.y() - myGL.OrbitRotation.PointStart.y()) + / static_cast(aWinXY.y())) + * (M_PI * 0.5); // Z-up locking: clamp pitch to prevent camera flipping at top/bottom if (std::abs(aPitchAngleDelta) > gp::Resolution()) @@ -1837,12 +1846,12 @@ void AIS_ViewController::handleViewRotation(const occ::handle& theView // Calculate rotation deltas from mouse movement NCollection_Vec2 aWinXY; theView->Window()->Size(aWinXY.x(), aWinXY.y()); - double aYawAngleDelta = - ((myGL.ViewRotation.PointStart.x() - myGL.ViewRotation.PointTo.x()) / static_cast(aWinXY.x())) - * (M_PI * 0.5); - double aPitchAngleDelta = - -((myGL.ViewRotation.PointStart.y() - myGL.ViewRotation.PointTo.y()) / static_cast(aWinXY.y())) - * (M_PI * 0.5); + double aYawAngleDelta = ((myGL.ViewRotation.PointStart.x() - myGL.ViewRotation.PointTo.x()) + / static_cast(aWinXY.x())) + * (M_PI * 0.5); + double aPitchAngleDelta = -((myGL.ViewRotation.PointStart.y() - myGL.ViewRotation.PointTo.y()) + / static_cast(aWinXY.y())) + * (M_PI * 0.5); // Add extra rotation from parameters aYawAngleDelta += theYawExtra; @@ -3393,7 +3402,8 @@ void AIS_ViewController::handleXRPresentations(const occ::handleUnitFactor() != static_cast(theView->View()->UnitFactor())) + if (!aPosePrs.IsNull() + && aPosePrs->UnitFactor() != static_cast(theView->View()->UnitFactor())) { theCtx->Remove(aPosePrs, false); aPosePrs.Nullify(); diff --git a/src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx b/src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx index ab2b2157618..40ceae79bf2 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ViewCube.cxx @@ -345,10 +345,10 @@ void AIS_ViewCube::createRoundRectangleTriangles( theTris->AddVertex(gp_Pnt(0.0, 0.0, 0.0).Transformed(theTrsf)); for (int aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter) { - const double anAngle = - NCollection_Lerp::Interpolate(M_PI * 0.5, - 0.0, - static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); + const double anAngle = NCollection_Lerp::Interpolate( + M_PI * 0.5, + 0.0, + static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); theTris->AddVertex(gp_Pnt(aHSize.X() + aRadius * std::cos(anAngle), aHSize.Y() + aRadius * std::sin(anAngle), 0.0) @@ -356,10 +356,10 @@ void AIS_ViewCube::createRoundRectangleTriangles( } for (int aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter) { - const double anAngle = - NCollection_Lerp::Interpolate(0.0, - -M_PI * 0.5, - static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); + const double anAngle = NCollection_Lerp::Interpolate( + 0.0, + -M_PI * 0.5, + static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); theTris->AddVertex(gp_Pnt(aHSize.X() + aRadius * std::cos(anAngle), -aHSize.Y() + aRadius * std::sin(anAngle), 0.0) @@ -367,10 +367,10 @@ void AIS_ViewCube::createRoundRectangleTriangles( } for (int aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter) { - const double anAngle = - NCollection_Lerp::Interpolate(-M_PI * 0.5, - -M_PI, - static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); + const double anAngle = NCollection_Lerp::Interpolate( + -M_PI * 0.5, + -M_PI, + static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); theTris->AddVertex(gp_Pnt(-aHSize.X() + aRadius * std::cos(anAngle), -aHSize.Y() + aRadius * std::sin(anAngle), 0.0) @@ -378,10 +378,10 @@ void AIS_ViewCube::createRoundRectangleTriangles( } for (int aNodeIter = 0; aNodeIter <= THE_NB_ROUND_SPLITS; ++aNodeIter) { - const double anAngle = - NCollection_Lerp::Interpolate(-M_PI, - -M_PI * 1.5, - static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); + const double anAngle = NCollection_Lerp::Interpolate( + -M_PI, + -M_PI * 1.5, + static_cast(aNodeIter) / static_cast(THE_NB_ROUND_SPLITS)); theTris->AddVertex(gp_Pnt(-aHSize.X() + aRadius * std::cos(anAngle), aHSize.Y() + aRadius * std::sin(anAngle), 0.0) @@ -517,10 +517,10 @@ void AIS_ViewCube::createBoxCornerTriangles(const occ::handleAddVertex(gp_Pnt(0.0, 0.0, 0.0).Transformed(aTrsf)); for (int aNodeIter = 0; aNodeIter < THE_NB_DISK_SLICES; ++aNodeIter) { - const double anAngle = - NCollection_Lerp::Interpolate(2.0 * M_PI, - 0.0, - static_cast(aNodeIter) / static_cast(THE_NB_DISK_SLICES)); + const double anAngle = NCollection_Lerp::Interpolate( + 2.0 * M_PI, + 0.0, + static_cast(aNodeIter) / static_cast(THE_NB_DISK_SLICES)); theTris->AddVertex( gp_Pnt(aRadius * std::cos(anAngle), aRadius * std::sin(anAngle), 0.0).Transformed(aTrsf)); } @@ -674,7 +674,10 @@ void AIS_ViewCube::Compute(const occ::handle&, { int aTriNodesFrom = aTris->VertexNumber(); const int aTriFrom = aNbTris; - createBoxPartTriangles(aTris, aNbNodes, aNbTris, static_cast(aPartIter)); + createBoxPartTriangles(aTris, + aNbNodes, + aNbTris, + static_cast(aPartIter)); if (aSegs.IsNull()) { continue; @@ -787,7 +790,8 @@ void AIS_ViewCube::Compute(const occ::handle&, // Display box corners { int aNbNodes = 0, aNbTris = 0; - for (int aPartIter = V3d_XposYposZpos; aPartIter <= static_cast(V3d_XnegYnegZneg); ++aPartIter) + for (int aPartIter = V3d_XposYposZpos; aPartIter <= static_cast(V3d_XnegYnegZneg); + ++aPartIter) { createBoxPartTriangles(occ::handle(), aNbNodes, @@ -799,7 +803,8 @@ void AIS_ViewCube::Compute(const occ::handle&, occ::handle aTris = new Graphic3d_ArrayOfTriangles(aNbNodes, aNbTris * 3, Graphic3d_ArrayFlags_VertexNormal); aNbNodes = aNbTris = 0; - for (int aPartIter = V3d_XposYposZpos; aPartIter <= static_cast(V3d_XnegYnegZneg); ++aPartIter) + for (int aPartIter = V3d_XposYposZpos; aPartIter <= static_cast(V3d_XnegYnegZneg); + ++aPartIter) { const V3d_TypeOfOrientation anOrient = static_cast(aPartIter); createBoxPartTriangles(aTris, aNbNodes, aNbTris, anOrient); diff --git a/src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx b/src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx index 33a65d1d46d..851a3e36278 100644 --- a/src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx +++ b/src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx @@ -1266,7 +1266,8 @@ void PrsDim_Dimension::ComputeSelection(const occ::handle& return; } - PrsDim_DimensionSelectionMode aSelectionMode = static_cast(theMode); + PrsDim_DimensionSelectionMode aSelectionMode = + static_cast(theMode); // init appropriate entity owner occ::handle aSensitiveOwner; diff --git a/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx b/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx index f9d6764b810..0e42713d5de 100644 --- a/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx +++ b/src/Visualization/TKV3d/PrsMgr/PrsMgr_PresentableObject.cxx @@ -710,8 +710,10 @@ void PrsMgr_PresentableObject::UnsetMaterial() void PrsMgr_PresentableObject::SetTransparency(const double theValue) { myDrawer->SetupOwnShadingAspect(); - myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency(static_cast(theValue)); - myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial().SetTransparency(static_cast(theValue)); + myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency( + static_cast(theValue)); + myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial().SetTransparency( + static_cast(theValue)); myDrawer->SetTransparency(static_cast(theValue)); } diff --git a/src/Visualization/TKV3d/Select3D/Select3D_BVHIndexBuffer.hxx b/src/Visualization/TKV3d/Select3D/Select3D_BVHIndexBuffer.hxx index 9cad2b3e379..1ac3b71446e 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_BVHIndexBuffer.hxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_BVHIndexBuffer.hxx @@ -61,9 +61,9 @@ public: //! Access index at specified position int PatchSize(const int theIndex) const { - return myHasPatches - ? static_cast(*reinterpret_cast(value(theIndex) + sizeof(unsigned int))) - : 1; + return myHasPatches ? static_cast(*reinterpret_cast( + value(theIndex) + sizeof(unsigned int))) + : 1; } //! Change index at specified position diff --git a/src/Visualization/TKV3d/SelectBasics/SelectBasics_PickResult.hxx b/src/Visualization/TKV3d/SelectBasics/SelectBasics_PickResult.hxx index 3fc54dcf8f1..365fde1487a 100644 --- a/src/Visualization/TKV3d/SelectBasics/SelectBasics_PickResult.hxx +++ b/src/Visualization/TKV3d/SelectBasics/SelectBasics_PickResult.hxx @@ -94,7 +94,9 @@ public: //! Set surface normal at picked point. void SetSurfaceNormal(const gp_Vec& theNormal) { - myNormal.SetValues(static_cast(theNormal.X()), static_cast(theNormal.Y()), static_cast(theNormal.Z())); + myNormal.SetValues(static_cast(theNormal.X()), + static_cast(theNormal.Y()), + static_cast(theNormal.Z())); } private: diff --git a/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectingVolumeManager.cxx b/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectingVolumeManager.cxx index dc99200c277..78d6088bcbb 100644 --- a/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectingVolumeManager.cxx +++ b/src/Visualization/TKV3d/SelectMgr/SelectMgr_SelectingVolumeManager.cxx @@ -358,10 +358,11 @@ bool SelectMgr_SelectingVolumeManager::OverlapsPolygon( return false; } - return myActiveSelectingVolume->OverlapsPolygon(theArrayOfPnts, - static_cast(theSensType), - myViewClipRange, - thePickResult); + return myActiveSelectingVolume->OverlapsPolygon( + theArrayOfPnts, + static_cast(theSensType), + myViewClipRange, + thePickResult); } //======================================================================= @@ -399,12 +400,13 @@ bool SelectMgr_SelectingVolumeManager::OverlapsTriangle( return false; } - return myActiveSelectingVolume->OverlapsTriangle(thePt1, - thePt2, - thePt3, - static_cast(theSensType), - myViewClipRange, - thePickResult); + return myActiveSelectingVolume->OverlapsTriangle( + thePt1, + thePt2, + thePt3, + static_cast(theSensType), + myViewClipRange, + thePickResult); } //================================================================================================= diff --git a/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.cxx b/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.cxx index 9f7488c5c2b..c0c67dec806 100644 --- a/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.cxx +++ b/src/Visualization/TKV3d/StdPrs/StdPrs_BRepFont.cxx @@ -63,7 +63,8 @@ static const Font_FTFontParams THE_FONT_PARAMS(THE_FONT_SIZE, THE_RESOLUTION_DPI // compute scaling factor for specified font size inline double getScale(const double theSize) { - return theSize / static_cast(THE_FONT_SIZE) * 72.0 / static_cast(THE_RESOLUTION_DPI); + return theSize / static_cast(THE_FONT_SIZE) * 72.0 + / static_cast(THE_RESOLUTION_DPI); } #ifdef HAVE_FREETYPE diff --git a/src/Visualization/TKV3d/StdPrs/StdPrs_Plane.cxx b/src/Visualization/TKV3d/StdPrs/StdPrs_Plane.cxx index 36065425150..2062697f694 100644 --- a/src/Visualization/TKV3d/StdPrs/StdPrs_Plane.cxx +++ b/src/Visualization/TKV3d/StdPrs/StdPrs_Plane.cxx @@ -59,9 +59,9 @@ void StdPrs_Plane::Add(const occ::handle& aPresentation, if (theaspect->DisplayIso()) { TheGroup->SetPrimitivesAspect(theaspect->IsoAspect()->Aspect()); - const double dist = theaspect->IsoDistance(); - const int nbx = static_cast(std::abs(2. * Xmax) / dist) - 1; - const int nby = static_cast(std::abs(2. * Ymax) / dist) - 1; + const double dist = theaspect->IsoDistance(); + const int nbx = static_cast(std::abs(2. * Xmax) / dist) - 1; + const int nby = static_cast(std::abs(2. * Ymax) / dist) - 1; occ::handle aPrims = new Graphic3d_ArrayOfSegments(2 * (nbx + nby)); int i; double cur = -Xmax + dist; diff --git a/src/Visualization/TKV3d/V3d/V3d_View.cxx b/src/Visualization/TKV3d/V3d/V3d_View.cxx index 971d679a5c5..23ae9bf3bb9 100644 --- a/src/Visualization/TKV3d/V3d/V3d_View.cxx +++ b/src/Visualization/TKV3d/V3d/V3d_View.cxx @@ -2444,7 +2444,8 @@ void V3d_View::ZoomAtPoint(const int theMouseStartX, bool wasUpdateEnabled = SetImmediateUpdate(false); // zoom - double aDxy = static_cast((theMouseEndX + theMouseEndY) - (theMouseStartX + theMouseStartY)); + double aDxy = + static_cast((theMouseEndX + theMouseEndY) - (theMouseStartX + theMouseStartY)); double aDZoom = std::abs(aDxy) / 100.0 + 1.0; aDZoom = (aDxy > 0.0) ? aDZoom : 1.0 / aDZoom; @@ -2573,7 +2574,8 @@ void V3d_View::Rotation(const int X, const int Y) double dx = 0., dy = 0., dz = 0.; if (myZRotation) { - dz = atan2(static_cast(X) - rx / 2., ry / 2. - static_cast(Y)) - atan2(sx - rx / 2., ry / 2. - sy); + dz = atan2(static_cast(X) - rx / 2., ry / 2. - static_cast(Y)) + - atan2(sx - rx / 2., ry / 2. - sy); } else { @@ -2679,7 +2681,9 @@ bool V3d_View::ToPixMap(Image_PixMap& theImage, const V3d_ImageDumpOptions& theP break; } - if (!theImage.InitZero(aFormat, static_cast(aTargetSize.x()), static_cast(aTargetSize.y()))) + if (!theImage.InitZero(aFormat, + static_cast(aTargetSize.x()), + static_cast(aTargetSize.y()))) { Message::SendFail(TCollection_AsciiString("Fail to allocate an image ") + aTargetSize.x() + "x" + aTargetSize.y() + " for view dump"); From ddedaa4883aeb7862544c4d937d8d0e95d3a15a7 Mon Sep 17 00:00:00 2001 From: jijinbei Date: Sun, 19 Apr 2026 07:48:14 +0900 Subject: [PATCH 3/3] Coding - Fix indentation of nested #ifdef in OSD_Thread.cxx Applies the CI clang-format patch: nested preprocessor directives inside a block need 2-space indentation per OCCT's .clang-format. --- src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx b/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx index 24608a78d05..12e60496a5a 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Thread.cxx @@ -187,11 +187,11 @@ bool OSD_Thread::Run(void* const data, } else { -#ifdef __APPLE__ + #ifdef __APPLE__ myThreadId = reinterpret_cast(myThread); -#else + #else myThreadId = static_cast(myThread); -#endif + #endif } #endif return myThread != OSD_PTHREAD_NULL;