]> OCCT Git - occt-copy.git/commitdiff
0031842: Coding Rules, BOPAlgo - eliminate CLang warning -fsanitize=undefined referen...
authorkgv <kgv@opencascade.com>
Mon, 12 Oct 2020 15:00:22 +0000 (18:00 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 13 Oct 2020 16:07:42 +0000 (19:07 +0300)
Added NULL checks before Progress Scope pointer dereference.

15 files changed:
src/BOPAlgo/BOPAlgo_BOP.cxx
src/BOPAlgo/BOPAlgo_Builder.cxx
src/BOPAlgo/BOPAlgo_Builder_2.cxx
src/BOPAlgo/BOPAlgo_Builder_3.cxx
src/BOPAlgo/BOPAlgo_CheckerSI.cxx
src/BOPAlgo/BOPAlgo_MakerVolume.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx
src/BOPAlgo/BOPAlgo_Splitter.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx
src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx

index b516015c4900ecb9b58d17eef9b495ffadb93079..b3367e2eb02648b650460841af9a18bb84faa043 100644 (file)
@@ -387,7 +387,10 @@ void BOPAlgo_BOP::Perform()
   pPF=new BOPAlgo_PaveFiller(aAllocator);
   pPF->SetArguments(aLS);
   pPF->SetRunParallel(myRunParallel);
-  pPF->SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    pPF->SetProgressIndicator(*myProgressScope);
+  }
   pPF->SetFuzzyValue(myFuzzyValue);
   pPF->SetNonDestructive(myNonDestructive);
   pPF->SetGlue(myGlue);
index e46106ef495fd769f845d56bcd0ea778209bc009..7ef864a1b602e9797c5a6bc15cb73963366592ab 100644 (file)
@@ -195,7 +195,10 @@ void BOPAlgo_Builder::Perform()
   //
   pPF->SetArguments(myArguments);
   pPF->SetRunParallel(myRunParallel);
-  pPF->SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    pPF->SetProgressIndicator(*myProgressScope);
+  }
   pPF->SetFuzzyValue(myFuzzyValue);
   pPF->SetNonDestructive(myNonDestructive);
   pPF->SetGlue(myGlue);
@@ -632,7 +635,10 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects,
   aBS.SetRunParallel(myRunParallel);
   aBS.SetContext(myContext);
   aBS.SetFuzzyValue(myFuzzyValue);
-  aBS.SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    aBS.SetProgressIndicator(*myProgressScope);
+  }
   aBS.Perform();
 
   // Resulting solids
index 09a57fa46a109c355c4520eb515521fbd79108d2..a0a2fc870c5a525402e2fa15074d43510f84946c 100644 (file)
@@ -450,7 +450,10 @@ void BOPAlgo_Builder::BuildSplitFaces()
     aBF.SetFace(aF);
     aBF.SetShapes(aLE);
     aBF.SetRunParallel(myRunParallel);
-    aBF.SetProgressIndicator(*myProgressScope);
+    if (myProgressScope != NULL)
+    {
+      aBF.SetProgressIndicator(*myProgressScope);
+    }
     //
   }// for (i=0; i<aNbS; ++i) {
   //
@@ -637,7 +640,10 @@ void BOPAlgo_Builder::FillSameDomainFaces()
         aPSB.Shape1() = aF1;
         aPSB.Shape2() = aF2;
         aPSB.SetFuzzyValue(myFuzzyValue);
-        aPSB.SetProgressIndicator(*myProgressScope);
+        if (myProgressScope != NULL)
+        {
+          aPSB.SetProgressIndicator(*myProgressScope);
+        }
       }
     }
   }
@@ -790,7 +796,10 @@ void BOPAlgo_Builder::FillInternalVertices()
         aVFI.SetVertex(aV);
         aVFI.SetFace(aFIm);
         aVFI.SetFuzzyValue(myFuzzyValue);
-        aVFI.SetProgressIndicator(*myProgressScope);
+        if (myProgressScope != NULL)
+        {
+          aVFI.SetProgressIndicator(*myProgressScope);
+        }
       }
     }
   }
index 067256a950a02b7e48f95f78087655afb2b8b4f8..f8d5b50999e8fc6b72cff5f7774ba8fd66590456 100644 (file)
@@ -432,7 +432,10 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol
     aBS.SetSolid(aSolid);
     aBS.SetShapes(aSFS);
     aBS.SetRunParallel(myRunParallel);
-    aBS.SetProgressIndicator(*myProgressScope);
+    if (myProgressScope != NULL)
+    {
+      aBS.SetProgressIndicator(*myProgressScope);
+    }
   }//for (i=0; i<aNbS; ++i) {
   //
   Standard_Integer k, aNbBS;
index 26c04b1fc764759ab311b28ab9aa1f7db1431fa2..93e4a0645c9fb622ea984c5a7219d28e1faf2eeb 100644 (file)
@@ -432,7 +432,10 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
     aFaceSelfIntersect.SetFace(aF);
     aFaceSelfIntersect.SetTolF(aTolF);
     //
-    aFaceSelfIntersect.SetProgressIndicator(*myProgressScope);
+    if (myProgressScope != NULL)
+    {
+      aFaceSelfIntersect.SetProgressIndicator(*myProgressScope);
+    }
   }
   
   Standard_Integer aNbFace = aVFace.Length();
index 148046e13cd2940b553f03ac2d29e54fe6f8a209..2ea86e878317b633dafb9620d785a84cbf3a93df 100644 (file)
@@ -86,7 +86,10 @@ void BOPAlgo_MakerVolume::Perform()
   }
   //
   pPF->SetRunParallel(myRunParallel);
-  pPF->SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    pPF->SetProgressIndicator(*myProgressScope);
+  }
   pPF->SetFuzzyValue(myFuzzyValue);
   pPF->SetNonDestructive(myNonDestructive);
   pPF->SetGlue(myGlue);
index 593557621f64be3de6b36bb510f6d1076bd51ef6..ee6b573d5992bd4ec4741b46129b91a6b5dfa416 100644 (file)
@@ -264,7 +264,10 @@ void BOPAlgo_PaveFiller::IntersectVE
       aVESolver.SetEdge(aE);
       aVESolver.SetPaveBlock(aPB);
       aVESolver.SetFuzzyValue(myFuzzyValue);
-      aVESolver.SetProgressIndicator(*myProgressScope);
+      if (myProgressScope != NULL)
+      {
+        aVESolver.SetProgressIndicator(*myProgressScope);
+      }
     }
   }
   //
index a100b82f7c26b7b8b86ffbff2af4569ec079ba4b..c199a87c8c7fd28d2c73e6b772b8a5c4e1db10d5 100644 (file)
@@ -253,7 +253,10 @@ void BOPAlgo_PaveFiller::PerformEE()
         anEdgeEdge.SetEdge2(aE2, aT21, aT22);
         anEdgeEdge.SetBoxes (aBB1, aBB2);
         anEdgeEdge.SetFuzzyValue(myFuzzyValue);
-        anEdgeEdge.SetProgressIndicator(*myProgressScope);
+        if (myProgressScope != NULL)
+        {
+          anEdgeEdge.SetProgressIndicator(*myProgressScope);
+        }
       }//for (; aIt2.More(); aIt2.Next()) {
     }//for (; aIt1.More(); aIt1.Next()) {
   }//for (; myIterator->More(); myIterator->Next()) {
@@ -1070,10 +1073,17 @@ void BOPAlgo_PaveFiller::ForceInterfEE()
         anEdgeEdge.SetEdge2(aE2, aT21, aT22);
         anEdgeEdge.SetBoxes (myDS->ShapeInfo(nE1).Box(), myDS->ShapeInfo (nE2).Box());
         if (bUseAddTol)
+        {
           anEdgeEdge.SetFuzzyValue(myFuzzyValue + aTolAdd);
+        }
         else
+        {
           anEdgeEdge.SetFuzzyValue(myFuzzyValue);
-        anEdgeEdge.SetProgressIndicator(*myProgressScope);
+        }
+        if (myProgressScope != NULL)
+        {
+          anEdgeEdge.SetProgressIndicator(*myProgressScope);
+        }
       }
     }
   }
index e794d632f574a8362e9f3e62cea6b5042c970d04..9a289ddf6d340272dde936efa930d436cf40bc73 100644 (file)
@@ -217,7 +217,10 @@ void BOPAlgo_PaveFiller::PerformVF()
     aVertexFace.SetVertex(aV);
     aVertexFace.SetFace(aF);
     aVertexFace.SetFuzzyValue(myFuzzyValue);
-    aVertexFace.SetProgressIndicator(*myProgressScope);
+    if (myProgressScope != NULL)
+    {
+      aVertexFace.SetProgressIndicator(*myProgressScope);
+    }
   }//for (; myIterator->More(); myIterator->Next()) {
   //
   aNbVF=aVVF.Length();
index 550744b742bc227d69b6caf484c9f3019c40ab59..aebd4882d41ea25c7ec6cde5fb0e62c41049f2b2 100644 (file)
@@ -278,7 +278,10 @@ void BOPAlgo_PaveFiller::PerformEF()
       aSR = aPBRange;
       BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange);
       aEdgeFace.SetRange (aPBRange);
-      aEdgeFace.SetProgressIndicator(*myProgressScope);
+      if (myProgressScope != NULL)
+      {
+        aEdgeFace.SetProgressIndicator(*myProgressScope);
+      }
       // Save the pair to avoid their forced intersection
       BOPDS_MapOfPaveBlock* pMPB = myFPBDone.ChangeSeek(nF);
       if (!pMPB)
@@ -1010,7 +1013,10 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
         aEdgeFace.SetFuzzyValue(myFuzzyValue + aTolAdd);
         aEdgeFace.UseQuickCoincidenceCheck(Standard_True);
         aEdgeFace.SetRange(IntTools_Range(aPB->Pave1().Parameter(), aPB->Pave2().Parameter()));
-        aEdgeFace.SetProgressIndicator(*myProgressScope);
+        if (myProgressScope != NULL)
+        {
+          aEdgeFace.SetProgressIndicator(*myProgressScope);
+        }
       }
     }
   }
index 3d6d02918b234a12abb3949871cab3c1ef2d8fb9..9c35a81fcf590aaf7403d153937873cf632710a1 100644 (file)
@@ -308,7 +308,10 @@ void BOPAlgo_PaveFiller::PerformFF()
       //
       aFaceFace.SetParameters(bApprox, bCompC2D1, bCompC2D2, anApproxTol);
       aFaceFace.SetFuzzyValue(myFuzzyValue);
-      aFaceFace.SetProgressIndicator(*myProgressScope);
+      if (myProgressScope != NULL)
+      {
+        aFaceFace.SetProgressIndicator(*myProgressScope);
+      }
     }
     else {
       // for the Glue mode just add all interferences of that type
@@ -1019,7 +1022,10 @@ void BOPAlgo_PaveFiller::PostTreatFF
   }
   //
   // 2 Fuse shapes
-  aPF.SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    aPF.SetProgressIndicator(*myProgressScope);
+  }
   aPF.SetRunParallel(myRunParallel);
   aPF.SetArguments(aLS);
   aPF.Perform();
index 18467d0e31f3afb14964ec4230c47bca96a105f5..11a0cacc39f96c76121ef3ce3b594e62dc07955f 100644 (file)
@@ -484,7 +484,10 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
         aBSE.SetCommonBlock(aCB);
       }
       aBSE.SetDS(myDS);
-      aBSE.SetProgressIndicator(*myProgressScope);
+      if (myProgressScope != NULL)
+      {
+        aBSE.SetProgressIndicator(*myProgressScope);
+      }
     } // for (; aItPB.More(); aItPB.Next()) {
   }  // for (i=0; i<aNbPBP; ++i) {      
   //
@@ -596,7 +599,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
       BOPAlgo_MPC& aMPC=aVMPC.Appended();
       aMPC.SetEdge(aE);
       aMPC.SetFace(aF1F);
-      aMPC.SetProgressIndicator(*myProgressScope);
+      if (myProgressScope != NULL)
+      {
+        aMPC.SetProgressIndicator(*myProgressScope);
+      }
     }
     //
     // On
@@ -660,7 +666,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
 
       aMPC.SetEdge(aE);
       aMPC.SetFace(aF1F);
-      aMPC.SetProgressIndicator(*myProgressScope);
+      if (myProgressScope != NULL)
+      {
+        aMPC.SetProgressIndicator(*myProgressScope);
+      }
     }
   }// for (i=0; i<aNbFI; ++i) {
   //
@@ -710,7 +719,10 @@ void BOPAlgo_PaveFiller::MakePCurves()
               aMPC.SetEdge(aE);
               aMPC.SetFace(aFf[m]);
               aMPC.SetFlag(Standard_True);
-              aMPC.SetProgressIndicator(*myProgressScope);
+              if (myProgressScope != NULL)
+              {
+                aMPC.SetProgressIndicator(*myProgressScope);
+              }
             }
           }
         }
index 5936d6ce943b148d1e9a7f7b8cf434d29b9c6e0a..dc53bef84871a6a1297d30ebe8e561761429493d 100644 (file)
@@ -89,7 +89,10 @@ void BOPAlgo_Splitter::Perform()
   BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller();
   pPF->SetArguments(aLS);
   pPF->SetRunParallel(myRunParallel);
-  pPF->SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    pPF->SetProgressIndicator(*myProgressScope);
+  }
   pPF->SetFuzzyValue(myFuzzyValue);
   pPF->SetNonDestructive(myNonDestructive);
   pPF->SetGlue(myGlue);
index 0046e4fb9b8e7476b1f766b35b9c464e37510d58..4e310b2f6d95c6fd0d30c33777cf31cc61718d0a 100644 (file)
@@ -125,7 +125,10 @@ void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArg
   myDSFiller->SetArguments(theArgs);
   // Set options for intersection
   myDSFiller->SetRunParallel(myRunParallel);
-  myDSFiller->SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    myDSFiller->SetProgressIndicator(*myProgressScope);
+  }
   myDSFiller->SetFuzzyValue(myFuzzyValue);
   myDSFiller->SetNonDestructive(myNonDestructive);
   myDSFiller->SetGlue(myGlue);
@@ -145,7 +148,10 @@ void BRepAlgoAPI_BuilderAlgo::BuildResult()
 {
   // Set options to the builder
   myBuilder->SetRunParallel(myRunParallel);
-  myBuilder->SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    myBuilder->SetProgressIndicator(*myProgressScope);
+  }
   myBuilder->SetCheckInverted(myCheckInverted);
   myBuilder->SetToFillHistory(myFillHistory);
   // Perform building of the result with pre-calculated intersections
index d906ff207e723ab77ed50e8e917df08f354d843b..3dc00987798bbcf6cff58fd3788813992c00be66 100644 (file)
@@ -94,7 +94,10 @@ void BRepAlgoAPI_Check::Perform()
   anAnalyzer.SelfInterMode() = myTestSI;
   // Set options from BOPAlgo_Options
   anAnalyzer.SetRunParallel(myRunParallel);
-  anAnalyzer.SetProgressIndicator(*myProgressScope);
+  if (myProgressScope != NULL)
+  {
+    anAnalyzer.SetProgressIndicator(*myProgressScope);
+  }
   anAnalyzer.SetFuzzyValue(myFuzzyValue);
   // Perform the check
   anAnalyzer.Perform();