Parcourir la source

core: fix shitloads of compiler warnings in the Bullet source code.

legacy
Sam Hocevar sam il y a 12 ans
Parent
révision
25d3ec6fd8
7 fichiers modifiés avec 104 ajouts et 60 suppressions
  1. +2
    -0
      src/bullet/BulletCollision/BroadphaseCollision/btDbvt.h
  2. +14
    -8
      src/bullet/LinearMath/btAlignedObjectArray.h
  3. +3
    -1
      src/bullet/LinearMath/btHashMap.h
  4. +27
    -17
      src/bullet/LinearMath/btQuadWord.h
  5. +13
    -7
      src/bullet/LinearMath/btQuaternion.h
  6. +2
    -0
      src/bullet/LinearMath/btSerializer.h
  7. +43
    -27
      src/bullet/LinearMath/btVector3.h

+ 2
- 0
src/bullet/BulletCollision/BroadphaseCollision/btDbvt.h Voir le fichier

@@ -92,7 +92,9 @@ subject to the following restrictions:
#endif

#if DBVT_USE_MEMMOVE
// LOL BEGIN
#if !defined( __CELLOS_LV2__) && !defined(__MWERKS__) && !defined(__native_client__)
// LOL END
#include <memory.h>
#endif
#include <string.h>


+ 14
- 8
src/bullet/LinearMath/btAlignedObjectArray.h Voir le fichier

@@ -67,10 +67,12 @@ private:
#endif//BT_ALLOW_ARRAY_COPY_OPERATOR

protected:
SIMD_FORCE_INLINE int allocSize(int size)
// LOL BEGIN
SIMD_FORCE_INLINE int allocSize(int _size)
{
return (size ? size*2 : 1);
return (_size ? _size*2 : 1);
}
// LOL END
SIMD_FORCE_INLINE void copy(int start,int end, T* dest) const
{
int i;
@@ -99,12 +101,14 @@ protected:
}
}

SIMD_FORCE_INLINE void* allocate(int size)
// LOL BEGIN
SIMD_FORCE_INLINE void* allocate(int _size)
{
if (size)
return m_allocator.allocate(size);
if (_size)
return m_allocator.allocate(_size);
return 0;
}
// LOL END

SIMD_FORCE_INLINE void deallocate()
{
@@ -473,14 +477,16 @@ protected:
}

//PCK: whole function
void initializeFromBuffer(void *buffer, int size, int capacity)
// LOL BEGIN
void initializeFromBuffer(void *buffer, int _size, int _capacity)
{
clear();
m_ownsMemory = false;
m_data = (T*)buffer;
m_size = size;
m_capacity = capacity;
m_size = _size;
m_capacity = _capacity;
}
// LOL END

void copyFromArray(const btAlignedObjectArray& otherArray)
{


+ 3
- 1
src/bullet/LinearMath/btHashMap.h Voir le fichier

@@ -52,8 +52,10 @@ struct btHashString
{
int ret = 0 ;

while( ! (ret = *(unsigned char *)src - *(unsigned char *)dst) && *dst)
// LOL BEGIN
while( ! (ret = *src - *dst) && *dst)
++src, ++dst;
// LOL END

if ( ret < 0 )
ret = -1 ;


+ 27
- 17
src/bullet/LinearMath/btQuadWord.h Voir le fichier

@@ -59,14 +59,16 @@ protected:
SIMD_FORCE_INLINE const btScalar& getY() const { return m_floats[1]; }
/**@brief Return the z value */
SIMD_FORCE_INLINE const btScalar& getZ() const { return m_floats[2]; }
// LOL BEGIN
/**@brief Set the x value */
SIMD_FORCE_INLINE void setX(btScalar x) { m_floats[0] = x;};
SIMD_FORCE_INLINE void setX(btScalar _x) { m_floats[0] = _x;};
/**@brief Set the y value */
SIMD_FORCE_INLINE void setY(btScalar y) { m_floats[1] = y;};
SIMD_FORCE_INLINE void setY(btScalar _y) { m_floats[1] = _y;};
/**@brief Set the z value */
SIMD_FORCE_INLINE void setZ(btScalar z) { m_floats[2] = z;};
SIMD_FORCE_INLINE void setZ(btScalar _z) { m_floats[2] = _z;};
/**@brief Set the w value */
SIMD_FORCE_INLINE void setW(btScalar w) { m_floats[3] = w;};
SIMD_FORCE_INLINE void setW(btScalar _w) { m_floats[3] = _w;};
// LOL END
/**@brief Return the x value */
SIMD_FORCE_INLINE const btScalar& x() const { return m_floats[0]; }
/**@brief Return the y value */
@@ -97,13 +99,15 @@ protected:
* @param y Value of y
* @param z Value of z
*/
SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z)
// LOL BEGIN
SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z)
{
m_floats[0]=x;
m_floats[1]=y;
m_floats[2]=z;
m_floats[0]=_x;
m_floats[1]=_y;
m_floats[2]=_z;
m_floats[3] = 0.f;
}
// LOL END

/* void getValue(btScalar *m) const
{
@@ -118,13 +122,15 @@ protected:
* @param z Value of z
* @param w Value of w
*/
SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z,const btScalar& w)
// LOL BEGIN
SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z,const btScalar& _w)
{
m_floats[0]=x;
m_floats[1]=y;
m_floats[2]=z;
m_floats[3]=w;
m_floats[0]=_x;
m_floats[1]=_y;
m_floats[2]=_z;
m_floats[3]=_w;
}
// LOL END
/**@brief No initialization constructor */
SIMD_FORCE_INLINE btQuadWord()
// :m_floats[0](btScalar(0.)),m_floats[1](btScalar(0.)),m_floats[2](btScalar(0.)),m_floats[3](btScalar(0.))
@@ -136,10 +142,12 @@ protected:
* @param y Value of y
* @param z Value of z
*/
SIMD_FORCE_INLINE btQuadWord(const btScalar& x, const btScalar& y, const btScalar& z)
// LOL BEGIN
SIMD_FORCE_INLINE btQuadWord(const btScalar& _x, const btScalar& _y, const btScalar& _z)
{
m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m_floats[3] = 0.0f;
m_floats[0] = _x, m_floats[1] = _y, m_floats[2] = _z, m_floats[3] = 0.0f;
}
// LOL END

/**@brief Initializing constructor
* @param x Value of x
@@ -147,10 +155,12 @@ protected:
* @param z Value of z
* @param w Value of w
*/
SIMD_FORCE_INLINE btQuadWord(const btScalar& x, const btScalar& y, const btScalar& z,const btScalar& w)
// LOL BEGIN
SIMD_FORCE_INLINE btQuadWord(const btScalar& _x, const btScalar& _y, const btScalar& _z,const btScalar& _w)
{
m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m_floats[3] = w;
m_floats[0] = _x, m_floats[1] = _y, m_floats[2] = _z, m_floats[3] = _w;
}
// LOL END

/**@brief Set each element to the max of the current values and the values of another btQuadWord
* @param other The other btQuadWord to compare with


+ 13
- 7
src/bullet/LinearMath/btQuaternion.h Voir le fichier

@@ -30,16 +30,20 @@ public:
// template <typename btScalar>
// explicit Quaternion(const btScalar *v) : Tuple4<btScalar>(v) {}
/**@brief Constructor from scalars */
btQuaternion(const btScalar& x, const btScalar& y, const btScalar& z, const btScalar& w)
: btQuadWord(x, y, z, w)
// LOL BEGIN
btQuaternion(const btScalar& _x, const btScalar& _y, const btScalar& _z, const btScalar& _w)
: btQuadWord(_x, _y, _z, _w)
{}
// LOL END
/**@brief Axis angle Constructor
* @param axis The axis which the rotation is around
* @param angle The magnitude of the rotation around the angle (Radians) */
btQuaternion(const btVector3& axis, const btScalar& angle)
// LOL BEGIN
btQuaternion(const btVector3& axis, const btScalar& _angle)
{
setRotation(axis, angle);
setRotation(axis, _angle);
}
// LOL END
/**@brief Constructor from Euler angles
* @param yaw Angle around Y unless BT_EULER_DEFAULT_ZYX defined then Z
* @param pitch Angle around X unless BT_EULER_DEFAULT_ZYX defined then Y
@@ -55,14 +59,16 @@ public:
/**@brief Set the rotation using axis angle notation
* @param axis The axis around which to rotate
* @param angle The magnitude of the rotation in Radians */
void setRotation(const btVector3& axis, const btScalar& angle)
// LOL BEGIN
void setRotation(const btVector3& axis, const btScalar& _angle)
{
btScalar d = axis.length();
btAssert(d != btScalar(0.0));
btScalar s = btSin(angle * btScalar(0.5)) / d;
btScalar s = btSin(_angle * btScalar(0.5)) / d;
setValue(axis.x() * s, axis.y() * s, axis.z() * s,
btCos(angle * btScalar(0.5)));
btCos(_angle * btScalar(0.5)));
}
// LOL END
/**@brief Set the quaternion using Euler angles
* @param yaw Angle around Y
* @param pitch Angle around X


+ 2
- 0
src/bullet/LinearMath/btSerializer.h Voir le fichier

@@ -20,7 +20,9 @@ subject to the following restrictions:
#include "btStackAlloc.h"
#include "btHashMap.h"

// LOL BEGIN
#if !defined( __CELLOS_LV2__) && !defined(__MWERKS__) && !defined(__native_client__)
// LOL END
#include <memory.h>
#endif
#include <string.h>


+ 43
- 27
src/bullet/LinearMath/btVector3.h Voir le fichier

@@ -79,13 +79,15 @@ public:
* @param y Y value
* @param z Z value
*/
SIMD_FORCE_INLINE btVector3(const btScalar& x, const btScalar& y, const btScalar& z)
// LOL BEGIN
SIMD_FORCE_INLINE btVector3(const btScalar& _x, const btScalar& _y, const btScalar& _z)
{
m_floats[0] = x;
m_floats[1] = y;
m_floats[2] = z;
m_floats[0] = _x;
m_floats[1] = _y;
m_floats[2] = _z;
m_floats[3] = btScalar(0.);
}
// LOL END

/**@brief Add a vector to this one
@@ -267,14 +269,16 @@ public:
SIMD_FORCE_INLINE const btScalar& getY() const { return m_floats[1]; }
/**@brief Return the z value */
SIMD_FORCE_INLINE const btScalar& getZ() const { return m_floats[2]; }
// LOL BEGIN
/**@brief Set the x value */
SIMD_FORCE_INLINE void setX(btScalar x) { m_floats[0] = x;};
SIMD_FORCE_INLINE void setX(btScalar _x) { m_floats[0] = _x;};
/**@brief Set the y value */
SIMD_FORCE_INLINE void setY(btScalar y) { m_floats[1] = y;};
SIMD_FORCE_INLINE void setY(btScalar _y) { m_floats[1] = _y;};
/**@brief Set the z value */
SIMD_FORCE_INLINE void setZ(btScalar z) {m_floats[2] = z;};
SIMD_FORCE_INLINE void setZ(btScalar _z) {m_floats[2] = _z;};
/**@brief Set the w value */
SIMD_FORCE_INLINE void setW(btScalar w) { m_floats[3] = w;};
SIMD_FORCE_INLINE void setW(btScalar _w) { m_floats[3] = _w;};
// LOL END
/**@brief Return the x value */
SIMD_FORCE_INLINE const btScalar& x() const { return m_floats[0]; }
/**@brief Return the y value */
@@ -321,13 +325,15 @@ public:
btSetMin(m_floats[3], other.w());
}

SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z)
// LOL BEGIN
SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z)
{
m_floats[0]=x;
m_floats[1]=y;
m_floats[2]=z;
m_floats[0]=_x;
m_floats[1]=_y;
m_floats[2]=_z;
m_floats[3] = btScalar(0.);
}
// LOL END

void getSkewSymmetricMatrix(btVector3* v0,btVector3* v1,btVector3* v2) const
{
@@ -491,18 +497,20 @@ SIMD_FORCE_INLINE btVector3 btVector3::normalized() const
return *this / length();
}

SIMD_FORCE_INLINE btVector3 btVector3::rotate( const btVector3& wAxis, const btScalar angle ) const
// LOL BEGIN
SIMD_FORCE_INLINE btVector3 btVector3::rotate( const btVector3& wAxis, const btScalar _angle ) const
{
// wAxis must be a unit lenght vector

btVector3 o = wAxis * wAxis.dot( *this );
btVector3 x = *this - o;
btVector3 y;
btVector3 _x = *this - o;
btVector3 _y;

y = wAxis.cross( *this );
_y = wAxis.cross( *this );

return ( o + x * btCos( angle ) + y * btSin( angle ) );
return ( o + _x * btCos( _angle ) + _y * btSin( _angle ) );
}
// LOL END

class btVector4 : public btVector3
{
@@ -511,11 +519,13 @@ public:
SIMD_FORCE_INLINE btVector4() {}


SIMD_FORCE_INLINE btVector4(const btScalar& x, const btScalar& y, const btScalar& z,const btScalar& w)
: btVector3(x,y,z)
// LOL BEGIN
SIMD_FORCE_INLINE btVector4(const btScalar& _x, const btScalar& _y, const btScalar& _z,const btScalar& _w)
: btVector3(_x,_y,_z)
{
m_floats[3] = w;
m_floats[3] = _w;
}
// LOL END


SIMD_FORCE_INLINE btVector4 absolute4() const
@@ -623,13 +633,15 @@ public:
* @param z Value of z
* @param w Value of w
*/
SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z,const btScalar& w)
// LOL BEGIN
SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z,const btScalar& _w)
{
m_floats[0]=x;
m_floats[1]=y;
m_floats[2]=z;
m_floats[3]=w;
m_floats[0]=_x;
m_floats[1]=_y;
m_floats[2]=_z;
m_floats[3]=_w;
}
// LOL END


};
@@ -640,7 +652,9 @@ SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar& sourceVal, btScalar& d
{
#ifdef BT_USE_DOUBLE_PRECISION
unsigned char* dest = (unsigned char*) &destVal;
unsigned char* src = (unsigned char*) &sourceVal;
// LOL BEGIN
unsigned char const* src = (unsigned char const*) &sourceVal;
// LOL END
dest[0] = src[7];
dest[1] = src[6];
dest[2] = src[5];
@@ -651,7 +665,9 @@ SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar& sourceVal, btScalar& d
dest[7] = src[0];
#else
unsigned char* dest = (unsigned char*) &destVal;
unsigned char* src = (unsigned char*) &sourceVal;
// LOL BEGIN
unsigned char const* src = (unsigned char const*) &sourceVal;
// LOL END
dest[0] = src[3];
dest[1] = src[2];
dest[2] = src[1];


Chargement…
Annuler
Enregistrer