1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-26 10:19:45 +03:00

0031842: Coding Rules, BOPAlgo - eliminate CLang warning -fsanitize=undefined reference binding to null pointer

Added NULL checks before Progress Scope pointer dereference.
This commit is contained in:
kgv 2020-10-12 18:00:22 +03:00 committed by bugmaster
parent 2958b91f62
commit d922149528
15 changed files with 104 additions and 25 deletions

View File

@ -387,7 +387,10 @@ void BOPAlgo_BOP::Perform()
pPF=new BOPAlgo_PaveFiller(aAllocator); pPF=new BOPAlgo_PaveFiller(aAllocator);
pPF->SetArguments(aLS); pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel); pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
pPF->SetProgressIndicator(*myProgressScope);
}
pPF->SetFuzzyValue(myFuzzyValue); pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive); pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue); pPF->SetGlue(myGlue);

View File

@ -195,7 +195,10 @@ void BOPAlgo_Builder::Perform()
// //
pPF->SetArguments(myArguments); pPF->SetArguments(myArguments);
pPF->SetRunParallel(myRunParallel); pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
pPF->SetProgressIndicator(*myProgressScope);
}
pPF->SetFuzzyValue(myFuzzyValue); pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive); pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue); pPF->SetGlue(myGlue);
@ -632,7 +635,10 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects,
aBS.SetRunParallel(myRunParallel); aBS.SetRunParallel(myRunParallel);
aBS.SetContext(myContext); aBS.SetContext(myContext);
aBS.SetFuzzyValue(myFuzzyValue); aBS.SetFuzzyValue(myFuzzyValue);
aBS.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aBS.SetProgressIndicator(*myProgressScope);
}
aBS.Perform(); aBS.Perform();
// Resulting solids // Resulting solids

View File

@ -450,7 +450,10 @@ void BOPAlgo_Builder::BuildSplitFaces()
aBF.SetFace(aF); aBF.SetFace(aF);
aBF.SetShapes(aLE); aBF.SetShapes(aLE);
aBF.SetRunParallel(myRunParallel); aBF.SetRunParallel(myRunParallel);
aBF.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aBF.SetProgressIndicator(*myProgressScope);
}
// //
}// for (i=0; i<aNbS; ++i) { }// for (i=0; i<aNbS; ++i) {
// //
@ -637,7 +640,10 @@ void BOPAlgo_Builder::FillSameDomainFaces()
aPSB.Shape1() = aF1; aPSB.Shape1() = aF1;
aPSB.Shape2() = aF2; aPSB.Shape2() = aF2;
aPSB.SetFuzzyValue(myFuzzyValue); aPSB.SetFuzzyValue(myFuzzyValue);
aPSB.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aPSB.SetProgressIndicator(*myProgressScope);
}
} }
} }
} }
@ -790,7 +796,10 @@ void BOPAlgo_Builder::FillInternalVertices()
aVFI.SetVertex(aV); aVFI.SetVertex(aV);
aVFI.SetFace(aFIm); aVFI.SetFace(aFIm);
aVFI.SetFuzzyValue(myFuzzyValue); aVFI.SetFuzzyValue(myFuzzyValue);
aVFI.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aVFI.SetProgressIndicator(*myProgressScope);
}
} }
} }
} }

View File

@ -432,7 +432,10 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol
aBS.SetSolid(aSolid); aBS.SetSolid(aSolid);
aBS.SetShapes(aSFS); aBS.SetShapes(aSFS);
aBS.SetRunParallel(myRunParallel); aBS.SetRunParallel(myRunParallel);
aBS.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aBS.SetProgressIndicator(*myProgressScope);
}
}//for (i=0; i<aNbS; ++i) { }//for (i=0; i<aNbS; ++i) {
// //
Standard_Integer k, aNbBS; Standard_Integer k, aNbBS;

View File

@ -432,7 +432,10 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
aFaceSelfIntersect.SetFace(aF); aFaceSelfIntersect.SetFace(aF);
aFaceSelfIntersect.SetTolF(aTolF); aFaceSelfIntersect.SetTolF(aTolF);
// //
aFaceSelfIntersect.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aFaceSelfIntersect.SetProgressIndicator(*myProgressScope);
}
} }
Standard_Integer aNbFace = aVFace.Length(); Standard_Integer aNbFace = aVFace.Length();

View File

@ -86,7 +86,10 @@ void BOPAlgo_MakerVolume::Perform()
} }
// //
pPF->SetRunParallel(myRunParallel); pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
pPF->SetProgressIndicator(*myProgressScope);
}
pPF->SetFuzzyValue(myFuzzyValue); pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive); pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue); pPF->SetGlue(myGlue);

View File

@ -264,7 +264,10 @@ void BOPAlgo_PaveFiller::IntersectVE
aVESolver.SetEdge(aE); aVESolver.SetEdge(aE);
aVESolver.SetPaveBlock(aPB); aVESolver.SetPaveBlock(aPB);
aVESolver.SetFuzzyValue(myFuzzyValue); aVESolver.SetFuzzyValue(myFuzzyValue);
aVESolver.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aVESolver.SetProgressIndicator(*myProgressScope);
}
} }
} }
// //

View File

@ -253,7 +253,10 @@ void BOPAlgo_PaveFiller::PerformEE()
anEdgeEdge.SetEdge2(aE2, aT21, aT22); anEdgeEdge.SetEdge2(aE2, aT21, aT22);
anEdgeEdge.SetBoxes (aBB1, aBB2); anEdgeEdge.SetBoxes (aBB1, aBB2);
anEdgeEdge.SetFuzzyValue(myFuzzyValue); anEdgeEdge.SetFuzzyValue(myFuzzyValue);
anEdgeEdge.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
anEdgeEdge.SetProgressIndicator(*myProgressScope);
}
}//for (; aIt2.More(); aIt2.Next()) { }//for (; aIt2.More(); aIt2.Next()) {
}//for (; aIt1.More(); aIt1.Next()) { }//for (; aIt1.More(); aIt1.Next()) {
}//for (; myIterator->More(); myIterator->Next()) { }//for (; myIterator->More(); myIterator->Next()) {
@ -1070,10 +1073,17 @@ void BOPAlgo_PaveFiller::ForceInterfEE()
anEdgeEdge.SetEdge2(aE2, aT21, aT22); anEdgeEdge.SetEdge2(aE2, aT21, aT22);
anEdgeEdge.SetBoxes (myDS->ShapeInfo(nE1).Box(), myDS->ShapeInfo (nE2).Box()); anEdgeEdge.SetBoxes (myDS->ShapeInfo(nE1).Box(), myDS->ShapeInfo (nE2).Box());
if (bUseAddTol) if (bUseAddTol)
{
anEdgeEdge.SetFuzzyValue(myFuzzyValue + aTolAdd); anEdgeEdge.SetFuzzyValue(myFuzzyValue + aTolAdd);
}
else else
{
anEdgeEdge.SetFuzzyValue(myFuzzyValue); anEdgeEdge.SetFuzzyValue(myFuzzyValue);
anEdgeEdge.SetProgressIndicator(*myProgressScope); }
if (myProgressScope != NULL)
{
anEdgeEdge.SetProgressIndicator(*myProgressScope);
}
} }
} }
} }

View File

@ -217,7 +217,10 @@ void BOPAlgo_PaveFiller::PerformVF()
aVertexFace.SetVertex(aV); aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF); aVertexFace.SetFace(aF);
aVertexFace.SetFuzzyValue(myFuzzyValue); aVertexFace.SetFuzzyValue(myFuzzyValue);
aVertexFace.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aVertexFace.SetProgressIndicator(*myProgressScope);
}
}//for (; myIterator->More(); myIterator->Next()) { }//for (; myIterator->More(); myIterator->Next()) {
// //
aNbVF=aVVF.Length(); aNbVF=aVVF.Length();

View File

@ -278,7 +278,10 @@ void BOPAlgo_PaveFiller::PerformEF()
aSR = aPBRange; aSR = aPBRange;
BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange); BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange);
aEdgeFace.SetRange (aPBRange); aEdgeFace.SetRange (aPBRange);
aEdgeFace.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aEdgeFace.SetProgressIndicator(*myProgressScope);
}
// Save the pair to avoid their forced intersection // Save the pair to avoid their forced intersection
BOPDS_MapOfPaveBlock* pMPB = myFPBDone.ChangeSeek(nF); BOPDS_MapOfPaveBlock* pMPB = myFPBDone.ChangeSeek(nF);
if (!pMPB) if (!pMPB)
@ -1010,7 +1013,10 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
aEdgeFace.SetFuzzyValue(myFuzzyValue + aTolAdd); aEdgeFace.SetFuzzyValue(myFuzzyValue + aTolAdd);
aEdgeFace.UseQuickCoincidenceCheck(Standard_True); aEdgeFace.UseQuickCoincidenceCheck(Standard_True);
aEdgeFace.SetRange(IntTools_Range(aPB->Pave1().Parameter(), aPB->Pave2().Parameter())); aEdgeFace.SetRange(IntTools_Range(aPB->Pave1().Parameter(), aPB->Pave2().Parameter()));
aEdgeFace.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aEdgeFace.SetProgressIndicator(*myProgressScope);
}
} }
} }
} }

View File

@ -308,7 +308,10 @@ void BOPAlgo_PaveFiller::PerformFF()
// //
aFaceFace.SetParameters(bApprox, bCompC2D1, bCompC2D2, anApproxTol); aFaceFace.SetParameters(bApprox, bCompC2D1, bCompC2D2, anApproxTol);
aFaceFace.SetFuzzyValue(myFuzzyValue); aFaceFace.SetFuzzyValue(myFuzzyValue);
aFaceFace.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aFaceFace.SetProgressIndicator(*myProgressScope);
}
} }
else { else {
// for the Glue mode just add all interferences of that type // for the Glue mode just add all interferences of that type
@ -1019,7 +1022,10 @@ void BOPAlgo_PaveFiller::PostTreatFF
} }
// //
// 2 Fuse shapes // 2 Fuse shapes
aPF.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aPF.SetProgressIndicator(*myProgressScope);
}
aPF.SetRunParallel(myRunParallel); aPF.SetRunParallel(myRunParallel);
aPF.SetArguments(aLS); aPF.SetArguments(aLS);
aPF.Perform(); aPF.Perform();

View File

@ -484,7 +484,10 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
aBSE.SetCommonBlock(aCB); aBSE.SetCommonBlock(aCB);
} }
aBSE.SetDS(myDS); aBSE.SetDS(myDS);
aBSE.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aBSE.SetProgressIndicator(*myProgressScope);
}
} // for (; aItPB.More(); aItPB.Next()) { } // for (; aItPB.More(); aItPB.Next()) {
} // for (i=0; i<aNbPBP; ++i) { } // for (i=0; i<aNbPBP; ++i) {
// //
@ -596,7 +599,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPC& aMPC=aVMPC.Appended(); BOPAlgo_MPC& aMPC=aVMPC.Appended();
aMPC.SetEdge(aE); aMPC.SetEdge(aE);
aMPC.SetFace(aF1F); aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aMPC.SetProgressIndicator(*myProgressScope);
}
} }
// //
// On // On
@ -660,7 +666,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE); aMPC.SetEdge(aE);
aMPC.SetFace(aF1F); aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aMPC.SetProgressIndicator(*myProgressScope);
}
} }
}// for (i=0; i<aNbFI; ++i) { }// for (i=0; i<aNbFI; ++i) {
// //
@ -710,7 +719,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE); aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]); aMPC.SetFace(aFf[m]);
aMPC.SetFlag(Standard_True); aMPC.SetFlag(Standard_True);
aMPC.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
aMPC.SetProgressIndicator(*myProgressScope);
}
} }
} }
} }

View File

@ -89,7 +89,10 @@ void BOPAlgo_Splitter::Perform()
BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller(); BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller();
pPF->SetArguments(aLS); pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel); pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
pPF->SetProgressIndicator(*myProgressScope);
}
pPF->SetFuzzyValue(myFuzzyValue); pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive); pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue); pPF->SetGlue(myGlue);

View File

@ -125,7 +125,10 @@ void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArg
myDSFiller->SetArguments(theArgs); myDSFiller->SetArguments(theArgs);
// Set options for intersection // Set options for intersection
myDSFiller->SetRunParallel(myRunParallel); myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
myDSFiller->SetProgressIndicator(*myProgressScope);
}
myDSFiller->SetFuzzyValue(myFuzzyValue); myDSFiller->SetFuzzyValue(myFuzzyValue);
myDSFiller->SetNonDestructive(myNonDestructive); myDSFiller->SetNonDestructive(myNonDestructive);
myDSFiller->SetGlue(myGlue); myDSFiller->SetGlue(myGlue);
@ -145,7 +148,10 @@ void BRepAlgoAPI_BuilderAlgo::BuildResult()
{ {
// Set options to the builder // Set options to the builder
myBuilder->SetRunParallel(myRunParallel); myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
myBuilder->SetProgressIndicator(*myProgressScope);
}
myBuilder->SetCheckInverted(myCheckInverted); myBuilder->SetCheckInverted(myCheckInverted);
myBuilder->SetToFillHistory(myFillHistory); myBuilder->SetToFillHistory(myFillHistory);
// Perform building of the result with pre-calculated intersections // Perform building of the result with pre-calculated intersections

View File

@ -94,7 +94,10 @@ void BRepAlgoAPI_Check::Perform()
anAnalyzer.SelfInterMode() = myTestSI; anAnalyzer.SelfInterMode() = myTestSI;
// Set options from BOPAlgo_Options // Set options from BOPAlgo_Options
anAnalyzer.SetRunParallel(myRunParallel); anAnalyzer.SetRunParallel(myRunParallel);
anAnalyzer.SetProgressIndicator(*myProgressScope); if (myProgressScope != NULL)
{
anAnalyzer.SetProgressIndicator(*myProgressScope);
}
anAnalyzer.SetFuzzyValue(myFuzzyValue); anAnalyzer.SetFuzzyValue(myFuzzyValue);
// Perform the check // Perform the check
anAnalyzer.Perform(); anAnalyzer.Perform();