From d55e2049e5a8ade04954b9f366d7e74c5cba3671 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sat, 18 Feb 2023 23:32:35 -0500 Subject: [PATCH] Silence some warnings with static_casts --- 3d-viewer/3d_rendering/opengl/opengl_utils.cpp | 13 +++++++------ common/gal/opengl/shader.cpp | 2 +- .../dialogs/dialog_global_sym_lib_table_config.cpp | 2 +- eeschema/sim/sim_model_spice.cpp | 2 +- libs/kimath/include/math/vector2d.h | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/3d-viewer/3d_rendering/opengl/opengl_utils.cpp b/3d-viewer/3d_rendering/opengl/opengl_utils.cpp index a1994fb62f..c815ca3d79 100644 --- a/3d-viewer/3d_rendering/opengl/opengl_utils.cpp +++ b/3d-viewer/3d_rendering/opengl/opengl_utils.cpp @@ -27,7 +27,7 @@ #include #include // 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( corner.x ), static_cast( 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( corner.x ), static_cast( 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( corner.x * 2.0f ), + static_cast( corner.y * 2.0f ), 0.0f ); + glVertex3f( static_cast( corner.x ), static_cast( corner.y ), 1.0f ); + glVertex3f( static_cast( corner.x ), static_cast( corner.y ), 0.0f ); } glNormal3f( 0.0, 1.0f, 0.0f ); diff --git a/common/gal/opengl/shader.cpp b/common/gal/opengl/shader.cpp index d245f707c0..51ef423349 100644 --- a/common/gal/opengl/shader.cpp +++ b/common/gal/opengl/shader.cpp @@ -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( aValue.x ), static_cast( aValue.y ) ); } diff --git a/eeschema/dialogs/dialog_global_sym_lib_table_config.cpp b/eeschema/dialogs/dialog_global_sym_lib_table_config.cpp index 898d26c312..79d63f8def 100644 --- a/eeschema/dialogs/dialog_global_sym_lib_table_config.cpp +++ b/eeschema/dialogs/dialog_global_sym_lib_table_config.cpp @@ -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; } diff --git a/eeschema/sim/sim_model_spice.cpp b/eeschema/sim/sim_model_spice.cpp index 50409d1e0b..11a847c088 100644 --- a/eeschema/sim/sim_model_spice.cpp +++ b/eeschema/sim/sim_model_spice.cpp @@ -67,7 +67,7 @@ std::unique_ptr SIM_MODEL_SPICE::Create( const SIM_LIBRARY_SPIC spiceModel->m_spiceModelParser->ReadModel( aLibrary, aSpiceCode ); return std::unique_ptr( spiceModel ); } - catch( const IO_ERROR& e ) + catch( const IO_ERROR& ) { // Fall back to raw spice code } diff --git a/libs/kimath/include/math/vector2d.h b/libs/kimath/include/math/vector2d.h index 6f5156e027..22fe47e38b 100644 --- a/libs/kimath/include/math/vector2d.h +++ b/libs/kimath/include/math/vector2d.h @@ -242,7 +242,7 @@ VECTOR2::VECTOR2( T aX, T aY ) template T VECTOR2::EuclideanNorm() const { - return sqrt( (extended_type) x * x + (extended_type) y * y ); + return static_cast( sqrt( (extended_type) x * x + (extended_type) y * y ) ); } @@ -421,7 +421,7 @@ VECTOR2 VECTOR2::operator/( double aFactor ) const if( std::is_integral::value ) return VECTOR2( KiROUND( x / aFactor ), KiROUND( y / aFactor ) ); else - return VECTOR2( x / aFactor, y / aFactor ); + return VECTOR2( static_cast( x / aFactor ), static_cast( y / aFactor ) ); }