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];
Standard_RangeError_Raise_if (theIndex < aLastBlock.FirstIndex(),
"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?
if (anIndLastBlock < aLastBlock.Size()) {
myLength = aNewLength;

View File

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

View File

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