From 8b4b6f93e41f1811b31bcd4bdcc18c613301f2e3 Mon Sep 17 00:00:00 2001 From: Jordan Cristiano Date: Thu, 27 Jun 2013 01:29:43 -0400 Subject: [PATCH] Eliminated some warnings in mathlib and tier0. --- mp/src/public/mathlib/mathlib.h | 16 +++++----- mp/src/public/mathlib/vector.h | 56 ++++++++++++++++----------------- mp/src/public/tier0/dbg.h | 8 ++--- sp/src/public/mathlib/mathlib.h | 16 +++++----- sp/src/public/mathlib/vector.h | 56 ++++++++++++++++----------------- sp/src/public/tier0/dbg.h | 8 ++--- 6 files changed, 80 insertions(+), 80 deletions(-) diff --git a/mp/src/public/mathlib/mathlib.h b/mp/src/public/mathlib/mathlib.h index 797d5e86..d5d281c3 100644 --- a/mp/src/public/mathlib/mathlib.h +++ b/mp/src/public/mathlib/mathlib.h @@ -77,7 +77,7 @@ public: private: unsigned int mOldValues; #else - FPExceptionEnabler(unsigned int enableBits = 0) + FPExceptionEnabler(unsigned int /*enableBits*/ = 0) { } ~FPExceptionEnabler() @@ -204,8 +204,8 @@ public: { m_Plane[i].normal = vecNormal; m_Plane[i].dist = dist; - m_Plane[i].type = nType; - m_Plane[i].signbits = SignbitsForPlane( &m_Plane[i] ); + m_Plane[i].type = static_cast(nType); + m_Plane[i].signbits = static_cast(SignbitsForPlane( &m_Plane[i] )); m_AbsNormal[i].Init( fabs(vecNormal.x), fabs(vecNormal.y), fabs(vecNormal.z) ); } @@ -1717,7 +1717,7 @@ void Parabolic_Spline_NormalizeX( FORCEINLINE float QuinticInterpolatingPolynomial(float t) { // 6t^5-15t^4+10t^3 - return t * t * t *( t * ( t* 6.0 - 15.0 ) + 10.0 ); + return static_cast(t * t * t *( t * ( t* 6.0 - 15.0 ) + 10.0 )); } // given a table of sorted tabulated positions, return the two indices and blendfactor to linear @@ -2013,13 +2013,13 @@ FORCEINLINE float * UnpackNormal_UBYTE4( const unsigned int *pPackedNormal, floa unsigned char cX, cY; if ( bIsTangent ) { - cX = *pPackedNormal >> 16; // Unpack Z - cY = *pPackedNormal >> 24; // Unpack W + cX = static_cast(*pPackedNormal >> 16); // Unpack Z + cY = static_cast(*pPackedNormal >> 24); // Unpack W } else { - cX = *pPackedNormal >> 0; // Unpack X - cY = *pPackedNormal >> 8; // Unpack Y + cX = static_cast(*pPackedNormal >> 0); // Unpack X + cY = static_cast(*pPackedNormal >> 8); // Unpack Y } float x = cX - 128.0f; diff --git a/mp/src/public/mathlib/vector.h b/mp/src/public/mathlib/vector.h index 4b361640..05882868 100644 --- a/mp/src/public/mathlib/vector.h +++ b/mp/src/public/mathlib/vector.h @@ -869,10 +869,10 @@ FORCEINLINE ShortVector& ShortVector::operator-=(const ShortVector& v) FORCEINLINE ShortVector& ShortVector::operator*=(float fl) { - x *= fl; - y *= fl; - z *= fl; - w *= fl; + x *= static_cast(fl); + y *= static_cast(fl); + z *= static_cast(fl); + w *= static_cast(fl); return *this; } @@ -889,10 +889,10 @@ FORCEINLINE ShortVector& ShortVector::operator/=(float fl) { Assert( fl != 0.0f ); float oofl = 1.0f / fl; - x *= oofl; - y *= oofl; - z *= oofl; - w *= oofl; + x *= static_cast(oofl); + y *= static_cast(oofl); + z *= static_cast(oofl); + w *= static_cast(oofl); return *this; } @@ -909,10 +909,10 @@ FORCEINLINE ShortVector& ShortVector::operator/=(const ShortVector& v) FORCEINLINE void ShortVectorMultiply( const ShortVector& src, float fl, ShortVector& res ) { Assert( IsFinite(fl) ); - res.x = src.x * fl; - res.y = src.y * fl; - res.z = src.z * fl; - res.w = src.w * fl; + res.x = src.x * static_cast(fl); + res.y = src.y * static_cast(fl); + res.z = src.z * static_cast(fl); + res.w = src.w * static_cast(fl); } FORCEINLINE ShortVector ShortVector::operator*(float fl) const @@ -1019,10 +1019,10 @@ FORCEINLINE IntVector4D& IntVector4D::operator-=(const IntVector4D& v) FORCEINLINE IntVector4D& IntVector4D::operator*=(float fl) { - x *= fl; - y *= fl; - z *= fl; - w *= fl; + x *= static_cast(fl); + y *= static_cast(fl); + z *= static_cast(fl); + w *= static_cast(fl); return *this; } @@ -1039,10 +1039,10 @@ FORCEINLINE IntVector4D& IntVector4D::operator/=(float fl) { Assert( fl != 0.0f ); float oofl = 1.0f / fl; - x *= oofl; - y *= oofl; - z *= oofl; - w *= oofl; + x *= static_cast(oofl); + y *= static_cast(oofl); + z *= static_cast(oofl); + w *= static_cast(oofl); return *this; } @@ -1059,10 +1059,10 @@ FORCEINLINE IntVector4D& IntVector4D::operator/=(const IntVector4D& v) FORCEINLINE void IntVector4DMultiply( const IntVector4D& src, float fl, IntVector4D& res ) { Assert( IsFinite(fl) ); - res.x = src.x * fl; - res.y = src.y * fl; - res.z = src.z * fl; - res.w = src.w * fl; + res.x = src.x * static_cast(fl); + res.y = src.y * static_cast(fl); + res.z = src.z * static_cast(fl); + res.w = src.w * static_cast(fl); } FORCEINLINE IntVector4D IntVector4D::operator*(float fl) const @@ -1487,28 +1487,28 @@ inline Vector RandomVector( float minVal, float maxVal ) // Helper debugging stuff.... //----------------------------------------------------------------------------- -inline bool operator==( float const* f, const Vector& v ) +inline bool operator==( float const* /*f*/, const Vector& /*v*/ ) { // AIIIEEEE!!!! Assert(0); return false; } -inline bool operator==( const Vector& v, float const* f ) +inline bool operator==( const Vector& /*v*/, float const* /*f*/ ) { // AIIIEEEE!!!! Assert(0); return false; } -inline bool operator!=( float const* f, const Vector& v ) +inline bool operator!=( float const* /*f*/, const Vector& /*v*/ ) { // AIIIEEEE!!!! Assert(0); return false; } -inline bool operator!=( const Vector& v, float const* f ) +inline bool operator!=( const Vector& /*v*/, float const* /*f*/ ) { // AIIIEEEE!!!! Assert(0); diff --git a/mp/src/public/tier0/dbg.h b/mp/src/public/tier0/dbg.h index c1f8794e..a151c65d 100644 --- a/mp/src/public/tier0/dbg.h +++ b/mp/src/public/tier0/dbg.h @@ -244,7 +244,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #else #define _AssertMsg( _exp, _msg, _executeExp, _bFatal ) \ do { \ - if (!(_exp)) \ + if (0, !(_exp)) \ { \ _SpewInfo( SPEW_ASSERT, __TFILE__, __LINE__ ); \ SpewRetval_t ret = _SpewMessage("%s", _msg); \ @@ -254,11 +254,11 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); { \ if ( !ShouldUseNewAssertDialog() || DoNewAssertDialog( __TFILE__, __LINE__, _msg ) ) \ DebuggerBreak(); \ - if ( _bFatal ) \ + if ( 0, _bFatal ) \ _ExitOnFatalAssert( __TFILE__, __LINE__ ); \ } \ } \ - } while (0) + } while (0,0) #define _AssertMsgOnce( _exp, _msg, _bFatal ) \ do { \ @@ -267,7 +267,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); { \ _AssertMsg( _exp, _msg, (fAsserted = true), _bFatal ); \ } \ - } while (0) + } while (0,0) #endif /* Spew macros... */ diff --git a/sp/src/public/mathlib/mathlib.h b/sp/src/public/mathlib/mathlib.h index 797d5e86..d5d281c3 100644 --- a/sp/src/public/mathlib/mathlib.h +++ b/sp/src/public/mathlib/mathlib.h @@ -77,7 +77,7 @@ public: private: unsigned int mOldValues; #else - FPExceptionEnabler(unsigned int enableBits = 0) + FPExceptionEnabler(unsigned int /*enableBits*/ = 0) { } ~FPExceptionEnabler() @@ -204,8 +204,8 @@ public: { m_Plane[i].normal = vecNormal; m_Plane[i].dist = dist; - m_Plane[i].type = nType; - m_Plane[i].signbits = SignbitsForPlane( &m_Plane[i] ); + m_Plane[i].type = static_cast(nType); + m_Plane[i].signbits = static_cast(SignbitsForPlane( &m_Plane[i] )); m_AbsNormal[i].Init( fabs(vecNormal.x), fabs(vecNormal.y), fabs(vecNormal.z) ); } @@ -1717,7 +1717,7 @@ void Parabolic_Spline_NormalizeX( FORCEINLINE float QuinticInterpolatingPolynomial(float t) { // 6t^5-15t^4+10t^3 - return t * t * t *( t * ( t* 6.0 - 15.0 ) + 10.0 ); + return static_cast(t * t * t *( t * ( t* 6.0 - 15.0 ) + 10.0 )); } // given a table of sorted tabulated positions, return the two indices and blendfactor to linear @@ -2013,13 +2013,13 @@ FORCEINLINE float * UnpackNormal_UBYTE4( const unsigned int *pPackedNormal, floa unsigned char cX, cY; if ( bIsTangent ) { - cX = *pPackedNormal >> 16; // Unpack Z - cY = *pPackedNormal >> 24; // Unpack W + cX = static_cast(*pPackedNormal >> 16); // Unpack Z + cY = static_cast(*pPackedNormal >> 24); // Unpack W } else { - cX = *pPackedNormal >> 0; // Unpack X - cY = *pPackedNormal >> 8; // Unpack Y + cX = static_cast(*pPackedNormal >> 0); // Unpack X + cY = static_cast(*pPackedNormal >> 8); // Unpack Y } float x = cX - 128.0f; diff --git a/sp/src/public/mathlib/vector.h b/sp/src/public/mathlib/vector.h index 4b361640..05882868 100644 --- a/sp/src/public/mathlib/vector.h +++ b/sp/src/public/mathlib/vector.h @@ -869,10 +869,10 @@ FORCEINLINE ShortVector& ShortVector::operator-=(const ShortVector& v) FORCEINLINE ShortVector& ShortVector::operator*=(float fl) { - x *= fl; - y *= fl; - z *= fl; - w *= fl; + x *= static_cast(fl); + y *= static_cast(fl); + z *= static_cast(fl); + w *= static_cast(fl); return *this; } @@ -889,10 +889,10 @@ FORCEINLINE ShortVector& ShortVector::operator/=(float fl) { Assert( fl != 0.0f ); float oofl = 1.0f / fl; - x *= oofl; - y *= oofl; - z *= oofl; - w *= oofl; + x *= static_cast(oofl); + y *= static_cast(oofl); + z *= static_cast(oofl); + w *= static_cast(oofl); return *this; } @@ -909,10 +909,10 @@ FORCEINLINE ShortVector& ShortVector::operator/=(const ShortVector& v) FORCEINLINE void ShortVectorMultiply( const ShortVector& src, float fl, ShortVector& res ) { Assert( IsFinite(fl) ); - res.x = src.x * fl; - res.y = src.y * fl; - res.z = src.z * fl; - res.w = src.w * fl; + res.x = src.x * static_cast(fl); + res.y = src.y * static_cast(fl); + res.z = src.z * static_cast(fl); + res.w = src.w * static_cast(fl); } FORCEINLINE ShortVector ShortVector::operator*(float fl) const @@ -1019,10 +1019,10 @@ FORCEINLINE IntVector4D& IntVector4D::operator-=(const IntVector4D& v) FORCEINLINE IntVector4D& IntVector4D::operator*=(float fl) { - x *= fl; - y *= fl; - z *= fl; - w *= fl; + x *= static_cast(fl); + y *= static_cast(fl); + z *= static_cast(fl); + w *= static_cast(fl); return *this; } @@ -1039,10 +1039,10 @@ FORCEINLINE IntVector4D& IntVector4D::operator/=(float fl) { Assert( fl != 0.0f ); float oofl = 1.0f / fl; - x *= oofl; - y *= oofl; - z *= oofl; - w *= oofl; + x *= static_cast(oofl); + y *= static_cast(oofl); + z *= static_cast(oofl); + w *= static_cast(oofl); return *this; } @@ -1059,10 +1059,10 @@ FORCEINLINE IntVector4D& IntVector4D::operator/=(const IntVector4D& v) FORCEINLINE void IntVector4DMultiply( const IntVector4D& src, float fl, IntVector4D& res ) { Assert( IsFinite(fl) ); - res.x = src.x * fl; - res.y = src.y * fl; - res.z = src.z * fl; - res.w = src.w * fl; + res.x = src.x * static_cast(fl); + res.y = src.y * static_cast(fl); + res.z = src.z * static_cast(fl); + res.w = src.w * static_cast(fl); } FORCEINLINE IntVector4D IntVector4D::operator*(float fl) const @@ -1487,28 +1487,28 @@ inline Vector RandomVector( float minVal, float maxVal ) // Helper debugging stuff.... //----------------------------------------------------------------------------- -inline bool operator==( float const* f, const Vector& v ) +inline bool operator==( float const* /*f*/, const Vector& /*v*/ ) { // AIIIEEEE!!!! Assert(0); return false; } -inline bool operator==( const Vector& v, float const* f ) +inline bool operator==( const Vector& /*v*/, float const* /*f*/ ) { // AIIIEEEE!!!! Assert(0); return false; } -inline bool operator!=( float const* f, const Vector& v ) +inline bool operator!=( float const* /*f*/, const Vector& /*v*/ ) { // AIIIEEEE!!!! Assert(0); return false; } -inline bool operator!=( const Vector& v, float const* f ) +inline bool operator!=( const Vector& /*v*/, float const* /*f*/ ) { // AIIIEEEE!!!! Assert(0); diff --git a/sp/src/public/tier0/dbg.h b/sp/src/public/tier0/dbg.h index c1f8794e..a151c65d 100644 --- a/sp/src/public/tier0/dbg.h +++ b/sp/src/public/tier0/dbg.h @@ -244,7 +244,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #else #define _AssertMsg( _exp, _msg, _executeExp, _bFatal ) \ do { \ - if (!(_exp)) \ + if (0, !(_exp)) \ { \ _SpewInfo( SPEW_ASSERT, __TFILE__, __LINE__ ); \ SpewRetval_t ret = _SpewMessage("%s", _msg); \ @@ -254,11 +254,11 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); { \ if ( !ShouldUseNewAssertDialog() || DoNewAssertDialog( __TFILE__, __LINE__, _msg ) ) \ DebuggerBreak(); \ - if ( _bFatal ) \ + if ( 0, _bFatal ) \ _ExitOnFatalAssert( __TFILE__, __LINE__ ); \ } \ } \ - } while (0) + } while (0,0) #define _AssertMsgOnce( _exp, _msg, _bFatal ) \ do { \ @@ -267,7 +267,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); { \ _AssertMsg( _exp, _msg, (fAsserted = true), _bFatal ); \ } \ - } while (0) + } while (0,0) #endif /* Spew macros... */