Silence some warnings with static_casts

This commit is contained in:
Marek Roszko 2023-02-18 23:32:35 -05:00
parent aacc9746e3
commit d55e2049e5
5 changed files with 12 additions and 11 deletions

View File

@ -27,7 +27,7 @@
#include <trigo.h>
#include <wx/debug.h> // For the wxASSERT
#define RADPERDEG 0.0174533
#define RADPERDEG 0.0174533f
void DrawRoundArrow( SFVEC3F aPosition, SFVEC3F aTargetPos, float aSize )
{
@ -155,7 +155,7 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
{
SFVEC2D corner = SFVEC2D( 0.0, radius );
RotatePoint( &corner.x, &corner.y, ii );
glVertex3f( corner.x, corner.y, 0.0 );
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 0.0 );
}
glVertex3d( 0.0, -radius, 0.0 );
@ -171,7 +171,7 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
SFVEC2D corner = SFVEC2D( 0.0, radius );
RotatePoint( &corner.x, &corner.y, ii );
glVertex3f( corner.x, corner.y, 1.0 );
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 1.0 );
}
glVertex3f( 0.0, radius, 1.0 );
@ -185,9 +185,10 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
SFVEC2D corner = SFVEC2D( 0.0, radius );
RotatePoint( &corner.x, &corner.y, ii );
glNormal3f( corner.x * 2.0f, corner.y * 2.0f, 0.0f );
glVertex3f( corner.x, corner.y, 1.0 );
glVertex3f( corner.x, corner.y, 0.0 );
glNormal3f( static_cast<GLfloat>( corner.x * 2.0f ),
static_cast<GLfloat>( corner.y * 2.0f ), 0.0f );
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 1.0f );
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 0.0f );
}
glNormal3f( 0.0, 1.0f, 0.0f );

View File

@ -165,7 +165,7 @@ void SHADER::SetParameter( int parameterNumber, float f0, float f1, float f2, fl
void SHADER::SetParameter( int aParameterNumber, const VECTOR2D& aValue ) const
{
assert( (unsigned) aParameterNumber < parameterLocation.size() );
glUniform2f( parameterLocation[aParameterNumber], aValue.x, aValue.y );
glUniform2f( parameterLocation[aParameterNumber], static_cast<GLfloat>( aValue.x ), static_cast<GLfloat>( aValue.y ) );
}

View File

@ -128,7 +128,7 @@ bool DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow()
if( !SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE::GetGlobalLibTable() ) )
return false;
}
catch( const IO_ERROR& ioe )
catch( const IO_ERROR& )
{
return false;
}

View File

@ -67,7 +67,7 @@ std::unique_ptr<SIM_MODEL_SPICE> SIM_MODEL_SPICE::Create( const SIM_LIBRARY_SPIC
spiceModel->m_spiceModelParser->ReadModel( aLibrary, aSpiceCode );
return std::unique_ptr<SIM_MODEL_SPICE>( spiceModel );
}
catch( const IO_ERROR& e )
catch( const IO_ERROR& )
{
// Fall back to raw spice code
}

View File

@ -242,7 +242,7 @@ VECTOR2<T>::VECTOR2( T aX, T aY )
template <class T>
T VECTOR2<T>::EuclideanNorm() const
{
return sqrt( (extended_type) x * x + (extended_type) y * y );
return static_cast<T>( sqrt( (extended_type) x * x + (extended_type) y * y ) );
}
@ -421,7 +421,7 @@ VECTOR2<T> VECTOR2<T>::operator/( double aFactor ) const
if( std::is_integral<T>::value )
return VECTOR2<T>( KiROUND( x / aFactor ), KiROUND( y / aFactor ) );
else
return VECTOR2<T>( x / aFactor, y / aFactor );
return VECTOR2<T>( static_cast<T>( x / aFactor ), static_cast<T>( y / aFactor ) );
}