kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #36238
[PATCH 1/1] Remove tautological casts
These casts have the same source and destination type, and are therefore
useless.
Also, enable warnings for tautological casts, with an exception for the
SWIG wrapper code.
---
3d-viewer/3d_cache/dialogs/panel_prev_model.cpp | 2 +-
3d-viewer/3d_cache/sg/sg_helpers.h | 4 ++--
3d-viewer/3d_canvas/create_layer_items.cpp | 10 ++++-----
3d-viewer/3d_model_viewer/c3d_model_viewer.cpp | 2 +-
.../3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp | 2 +-
.../3d_render_ogl_legacy/clayer_triangles.h | 4 ++--
.../accelerators/cbvh_pbrt.cpp | 2 +-
.../c3d_render_createscene.cpp | 8 ++++----
.../3d_render_raytracing/c3d_render_raytracing.cpp | 12 +++++------
.../shapes2D/citemlayercsg2d.cpp | 6 ++----
.../3d_render_raytracing/shapes2D/cpolygon2d.cpp | 2 +-
.../3d_render_raytracing/shapes3D/clayeritem.cpp | 4 ++--
3d-viewer/3d_rendering/cimage.cpp | 4 ++--
3d-viewer/3d_rendering/cpostshader.h | 2 +-
3d-viewer/3d_rendering/trackball.cpp | 12 +++++------
CMakeLists.txt | 6 ++++++
bitmap2component/bitmap2cmp_gui.cpp | 2 +-
common/base_struct.cpp | 2 +-
common/bezier_curves.cpp | 4 ++--
common/draw_frame.cpp | 4 ++--
common/draw_panel_gal.cpp | 2 +-
common/gal/cairo/cairo_gal.cpp | 6 +++---
common/gal/opengl/opengl_compositor.cpp | 6 +++---
common/gal/opengl/opengl_gal.cpp | 2 +-
common/gal/opengl/shader.cpp | 2 +-
common/lib_table_base.cpp | 2 +-
common/page_layout/worksheet_dataitem.cpp | 2 +-
common/preview_items/ruler_item.cpp | 2 +-
common/utf8.cpp | 2 +-
common/view/view.cpp | 4 ++--
common/widgets/footprint_preview_widget.cpp | 4 ++--
common/worksheet_viewitem.cpp | 10 ++++-----
common/xnode.cpp | 4 ++--
cvpcb/cvpcb.cpp | 2 +-
eeschema/dialogs/dialog_edit_one_field.cpp | 2 +-
eeschema/dialogs/dialog_erc.cpp | 2 +-
eeschema/eeschema_config.cpp | 4 ++--
eeschema/generate_alias_info.cpp | 2 +-
eeschema/hierarch.cpp | 2 +-
.../netlist_exporters/netlist_exporter_pspice.cpp | 2 +-
eeschema/sch_eagle_plugin.cpp | 4 ++--
eeschema/sch_line.cpp | 6 +++---
eeschema/sch_sheet_path.h | 2 +-
.../gerbview_dialog_display_options_frame.cpp | 2 +-
gerbview/gerbview_frame.cpp | 2 +-
gerbview/select_layers_to_pcb.h | 4 ++--
gerbview/tools/selection_tool.cpp | 4 ++--
include/gal/graphics_abstraction_layer.h | 4 ++--
include/layers_id_colors_and_visibility.h | 6 +++---
include/utf8.h | 6 +++---
pagelayout_editor/block.cpp | 2 +-
pagelayout_editor/pl_editor.cpp | 2 +-
pagelayout_editor/pl_editor_frame.cpp | 4 ++--
pcb_calculator/pcb_calculator.cpp | 2 +-
pcbnew/CMakeLists.txt | 7 +++++++
pcbnew/board_items_to_polygon_shape_transform.cpp | 2 +-
pcbnew/class_dimension.cpp | 2 +-
pcbnew/class_drawsegment.cpp | 2 +-
pcbnew/class_module.cpp | 4 ++--
pcbnew/class_module.h | 4 ++--
pcbnew/class_pcb_target.cpp | 2 +-
pcbnew/class_pcb_text.cpp | 2 +-
pcbnew/class_track.cpp | 4 ++--
pcbnew/class_track.h | 2 +-
pcbnew/class_zone.cpp | 2 +-
pcbnew/connectivity_algo.cpp | 10 ++++-----
pcbnew/convert_drawsegment_list_to_polygon.cpp | 7 +++----
pcbnew/dialogs/dialog_display_options.cpp | 3 +--
pcbnew/files.cpp | 4 ++--
pcbnew/footprint_info_impl.cpp | 2 +-
pcbnew/import_dxf/dxf2brd_items.cpp | 4 ++--
pcbnew/legacy_plugin.cpp | 2 +-
pcbnew/pad_draw_functions.cpp | 2 +-
pcbnew/pcb_base_frame.cpp | 2 +-
pcbnew/pcb_draw_panel_gal.cpp | 2 +-
pcbnew/pcb_view.cpp | 2 +-
pcbnew/ratsnest.cpp | 2 +-
pcbnew/router/pns_diff_pair_placer.cpp | 4 ++--
pcbnew/router/pns_kicad_iface.cpp | 2 +-
pcbnew/router/pns_line_placer.cpp | 2 +-
pcbnew/router/pns_meander.cpp | 4 ++--
pcbnew/router/pns_sizes_settings.cpp | 2 +-
pcbnew/router/router_tool.cpp | 2 +-
pcbnew/specctra_import_export/specctra.cpp | 4 ++--
pcbnew/specctra_import_export/specctra.h | 8 ++++----
pcbnew/tools/drawing_tool.cpp | 2 +-
pcbnew/tools/edit_tool.cpp | 2 +-
pcbnew/tools/pcbnew_control.cpp | 2 +-
pcbnew/tools/selection_tool.cpp | 2 +-
plugins/3d/idf/s3d_plugin_idf.cpp | 2 +-
polygon/clipper.cpp | 24 +++++++++++-----------
potrace/trace.cpp | 6 +++---
utils/idftools/idf2vrml.cpp | 4 ++--
93 files changed, 181 insertions(+), 174 deletions(-)
diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp
index 3544f37c8..37f597288 100644
--- a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp
+++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp
@@ -64,7 +64,7 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
m_parentInfoList = aParentInfoList;
- m_dummyBoard->Add( (MODULE*)aModuleCopy );
+ m_dummyBoard->Add( aModuleCopy );
m_copyModule = aModuleCopy;
// Set 3d viewer configuration for preview
diff --git a/3d-viewer/3d_cache/sg/sg_helpers.h b/3d-viewer/3d_cache/sg/sg_helpers.h
index 34de4eb1b..80f3452b7 100644
--- a/3d-viewer/3d_cache/sg/sg_helpers.h
+++ b/3d-viewer/3d_cache/sg/sg_helpers.h
@@ -118,7 +118,7 @@ class SGCOORDINDEX;
sL = std::find( aRefList.begin(), aRefList.end(), aNode ); \
if( sL != aRefList.end() ) return true; \
if( isChild ) { \
- SGNODE* ppn = (SGNODE*)aNode->GetParent(); \
+ SGNODE* ppn = aNode->GetParent(); \
if( NULL != ppn ) { \
if( this != ppn ) { \
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; \
@@ -152,7 +152,7 @@ class SGCOORDINDEX;
SGNODE* psg = NULL; \
while( sLA != eLA ) { \
if( (SGNODE*)*sLA != aCallingNode ) { \
- psg = (SGNODE*) (*sLA)->FindNode( aName, this ); \
+ psg = (*sLA)->FindNode( aName, this ); \
if( NULL != psg) \
return psg; \
} \
diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp
index 888925c24..09ea35e5e 100644
--- a/3d-viewer/3d_canvas/create_layer_items.cpp
+++ b/3d-viewer/3d_canvas/create_layer_items.cpp
@@ -1178,17 +1178,17 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
ii != m_layers_holes2D.end();
++ii )
{
- ((CBVHCONTAINER2D *)(ii->second))->BuildBVH();
+ ii->second->BuildBVH();
}
}
// We only need the Solder mask to initialize the BVH
// because..?
- if( (CBVHCONTAINER2D *)m_layers_container2D[B_Mask] )
- ((CBVHCONTAINER2D *)m_layers_container2D[B_Mask])->BuildBVH();
+ if( m_layers_container2D[B_Mask] )
+ m_layers_container2D[B_Mask]->BuildBVH();
- if( (CBVHCONTAINER2D *)m_layers_container2D[F_Mask] )
- ((CBVHCONTAINER2D *)m_layers_container2D[F_Mask])->BuildBVH();
+ if( m_layers_container2D[F_Mask] )
+ m_layers_container2D[F_Mask]->BuildBVH();
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_endHolesBVHTime = GetRunningMicroSecs();
diff --git a/3d-viewer/3d_model_viewer/c3d_model_viewer.cpp b/3d-viewer/3d_model_viewer/c3d_model_viewer.cpp
index e00a772f7..39672936c 100644
--- a/3d-viewer/3d_model_viewer/c3d_model_viewer.cpp
+++ b/3d-viewer/3d_model_viewer/c3d_model_viewer.cpp
@@ -157,7 +157,7 @@ void C3D_MODEL_VIEWER::Set3DModel(const wxString &aModelPathName)
const S3DMODEL* model = m_cacheManager->GetModel( aModelPathName );
if( model )
- Set3DModel( (const S3DMODEL &)*model );
+ Set3DModel( *model );
else
Clear3DModel();
}
diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp
index 6498d0f9b..5e554f41d 100644
--- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp
+++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp
@@ -1013,7 +1013,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
zpos );
if( module->GetOrientation() )
- glRotated( (double) module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
+ glRotated( module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
if( module->IsFlipped() )
{
diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/clayer_triangles.h b/3d-viewer/3d_rendering/3d_render_ogl_legacy/clayer_triangles.h
index 4a4f08c12..ffd0dfdcb 100644
--- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/clayer_triangles.h
+++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/clayer_triangles.h
@@ -105,13 +105,13 @@ public:
* @brief GetVertexPointer - Get the array of vertexes
* @return The pointer to the start of array vertex
*/
- const float *GetVertexPointer() const { return (const float *)&m_vertexs[0].x; }
+ const float *GetVertexPointer() const { return &m_vertexs[0].x; }
/**
* @brief GetNormalsPointer - Get the array of normals
* @return The pointer to start of array of normals
*/
- const float *GetNormalsPointer() const { return (const float *)&m_normals[0].x; }
+ const float *GetNormalsPointer() const { return &m_normals[0].x; }
/**
* @brief GetVertexSize
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp
index 8291fb82a..2c6a46ae6 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp
@@ -519,7 +519,7 @@ BVHBuildNode *CBVH_PBRT::recursiveBuild ( std::vector<BVHPrimitiveInfo> &primiti
wxASSERT( (primitiveNr >= 0) &&
(primitiveNr < (int)m_primitives.size()) );
- const COBJECT *obj = static_cast<const COBJECT *>( m_primitives[ primitiveNr ] );
+ const COBJECT *obj = m_primitives[ primitiveNr ];
wxASSERT( obj != NULL );
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp
index e37bb1041..0062bc4d1 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp
@@ -286,7 +286,7 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
m_outlineBoard2dObjects = new CCONTAINER2D;
- if( ((const SHAPE_POLY_SET &)m_settings.GetBoardPoly()).OutlineCount() == 1 )
+ if( m_settings.GetBoardPoly().OutlineCount() == 1 )
{
float divFactor = 0.0f;
@@ -1500,9 +1500,9 @@ void C3D_RENDER_RAYTRACING::add_3D_models( const S3DMODEL *a3DModel,
const SFVEC3F vt1 = SFVEC3F( aModelMatrix * glm::vec4( v1, 1.0f) );
const SFVEC3F vt2 = SFVEC3F( aModelMatrix * glm::vec4( v2, 1.0f) );
- const SFVEC3F nt0 = glm::normalize( SFVEC3F( normalMatrix * n0 ) );
- const SFVEC3F nt1 = glm::normalize( SFVEC3F( normalMatrix * n1 ) );
- const SFVEC3F nt2 = glm::normalize( SFVEC3F( normalMatrix * n2 ) );
+ const SFVEC3F nt0 = glm::normalize( normalMatrix * n0 );
+ const SFVEC3F nt1 = glm::normalize( normalMatrix * n1 );
+ const SFVEC3F nt2 = glm::normalize( normalMatrix * n2 );
CTRIANGLE *newTriangle = new CTRIANGLE( vt0, vt2, vt1,
nt0, nt2, nt1 );
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp
index 474ac7b9b..b2a61e899 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp
@@ -966,16 +966,16 @@ void C3D_RENDER_RAYTRACING::rt_render_post_process_blur_finish( GLubyte *ptrPBO,
GLubyte *ptr = &ptrPBO[ y * m_realBufferSize.x * 4 ];
const SFVEC3F *ptrShaderY0 =
- &m_shaderBuffer[ glm::max((int)y - 2, 0) * m_realBufferSize.x ];
+ &m_shaderBuffer[ glm::max(y - 2, 0) * m_realBufferSize.x ];
const SFVEC3F *ptrShaderY1 =
- &m_shaderBuffer[ glm::max((int)y - 1, 0) * m_realBufferSize.x ];
+ &m_shaderBuffer[ glm::max(y - 1, 0) * m_realBufferSize.x ];
const SFVEC3F *ptrShaderY2 =
&m_shaderBuffer[ y * m_realBufferSize.x ];
const SFVEC3F *ptrShaderY3 =
- &m_shaderBuffer[ glm::min((int)y + 1, (int)(m_realBufferSize.y - 1)) *
+ &m_shaderBuffer[ glm::min(y + 1, (int)(m_realBufferSize.y - 1)) *
m_realBufferSize.x ];
const SFVEC3F *ptrShaderY4 =
- &m_shaderBuffer[ glm::min((int)y + 2, (int)(m_realBufferSize.y - 1)) *
+ &m_shaderBuffer[ glm::min(y + 2, (int)(m_realBufferSize.y - 1)) *
m_realBufferSize.x ];
for( signed int x = 0; x < (int)m_realBufferSize.x; ++x )
@@ -1090,7 +1090,7 @@ void C3D_RENDER_RAYTRACING::render_preview( GLubyte *ptrPBO )
for( unsigned int y = 0; y < RAYPACKET_DIM; ++y )
{
- const float posYfactor = (float)(windowsPos.y + y * 4.0f) / (float)m_windowSize.y;
+ const float posYfactor = windowsPos.y + y * 4.0f / m_windowSize.y;
bgColor[y] = (SFVEC3F)m_settings.m_BgColorTop * SFVEC3F(posYfactor) +
(SFVEC3F)m_settings.m_BgColorBot * ( SFVEC3F(1.0f) - SFVEC3F(posYfactor) );
@@ -1834,7 +1834,7 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor,
if( nr_lights_that_can_cast_shadows > 0 )
{
aHitInfo.m_ShadowFactor = glm::max( shadow_att_factor_sum /
- (float)(nr_lights_that_can_cast_shadows * 1.0f), 0.0f );
+ (nr_lights_that_can_cast_shadows * 1.0f), 0.0f );
}
else
{
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/citemlayercsg2d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/citemlayercsg2d.cpp
index b419c6e0c..12de0304a 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/citemlayercsg2d.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/citemlayercsg2d.cpp
@@ -122,16 +122,14 @@ bool CITEMLAYERCSG2D::Intersect( const RAYSEG2D &aSegRay,
//check against all subbed objects
for( unsigned int i = 0; i < m_objectB->size(); ++i )
{
- if( ((const COBJECT2D *)(*m_objectB)[i])->IsPointInside( currentRayPos ) )
+ if( (*m_objectB)[i]->IsPointInside( currentRayPos ) )
{
hitSubRegion = true;
// ray point is inside a subtracted region, so move it to the end of the
// subtracted region
float hitDist;
- if( !((const COBJECT2D *)(*m_objectB)[i])->Intersect( aSegRay,
- &hitDist,
- ¤tNormal ) )
+ if( !(*m_objectB)[i]->Intersect( aSegRay, &hitDist, ¤tNormal ) )
return false; // ray hit main object but did not leave subtracted volume
wxASSERT( hitDist <= 1.0f );
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cpolygon2d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cpolygon2d.cpp
index e5cc03799..1ad75e4e7 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cpolygon2d.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cpolygon2d.cpp
@@ -89,7 +89,7 @@ CPOLYGONBLOCK2D::CPOLYGONBLOCK2D( const SEGMENTS_WIDTH_NORMALS &aOpenSegmentList
for( unsigned int i = 0; i < m_outers_and_holes.m_Outers.size(); i++ )
{
for( unsigned int j = 0; j < m_outers_and_holes.m_Outers[i].size(); j++ )
- m_bbox.Union( ((SEGMENTS)m_outers_and_holes.m_Outers[i])[j].m_Start );
+ m_bbox.Union( (m_outers_and_holes.m_Outers[i])[j].m_Start );
}
m_bbox.ScaleNextUp();
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/clayeritem.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/clayeritem.cpp
index ee51d4448..0a38ea08f 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/clayeritem.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/clayeritem.cpp
@@ -75,7 +75,7 @@ bool CLAYERITEM::Intersect( const RAY &aRay, HITINFO &aHitInfo ) const
bool hit_top = false;
bool hit_bot = false;
- if( (float)fabs(aRay.m_Dir.z) > FLT_EPSILON )
+ if( fabs(aRay.m_Dir.z) > FLT_EPSILON )
{
tBot = (m_bbox.Min().z - aRay.m_Origin.z) * aRay.m_InvDir.z;
tTop = (m_bbox.Max().z - aRay.m_Origin.z) * aRay.m_InvDir.z;
@@ -342,7 +342,7 @@ bool CLAYERITEM::IntersectP( const RAY &aRay , float aMaxDistance ) const
bool hit_top = false;
bool hit_bot = false;
- if( (float)fabs(aRay.m_Dir.z) > FLT_EPSILON )
+ if( fabs(aRay.m_Dir.z) > FLT_EPSILON )
{
tBot = (m_bbox.Min().z - aRay.m_Origin.z) * aRay.m_InvDir.z;
tTop = (m_bbox.Max().z - aRay.m_Origin.z) * aRay.m_InvDir.z;
diff --git a/3d-viewer/3d_rendering/cimage.cpp b/3d-viewer/3d_rendering/cimage.cpp
index 78622970b..7991413ae 100644
--- a/3d-viewer/3d_rendering/cimage.cpp
+++ b/3d-viewer/3d_rendering/cimage.cpp
@@ -43,7 +43,7 @@ CIMAGE::CIMAGE( unsigned int aXsize, unsigned int aYsize )
memset( m_pixels, 0, m_wxh );
m_width = aXsize;
m_height = aYsize;
- m_wraping = (E_WRAP)WRAP_CLAMP;
+ m_wraping = WRAP_CLAMP;
}
@@ -54,7 +54,7 @@ CIMAGE::CIMAGE( const CIMAGE &aSrcImage )
memcpy( m_pixels, aSrcImage.GetBuffer(), m_wxh );
m_width = aSrcImage.GetWidth();
m_height = aSrcImage.GetHeight();
- m_wraping = (E_WRAP)WRAP_CLAMP;
+ m_wraping = WRAP_CLAMP;
}
diff --git a/3d-viewer/3d_rendering/cpostshader.h b/3d-viewer/3d_rendering/cpostshader.h
index fa5950517..ed4bf46c5 100644
--- a/3d-viewer/3d_rendering/cpostshader.h
+++ b/3d-viewer/3d_rendering/cpostshader.h
@@ -103,7 +103,7 @@ private:
clampPos.x = glm::clamp( aPos.x, 0, (int)m_size.x - 1 );
clampPos.y = glm::clamp( aPos.y, 0, (int)m_size.y - 1 );
- return (unsigned int)( clampPos.x + m_size.x * clampPos.y );
+ return clampPos.x + m_size.x * clampPos.y;
}
protected:
diff --git a/3d-viewer/3d_rendering/trackball.cpp b/3d-viewer/3d_rendering/trackball.cpp
index 5037de9bd..d07e67350 100644
--- a/3d-viewer/3d_rendering/trackball.cpp
+++ b/3d-viewer/3d_rendering/trackball.cpp
@@ -113,7 +113,7 @@ void vcross( const double *v1, const double *v2, double *cross )
double vlength( const double *v )
{
- return (double) sqrt( v[0] * v[0] + v[1] * v[1] + v[2] * v[2] );
+ return sqrt( v[0] * v[0] + v[1] * v[1] + v[2] * v[2] );
}
void vscale( double *v, double div )
@@ -194,7 +194,7 @@ void trackball( double q[4], double p1x, double p1y, double p2x, double p2y )
if( t < -1.0 )
t = -1.0;
- phi = 2.0f * (double) asin( t );
+ phi = 2.0f * asin( t );
axis_to_quat( a, phi, q );
}
@@ -206,8 +206,8 @@ void axis_to_quat( double a[3], double phi, double q[4] )
{
vnormal( a );
vcopy( a, q );
- vscale( q, (double) sin( phi / 2.0) );
- q[3] = (double) cos( phi / 2.0 );
+ vscale( q, sin( phi / 2.0) );
+ q[3] = cos( phi / 2.0 );
}
/*
@@ -218,11 +218,11 @@ static double tb_project_to_sphere( double r, double x, double y )
{
double d, z;
- d = (double) sqrt( x*x + y*y );
+ d = sqrt( x*x + y*y );
if( d < r * 0.70710678118654752440 )
{ /* Inside sphere */
- z = (double) sqrt( r*r - d*d );
+ z = sqrt( r*r - d*d );
}
else
{ /* On hyperbola */
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2ea761f9..4c716a2f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -197,6 +197,12 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
if(COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
endif()
+
+ CHECK_CXX_COMPILER_FLAG("-Wuseless-cast" COMPILER_SUPPORTS_WUSELESS_CAST)
+
+ if(COMPILER_SUPPORTS_WUSELESS_CAST)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuseless-cast")
+ endif()
endif()
diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp
index 19969b16d..b60417726 100644
--- a/bitmap2component/bitmap2cmp_gui.cpp
+++ b/bitmap2component/bitmap2cmp_gui.cpp
@@ -717,7 +717,7 @@ KIFACE_I& Kiface()
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
{
- process = (PGM_BASE*) aProgram;
+ process = aProgram;
return &kiface;
}
diff --git a/common/base_struct.cpp b/common/base_struct.cpp
index ca8876a96..dbb1ed83c 100644
--- a/common/base_struct.cpp
+++ b/common/base_struct.cpp
@@ -176,7 +176,7 @@ wxString EDA_ITEM::GetSelectMenuText() const
wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
GetClass() );
- return wxString( wxT( "Undefined menu text for " ) + GetClass() );
+ return wxT( "Undefined menu text for " ) + GetClass();
}
diff --git a/common/bezier_curves.cpp b/common/bezier_curves.cpp
index 8b66185b7..77f172b71 100644
--- a/common/bezier_curves.cpp
+++ b/common/bezier_curves.cpp
@@ -50,7 +50,7 @@ void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput )
wxCHECK( !m_ctrlPts.empty(), /* void */ );
m_output = &aOutput;
m_output->clear();
- m_output->push_back( wxPoint( m_ctrlPts.front() ) );
+ m_output->push_back( m_ctrlPts.front() );
// Only quadratic and cubic Bezier curves are handled
if( m_ctrlPts.size() == 3 )
@@ -64,7 +64,7 @@ void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput )
m_ctrlPts[2].x, m_ctrlPts[2].y,
m_ctrlPts[3].x, m_ctrlPts[3].y, 0 );
- m_output->push_back( wxPoint( m_ctrlPts.back() ) );
+ m_output->push_back( m_ctrlPts.back() );
}
diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp
index 1d9a1225c..db6f8eb43 100644
--- a/common/draw_frame.cpp
+++ b/common/draw_frame.cpp
@@ -746,7 +746,7 @@ const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
}
else if( BASE_SCREEN* screen = GetScreen() )
{
- level = m_zoomLevelCoeff / (double) screen->GetZoom();
+ level = m_zoomLevelCoeff / screen->GetZoom();
}
// returns a human readable value which can be displayed as zoom
@@ -1491,7 +1491,7 @@ bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos,
bool EDA_DRAW_FRAME::isBusy() const
{
- const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
+ const BASE_SCREEN* screen = GetScreen();
if( !screen )
return false;
diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp
index 98fc26517..41914c3f0 100644
--- a/common/draw_panel_gal.cpp
+++ b/common/draw_panel_gal.cpp
@@ -159,7 +159,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
wxASSERT( m_painter );
m_drawing = true;
- KIGFX::RENDER_SETTINGS* settings = static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() );
+ KIGFX::RENDER_SETTINGS* settings = m_painter->GetSettings();
m_viewControls->UpdateScrollbars();
diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp
index 0f3efa3fc..2e38da8e2 100644
--- a/common/gal/cairo/cairo_gal.cpp
+++ b/common/gal/cairo/cairo_gal.cpp
@@ -149,9 +149,9 @@ void CAIRO_GAL::EndDrawing()
// Now translate the raw context data from the format stored
// by cairo into a format understood by wxImage.
pixman_image_t* dstImg = pixman_image_create_bits(PIXMAN_r8g8b8,
- screenSize.x, screenSize.y, (uint32_t*)wxOutput, wxBufferWidth * 3 );
+ screenSize.x, screenSize.y, reinterpret_cast<uint32_t*>(wxOutput), wxBufferWidth * 3 );
pixman_image_t* srcImg = pixman_image_create_bits(PIXMAN_a8b8g8r8,
- screenSize.x, screenSize.y, (uint32_t*)bitmapBuffer, wxBufferWidth * 4 );
+ screenSize.x, screenSize.y, bitmapBuffer, wxBufferWidth * 4 );
pixman_image_composite (PIXMAN_OP_SRC, srcImg, NULL, dstImg,
0, 0, 0, 0, 0, 0, screenSize.x, screenSize.y );
@@ -160,7 +160,7 @@ void CAIRO_GAL::EndDrawing()
pixman_image_unref( srcImg );
pixman_image_unref( dstImg );
- wxImage img( wxBufferWidth, screenSize.y, (unsigned char*) wxOutput, true );
+ wxImage img( wxBufferWidth, screenSize.y, wxOutput, true );
wxBitmap bmp( img );
wxMemoryDC mdc( bmp );
wxClientDC clientDC( this );
diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp
index 8b7e3d1a7..bb2234321 100644
--- a/common/gal/opengl/opengl_compositor.cpp
+++ b/common/gal/opengl/opengl_compositor.cpp
@@ -153,10 +153,10 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions )
{
assert( m_initialized );
- int maxBuffers, maxTextureSize;
+ GLint maxBuffers, maxTextureSize;
// Get the maximum number of buffers
- glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, (GLint*) &maxBuffers );
+ glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, &maxBuffers );
if( (int) usedBuffers() >= maxBuffers )
{
@@ -165,7 +165,7 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions )
"your graphic drivers." );
}
- glGetIntegerv( GL_MAX_TEXTURE_SIZE, (GLint*) &maxTextureSize );
+ glGetIntegerv( GL_MAX_TEXTURE_SIZE, &maxTextureSize );
if( maxTextureSize < (int) aDimensions.x || maxTextureSize < (int) aDimensions.y )
{
diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index d10bc1a13..67cb51d74 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -239,7 +239,7 @@ void OPENGL_GAL::BeginDrawing()
glLoadIdentity();
// Create the screen transformation (Do the RH-LH conversion here)
- glOrtho( 0, (GLint) screenSize.x, (GLsizei) screenSize.y, 0, -depthRange.x, -depthRange.y );
+ glOrtho( 0, screenSize.x, screenSize.y, 0, -depthRange.x, -depthRange.y );
if( !isFramebufferInitialized )
{
diff --git a/common/gal/opengl/shader.cpp b/common/gal/opengl/shader.cpp
index 5a8fd6817..2a6d631ea 100644
--- a/common/gal/opengl/shader.cpp
+++ b/common/gal/opengl/shader.cpp
@@ -247,7 +247,7 @@ bool SHADER::loadShaderFromStringArray( SHADER_TYPE aShaderType, const char** aA
programInfo( programNumber );
// Attach the sources
- glShaderSource( shaderNumber, aSize, (const GLchar**) aArray, NULL );
+ glShaderSource( shaderNumber, aSize, aArray, NULL );
programInfo( programNumber );
// Compile and attach shader to the program
diff --git a/common/lib_table_base.cpp b/common/lib_table_base.cpp
index 5147d68d8..a44a889f1 100644
--- a/common/lib_table_base.cpp
+++ b/common/lib_table_base.cpp
@@ -312,7 +312,7 @@ LIB_TABLE_ROW* LIB_TABLE::findRow( const wxString& aNickName ) const
LIB_TABLE_ROW* LIB_TABLE::findRow( const wxString& aNickName )
{
- LIB_TABLE* cur = (LIB_TABLE*) this;
+ LIB_TABLE* cur = this;
do
{
diff --git a/common/page_layout/worksheet_dataitem.cpp b/common/page_layout/worksheet_dataitem.cpp
index 22473ba71..d6360893e 100644
--- a/common/page_layout/worksheet_dataitem.cpp
+++ b/common/page_layout/worksheet_dataitem.cpp
@@ -484,7 +484,7 @@ void WORKSHEET_DATAITEM_TEXT::IncrementLabel( int aIncr )
if( lbchar >= '0' && lbchar <= '9' )
// A number is expected:
- m_FullText << (int)( aIncr + lbchar - '0' );
+ m_FullText << ( aIncr + lbchar - '0' );
else
m_FullText << (wxChar) ( aIncr + lbchar );
}
diff --git a/common/preview_items/ruler_item.cpp b/common/preview_items/ruler_item.cpp
index 18f9ee171..4964dbee9 100644
--- a/common/preview_items/ruler_item.cpp
+++ b/common/preview_items/ruler_item.cpp
@@ -232,7 +232,7 @@ void RULER_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
{
auto& gal = *aView->GetGAL();
- auto rs = static_cast<KIGFX::RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() );
+ auto rs = aView->GetPainter()->GetSettings();
const auto origin = m_geomMgr.GetOrigin();
const auto end = m_geomMgr.GetEnd();
diff --git a/common/utf8.cpp b/common/utf8.cpp
index 57677ca7c..f88ab5537 100644
--- a/common/utf8.cpp
+++ b/common/utf8.cpp
@@ -231,7 +231,7 @@ UTF8& UTF8::operator+=( unsigned w_ch )
m_s += substr.m_s;
}
- return (UTF8&) *this;
+ return *this;
}
diff --git a/common/view/view.cpp b/common/view/view.cpp
index 84f848cd4..9ffe56fb2 100644
--- a/common/view/view.cpp
+++ b/common/view/view.cpp
@@ -465,7 +465,7 @@ VECTOR2D VIEW::ToWorld( const VECTOR2D& aCoord, bool aAbsolute ) const
const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
if( aAbsolute )
- return VECTOR2D( matrix * aCoord );
+ return matrix * aCoord;
else
return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y );
}
@@ -484,7 +484,7 @@ VECTOR2D VIEW::ToScreen( const VECTOR2D& aCoord, bool aAbsolute ) const
const MATRIX3x3D& matrix = m_gal->GetWorldScreenMatrix();
if( aAbsolute )
- return VECTOR2D( matrix * aCoord );
+ return matrix * aCoord;
else
return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y );
}
diff --git a/common/widgets/footprint_preview_widget.cpp b/common/widgets/footprint_preview_widget.cpp
index a30520d1c..e6b5135b2 100644
--- a/common/widgets/footprint_preview_widget.cpp
+++ b/common/widgets/footprint_preview_widget.cpp
@@ -77,14 +77,14 @@ void FOOTPRINT_PREVIEW_WIDGET::ClearStatus()
void FOOTPRINT_PREVIEW_WIDGET::CacheFootprint( const LIB_ID& aFPID )
{
if( m_prev_panel )
- (void) m_prev_panel->CacheFootprint( aFPID );
+ m_prev_panel->CacheFootprint( aFPID );
}
void FOOTPRINT_PREVIEW_WIDGET::DisplayFootprint( const LIB_ID& aFPID )
{
if( m_prev_panel )
- (void) m_prev_panel->DisplayFootprint( aFPID );
+ m_prev_panel->DisplayFootprint( aFPID );
}
diff --git a/common/worksheet_viewitem.cpp b/common/worksheet_viewitem.cpp
index 15924033a..bbba9d7be 100644
--- a/common/worksheet_viewitem.cpp
+++ b/common/worksheet_viewitem.cpp
@@ -141,7 +141,7 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_LINE* aItem, GAL* aGal ) const
{
aGal->SetIsStroke( true );
aGal->SetIsFill( false );
- aGal->SetStrokeColor( COLOR4D( aItem->GetColor() ) );
+ aGal->SetStrokeColor( aItem->GetColor() );
aGal->SetLineWidth( aItem->GetPenWidth() );
aGal->DrawLine( VECTOR2D( aItem->GetStart() ), VECTOR2D( aItem->GetEnd() ) );
}
@@ -151,7 +151,7 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_RECT* aItem, GAL* aGal ) const
{
aGal->SetIsStroke( true );
aGal->SetIsFill( false );
- aGal->SetStrokeColor( COLOR4D( aItem->GetColor() ) );
+ aGal->SetStrokeColor( aItem->GetColor() );
aGal->SetLineWidth( aItem->GetPenWidth() );
aGal->DrawRectangle( VECTOR2D( aItem->GetStart() ), VECTOR2D( aItem->GetEnd() ) );
}
@@ -167,14 +167,14 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_POLYGON* aItem, GAL* aGal ) co
if( aItem->IsFilled() )
{
- aGal->SetFillColor( COLOR4D( aItem->GetColor() ) );
+ aGal->SetFillColor( aItem->GetColor() );
aGal->SetIsFill( true );
aGal->SetIsStroke( false );
aGal->DrawPolygon( corners );
}
else
{
- aGal->SetStrokeColor( COLOR4D( aItem->GetColor() ) );
+ aGal->SetStrokeColor( aItem->GetColor() );
aGal->SetIsFill( false );
aGal->SetIsStroke( true );
aGal->SetLineWidth( aItem->GetPenWidth() );
@@ -190,7 +190,7 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_TEXT* aItem, GAL* aGal ) const
aGal->Save();
aGal->Translate( position );
aGal->Rotate( -aItem->GetTextAngle() * M_PI / 1800.0 );
- aGal->SetStrokeColor( COLOR4D( aItem->GetColor() ) );
+ aGal->SetStrokeColor( aItem->GetColor() );
aGal->SetLineWidth( aItem->GetThickness() );
aGal->SetTextAttributes( aItem );
aGal->StrokeText( aItem->GetShownText(), VECTOR2D( 0, 0 ), 0.0 );
diff --git a/common/xnode.cpp b/common/xnode.cpp
index 74d31be9b..895581dd8 100644
--- a/common/xnode.cpp
+++ b/common/xnode.cpp
@@ -51,7 +51,7 @@ void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel )
void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel )
{
// output attributes first if they exist
- for( XATTR* attr = (XATTR*) GetAttributes(); attr; attr = (XATTR*) attr->GetNext() )
+ for( XATTR* attr = GetAttributes(); attr; attr = attr->GetNext() )
{
out->Print( 0, " (%s %s)",
// attr names should never need quoting, no spaces, we designed the file.
@@ -66,7 +66,7 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel )
case wxXML_ELEMENT_NODE:
// output children if they exist.
- for( XNODE* kid = (XNODE*) GetChildren(); kid; kid = (XNODE*) kid->GetNext() )
+ for( XNODE* kid = GetChildren(); kid; kid = kid->GetNext() )
{
if( kid->GetType() != wxXML_TEXT_NODE )
{
diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp
index bc167ebb5..6f552d645 100644
--- a/cvpcb/cvpcb.cpp
+++ b/cvpcb/cvpcb.cpp
@@ -111,7 +111,7 @@ KIFACE_I& Kiface() { return kiface; }
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
{
- process = (PGM_BASE*) aProgram;
+ process = aProgram;
return &kiface;
}
diff --git a/eeschema/dialogs/dialog_edit_one_field.cpp b/eeschema/dialogs/dialog_edit_one_field.cpp
index e5d0a0a7f..8076ac825 100644
--- a/eeschema/dialogs/dialog_edit_one_field.cpp
+++ b/eeschema/dialogs/dialog_edit_one_field.cpp
@@ -102,7 +102,7 @@ void DIALOG_EDIT_ONE_FIELD::init()
wxString msg;
m_TextValue->SetFocus();
- SCH_BASE_FRAME* parent = static_cast<SCH_BASE_FRAME*>( GetParent() );
+ SCH_BASE_FRAME* parent = GetParent();
m_TextValue->SetValidator( SCH_FIELD_VALIDATOR(
parent->IsType( FRAME_SCH_LIB_EDITOR ),
m_fieldId, &m_text ) );
diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 5b7c7a3a3..aa67ab64c 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -212,7 +212,7 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
for( i = 0; i < sheetList.size(); i++ )
{
- SCH_ITEM* item = (SCH_ITEM*) sheetList[i].LastDrawList();
+ SCH_ITEM* item = sheetList[i].LastDrawList();
for( ; item; item = item->Next() )
{
diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp
index 24c74fe06..451a3a286 100644
--- a/eeschema/eeschema_config.cpp
+++ b/eeschema/eeschema_config.cpp
@@ -270,8 +270,8 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
int sep, firstId;
dlg.GetRefIdSeparator( sep, firstId);
- if( sep != (int)LIB_PART::GetSubpartIdSeparator() ||
- firstId != (int)LIB_PART::GetSubpartFirstId() )
+ if( sep != LIB_PART::GetSubpartIdSeparator() ||
+ firstId != LIB_PART::GetSubpartFirstId() )
{
LIB_PART::SetSubpartIdNotation( sep, firstId );
saveProjectConfig = true;
diff --git a/eeschema/generate_alias_info.cpp b/eeschema/generate_alias_info.cpp
index 37dc5db16..bc4fd1247 100644
--- a/eeschema/generate_alias_info.cpp
+++ b/eeschema/generate_alias_info.cpp
@@ -74,7 +74,7 @@ public:
try
{
- m_alias = const_cast< LIB_ALIAS* >( m_sym_lib_table->LoadSymbol( m_lib_id ) );
+ m_alias = m_sym_lib_table->LoadSymbol( m_lib_id );
}
catch( const IO_ERROR& ioe )
{
diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp
index d35168134..92535b83f 100644
--- a/eeschema/hierarch.cpp
+++ b/eeschema/hierarch.cpp
@@ -149,7 +149,7 @@ HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* aParent, const wxPoint
DIALOG_SHIM( aParent, wxID_ANY, _( "Navigator" ), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{
- wxASSERT( dynamic_cast< SCH_EDIT_FRAME* >( aParent ) );
+ wxASSERT( aParent );
m_SchFrameEditor = aParent;
m_currSheet = aParent->GetCurrentSheet();
diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
index f711cb934..576485c24 100644
--- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
@@ -53,7 +53,7 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceDevice( const wxString& aComponent ) c
// Prefix the device type if plain reference would result in a different device type
return it->m_primitive != it->m_refName[0] ?
- wxString( it->m_primitive + it->m_refName ) : it->m_refName;
+ it->m_primitive + it->m_refName : it->m_refName;
}
diff --git a/eeschema/sch_eagle_plugin.cpp b/eeschema/sch_eagle_plugin.cpp
index 983607b7f..298243df1 100644
--- a/eeschema/sch_eagle_plugin.cpp
+++ b/eeschema/sch_eagle_plugin.cpp
@@ -1062,7 +1062,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
wxString libraryname = epart->library;
wxString gatename = epart->deviceset + epart->device + einstance.gate;
- wxString symbolname = wxString( epart->deviceset + epart->device );
+ wxString symbolname = epart->deviceset + epart->device;
symbolname.Replace( "*", "" );
LIB_ALIAS::ValidateName( symbolname );
@@ -1383,7 +1383,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
{
if( connect.gate == aGateName && pin->GetName() == connect.pin )
{
- wxArrayString pads = wxSplit( wxString( connect.pad ), ' ');
+ wxArrayString pads = wxSplit( connect.pad, ' ');
pin->SetPartNumber( aGateNumber );
pin->SetUnit( aGateNumber );
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index b0d9f1206..5bbd33581 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -410,8 +410,8 @@ EDA_ITEM* SCH_LINE::MergeOverlap( SCH_LINE* aLine )
if( this == aLine || GetLayer() != aLine->GetLayer() )
return NULL;
- SCH_LINE leftmost = SCH_LINE( *aLine );
- SCH_LINE rightmost = SCH_LINE( *this );
+ SCH_LINE leftmost = *aLine;
+ SCH_LINE rightmost = *this;
// We place the start to the left and below the end of both lines
if( leftmost.m_start != std::min( { leftmost.m_start, leftmost.m_end }, less ) )
@@ -427,7 +427,7 @@ EDA_ITEM* SCH_LINE::MergeOverlap( SCH_LINE* aLine )
if( less( rightmost.m_start, leftmost.m_start ) )
std::swap( leftmost, rightmost );
- SCH_LINE other = SCH_LINE( rightmost );
+ SCH_LINE other = rightmost;
if( less( rightmost.m_end, leftmost.m_end ) )
rightmost = leftmost;
diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h
index a8f708ea0..509c1392e 100644
--- a/eeschema/sch_sheet_path.h
+++ b/eeschema/sch_sheet_path.h
@@ -127,7 +127,7 @@ public:
if( aIndex < size() )
retv = at( aIndex );
- return const_cast< SCH_SHEET* >( retv );
+ return retv;
}
SCH_SHEET* GetSheet( unsigned aIndex )
diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
index bd032e8a1..a7b0aafbe 100644
--- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
+++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
@@ -192,7 +192,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
// Apply changes to the GAL
auto view = m_Parent->GetGalCanvas()->GetView();
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
- auto settings = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( painter->GetSettings() );
+ auto settings = painter->GetSettings();
settings->LoadDisplayOptions( displayOptions );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 3ddaf9320..7a23f08af 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -538,7 +538,7 @@ void GERBVIEW_FRAME::applyDisplaySettingsToGAL()
{
auto view = GetGalCanvas()->GetView();
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
- auto settings = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( painter->GetSettings() );
+ auto settings = painter->GetSettings();
settings->LoadDisplayOptions( &m_DisplayOptions );
settings->ImportLegacyColors( m_colorsSettings );
diff --git a/gerbview/select_layers_to_pcb.h b/gerbview/select_layers_to_pcb.h
index 858cc02af..4d736a1d7 100644
--- a/gerbview/select_layers_to_pcb.h
+++ b/gerbview/select_layers_to_pcb.h
@@ -43,8 +43,8 @@ private:
static int m_exportBoardCopperLayersCount;
LAYER_NUM m_layersLookUpTable[GERBER_DRAWLAYERS_COUNT]; // Indexes Gerber layers to PCB file layers
// the last value in table is the number of copper layers
- int m_buttonTable[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes buttons to Gerber layers
- wxStaticText* m_layersList[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes text strings to buttons
+ int m_buttonTable[GERBER_DRAWLAYERS_COUNT+1]; // Indexes buttons to Gerber layers
+ wxStaticText* m_layersList[GERBER_DRAWLAYERS_COUNT+1]; // Indexes text strings to buttons
public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent );
~LAYERS_MAP_DIALOG() {};
diff --git a/gerbview/tools/selection_tool.cpp b/gerbview/tools/selection_tool.cpp
index f1499cc81..6020bcf2f 100644
--- a/gerbview/tools/selection_tool.cpp
+++ b/gerbview/tools/selection_tool.cpp
@@ -279,7 +279,7 @@ SELECTION& GERBVIEW_SELECTION_TOOL::RequestSelection( int aFlags )
// Now safely remove the items from the selection
for( auto item : removed_items )
- unselect( static_cast<EDA_ITEM *>( item ) );
+ unselect( item );
return m_selection;
}
@@ -608,7 +608,7 @@ void GERBVIEW_SELECTION_TOOL::clearSelection()
return;
for( auto item : m_selection )
- unselectVisually( static_cast<EDA_ITEM*>( item ) );
+ unselectVisually( item );
m_selection.Clear();
diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h
index b3d571a34..4991eafce 100644
--- a/include/gal/graphics_abstraction_layer.h
+++ b/include/gal/graphics_abstraction_layer.h
@@ -906,7 +906,7 @@ public:
*/
inline VECTOR2D ToWorld( const VECTOR2D& aPoint ) const
{
- return VECTOR2D( screenWorldMatrix * aPoint );
+ return screenWorldMatrix * aPoint;
}
/**
@@ -917,7 +917,7 @@ public:
*/
inline VECTOR2D ToScreen( const VECTOR2D& aPoint ) const
{
- return VECTOR2D( worldScreenMatrix * aPoint );
+ return worldScreenMatrix * aPoint;
}
/**
diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h
index 2cd5d314f..33465170b 100644
--- a/include/layers_id_colors_and_visibility.h
+++ b/include/layers_id_colors_and_visibility.h
@@ -302,9 +302,9 @@ enum GERBVIEW_LAYER_ID: int
// from a dialog, but have a visibility control flag.
// Here is a mask to set them visible, to be sure they are displayed
// after loading a board for instance
-#define MIN_VISIBILITY_MASK int( ( 1 << GAL_LAYER_INDEX( LAYER_PADS_PLATEDHOLES ) ) +\
- ( 1 << GAL_LAYER_INDEX( LAYER_VIAS_HOLES ) ) +\
- ( 1 << GAL_LAYER_INDEX( LAYER_DRC ) ) +\
+#define MIN_VISIBILITY_MASK ( ( 1 << GAL_LAYER_INDEX( LAYER_PADS_PLATEDHOLES ) ) |\
+ ( 1 << GAL_LAYER_INDEX( LAYER_VIAS_HOLES ) ) |\
+ ( 1 << GAL_LAYER_INDEX( LAYER_DRC ) ) |\
( 1 << GAL_LAYER_INDEX( LAYER_GP_OVERLAY ) ) )
diff --git a/include/utf8.h b/include/utf8.h
index 3591f1aff..3360bc85e 100644
--- a/include/utf8.h
+++ b/include/utf8.h
@@ -128,21 +128,21 @@ public:
{
m_s += str.m_s;
MAYBE_VERIFY_UTF8( c_str() );
- return (UTF8&) *this;
+ return *this;
}
UTF8& operator+=( char ch )
{
m_s.operator+=( ch );
MAYBE_VERIFY_UTF8( c_str() );
- return (UTF8&) *this;
+ return *this;
}
UTF8& operator+=( const char* s )
{
m_s.operator+=( s );
MAYBE_VERIFY_UTF8( c_str() );
- return (UTF8&) *this;
+ return *this;
}
/// Append a wide (unicode) char to the UTF8 string.
diff --git a/pagelayout_editor/block.cpp b/pagelayout_editor/block.cpp
index d0c34d271..9f5de4d2f 100644
--- a/pagelayout_editor/block.cpp
+++ b/pagelayout_editor/block.cpp
@@ -202,7 +202,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
void PL_EDITOR_FRAME::Block_Move( wxDC* DC )
{
- auto screen = static_cast<PL_EDITOR_SCREEN*>( GetScreen() );
+ auto screen = GetScreen();
wxPoint delta;
wxPoint oldpos;
diff --git a/pagelayout_editor/pl_editor.cpp b/pagelayout_editor/pl_editor.cpp
index 9d1a6b300..e5c8a45a7 100644
--- a/pagelayout_editor/pl_editor.cpp
+++ b/pagelayout_editor/pl_editor.cpp
@@ -104,7 +104,7 @@ KIFACE_I& Kiface() { return kiface; }
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
{
- process = (PGM_BASE*) aProgram;
+ process = aProgram;
return &kiface;
}
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index fe4225422..c251d2d16 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -386,7 +386,7 @@ void PL_EDITOR_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
void PL_EDITOR_FRAME::UpdateStatusBar()
{
- PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
+ PL_EDITOR_SCREEN* screen = GetScreen();
if( !screen )
return;
@@ -674,7 +674,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
const PAGE_INFO& pageInfo = GetPageSettings();
TITLE_BLOCK t_block = GetTitleBlock();
COLOR4D color = COLOR4D( RED ); // Needed, not used
- PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
+ PL_EDITOR_SCREEN* screen = GetScreen();
screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
diff --git a/pcb_calculator/pcb_calculator.cpp b/pcb_calculator/pcb_calculator.cpp
index 62937e913..9091fd7fc 100644
--- a/pcb_calculator/pcb_calculator.cpp
+++ b/pcb_calculator/pcb_calculator.cpp
@@ -93,7 +93,7 @@ KIFACE_I& Kiface() { return kiface; }
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
{
- process = (PGM_BASE*) aProgram;
+ process = aProgram;
return &kiface;
}
diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index b690359ab..45920d9d7 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -377,6 +377,13 @@ if( COMPILER_SUPPORTS_WSHADOW )
endif()
+if( COMPILER_SUPPORTS_WUSELESS_CASTS )
+ set_source_files_properties( pcbnew_wrap.cxx pcbnewPYTHON_wrap.cxx
+ PROPERTIES COMPILE_FLAGS -Wno-useless-casts
+ )
+endif()
+
+
if( KICAD_SCRIPTING )
set( PCBNEW_SCRIPTING_SRCS
${PCBNEW_SCRIPTING_DIALOGS}
diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp
index 9b94f08c4..b89edf02b 100644
--- a/pcbnew/board_items_to_polygon_shape_transform.cpp
+++ b/pcbnew/board_items_to_polygon_shape_transform.cpp
@@ -1033,7 +1033,7 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer,
{
corner.x = copper_thickness.x / 2;
corner.y = KiROUND( sqrt( ( (double) outer_radius * outer_radius ) -
- ( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) ) );
+ ( ( corner.x - delta ) * ( corner.x - deltasize ) ) ) );
corner.x -= deltasize;
/* creates an intermediate point, to have a > 90 deg angle
diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp
index c4f0f1643..a16de5be2 100644
--- a/pcbnew/class_dimension.cpp
+++ b/pcbnew/class_dimension.cpp
@@ -520,5 +520,5 @@ void DIMENSION::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_DIMENSION_T );
- std::swap( *((DIMENSION*) this), *((DIMENSION*) aImage) );
+ std::swap( *this, *((DIMENSION*) aImage) );
}
diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp
index 462029b0d..accef5759 100644
--- a/pcbnew/class_drawsegment.cpp
+++ b/pcbnew/class_drawsegment.cpp
@@ -894,5 +894,5 @@ void DRAWSEGMENT::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_LINE_T );
- std::swap( *((DRAWSEGMENT*) this), *((DRAWSEGMENT*) aImage) );
+ std::swap( *this, *((DRAWSEGMENT*) aImage) );
}
diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp
index 327f0a8c0..984de1baa 100644
--- a/pcbnew/class_module.cpp
+++ b/pcbnew/class_module.cpp
@@ -554,7 +554,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );
// Display last date the component was edited (useful in Module Editor).
- wxDateTime date( static_cast<time_t>( m_LastEditTime ) );
+ wxDateTime date( m_LastEditTime );
if( m_LastEditTime && date.IsValid() )
// Date format: see http://www.cplusplus.com/reference/ctime/strftime
@@ -1488,5 +1488,5 @@ void MODULE::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_MODULE_T );
- std::swap( *((MODULE*) this), *((MODULE*) aImage) );
+ std::swap( *this, *((MODULE*) aImage) );
}
diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h
index 919886213..72051477e 100644
--- a/pcbnew/class_module.h
+++ b/pcbnew/class_module.h
@@ -535,7 +535,7 @@ public:
* non-plated through holes when false.
* @return the number of pads according to \a aIncludeNPTH.
*/
- unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
+ unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH ) const;
/**
* GetUniquePadCount
@@ -549,7 +549,7 @@ public:
* non-plated through holes when false.
* @return the number of unique pads according to \a aIncludeNPTH.
*/
- unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
+ unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH ) const;
/**
* Function GetNextPadName
diff --git a/pcbnew/class_pcb_target.cpp b/pcbnew/class_pcb_target.cpp
index 69f973a79..e5ebd78a3 100644
--- a/pcbnew/class_pcb_target.cpp
+++ b/pcbnew/class_pcb_target.cpp
@@ -211,5 +211,5 @@ void PCB_TARGET::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_TARGET_T );
- std::swap( *((PCB_TARGET*) this), *((PCB_TARGET*) aImage) );
+ std::swap( *this, *((PCB_TARGET*) aImage) );
}
diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp
index 21e07d7cf..2171acc86 100644
--- a/pcbnew/class_pcb_text.cpp
+++ b/pcbnew/class_pcb_text.cpp
@@ -204,5 +204,5 @@ void TEXTE_PCB::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_TEXT_T );
- std::swap( *((TEXTE_PCB*) this), *((TEXTE_PCB*) aImage) );
+ std::swap( *this, *((TEXTE_PCB*) aImage) );
}
diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp
index 54f831b3c..ecf459c05 100644
--- a/pcbnew/class_track.cpp
+++ b/pcbnew/class_track.cpp
@@ -1658,14 +1658,14 @@ void TRACK::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_TRACE_T );
- std::swap( *((TRACK*) this), *((TRACK*) aImage) );
+ std::swap( *this, *((TRACK*) aImage) );
}
void VIA::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_VIA_T );
- std::swap( *((VIA*) this), *((VIA*) aImage) );
+ std::swap( *this, *((VIA*) aImage) );
}
#if defined(DEBUG)
diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h
index bf0751e16..1cb71236f 100644
--- a/pcbnew/class_track.h
+++ b/pcbnew/class_track.h
@@ -531,7 +531,7 @@ inline TRACK* GetFirstTrack( TRACK* aTrk, const TRACK* aStopPoint = NULL )
// It could stop because of the stop point, not on a via
if( aTrk && ( aTrk->Type() == PCB_TRACE_T ) )
- return static_cast<TRACK*>( aTrk );
+ return aTrk;
else
return NULL;
}
diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp
index 1fd86ce2d..6287ed6f4 100644
--- a/pcbnew/class_zone.cpp
+++ b/pcbnew/class_zone.cpp
@@ -1307,7 +1307,7 @@ void ZONE_CONTAINER::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_ZONE_AREA_T );
- std::swap( *((ZONE_CONTAINER*) this), *((ZONE_CONTAINER*) aImage) );
+ std::swap( *this, *((ZONE_CONTAINER*) aImage) );
}
void ZONE_CONTAINER::CacheTriangulation()
diff --git a/pcbnew/connectivity_algo.cpp b/pcbnew/connectivity_algo.cpp
index 9d110ddbf..c6948b2e6 100644
--- a/pcbnew/connectivity_algo.cpp
+++ b/pcbnew/connectivity_algo.cpp
@@ -784,17 +784,15 @@ void CN_CONNECTIVITY_ALGO::MarkNetAsDirty( int aNet )
void CN_VISITOR::checkZoneItemConnection( CN_ZONE* aZone, CN_ITEM* aItem )
{
- auto zoneItem = static_cast<CN_ZONE*> ( aZone );
-
- if( zoneItem->Net() != aItem->Net() && !aItem->CanChangeNet() )
+ if( aZone->Net() != aItem->Net() && !aItem->CanChangeNet() )
return;
- if( zoneItem->ContainsPoint( aItem->GetAnchor( 0 ) ) ||
+ if( aZone->ContainsPoint( aItem->GetAnchor( 0 ) ) ||
( aItem->Parent()->Type() == PCB_TRACE_T &&
- zoneItem->ContainsPoint( aItem->GetAnchor( 1 ) ) ) )
+ aZone->ContainsPoint( aItem->GetAnchor( 1 ) ) ) )
{
std::lock_guard<std::mutex> lock( *m_listLock );
- CN_ITEM::Connect( zoneItem, aItem );
+ CN_ITEM::Connect( aZone, aItem );
}
}
diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp
index 1003ddb84..c189012f5 100644
--- a/pcbnew/convert_drawsegment_list_to_polygon.cpp
+++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp
@@ -189,7 +189,6 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
// Make a working copy of aSegList, because the list is modified during calculations
std::vector< DRAWSEGMENT* > segList = aSegList;
- DRAWSEGMENT* graphic;
wxPoint prevPt;
// Find edge point with minimum x, this should be in the outer polygon
@@ -199,7 +198,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
for( size_t i = 0; i < segList.size(); i++ )
{
- graphic = (DRAWSEGMENT*) segList[i];
+ auto graphic = segList[i];
switch( graphic->GetShape() )
{
@@ -273,7 +272,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
// can put enough graphics together by matching endpoints to formulate a cohesive
// polygon.
- graphic = (DRAWSEGMENT*) segList[xmini];
+ auto graphic = segList[xmini];
// The first DRAWSEGMENT is in 'graphic', ok to remove it from 'items'
segList.erase( segList.begin() + xmini );
@@ -406,7 +405,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
// emit a signal layers keepout for every interior polygon left...
int hole = aPolygons.NewHole();
- graphic = (DRAWSEGMENT*) segList[0];
+ graphic = segList[0];
segList.erase( segList.begin() );
if( graphic->GetShape() == S_CIRCLE )
diff --git a/pcbnew/dialogs/dialog_display_options.cpp b/pcbnew/dialogs/dialog_display_options.cpp
index 2711f4d11..50bc77cb2 100644
--- a/pcbnew/dialogs/dialog_display_options.cpp
+++ b/pcbnew/dialogs/dialog_display_options.cpp
@@ -119,8 +119,7 @@ bool DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow()
// Apply changes to the GAL
KIGFX::VIEW* view = m_parent->GetGalCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
- KIGFX::PCB_RENDER_SETTINGS* settings =
- static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
+ KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
settings->LoadDisplayOptions( displ_opts );
view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp
index 5db8baa56..68640deef 100644
--- a/pcbnew/files.cpp
+++ b/pcbnew/files.cpp
@@ -868,8 +868,8 @@ bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
wxGetEnv( project_env, &env_path );
wxString result( newLibPath );
- rel_path = result.Replace( env_path,
- wxString( "$(" + project_env + ")" ) ) ? result : "" ;
+ auto result_valid = result.Replace( env_path, ( "$(" + project_env + ")" ) );
+ rel_path = result_valid ? result : "" ;
if( !rel_path.IsEmpty() )
newLibPath = rel_path;
diff --git a/pcbnew/footprint_info_impl.cpp b/pcbnew/footprint_info_impl.cpp
index 4d9abff17..e98ebaf5f 100644
--- a/pcbnew/footprint_info_impl.cpp
+++ b/pcbnew/footprint_info_impl.cpp
@@ -291,7 +291,7 @@ bool FOOTPRINT_LIST_IMPL::JoinWorkers()
} ) );
}
- while( !m_cancelled && (size_t)m_count_finished.load() < total_count )
+ while( !m_cancelled && m_count_finished.load() < total_count )
{
if( m_progress_reporter && !m_progress_reporter->KeepRefreshing() )
m_cancelled = true;
diff --git a/pcbnew/import_dxf/dxf2brd_items.cpp b/pcbnew/import_dxf/dxf2brd_items.cpp
index b02438630..9241b7dc4 100644
--- a/pcbnew/import_dxf/dxf2brd_items.cpp
+++ b/pcbnew/import_dxf/dxf2brd_items.cpp
@@ -395,7 +395,7 @@ void DXF2BRD_CONVERTER::addText( const DRW_Text& aData )
textItem->SetThickness( mapWidth( aData.thickness ) );
textItem->SetText( text );
- m_newItemsList.push_back( static_cast< BOARD_ITEM* >( brdItem ) );
+ m_newItemsList.push_back( brdItem );
}
@@ -508,7 +508,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& aData )
}
#endif
- m_newItemsList.push_back( static_cast< BOARD_ITEM* >( brdItem ) );
+ m_newItemsList.push_back( brdItem );
}
diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp
index 2876f6bfc..5f2f7dc3e 100644
--- a/pcbnew/legacy_plugin.cpp
+++ b/pcbnew/legacy_plugin.cpp
@@ -288,7 +288,7 @@ PCB_LAYER_ID LEGACY_PLUGIN::leg_layer2new( int cu_count, LAYER_NUM aLayerNum )
// this is a speed critical function, be careful.
- if( unsigned( old ) <= unsigned( LAYER_N_FRONT ) )
+ if( old <= unsigned( LAYER_N_FRONT ) )
{
if( old == LAYER_N_FRONT )
newid = F_Cu;
diff --git a/pcbnew/pad_draw_functions.cpp b/pcbnew/pad_draw_functions.cpp
index a87dac001..9f72f93b5 100644
--- a/pcbnew/pad_draw_functions.cpp
+++ b/pcbnew/pad_draw_functions.cpp
@@ -721,7 +721,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
if( aDrawInfo.m_Display_padnum )
{
int numpad_len = std::max( (int) m_name.Length(), MIN_CHAR_COUNT );
- tsize = std::min( (int) AreaSize.y, AreaSize.x / numpad_len );
+ tsize = std::min( AreaSize.y, AreaSize.x / numpad_len );
if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable when size too small.
{
diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp
index bf697faa0..9e317b752 100644
--- a/pcbnew/pcb_base_frame.cpp
+++ b/pcbnew/pcb_base_frame.cpp
@@ -1022,7 +1022,7 @@ void PCB_BASE_FRAME::updateZoomSelectBox()
{
msg = _( "Zoom " );
- double level = m_zoomLevelCoeff / (double)GetScreen()->m_ZoomList[i];
+ double level = m_zoomLevelCoeff / GetScreen()->m_ZoomList[i];
wxString value = wxString::Format( wxT( "%.2f" ), level );
msg += value;
diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp
index 389fed9e7..2eba01bda 100644
--- a/pcbnew/pcb_draw_panel_gal.cpp
+++ b/pcbnew/pcb_draw_panel_gal.cpp
@@ -149,7 +149,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
}
// Load drawings
- for( auto drawing : const_cast<BOARD*>(aBoard)->Drawings() )
+ for( auto drawing : aBoard->Drawings() )
m_view->Add( drawing );
// Load tracks
diff --git a/pcbnew/pcb_view.cpp b/pcbnew/pcb_view.cpp
index f4f913eaf..e65d802e5 100644
--- a/pcbnew/pcb_view.cpp
+++ b/pcbnew/pcb_view.cpp
@@ -103,7 +103,7 @@ void PCB_VIEW::Update( KIGFX::VIEW_ITEM* aItem )
void PCB_VIEW::UpdateDisplayOptions( PCB_DISPLAY_OPTIONS* aOptions )
{
auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetPainter() );
- auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
+ auto settings = painter->GetSettings();
settings->LoadDisplayOptions( aOptions );
}
diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp
index d3d2ee1d6..783b4ec3f 100644
--- a/pcbnew/ratsnest.cpp
+++ b/pcbnew/ratsnest.cpp
@@ -211,7 +211,7 @@ void PCB_BASE_FRAME::TraceAirWiresToTargets( wxDC* aDC )
GRSetDrawMode( aDC, GR_XOR );
- for( int i = 0; i < std::min( (int) displ_opts->m_MaxLinksShowed, (int) targets.size() ); i++ )
+ for( int i = 0; i < std::min( displ_opts->m_MaxLinksShowed, (int) targets.size() ); i++ )
{
auto p = targets[i];
GRLine( m_canvas->GetClipBox(), aDC, s_CursorPos, wxPoint( p.x, p.y ), 0, YELLOW );
diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp
index 0a344ef75..85962392b 100644
--- a/pcbnew/router/pns_diff_pair_placer.cpp
+++ b/pcbnew/router/pns_diff_pair_placer.cpp
@@ -353,8 +353,8 @@ const ITEM_SET DIFF_PAIR_PLACER::Traces()
{
ITEM_SET t;
- t.Add( const_cast<LINE*>( &m_currentTrace.PLine() ) );
- t.Add( const_cast<LINE*>( &m_currentTrace.NLine() ) );
+ t.Add( &m_currentTrace.PLine() );
+ t.Add( &m_currentTrace.NLine() );
return t;
}
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index 4e7a5d118..dcb7fa6e5 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -853,7 +853,7 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
{
case S_ARC:
{
- SHAPE_ARC arc( aItem->GetCenter(), aItem->GetArcStart(), (double) aItem->GetAngle() / 10.0 );
+ SHAPE_ARC arc( aItem->GetCenter(), aItem->GetArcStart(), aItem->GetAngle() / 10.0 );
auto l = arc.ConvertToPolyline();
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index 705a65899..14e535937 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -918,7 +918,7 @@ bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
int eiDepth = -1;
if( aEndItem && aEndItem->Owner() )
- eiDepth = static_cast<NODE*>( aEndItem->Owner() )->Depth();
+ eiDepth = aEndItem->Owner()->Depth();
if( m_lastNode )
{
diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp
index 8165b7139..a8b4cb4ae 100644
--- a/pcbnew/router/pns_meander.cpp
+++ b/pcbnew/router/pns_meander.cpp
@@ -209,7 +209,7 @@ SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool
{
const int ArcSegments = Settings().m_cornerArcSegments;
- double radius = (double) aDir.EuclideanNorm();
+ double radius = aDir.EuclideanNorm();
double angleStep = M_PI / 2.0 / (double) ArcSegments;
double correction = 12.0 * radius * ( 1.0 - cos( angleStep / 2.0 ) );
@@ -234,7 +234,7 @@ SHAPE_LINE_CHAIN MEANDER_SHAPE::makeMiterShape( VECTOR2D aP, VECTOR2D aDir, bool
break;
case MEANDER_STYLE_CHAMFER:
{
- double radius = (double) aDir.EuclideanNorm();
+ double radius = aDir.EuclideanNorm();
double correction = 0;
if( m_dual && radius > m_meanCornerRadius )
correction = (double)(-2 * abs(m_baselineOffset)) * tan( 22.5 * M_PI / 180.0 );
diff --git a/pcbnew/router/pns_sizes_settings.cpp b/pcbnew/router/pns_sizes_settings.cpp
index 58a158b98..4b70bcfc6 100644
--- a/pcbnew/router/pns_sizes_settings.cpp
+++ b/pcbnew/router/pns_sizes_settings.cpp
@@ -52,7 +52,7 @@ int SIZES_SETTINGS::inheritTrackWidth( ITEM* aItem )
return 0;
}
- JOINT* jt = static_cast<NODE*>( aItem->Owner() )->FindJoint( p, aItem );
+ JOINT* jt = aItem->Owner()->FindJoint( p, aItem );
assert( jt != NULL );
diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp
index ca0db2b7a..14a529e8c 100644
--- a/pcbnew/router/router_tool.cpp
+++ b/pcbnew/router/router_tool.cpp
@@ -1012,7 +1012,7 @@ void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECT
// with the reference, and on the same net. Ignore markers.
for( int i = 0; i < aCollector.GetCount(); i++ )
{
- BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
+ BOARD_ITEM* item = aCollector[i];
if( item->Type() == PCB_MARKER_T )
continue;
diff --git a/pcbnew/specctra_import_export/specctra.cpp b/pcbnew/specctra_import_export/specctra.cpp
index 7e4eb5bfc..1a78a6ff7 100644
--- a/pcbnew/specctra_import_export/specctra.cpp
+++ b/pcbnew/specctra_import_export/specctra.cpp
@@ -137,7 +137,7 @@ void SPECCTRA_DB::readCOMPnPIN( std::string* component_id, std::string* pin_id )
static const char pin_def[] = "<pin_reference>::=<component_id>-<pin_id>";
- if( !IsSymbol( (T) CurTok() ) )
+ if( !IsSymbol( CurTok() ) )
Expecting( pin_def );
// case for: A12-14, i.e. no wrapping quotes. This should be a single
@@ -2567,7 +2567,7 @@ void SPECCTRA_DB::doCLASS( CLASS* growth )
if( bracketNesting >= 1 )
{
- T previousTok = (T) PrevTok();
+ T previousTok = PrevTok();
if( previousTok!=T_LEFT && previousTok!=T_circuit && tok!=T_RIGHT )
builder += ' ';
diff --git a/pcbnew/specctra_import_export/specctra.h b/pcbnew/specctra_import_export/specctra.h
index 1d2a60f58..dd2f847fb 100644
--- a/pcbnew/specctra_import_export/specctra.h
+++ b/pcbnew/specctra_import_export/specctra.h
@@ -1799,7 +1799,7 @@ public:
ELEM( T_placement, aParent )
{
unit = 0;
- flip_style = DSN_T( T_NONE );
+ flip_style = T_NONE;
}
~PLACEMENT()
@@ -1833,7 +1833,7 @@ public:
if( unit )
unit->Format( out, nestLevel );
- if( flip_style != DSN_T( T_NONE ) )
+ if( flip_style != T_NONE )
{
out->Print( nestLevel, "(place_control (flip_style %s))\n",
GetTokenText( flip_style ) );
@@ -2478,7 +2478,7 @@ public:
ELEM( T_fromto, aParent )
{
rules = 0;
- fromto_type = DSN_T( T_NONE );
+ fromto_type = T_NONE;
}
~FROMTO()
{
@@ -2491,7 +2491,7 @@ public:
out->Print( nestLevel, "(%s %s %s ",
Name(), fromText.c_str(), toText.c_str() );
- if( fromto_type != DSN_T( T_NONE ) )
+ if( fromto_type != T_NONE )
out->Print( 0, "(type %s)", GetTokenText( fromto_type ) );
if( net_id.size() )
diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp
index 115485adb..93d9463b8 100644
--- a/pcbnew/tools/drawing_tool.cpp
+++ b/pcbnew/tools/drawing_tool.cpp
@@ -1089,7 +1089,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
: new DRAWSEGMENT;
// Copy coordinates, layer, etc.
- *static_cast<DRAWSEGMENT*>( l ) = line45;
+ *l = line45;
l->SetEnd( aGraphic->GetStart() );
BOARD_COMMIT commit( m_frame );
diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp
index ad86f0725..e92c37e80 100644
--- a/pcbnew/tools/edit_tool.cpp
+++ b/pcbnew/tools/edit_tool.cpp
@@ -1134,7 +1134,7 @@ void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector
{
for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
{
- BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
+ BOARD_ITEM* item = aCollector[i];
if( item->Type() != PCB_MODULE_T )
aCollector.Remove( i );
diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp
index 6e18bb663..8ed93d1a4 100644
--- a/pcbnew/tools/pcbnew_control.cpp
+++ b/pcbnew/tools/pcbnew_control.cpp
@@ -560,7 +560,7 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
wxUpdateUIEvent dummy;
- static_cast<PCB_BASE_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
+ m_frame->OnUpdateLayerAlpha( dummy );
}
else
wxBell();
diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index 7ce4dc76f..29eb48b13 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -2117,7 +2117,7 @@ void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector ) c
if( track->GetNetCode() != via->GetNetCode() )
continue;
- double lenRatio = (double) ( track->GetLength() + track->GetWidth() ) /
+ double lenRatio = ( track->GetLength() + track->GetWidth() ) /
(double) via->GetWidth();
if( lenRatio > trackViaLengthRatio )
diff --git a/plugins/3d/idf/s3d_plugin_idf.cpp b/plugins/3d/idf/s3d_plugin_idf.cpp
index e45c1f3c4..fd72f301d 100644
--- a/plugins/3d/idf/s3d_plugin_idf.cpp
+++ b/plugins/3d/idf/s3d_plugin_idf.cpp
@@ -796,7 +796,7 @@ static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
tY += vY;
tA += vA;
- pout = (IDF3_COMP_OUTLINE*)((*so)->GetOutline());
+ pout = (*so)->GetOutline();
if( NULL == pout )
{
diff --git a/polygon/clipper.cpp b/polygon/clipper.cpp
index 448aff485..3a45cc5f1 100644
--- a/polygon/clipper.cpp
+++ b/polygon/clipper.cpp
@@ -387,11 +387,11 @@ public:
if( hi < 0 )
{
- if( lo == 0 ) return (double) hi * shift64;
- else return -(double) (~lo + ~hi * shift64);
+ if( lo == 0 ) return hi * shift64;
+ else return -(~lo + ~hi * shift64);
}
else
- return (double) (lo + hi * shift64);
+ return (lo + hi * shift64);
}
};
// ------------------------------------------------------------------------------
@@ -5221,7 +5221,7 @@ void ClipperOffset::DoOffset( double delta )
if( node.m_endtype == etClosedLine || node.m_endtype == etClosedPolygon )
m_normals.push_back( GetUnitNormal( m_srcPoly[len - 1], m_srcPoly[0] ) );
else
- m_normals.push_back( DoublePoint( m_normals[len - 2] ) );
+ m_normals.push_back( m_normals[len - 2] );
if( node.m_endtype == etClosedPolygon )
{
@@ -5267,11 +5267,11 @@ void ClipperOffset::DoOffset( double delta )
if( node.m_endtype == etOpenButt )
{
int j = len - 1;
- pt1 = IntPoint( (cInt) Round( m_srcPoly[j].X + m_normals[j].X *
- delta ), (cInt) Round( m_srcPoly[j].Y + m_normals[j].Y * delta ) );
+ pt1 = IntPoint( Round( m_srcPoly[j].X + m_normals[j].X * delta ),
+ Round( m_srcPoly[j].Y + m_normals[j].Y * delta ) );
m_destPoly.push_back( pt1 );
- pt1 = IntPoint( (cInt) Round( m_srcPoly[j].X - m_normals[j].X *
- delta ), (cInt) Round( m_srcPoly[j].Y - m_normals[j].Y * delta ) );
+ pt1 = IntPoint( Round( m_srcPoly[j].X - m_normals[j].X * delta ),
+ Round( m_srcPoly[j].Y - m_normals[j].Y * delta ) );
m_destPoly.push_back( pt1 );
}
else
@@ -5300,11 +5300,11 @@ void ClipperOffset::DoOffset( double delta )
if( node.m_endtype == etOpenButt )
{
- pt1 = IntPoint( (cInt) Round( m_srcPoly[0].X - m_normals[0].X * delta ),
- (cInt) Round( m_srcPoly[0].Y - m_normals[0].Y * delta ) );
+ pt1 = IntPoint( Round( m_srcPoly[0].X - m_normals[0].X * delta ),
+ Round( m_srcPoly[0].Y - m_normals[0].Y * delta ) );
m_destPoly.push_back( pt1 );
- pt1 = IntPoint( (cInt) Round( m_srcPoly[0].X + m_normals[0].X * delta ),
- (cInt) Round( m_srcPoly[0].Y + m_normals[0].Y * delta ) );
+ pt1 = IntPoint( Round( m_srcPoly[0].X + m_normals[0].X * delta ),
+ Round( m_srcPoly[0].Y + m_normals[0].Y * delta ) );
m_destPoly.push_back( pt1 );
}
else
diff --git a/potrace/trace.cpp b/potrace/trace.cpp
index e1168e7e1..8bbab85fe 100644
--- a/potrace/trace.cpp
+++ b/potrace/trace.cpp
@@ -132,9 +132,9 @@ static void pointslope( privpath_t* pp, int i, int j, dpoint_t* ctr, dpoint_t* d
ctr->x = x / k;
ctr->y = y / k;
- a = ( x2 - (double) x * x / k ) / k;
- b = ( xy - (double) x * y / k ) / k;
- c = ( y2 - (double) y * y / k ) / k;
+ a = ( x2 - x * x / k ) / k;
+ b = ( xy - x * y / k ) / k;
+ c = ( y2 - y * y / k ) / k;
lambda2 = ( a + c + sqrt( ( a - c ) * ( a - c ) + 4 * b * b ) ) / 2; /* larger e.value */
diff --git a/utils/idftools/idf2vrml.cpp b/utils/idftools/idf2vrml.cpp
index 4eb34c6d1..0eaa95e5d 100644
--- a/utils/idftools/idf2vrml.cpp
+++ b/utils/idftools/idf2vrml.cpp
@@ -758,7 +758,7 @@ bool MakeComponents( IDF3_BOARD& board, std::ostream& file, bool compact )
tY += vY;
tA += vA;
- if( ( pout = (IDF3_COMP_OUTLINE*)((*so)->GetOutline()) ) )
+ if( ( pout = (*so)->GetOutline() ) )
{
vcp = GetColor( cmap, cidx, pout->GetUID() );
}
@@ -825,7 +825,7 @@ bool MakeComponents( IDF3_BOARD& board, std::ostream& file, bool compact )
bot *= scale;
}
- vcp = GetColor( cmap, cidx, ((IDF3_COMP_OUTLINE*)((*so)->GetOutline()))->GetUID() );
+ vcp = GetColor( cmap, cidx, (*so)->GetOutline()->GetUID() );
vcp->bottom = bottom;
// note: this can happen because IDF allows some negative heights/thicknesses
References