mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0023373: MSVC++ warnings issued during compilation for 64bits, 'Sparse Arrays'
Replaced 'Standard_Integer' with 'Standard_Size' to avoid compiler warning. Removed redundant casting to 'Standard_Size'. Removed code checking if a 'Standard_Size' variable is negative.
This commit is contained in:
@@ -85,31 +85,31 @@ public:
|
||||
//!@{
|
||||
|
||||
//! Direct const access to the item
|
||||
const TheItemType& Value (const Standard_Integer theIndex) const
|
||||
const TheItemType& Value (const Standard_Size theIndex) const
|
||||
{
|
||||
return *(const TheItemType*)this->getValue(theIndex);
|
||||
}
|
||||
|
||||
//! Const access to the item - operator()
|
||||
const TheItemType& operator () (const Standard_Integer theIndex) const
|
||||
const TheItemType& operator () (const Standard_Size theIndex) const
|
||||
{
|
||||
return Value (theIndex);
|
||||
}
|
||||
|
||||
//! Modification access to the item
|
||||
TheItemType& ChangeValue (const Standard_Integer theIndex)
|
||||
TheItemType& ChangeValue (const Standard_Size theIndex)
|
||||
{
|
||||
return *(TheItemType*)(this->getValue (theIndex));
|
||||
}
|
||||
|
||||
//! Access to the item - operator()
|
||||
TheItemType& operator () (const Standard_Integer theIndex)
|
||||
TheItemType& operator () (const Standard_Size theIndex)
|
||||
{
|
||||
return ChangeValue (theIndex);
|
||||
}
|
||||
|
||||
//! Set a value at specified index method
|
||||
TheItemType& SetValue (const Standard_Integer theIndex,
|
||||
TheItemType& SetValue (const Standard_Size theIndex,
|
||||
const TheItemType& theValue)
|
||||
{
|
||||
return *(TheItemType*)this->setValue(theIndex, (Standard_Address)&theValue);
|
||||
@@ -134,33 +134,33 @@ public:
|
||||
}
|
||||
|
||||
//! Direct const access to the item
|
||||
const TheItemType& Find (const Standard_Integer theIndex) const
|
||||
const TheItemType& Find (const Standard_Size theIndex) const
|
||||
{
|
||||
return *(TheItemType*)this->getValue(theIndex);
|
||||
}
|
||||
|
||||
//! Modification access to the item; allocates space if
|
||||
//! necessary and marks the item as defined
|
||||
TheItemType& ChangeFind (const Standard_Integer theIndex)
|
||||
TheItemType& ChangeFind (const Standard_Size theIndex)
|
||||
{
|
||||
return *(TheItemType*)(this->changeValue (theIndex));
|
||||
}
|
||||
|
||||
//! Set a value as explicit method
|
||||
TheItemType& Bind (const Standard_Integer theIndex,
|
||||
TheItemType& Bind (const Standard_Size theIndex,
|
||||
const TheItemType& theValue)
|
||||
{
|
||||
return SetValue(theIndex, theValue);
|
||||
}
|
||||
|
||||
//! Returns True if the item is defined
|
||||
Standard_Boolean IsBound (const Standard_Integer theIndex) const
|
||||
Standard_Boolean IsBound (const Standard_Size theIndex) const
|
||||
{
|
||||
return this->HasValue(theIndex);
|
||||
}
|
||||
|
||||
//! Remove the item from array
|
||||
Standard_Boolean UnBind (const Standard_Integer theIndex)
|
||||
Standard_Boolean UnBind (const Standard_Size theIndex)
|
||||
{
|
||||
return this->UnsetValue(theIndex);
|
||||
}
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
}
|
||||
|
||||
//! Access current index with 'a-la map' interface
|
||||
Standard_Integer Key (void) const { return Index(); }
|
||||
Standard_Size Key (void) const { return Index(); }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -202,12 +202,10 @@ void NCollection_SparseArrayBase::exchange (NCollection_SparseArrayBase& theOthe
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Address NCollection_SparseArrayBase::setValue (const Standard_Integer theIndex,
|
||||
Standard_Address NCollection_SparseArrayBase::setValue (const Standard_Size theIndex,
|
||||
const Standard_Address theValue)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if (theIndex<0,"NCollection_SparseArray::SetValue()")
|
||||
Standard_Size anIndex = (Standard_Size)theIndex;
|
||||
Standard_Size iBlock = anIndex / myBlockSize;
|
||||
Standard_Size iBlock = theIndex / myBlockSize;
|
||||
|
||||
// resize blocks array if necessary
|
||||
if ( iBlock >= myNbBlocks )
|
||||
@@ -222,7 +220,7 @@ Standard_Address NCollection_SparseArrayBase::setValue (const Standard_Integer t
|
||||
Block aBlock (getBlock (anAddr));
|
||||
|
||||
// mark item as defined
|
||||
Standard_Size anInd = anIndex % myBlockSize;
|
||||
Standard_Size anInd = theIndex % myBlockSize;
|
||||
Standard_Address anItem = getItem (aBlock, anInd);
|
||||
|
||||
// either create an item by copy constructor if it is new, or assign it
|
||||
@@ -243,14 +241,13 @@ Standard_Address NCollection_SparseArrayBase::setValue (const Standard_Integer t
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean NCollection_SparseArrayBase::HasValue (const Standard_Integer theIndex) const
|
||||
Standard_Boolean NCollection_SparseArrayBase::HasValue (const Standard_Size theIndex) const
|
||||
{
|
||||
Standard_Size anIndex = (Standard_Size)theIndex;
|
||||
Standard_Size iBlock = anIndex / myBlockSize;
|
||||
if ( theIndex < 0 || iBlock >= myNbBlocks ||
|
||||
Standard_Size iBlock = theIndex / myBlockSize;
|
||||
if ( iBlock >= myNbBlocks ||
|
||||
! myData[iBlock] )
|
||||
return Standard_False;
|
||||
return getBlock(myData[iBlock]).IsSet(anIndex % myBlockSize) ? Standard_True : Standard_False;
|
||||
return getBlock(myData[iBlock]).IsSet(theIndex % myBlockSize) ? Standard_True : Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -258,16 +255,15 @@ Standard_Boolean NCollection_SparseArrayBase::HasValue (const Standard_Integer t
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean NCollection_SparseArrayBase::UnsetValue (const Standard_Integer theIndex)
|
||||
Standard_Boolean NCollection_SparseArrayBase::UnsetValue (const Standard_Size theIndex)
|
||||
{
|
||||
// check that the item is defined
|
||||
Standard_Size anIndex = (Standard_Size)theIndex;
|
||||
Standard_Size iBlock = anIndex / myBlockSize;
|
||||
if ( theIndex < 0 || iBlock >= myNbBlocks || ! myData[iBlock] )
|
||||
Standard_Size iBlock = theIndex / myBlockSize;
|
||||
if ( iBlock >= myNbBlocks || ! myData[iBlock] )
|
||||
return Standard_False;
|
||||
|
||||
Block aBlock (getBlock(myData[iBlock]));
|
||||
Standard_Size anInd = anIndex % myBlockSize;
|
||||
Standard_Size anInd = theIndex % myBlockSize;
|
||||
if ( ! aBlock.Unset(anInd) )
|
||||
return Standard_False;
|
||||
|
||||
|
@@ -45,11 +45,11 @@ public:
|
||||
Standard_Size Size () const { return mySize; }
|
||||
|
||||
//! Check whether the value at given index is set
|
||||
Standard_EXPORT Standard_Boolean HasValue (const Standard_Integer theIndex) const;
|
||||
Standard_EXPORT Standard_Boolean HasValue (const Standard_Size theIndex) const;
|
||||
|
||||
//! Deletes the item from the array;
|
||||
//! returns True if that item was defined
|
||||
Standard_EXPORT Standard_Boolean UnsetValue (const Standard_Integer theIndex);
|
||||
Standard_EXPORT Standard_Boolean UnsetValue (const Standard_Size theIndex);
|
||||
|
||||
//!@}
|
||||
|
||||
@@ -231,7 +231,7 @@ protected:
|
||||
}
|
||||
|
||||
//! Direct const access to the item
|
||||
Standard_Address getValue (const Standard_Integer theIndex) const
|
||||
Standard_Address getValue (const Standard_Size theIndex) const
|
||||
{
|
||||
Standard_OutOfRange_Raise_if (!HasValue(theIndex),"NCollection_SparseArray::Value()")
|
||||
return Block::ToArray(myData[theIndex/myBlockSize], myBlockSize, myItemSize) +
|
||||
@@ -239,12 +239,12 @@ protected:
|
||||
}
|
||||
|
||||
//! Set a value to the specified item; returns address of the set item
|
||||
Standard_EXPORT Standard_Address setValue (const Standard_Integer theIndex,
|
||||
Standard_EXPORT Standard_Address setValue (const Standard_Size theIndex,
|
||||
const Standard_Address theValue);
|
||||
|
||||
//! Modification access to the item; allocates necessary space
|
||||
//! and marks the item as defined
|
||||
Standard_EXPORT Standard_Address changeValue (const Standard_Integer theIndex);
|
||||
Standard_EXPORT Standard_Address changeValue (const Standard_Size theIndex);
|
||||
|
||||
//! Copy contents of theOther to this;
|
||||
//! assumes that this and theOther have exactly the same type of arguments
|
||||
|
Reference in New Issue
Block a user