1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0022773: Compiler warnings on 64-bit MSVC in NCollection_Vector.hxx

This commit is contained in:
DBV 2011-12-23 14:32:59 +00:00 committed by bugmaster
parent 5bc99ed056
commit 0f633a2224
3 changed files with 17 additions and 17 deletions

View File

@ -125,7 +125,7 @@ void * NCollection_BaseVector::ExpandV (const Standard_Integer theIndex)
MemBlock& aLastBlock = myData [myNBlocks - 1]; MemBlock& aLastBlock = myData [myNBlocks - 1];
Standard_RangeError_Raise_if (theIndex < aLastBlock.FirstIndex(), Standard_RangeError_Raise_if (theIndex < aLastBlock.FirstIndex(),
"NColelction_BaseVector::ExpandV"); "NColelction_BaseVector::ExpandV");
const unsigned int anIndLastBlock = theIndex - aLastBlock.FirstIndex(); Standard_Integer anIndLastBlock = theIndex - aLastBlock.FirstIndex();
// Is there still room for 1 item in the last array? // Is there still room for 1 item in the last array?
if (anIndLastBlock < aLastBlock.Size()) { if (anIndLastBlock < aLastBlock.Size()) {
myLength = aNewLength; myLength = aNewLength;

View File

@ -45,14 +45,14 @@ class NCollection_BaseVector
: myAlloc(theAlloc), : myAlloc(theAlloc),
myFirstInd(theFirstInd), myLength(0), mySize(theLength), myData(0L) {} myFirstInd(theFirstInd), myLength(0), mySize(theLength), myData(0L) {}
virtual void Reinit (const Standard_Integer, virtual void Reinit (const Standard_Integer,
const size_t) {} const Standard_Integer) {}
Standard_Integer FirstIndex () const { return myFirstInd; } Standard_Integer FirstIndex () const { return myFirstInd; }
size_t Size () const { return mySize; } Standard_Integer Size () const { return mySize; }
public: public:
virtual ~MemBlock () {} virtual ~MemBlock () {}
void SetLength (const size_t theLen) void SetLength (const Standard_Integer theLen)
{ myLength = theLen; } { myLength = theLen; }
size_t Length () const { return myLength; } Standard_Integer Length () const { return myLength; }
void * Find (const Standard_Integer theInd, void * Find (const Standard_Integer theInd,
const size_t theSize) const const size_t theSize) const
{ return ((char *) myData)+theInd*theSize;} { return ((char *) myData)+theInd*theSize;}
@ -60,8 +60,8 @@ class NCollection_BaseVector
GetIndexV (void * theItem, const size_t theSz) const; GetIndexV (void * theItem, const size_t theSz) const;
protected: protected:
Standard_Integer myFirstInd; Standard_Integer myFirstInd;
size_t myLength; Standard_Integer myLength;
size_t mySize; Standard_Integer mySize;
NCollection_BaseAllocator * myAlloc; NCollection_BaseAllocator * myAlloc;
void * myData; void * myData;
friend class NCollection_BaseVector; friend class NCollection_BaseVector;
@ -85,10 +85,10 @@ class NCollection_BaseVector
{ return &myVector -> myData[myICurBlock]; } { return &myVector -> myData[myICurBlock]; }
const NCollection_BaseVector * myVector; // the Master vector const NCollection_BaseVector * myVector; // the Master vector
size_t myICurBlock; // # of the current block Standard_Integer myICurBlock; // # of the current block
size_t myIEndBlock; Standard_Integer myIEndBlock;
size_t myCurIndex; // Index in the current block Standard_Integer myCurIndex; // Index in the current block
size_t myEndIndex; Standard_Integer myEndIndex;
}; };
protected: protected:

View File

@ -67,7 +67,7 @@ template <class TheItemType> class NCollection_Vector
: NCollection_BaseVector::MemBlock (theFirstInd, theSize, theAlloc) : NCollection_BaseVector::MemBlock (theFirstInd, theSize, theAlloc)
{ {
myData = myAlloc->Allocate(theSize * sizeof(TheItemType)); myData = myAlloc->Allocate(theSize * sizeof(TheItemType));
for (size_t i=0; i < theSize; i++) for (Standard_Integer i=0; i < theSize; i++)
new (&((TheItemType *) myData)[i]) TheItemType; new (&((TheItemType *) myData)[i]) TheItemType;
} }
//! Copy constructor //! Copy constructor
@ -77,7 +77,7 @@ template <class TheItemType> class NCollection_Vector
{ {
myLength = theOther.Length(); myLength = theOther.Length();
myData = myAlloc->Allocate(Size() * sizeof(TheItemType)); myData = myAlloc->Allocate(Size() * sizeof(TheItemType));
size_t i; Standard_Integer i;
for (i=0; i < Length(); i++) for (i=0; i < Length(); i++)
new (&((TheItemType *) myData)[i]) TheItemType(theOther.Value(i)); new (&((TheItemType *) myData)[i]) TheItemType(theOther.Value(i));
for (; i < Size(); i++) for (; i < Size(); i++)
@ -85,17 +85,17 @@ template <class TheItemType> class NCollection_Vector
} }
//! Reinit //! Reinit
virtual void Reinit (const Standard_Integer theFirst, virtual void Reinit (const Standard_Integer theFirst,
const size_t theSize) const Standard_Integer theSize)
{ {
if (myData) { if (myData) {
for (size_t i=0; i < mySize; i++) for (Standard_Integer i=0; i < mySize; i++)
((TheItemType *) myData)[i].~TheItemTypeD(); ((TheItemType *) myData)[i].~TheItemTypeD();
myAlloc->Free(myData); myAlloc->Free(myData);
myData = NULL; myData = NULL;
} }
if (theSize > 0) { if (theSize > 0) {
myData = myAlloc->Allocate(theSize * sizeof(TheItemType)); myData = myAlloc->Allocate(theSize * sizeof(TheItemType));
for (size_t i=0; i < theSize; i++) for (Standard_Integer i=0; i < theSize; i++)
new (&((TheItemType *) myData)[i]) TheItemType; new (&((TheItemType *) myData)[i]) TheItemType;
} }
myFirstInd = theFirst; myFirstInd = theFirst;
@ -106,7 +106,7 @@ template <class TheItemType> class NCollection_Vector
virtual ~MemBlock () virtual ~MemBlock ()
{ {
if (myData) { if (myData) {
for (size_t i=0; i < Size(); i++) for (Standard_Integer i=0; i < Size(); i++)
((TheItemType *) myData)[i].~TheItemTypeD(); ((TheItemType *) myData)[i].~TheItemTypeD();
myAlloc->Free(myData); myAlloc->Free(myData);
myData = NULL; myData = NULL;