Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ void BOPAlgo_PaveFiller::PerformEE(const Message_ProgressRange& theRange)
BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
Handle(NCollection_BaseAllocator) aAllocator;
BOPAlgo_VectorOfEdgeEdge aVEdgeEdge;
BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
// keep modified edges for further update
TColStd_MapOfInteger aMEdges;
//
Expand Down
10 changes: 6 additions & 4 deletions src/BRepTest/BRepTest_CheckCommands.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ Standard_EXPORT void BRepTest_CheckCommands_SetFaultyName(const char* name)
}
}


static TopTools_DataMapOfShapeListOfShape theMap;
static Standard_Integer nbfaulty = 0;
static Draw_SequenceOfDrawable3D lfaulty;
namespace
{
static TopTools_DataMapOfShapeListOfShape theMap;
static Standard_Integer nbfaulty = 0;
static Draw_SequenceOfDrawable3D lfaulty;
}

Standard_IMPORT Standard_Integer BRepCheck_Trace(const Standard_Integer phase);

Expand Down
40 changes: 37 additions & 3 deletions src/NCollection/NCollection_BaseMap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,47 @@ void NCollection_BaseMap::EndResize
myData2 = data2;
}

//=======================================================================
//function : Reallocate
//purpose :
//=======================================================================
Standard_Boolean NCollection_BaseMap::Reallocate(const Standard_Integer theNbBuckets)
{
// get next size for the buckets array
Standard_Integer aNewBuckets = NCollection_Primes::NextPrimeForMap(theNbBuckets);
if (aNewBuckets <= myNbBuckets)
{
if (!myData1)
{
aNewBuckets = myNbBuckets;
}
else
{
return Standard_False;
}
}
myNbBuckets = aNewBuckets;
const size_t aSize = myNbBuckets + 1;
myData1 = (NCollection_ListNode**)Standard::Reallocate(myData1, aSize * sizeof(NCollection_ListNode*));
memset(myData1, 0, aSize * sizeof(NCollection_ListNode*));
if (isDouble)
{
myData2 = (NCollection_ListNode**)Standard::Reallocate(myData2, aSize * sizeof(NCollection_ListNode*));
memset(myData2, 0, aSize * sizeof(NCollection_ListNode*));
}
else
{
myData2 = nullptr;
}
return Standard_True;
}

//=======================================================================
//function : Destroy
//purpose :
//purpose :
//=======================================================================

void NCollection_BaseMap::Destroy (NCollection_DelMapNode fDel,
Standard_Boolean doReleaseMemory)
void NCollection_BaseMap::Destroy(NCollection_DelMapNode fDel, Standard_Boolean doReleaseMemory)
{
if (!IsEmpty())
{
Expand Down
8 changes: 8 additions & 0 deletions src/NCollection/NCollection_BaseMap.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ public:
NCollection_ListNode** data1,
NCollection_ListNode** data2);

//! Reallocate the existed data containers.
//! Filling operation must to be done outside.
//! Reallocated memory will be cleared (all elements will be set to nullptr).
Standard_EXPORT Standard_Boolean Reallocate
(const Standard_Integer theNbBuckets);

//! Resizable
Standard_Boolean Resizable() const
{ return IsEmpty() || (mySize > myNbBuckets); }
Expand Down Expand Up @@ -243,6 +249,8 @@ public:
NCollection_ListNode ** myData1;
NCollection_ListNode ** myData2;

void resetSize() { mySize = 0; }

private:
// ---------- PRIVATE FIELDS ------------
Standard_Integer myNbBuckets;
Expand Down
Loading
Loading