mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0023332: Expression 'anIndex < 0' is always false. Unsigned type value is never < 0. in Vrmldata_Geometry.cxx
Examining index sign before casting to Standard_Size. Argument of method VrmlData_ArrayVec3d::Value() changed from Standard_Integer to Standard_Size to be consistent with its use (avoid compiler warnings)
This commit is contained in:
parent
d497b3141d
commit
8ad8260234
@ -46,7 +46,7 @@ class VrmlData_ArrayVec3d : public VrmlData_Node
|
||||
*/
|
||||
inline VrmlData_ArrayVec3d (const VrmlData_Scene& theScene,
|
||||
const char * theName,
|
||||
const size_t nVec,
|
||||
const Standard_Size nVec,
|
||||
const gp_XYZ * arrVec)
|
||||
: VrmlData_Node (theScene, theName),
|
||||
myArray (arrVec),
|
||||
@ -56,7 +56,7 @@ class VrmlData_ArrayVec3d : public VrmlData_Node
|
||||
/**
|
||||
* Query the number of vectors
|
||||
*/
|
||||
inline size_t Length () const { return myLength; }
|
||||
inline Standard_Size Length () const { return myLength; }
|
||||
|
||||
/**
|
||||
* Query the array
|
||||
@ -74,7 +74,7 @@ class VrmlData_ArrayVec3d : public VrmlData_Node
|
||||
/**
|
||||
* Set the array data
|
||||
*/
|
||||
inline void SetValues (const size_t nValues,
|
||||
inline void SetValues (const Standard_Size nValues,
|
||||
const gp_XYZ * arrValues)
|
||||
{ myLength = nValues; myArray = arrValues; }
|
||||
|
||||
@ -116,7 +116,7 @@ class VrmlData_ArrayVec3d : public VrmlData_Node
|
||||
* @return
|
||||
* the vector for the index. If index irrelevant, returns (0., 0., 0.)
|
||||
*/
|
||||
Standard_EXPORT const gp_XYZ& Value (const Standard_Integer i) const;
|
||||
Standard_EXPORT const gp_XYZ& Value (const Standard_Size i) const;
|
||||
|
||||
protected:
|
||||
// ---------- PROTECTED FIELDS ----------
|
||||
|
@ -69,14 +69,10 @@ IMPLEMENT_STANDARD_RTTIEXT (VrmlData_TextureCoordinate, VrmlData_Node)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_XYZ& VrmlData_ArrayVec3d::Value (const Standard_Integer i) const
|
||||
const gp_XYZ& VrmlData_ArrayVec3d::Value (const Standard_Size i) const
|
||||
{
|
||||
size_t anIndex = (size_t)i;
|
||||
if (anIndex < 0 || anIndex >= myLength) {
|
||||
static gp_XYZ anOrigin (0., 0., 0.);
|
||||
return anOrigin;
|
||||
}
|
||||
return myArray[i];
|
||||
static gp_XYZ anOrigin (0., 0., 0.);
|
||||
return i < myLength ? myArray[i] : anOrigin;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user