← Back to team overview

kicad-developers team mailing list archive

[PATCH 1/2] Remove useless casts

 

This removes casts where source and destination type are identical, as
reported by gcc -Wuseless-cast.

All of these should be trivial.
---
 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 +-
 .../c3d_render_ogl_legacy.cpp                  |  2 +-
 .../3d_render_ogl_legacy/clayer_triangles.h    |  4 ++--
 .../accelerators/cbvh_pbrt.cpp                 |  2 +-
 .../c3d_render_createscene.cpp                 |  8 ++++----
 .../c3d_render_raytracing.cpp                  |  2 +-
 .../shapes2D/citemlayercsg2d.cpp               |  6 ++----
 .../shapes2D/cpolygon2d.cpp                    |  2 +-
 .../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 ++++++------
 bitmap2component/bitmap2cmp_main.cpp           |  2 +-
 common/base_struct.cpp                         |  2 +-
 common/bezier_curves.cpp                       |  4 ++--
 common/board_printout.cpp                      |  2 +-
 common/draw_panel_gal.cpp                      |  4 ++--
 common/gal/opengl/opengl_compositor.cpp        |  6 +++---
 common/gal/opengl/opengl_gal.cpp               |  2 +-
 common/gal/opengl/shader.cpp                   |  4 ++--
 common/lib_table_base.cpp                      |  2 +-
 common/tool/picker_tool.cpp                    |  2 +-
 common/utf8.cpp                                |  2 +-
 common/view/view.cpp                           |  4 ++--
 common/widgets/footprint_preview_widget.cpp    |  4 ++--
 common/widgets/net_selector.cpp                |  2 +-
 common/xnode.cpp                               |  4 ++--
 cvpcb/cvpcb.cpp                                |  2 +-
 cvpcb/display_footprints_frame.cpp             |  2 +-
 dxflib_qcad/dl_dxf.cpp                         |  2 +-
 eeschema/dialogs/dialog_erc.cpp                |  2 +-
 eeschema/generate_alias_info.cpp               |  2 +-
 eeschema/hierarch.cpp                          |  2 +-
 eeschema/libedit/toolbars_libedit.cpp          |  2 +-
 .../netlist_exporter_pspice.cpp                |  2 +-
 eeschema/sch_eagle_plugin.cpp                  |  4 ++--
 eeschema/sch_marker.cpp                        |  2 +-
 eeschema/sch_sheet_path.h                      |  2 +-
 eeschema/toolbars_viewlib.cpp                  |  2 +-
 eeschema/tools/ee_inspection_tool.cpp          |  2 +-
 eeschema/tools/ee_point_editor.cpp             | 10 +++++-----
 eeschema/tools/ee_selection.cpp                |  2 +-
 eeschema/tools/ee_selection_tool.cpp           |  2 +-
 eeschema/tools/lib_edit_tool.cpp               |  2 +-
 eeschema/tools/sch_drawing_tools.cpp           |  6 +++---
 eeschema/tools/sch_edit_tool.cpp               |  4 ++--
 eeschema/tools/sch_editor_control.cpp          |  2 +-
 gerbview/gerbview_frame.cpp                    |  2 +-
 gerbview/tools/gerbview_control.cpp            |  2 +-
 gerbview/tools/gerbview_selection_tool.cpp     |  2 +-
 include/gal/graphics_abstraction_layer.h       |  4 ++--
 include/gal/opengl/shader.h                    |  2 +-
 include/utf8.h                                 |  6 +++---
 pagelayout_editor/pl_editor.cpp                |  2 +-
 pagelayout_editor/pl_editor_frame.cpp          |  2 +-
 pagelayout_editor/tools/pl_edit_tool.cpp       |  2 +-
 pagelayout_editor/tools/pl_editor_control.cpp  |  2 +-
 pagelayout_editor/tools/pl_point_editor.cpp    |  2 +-
 pagelayout_editor/tools/pl_selection_tool.cpp  |  2 +-
 pcb_calculator/pcb_calculator.cpp              |  2 +-
 .../class_board_stackup.cpp                    |  4 ++--
 pcbnew/class_board.cpp                         |  4 +---
 pcbnew/class_dimension.cpp                     |  2 +-
 pcbnew/class_drawsegment.cpp                   |  4 ++--
 pcbnew/class_marker_pcb.cpp                    |  8 ++++----
 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_zone.cpp                          |  2 +-
 pcbnew/connectivity/connectivity_algo.cpp      |  8 +++-----
 pcbnew/convert_drawsegment_list_to_polygon.cpp |  4 ++--
 pcbnew/dialogs/dialog_create_array.cpp         |  4 ++--
 pcbnew/exporters/export_gencad.cpp             |  4 +---
 pcbnew/files.cpp                               |  2 +-
 pcbnew/footprint_info_impl.cpp                 |  2 +-
 pcbnew/legacy_plugin.cpp                       |  2 +-
 pcbnew/pad_print_functions.cpp                 |  2 +-
 pcbnew/pcb_base_frame.cpp                      | 10 +++++-----
 pcbnew/pcb_draw_panel_gal.cpp                  |  2 +-
 pcbnew/pcb_view.cpp                            |  2 +-
 pcbnew/plot_board_layers.cpp                   |  3 +--
 pcbnew/plot_brditems_plotter.cpp               |  2 +-
 pcbnew/router/pns_diff_pair_placer.cpp         |  4 ++--
 pcbnew/router/pns_line_placer.cpp              |  2 +-
 pcbnew/router/pns_meander.cpp                  |  4 ++--
 pcbnew/router/pns_sizes_settings.cpp           |  2 +-
 pcbnew/specctra_import_export/specctra.cpp     |  4 ++--
 pcbnew/specctra_import_export/specctra.h       |  8 ++++----
 pcbnew/tools/drc.cpp                           |  2 +-
 pcbnew/tools/edit_tool.cpp                     |  4 ++--
 pcbnew/tools/pcb_tool_base.cpp                 |  2 +-
 pcbnew/tools/pcbnew_control.cpp                |  6 +++---
 pcbnew/tools/pcbnew_picker_tool.cpp            |  2 +-
 pcbnew/undo_redo.cpp                           |  2 +-
 plugins/3d/idf/s3d_plugin_idf.cpp              |  2 +-
 polygon/clipper.cpp                            | 18 +++++++++---------
 qa/libs/sexpr/test_sexpr_parser.cpp            |  4 ++--
 utils/idftools/idf2vrml.cpp                    |  4 ++--
 102 files changed, 173 insertions(+), 182 deletions(-)

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 ffbf4d125..2a898ff07 100644
--- a/3d-viewer/3d_canvas/create_layer_items.cpp
+++ b/3d-viewer/3d_canvas/create_layer_items.cpp
@@ -1098,17 +1098,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 5678e4707..3ead4f7a5 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
@@ -1007,7 +1007,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 9deb11978..3e12e97f8 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
@@ -106,13 +106,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 48daf8409..6b520a859 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;
 
@@ -1493,9 +1493,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 42e1bb243..0940caa8a 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
@@ -1876,7 +1876,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,
-                                                                          &currentNormal ) )
+                    if( !(*m_objectB)[i]->Intersect( aSegRay, &hitDist, &currentNormal ) )
                         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 9170f6867..ff95c0055 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 d562346d9..88a735c7b 100644
--- a/3d-viewer/3d_rendering/cimage.cpp
+++ b/3d-viewer/3d_rendering/cimage.cpp
@@ -47,7 +47,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;
 }
 
 
@@ -58,7 +58,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..c81aab0b7 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.0 * 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/bitmap2component/bitmap2cmp_main.cpp b/bitmap2component/bitmap2cmp_main.cpp
index fb9c1d2eb..99a1b3567 100644
--- a/bitmap2component/bitmap2cmp_main.cpp
+++ b/bitmap2component/bitmap2cmp_main.cpp
@@ -79,7 +79,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 a121781ab..ba34d93e9 100644
--- a/common/base_struct.cpp
+++ b/common/base_struct.cpp
@@ -149,7 +149,7 @@ wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS_T aUnits ) 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 8d7f58847..dca56ad6e 100644
--- a/common/bezier_curves.cpp
+++ b/common/bezier_curves.cpp
@@ -51,7 +51,7 @@ void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen )
     m_minSegLen = std::max( 1, aMinSegLen );
     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 )
@@ -65,7 +65,7 @@ void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen )
                 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/board_printout.cpp b/common/board_printout.cpp
index dfc7e9725..5cf006998 100644
--- a/common/board_printout.cpp
+++ b/common/board_printout.cpp
@@ -138,7 +138,7 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
     // Determine printout bounding box
     if( m_settings.PrintBorderAndTitleBlock() )
     {
-        bBox = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sheetSizeIU ) );
+        bBox = BOX2I( VECTOR2I( 0, 0 ), sheetSizeIU );
         view->SetLayerVisible( LAYER_WORKSHEET, true );
     }
     else
diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp
index 04bc371fa..9857e3d15 100644
--- a/common/draw_panel_gal.cpp
+++ b/common/draw_panel_gal.cpp
@@ -61,7 +61,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
     m_lostFocus  = false;
     m_stealsFocus = true;
 
-    m_currentCursor = wxStockCursor( wxCURSOR_ARROW );
+    m_currentCursor = wxCURSOR_ARROW;
 
     SetLayoutDirection( wxLayout_LeftToRight );
 
@@ -167,7 +167,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();
 
     try
     {
diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp
index 6fae6014f..ac83b6f63 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 c91e6b5da..e907cd92b 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -387,7 +387,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 d78379c36..f0008f085 100644
--- a/common/gal/opengl/shader.cpp
+++ b/common/gal/opengl/shader.cpp
@@ -234,7 +234,7 @@ std::string SHADER::ReadSource( const std::string& aShaderSourceName )
 }
 
 
-bool SHADER::loadShaderFromStringArray( SHADER_TYPE aShaderType, const char** aArray,
+bool SHADER::loadShaderFromStringArray( SHADER_TYPE aShaderType, const GLchar** aArray,
                                         size_t aSize )
 {
     assert( !isShaderLinked );
@@ -254,7 +254,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 fb8a8f2fc..7e1370482 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/tool/picker_tool.cpp b/common/tool/picker_tool.cpp
index d64d79fb9..38c71ac73 100644
--- a/common/tool/picker_tool.cpp
+++ b/common/tool/picker_tool.cpp
@@ -180,7 +180,7 @@ void PICKER_TOOL::setTransitions()
 
 void PICKER_TOOL::resetPicker()
 {
-    m_cursor = wxStockCursor( wxCURSOR_ARROW );
+    m_cursor = wxCURSOR_ARROW;
 
     m_picked = NULLOPT;
     m_clickHandler = NULLOPT;
diff --git a/common/utf8.cpp b/common/utf8.cpp
index 2d23e7814..103fff1d8 100644
--- a/common/utf8.cpp
+++ b/common/utf8.cpp
@@ -232,5 +232,5 @@ 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 4c4bed023..8c7069d17 100644
--- a/common/view/view.cpp
+++ b/common/view/view.cpp
@@ -477,7 +477,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 );
 }
@@ -496,7 +496,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 6a7d62cee..44948cf1d 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/widgets/net_selector.cpp b/common/widgets/net_selector.cpp
index acf2ec858..cc46023b1 100644
--- a/common/widgets/net_selector.cpp
+++ b/common/widgets/net_selector.cpp
@@ -253,7 +253,7 @@ protected:
             {
                 wxString netname = UnescapeString( netinfo->GetNetname() );
 
-                if( filter.IsEmpty() || wxString( netname ).MakeLower().Matches( filter ) )
+                if( filter.IsEmpty() || netname.MakeLower().Matches( filter ) )
                     netNames.push_back( netname );
             }
         }
diff --git a/common/xnode.cpp b/common/xnode.cpp
index 0fb2854a8..3eb8eb0e3 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)",
                     TO_UTF8( attr->GetName() ),
@@ -64,7 +64,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 330803996..628a92ac8 100644
--- a/cvpcb/cvpcb.cpp
+++ b/cvpcb/cvpcb.cpp
@@ -100,7 +100,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/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp
index e2b89fe85..900c0b1bf 100644
--- a/cvpcb/display_footprints_frame.cpp
+++ b/cvpcb/display_footprints_frame.cpp
@@ -414,7 +414,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
 
 void DISPLAY_FOOTPRINTS_FRAME::updateView()
 {
-    PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetCanvas() );
+    PCB_DRAW_PANEL_GAL* dp = GetCanvas();
     dp->UseColorScheme( &Settings().Colors() );
     dp->DisplayBoard( GetBoard() );
 
diff --git a/dxflib_qcad/dl_dxf.cpp b/dxflib_qcad/dl_dxf.cpp
index a76cf1611..bf68cc5c4 100644
--- a/dxflib_qcad/dl_dxf.cpp
+++ b/dxflib_qcad/dl_dxf.cpp
@@ -2299,7 +2299,7 @@ void DL_Dxf::addHatch( DL_CreationInterface* creationInterface )
 
         for( unsigned int k = 0; k<hatchEdges[i].size(); k++ )
         {
-            creationInterface->addHatchEdge( DL_HatchEdgeData( hatchEdges[i][k] ) );
+            creationInterface->addHatchEdge( hatchEdges[i][k] );
         }
     }
 
diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 7ea8691e4..2aa80ceaa 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -258,7 +258,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/generate_alias_info.cpp b/eeschema/generate_alias_info.cpp
index eea5c5125..878ea66c3 100644
--- a/eeschema/generate_alias_info.cpp
+++ b/eeschema/generate_alias_info.cpp
@@ -74,7 +74,7 @@ public:
 
         try
         {
-            m_module = const_cast< LIB_ALIAS* >( m_sym_lib_table->LoadSymbol( m_lib_id ) );
+            m_module = m_sym_lib_table->LoadSymbol( m_lib_id );
         }
         catch( const IO_ERROR& ioe )
         {
diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp
index f3d25a825..2b9548901 100644
--- a/eeschema/hierarch.cpp
+++ b/eeschema/hierarch.cpp
@@ -144,7 +144,7 @@ HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* aParent ) :
     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/libedit/toolbars_libedit.cpp b/eeschema/libedit/toolbars_libedit.cpp
index b6c969c15..c14ade320 100644
--- a/eeschema/libedit/toolbars_libedit.cpp
+++ b/eeschema/libedit/toolbars_libedit.cpp
@@ -136,7 +136,7 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
                                                wxDefaultPosition, wxDefaultSize,
                                                KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
 
-    ACTION_TOOLBAR* optToolbar = static_cast<ACTION_TOOLBAR*>( m_optionsToolBar );
+    ACTION_TOOLBAR* optToolbar = m_optionsToolBar;
 
     optToolbar->Add( ACTIONS::toggleGrid,             ACTION_TOOLBAR::TOGGLE );
     optToolbar->Add( ACTIONS::imperialUnits,          ACTION_TOOLBAR::TOGGLE );
diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
index 266b6f5be..a505bc699 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 494932074..fe1b52c73 100644
--- a/eeschema/sch_eagle_plugin.cpp
+++ b/eeschema/sch_eagle_plugin.cpp
@@ -1081,7 +1081,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( "*", "" );
     wxString kisymbolname = fixSymbolName( symbolname );
 
@@ -1441,7 +1441,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_marker.cpp b/eeschema/sch_marker.cpp
index ea6ba063b..bfa3fadeb 100644
--- a/eeschema/sch_marker.cpp
+++ b/eeschema/sch_marker.cpp
@@ -55,7 +55,7 @@ EDA_ITEM* SCH_MARKER::Clone() const
 
 void SCH_MARKER::SwapData( SCH_ITEM* aItem )
 {
-    std::swap( *((SCH_MARKER*) this), *((SCH_MARKER*) aItem ) );
+    std::swap( *this, *((SCH_MARKER*) aItem ) );
 }
 
 
diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h
index 37bd73989..c081a15f9 100644
--- a/eeschema/sch_sheet_path.h
+++ b/eeschema/sch_sheet_path.h
@@ -166,7 +166,7 @@ public:
         if( aIndex < size() )
             retv = at( aIndex );
 
-        return const_cast< SCH_SHEET* >( retv );
+        return retv;
     }
 
     SCH_SHEET* GetSheet( unsigned aIndex )
diff --git a/eeschema/toolbars_viewlib.cpp b/eeschema/toolbars_viewlib.cpp
index 74008d2a7..6c90429fd 100644
--- a/eeschema/toolbars_viewlib.cpp
+++ b/eeschema/toolbars_viewlib.cpp
@@ -42,7 +42,7 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
                                             wxDefaultPosition, wxDefaultSize,
                                             KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
 
-    ACTION_TOOLBAR* toolbar = static_cast<ACTION_TOOLBAR*>( m_mainToolBar );
+    ACTION_TOOLBAR* toolbar = m_mainToolBar;
     wxString msg;
 
     m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp
index 29a5a7e16..5df0d9d42 100644
--- a/eeschema/tools/ee_inspection_tool.cpp
+++ b/eeschema/tools/ee_inspection_tool.cpp
@@ -323,7 +323,7 @@ int EE_INSPECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
 
     if( selection.GetSize() == 1 )
     {
-        EDA_ITEM* item = (EDA_ITEM*) selection.Front();
+        EDA_ITEM* item = selection.Front();
 
         MSG_PANEL_ITEMS msgItems;
         item->GetMsgPanelInfo( m_frame->GetUserUnits(), msgItems );
diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp
index 4324387e9..9bb584d50 100644
--- a/eeschema/tools/ee_point_editor.cpp
+++ b/eeschema/tools/ee_point_editor.cpp
@@ -129,10 +129,10 @@ public:
             wxPoint    topLeft = sheet->GetPosition();
             wxPoint    botRight = sheet->GetPosition() + sheet->GetSize();
 
-            points->AddPoint( (wxPoint) topLeft );
+            points->AddPoint( topLeft );
             points->AddPoint( wxPoint( botRight.x, topLeft.y ) );
             points->AddPoint( wxPoint( topLeft.x, botRight.y ) );
-            points->AddPoint( (wxPoint) botRight );
+            points->AddPoint( botRight );
             break;
         }
         case SCH_BITMAP_T:
@@ -141,10 +141,10 @@ public:
             wxPoint     topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2;
             wxPoint     botRight = bitmap->GetPosition() + bitmap->GetSize() / 2;
 
-            points->AddPoint( (wxPoint) topLeft );
+            points->AddPoint( topLeft );
             points->AddPoint( wxPoint( botRight.x, topLeft.y ) );
             points->AddPoint( wxPoint( topLeft.x, botRight.y ) );
-            points->AddPoint( (wxPoint) botRight );
+            points->AddPoint( botRight );
             break;
         }
         case SCH_LINE_T:
@@ -283,7 +283,7 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
 
     KIGFX::VIEW_CONTROLS* controls = getViewControls();
     KIGFX::VIEW*          view = getView();
-    EDA_ITEM*             item = (EDA_ITEM*) selection.Front();
+    EDA_ITEM*             item = selection.Front();
 
     controls->ShowCursor( true );
 
diff --git a/eeschema/tools/ee_selection.cpp b/eeschema/tools/ee_selection.cpp
index 84f418afb..0b6f75b5a 100644
--- a/eeschema/tools/ee_selection.cpp
+++ b/eeschema/tools/ee_selection.cpp
@@ -54,5 +54,5 @@ EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const
         }
     }
 
-    return static_cast<EDA_ITEM*>( topLeftItem );
+    return topLeftItem;
 }
diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp
index 218a0e453..a56d16492 100644
--- a/eeschema/tools/ee_selection_tool.cpp
+++ b/eeschema/tools/ee_selection_tool.cpp
@@ -1127,7 +1127,7 @@ void EE_SELECTION_TOOL::ClearSelection()
         return;
 
     while( m_selection.GetSize() )
-        unhighlight( (EDA_ITEM*) m_selection.Front(), SELECTED, &m_selection );
+        unhighlight( m_selection.Front(), SELECTED, &m_selection );
 
     getView()->Update( &m_selection );
 
diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp
index 8eae01a6e..f038708e4 100644
--- a/eeschema/tools/lib_edit_tool.cpp
+++ b/eeschema/tools/lib_edit_tool.cpp
@@ -295,7 +295,7 @@ int LIB_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
     // Deactivate other tools; particularly important if another PICKER is currently running
     Activate();
 
-    picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
+    picker->SetCursor( wxCURSOR_BULLSEYE );
 
     picker->SetClickHandler(
         [this] ( const VECTOR2D& aPosition ) -> bool
diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp
index e2945d54a..3850fd0d7 100644
--- a/eeschema/tools/sch_drawing_tools.cpp
+++ b/eeschema/tools/sch_drawing_tools.cpp
@@ -491,7 +491,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
         }
         else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
         {
-            previewItem->SetPosition( (wxPoint)cursorPos );
+            previewItem->SetPosition( cursorPos );
             m_view->ClearPreview();
             m_view->AddToPreview( previewItem->Clone() );
         }
@@ -781,12 +781,12 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
             getViewControls()->SetAutoPan( false );
             getViewControls()->CaptureCursor( false );
 
-            if( m_frame->EditSheet( (SCH_SHEET*)sheet, g_CurrentSheet, nullptr ) )
+            if( m_frame->EditSheet( sheet, g_CurrentSheet, nullptr ) )
             {
                 m_frame->AddItemToScreenAndUndoList( sheet );
                 m_selectionTool->AddItemToSel( sheet );
             }
-            else 
+            else
             {
                 delete sheet;
             }
diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp
index c31fade11..81d4ad64a 100644
--- a/eeschema/tools/sch_edit_tool.cpp
+++ b/eeschema/tools/sch_edit_tool.cpp
@@ -180,7 +180,7 @@ bool SCH_EDIT_TOOL::Init()
         if( aSel.GetSize() != 1 )
             return false;
 
-        switch( static_cast<EDA_ITEM*>( aSel.Front() )->Type() )
+        switch( aSel.Front()->Type() )
         {
         case SCH_MARKER_T:
         case SCH_JUNCTION_T:
@@ -966,7 +966,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
     // Deactivate other tools; particularly important if another PICKER is currently running
     Activate();
 
-    picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
+    picker->SetCursor( wxCURSOR_BULLSEYE );
 
     picker->SetClickHandler(
         [this] ( const VECTOR2D& aPosition ) -> bool
diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp
index cc2ef8833..83316ebd6 100644
--- a/eeschema/tools/sch_editor_control.cpp
+++ b/eeschema/tools/sch_editor_control.cpp
@@ -778,7 +778,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
     // Deactivate other tools; particularly important if another PICKER is currently running
     Activate();
 
-    picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
+    picker->SetCursor( wxCURSOR_BULLSEYE );
 
     picker->SetClickHandler(
         [this] ( const VECTOR2D& aPos )
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 82380b261..d13108089 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -1222,7 +1222,7 @@ void GERBVIEW_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/gerbview/tools/gerbview_control.cpp b/gerbview/tools/gerbview_control.cpp
index 2abb72777..26baece94 100644
--- a/gerbview/tools/gerbview_control.cpp
+++ b/gerbview/tools/gerbview_control.cpp
@@ -170,7 +170,7 @@ int GERBVIEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
 
     if( selection.GetSize() == 1 )
     {
-        EDA_ITEM* item = (EDA_ITEM*) selection.Front();
+        EDA_ITEM* item = selection.Front();
 
         MSG_PANEL_ITEMS msgItems;
         item->GetMsgPanelInfo( m_frame->GetUserUnits(), msgItems );
diff --git a/gerbview/tools/gerbview_selection_tool.cpp b/gerbview/tools/gerbview_selection_tool.cpp
index d2a5d00e6..885ed1441 100644
--- a/gerbview/tools/gerbview_selection_tool.cpp
+++ b/gerbview/tools/gerbview_selection_tool.cpp
@@ -408,7 +408,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 05bd5968a..e89dce821 100644
--- a/include/gal/graphics_abstraction_layer.h
+++ b/include/gal/graphics_abstraction_layer.h
@@ -955,7 +955,7 @@ public:
      */
     inline VECTOR2D ToWorld( const VECTOR2D& aPoint ) const
     {
-        return VECTOR2D( screenWorldMatrix * aPoint );
+        return screenWorldMatrix * aPoint;
     }
 
     /**
@@ -966,7 +966,7 @@ public:
      */
     inline VECTOR2D ToScreen( const VECTOR2D& aPoint ) const
     {
-        return VECTOR2D( worldScreenMatrix * aPoint );
+        return worldScreenMatrix * aPoint;
     }
 
     /**
diff --git a/include/gal/opengl/shader.h b/include/gal/opengl/shader.h
index 819afd49c..f271ea7d6 100644
--- a/include/gal/opengl/shader.h
+++ b/include/gal/opengl/shader.h
@@ -208,7 +208,7 @@ private:
     /**
      * @brief Compile vertex of fragment shader source code into the program.
      */
-    bool loadShaderFromStringArray( SHADER_TYPE aShaderType, const char** aArray,
+    bool loadShaderFromStringArray( SHADER_TYPE aShaderType, const GLchar** aArray,
                                     size_t aSize );
 
     /**
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/pl_editor.cpp b/pagelayout_editor/pl_editor.cpp
index fb4f66848..185e99bc1 100644
--- a/pagelayout_editor/pl_editor.cpp
+++ b/pagelayout_editor/pl_editor.cpp
@@ -101,7 +101,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 3479ffe2e..327251f81 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -578,7 +578,7 @@ void PL_EDITOR_FRAME::DisplayGridMsg()
 
 void PL_EDITOR_FRAME::UpdateStatusBar()
 {
-    PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
+    PL_EDITOR_SCREEN* screen = GetScreen();
 
     if( !screen )
         return;
diff --git a/pagelayout_editor/tools/pl_edit_tool.cpp b/pagelayout_editor/tools/pl_edit_tool.cpp
index ecf951bbc..f6f945567 100644
--- a/pagelayout_editor/tools/pl_edit_tool.cpp
+++ b/pagelayout_editor/tools/pl_edit_tool.cpp
@@ -347,7 +347,7 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
     // Deactivate other tools; particularly important if another PICKER is currently running
     Activate();
 
-    picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
+    picker->SetCursor( wxCURSOR_BULLSEYE );
     m_pickerItem = nullptr;
 
     picker->SetClickHandler(
diff --git a/pagelayout_editor/tools/pl_editor_control.cpp b/pagelayout_editor/tools/pl_editor_control.cpp
index e9d99bbfa..8d4720f7c 100644
--- a/pagelayout_editor/tools/pl_editor_control.cpp
+++ b/pagelayout_editor/tools/pl_editor_control.cpp
@@ -147,7 +147,7 @@ int PL_EDITOR_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
 
     if( selection.GetSize() == 1 )
     {
-        EDA_ITEM* item = (EDA_ITEM*) selection.Front();
+        EDA_ITEM* item = selection.Front();
 
         MSG_PANEL_ITEMS msgItems;
         item->GetMsgPanelInfo( m_frame->GetUserUnits(), msgItems );
diff --git a/pagelayout_editor/tools/pl_point_editor.cpp b/pagelayout_editor/tools/pl_point_editor.cpp
index 8ce865f11..1eeb900f6 100644
--- a/pagelayout_editor/tools/pl_point_editor.cpp
+++ b/pagelayout_editor/tools/pl_point_editor.cpp
@@ -168,7 +168,7 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
 
     KIGFX::VIEW_CONTROLS* controls = getViewControls();
     KIGFX::VIEW*          view = getView();
-    EDA_ITEM*             item = (EDA_ITEM*) selection.Front();
+    EDA_ITEM*             item = selection.Front();
 
     controls->ShowCursor( true );
 
diff --git a/pagelayout_editor/tools/pl_selection_tool.cpp b/pagelayout_editor/tools/pl_selection_tool.cpp
index f9a6acbd3..15c351177 100644
--- a/pagelayout_editor/tools/pl_selection_tool.cpp
+++ b/pagelayout_editor/tools/pl_selection_tool.cpp
@@ -617,7 +617,7 @@ void PL_SELECTION_TOOL::ClearSelection()
         return;
 
     while( m_selection.GetSize() )
-        unhighlight( (EDA_ITEM*) m_selection.Front(), SELECTED, &m_selection );
+        unhighlight( m_selection.Front(), SELECTED, &m_selection );
 
     getView()->Update( &m_selection );
 
diff --git a/pcb_calculator/pcb_calculator.cpp b/pcb_calculator/pcb_calculator.cpp
index 548c9801c..977b8059d 100644
--- a/pcb_calculator/pcb_calculator.cpp
+++ b/pcb_calculator/pcb_calculator.cpp
@@ -89,7 +89,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/board_stackup_manager/class_board_stackup.cpp b/pcbnew/board_stackup_manager/class_board_stackup.cpp
index 4f6c36170..f45845b40 100644
--- a/pcbnew/board_stackup_manager/class_board_stackup.cpp
+++ b/pcbnew/board_stackup_manager/class_board_stackup.cpp
@@ -478,10 +478,10 @@ void BOARD_STACKUP::FormatBoardStackup( OUTPUTFORMATTER* aFormatter,
         {
             if( item->m_Type == BS_ITEM_TYPE_DIELECTRIC && item->m_ThicknessLocked )
                 aFormatter->Print( 0, " (thickness %s locked)",
-                                   FormatInternalUnits( (int)item->m_Thickness ).c_str() );
+                                   FormatInternalUnits( item->m_Thickness ).c_str() );
             else
                 aFormatter->Print( 0, " (thickness %s)",
-                                   FormatInternalUnits( (int)item->m_Thickness ).c_str() );
+                                   FormatInternalUnits( item->m_Thickness ).c_str() );
         }
 
         if( item->m_Type == BS_ITEM_TYPE_DIELECTRIC )
diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp
index 04dc0a6c1..0272ecd0e 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -1447,10 +1447,8 @@ std::tuple<int, double, double> BOARD::GetTrackLength( const TRACK& aTrack ) con
         {
             bool inPad = false;
 
-            for( auto pad_it : connectivity->GetConnectedPads( item ) )
+            for( auto pad : connectivity->GetConnectedPads( item ) )
             {
-                auto pad = static_cast<D_PAD*>( pad_it );
-
                 if( pad->HitTest( track->GetStart(), track->GetWidth() / 2 )
                         && pad->HitTest( track->GetEnd(), track->GetWidth() / 2 ) )
                 {
diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp
index 6365cf02e..20ce49bef 100644
--- a/pcbnew/class_dimension.cpp
+++ b/pcbnew/class_dimension.cpp
@@ -514,5 +514,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 1ae08dd21..6a1283630 100644
--- a/pcbnew/class_drawsegment.cpp
+++ b/pcbnew/class_drawsegment.cpp
@@ -807,7 +807,7 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
                 wxPoint vertexNext = m_BezierPoints[ii];
 
                 // Test if the point is within aRect
-                if( arect.Contains( ( wxPoint ) vertex ) )
+                if( arect.Contains( vertex ) )
                     return true;
 
                 // Test if this edge intersects aRect
@@ -997,5 +997,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_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp
index 8e13aa793..4b22adbd7 100644
--- a/pcbnew/class_marker_pcb.cpp
+++ b/pcbnew/class_marker_pcb.cpp
@@ -146,11 +146,11 @@ const EDA_RECT MARKER_PCB::GetBoundingBox() const
     EDA_RECT bbox = m_ShapeBoundingBox;
 
     wxPoint pos = m_Pos;
-    pos.x += int( bbox.GetOrigin().x * MarkerScale() );
-    pos.y += int( bbox.GetOrigin().y * MarkerScale() );
+    pos.x += bbox.GetOrigin().x * MarkerScale();
+    pos.y += bbox.GetOrigin().y * MarkerScale();
 
-    return EDA_RECT( pos, wxSize( int( bbox.GetWidth() * MarkerScale() ),
-                                  int( bbox.GetHeight() * MarkerScale() ) ) );
+    return EDA_RECT( pos, wxSize( bbox.GetWidth() * MarkerScale(),
+                                  bbox.GetHeight() * MarkerScale() ) );
 }
 
 
diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp
index ae7066316..0415f2e70 100644
--- a/pcbnew/class_module.cpp
+++ b/pcbnew/class_module.cpp
@@ -820,7 +820,7 @@ void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction )
             aFunction( static_cast<BOARD_ITEM*>( pad ) );
 
         for( auto drawing : m_drawings )
-            aFunction( static_cast<BOARD_ITEM*>( drawing ) );
+            aFunction( drawing );
 
         aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
         aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
@@ -1397,5 +1397,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 c5d426580..fd5628023 100644
--- a/pcbnew/class_module.h
+++ b/pcbnew/class_module.h
@@ -491,7 +491,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
@@ -505,7 +505,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 9551276c6..a3d0293a7 100644
--- a/pcbnew/class_pcb_target.cpp
+++ b/pcbnew/class_pcb_target.cpp
@@ -204,6 +204,6 @@ 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 16fb77fd1..1c2be2717 100644
--- a/pcbnew/class_pcb_text.cpp
+++ b/pcbnew/class_pcb_text.cpp
@@ -179,5 +179,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 09c82a2d0..1fbdf2a53 100644
--- a/pcbnew/class_track.cpp
+++ b/pcbnew/class_track.cpp
@@ -1036,14 +1036,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_zone.cpp b/pcbnew/class_zone.cpp
index ee9151143..e014ba7f9 100644
--- a/pcbnew/class_zone.cpp
+++ b/pcbnew/class_zone.cpp
@@ -1160,7 +1160,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) );
 }
 
 
diff --git a/pcbnew/connectivity/connectivity_algo.cpp b/pcbnew/connectivity/connectivity_algo.cpp
index ed77ef81c..e479da669 100644
--- a/pcbnew/connectivity/connectivity_algo.cpp
+++ b/pcbnew/connectivity/connectivity_algo.cpp
@@ -603,14 +603,12 @@ void CN_VISITOR::checkZoneItemConnection( CN_ZONE* aZone, CN_ITEM* aItem )
     if( !aZone->Parent()->GetBoundingBox().Intersects( aItem->Parent()->GetBoundingBox() ) )
         return;
 
-    auto zoneItem = static_cast<CN_ZONE*> ( aZone );
-
     for( int i = 0; i < aItem->AnchorCount(); ++i )
     {
-        if( zoneItem->ContainsPoint( aItem->GetAnchor( i ) ) )
+        if( aZone->ContainsPoint( aItem->GetAnchor( i ) ) )
         {
-            zoneItem->Connect( aItem );
-            aItem->Connect( zoneItem );
+            aZone->Connect( aItem );
+            aItem->Connect( aZone );
             return;
         }
     }
diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp
index 55083a6d9..78e8e68d5 100644
--- a/pcbnew/convert_drawsegment_list_to_polygon.cpp
+++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp
@@ -203,7 +203,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
 
     for( size_t i = 0; i < segList.size(); i++ )
     {
-        graphic = (DRAWSEGMENT*) segList[i];
+        graphic = segList[i];
 
         switch( graphic->GetShape() )
         {
@@ -316,7 +316,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];
+    graphic = segList[xmini];
 
     // The first DRAWSEGMENT is in 'graphic', ok to remove it from 'items'
     segList.erase( segList.begin() + xmini );
diff --git a/pcbnew/dialogs/dialog_create_array.cpp b/pcbnew/dialogs/dialog_create_array.cpp
index e7c9c3df2..635da1035 100644
--- a/pcbnew/dialogs/dialog_create_array.cpp
+++ b/pcbnew/dialogs/dialog_create_array.cpp
@@ -490,5 +490,5 @@ void DIALOG_CREATE_ARRAY::calculateCircularArrayProperties()
     // Find the radius, etc of the circle
     centre -= m_originalItemPosition;
 
-    m_circRadius.SetValue( int( centre.EuclideanNorm() ) );
-}
\ No newline at end of file
+    m_circRadius.SetValue( centre.EuclideanNorm() );
+}
diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp
index 6cb69a34a..f150cb83d 100644
--- a/pcbnew/exporters/export_gencad.cpp
+++ b/pcbnew/exporters/export_gencad.cpp
@@ -436,10 +436,8 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
 
     // Emit vias pads
 
-    for( auto item : vias )
+    for( auto via : vias )
     {
-        VIA* via = static_cast<VIA*>( item );
-
         viastacks.push_back( via );
         fprintf( aFile, "PAD V%d.%d.%s ROUND %g\nCIRCLE 0 0 %g\n",
                 via->GetWidth(), via->GetDrillValue(),
diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp
index 875905c56..319148965 100644
--- a/pcbnew/files.cpp
+++ b/pcbnew/files.cpp
@@ -890,7 +890,7 @@ bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
 
                 wxString result( newLibPath );
                 rel_path =  result.Replace( env_path,
-                                            wxString( "$(" + project_env + ")" ) ) ? result : "" ;
+                                            "$(" + project_env + ")" ) ? result : "" ;
 
                 if( !rel_path.IsEmpty() )
                     newLibPath = rel_path;
diff --git a/pcbnew/footprint_info_impl.cpp b/pcbnew/footprint_info_impl.cpp
index 89f3fa6be..9125b73e1 100644
--- a/pcbnew/footprint_info_impl.cpp
+++ b/pcbnew/footprint_info_impl.cpp
@@ -296,7 +296,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/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp
index bdb376229..4279c547d 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 ) )
     {
         // In .brd files, the layers are numbered from back to front
         // (the opposite of the .kicad_pcb files)
diff --git a/pcbnew/pad_print_functions.cpp b/pcbnew/pad_print_functions.cpp
index 673098ccd..a1837ea73 100644
--- a/pcbnew/pad_print_functions.cpp
+++ b/pcbnew/pad_print_functions.cpp
@@ -536,7 +536,7 @@ void D_PAD::PrintShape( 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 ec9c4c072..93b163ce4 100644
--- a/pcbnew/pcb_base_frame.cpp
+++ b/pcbnew/pcb_base_frame.cpp
@@ -88,7 +88,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
     m_Pcb( nullptr ),
     m_configSettings( aFrameType )
 {
-    m_UserGridSize        = wxPoint( (int) 10 * IU_PER_MILS, (int) 10 * IU_PER_MILS );
+    m_UserGridSize        = wxPoint( 10 * IU_PER_MILS, 10 * IU_PER_MILS );
 
     m_FastGrid1           = 0;
     m_FastGrid2           = 0;
@@ -455,7 +455,7 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
     if( GetCanvas() )
     {
         // Apply new display options to the GAL canvas
-        auto view = static_cast<KIGFX::PCB_VIEW*>( GetCanvas()->GetView() );
+        auto view = GetCanvas()->GetView();
         view->UpdateDisplayOptions( displ_opts );
 
         // Update pads
@@ -487,7 +487,7 @@ void PCB_BASE_FRAME::OnToggleEdgeDrawMode( wxCommandEvent& aEvent )
     if( GetCanvas() )
     {
         // Apply new display options to the GAL canvas
-        auto view = static_cast<KIGFX::PCB_VIEW*>( GetCanvas()->GetView() );
+        auto view = GetCanvas()->GetView();
         view->UpdateDisplayOptions( displ_opts );
         view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
     }
@@ -504,7 +504,7 @@ void PCB_BASE_FRAME::OnToggleTextDrawMode( wxCommandEvent& aEvent )
     if( GetCanvas() )
     {
         // Apply new display options to the canvas
-        auto view = static_cast<KIGFX::PCB_VIEW*>( GetCanvas()->GetView() );
+        auto view = GetCanvas()->GetView();
         view->UpdateDisplayOptions( displ_opts );
         view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
     }
@@ -816,7 +816,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 2803624dc..d019e69d5 100644
--- a/pcbnew/pcb_draw_panel_gal.cpp
+++ b/pcbnew/pcb_draw_panel_gal.cpp
@@ -166,7 +166,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
         m_worksheet->SetFileName( TO_UTF8( aBoard->GetFileName() ) );
 
     // 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 70295a94c..fbc2046d7 100644
--- a/pcbnew/pcb_view.cpp
+++ b/pcbnew/pcb_view.cpp
@@ -113,7 +113,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, settings->GetShowPageLimits() );
 }
diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp
index ed46a72aa..98ecb7b6a 100644
--- a/pcbnew/plot_board_layers.cpp
+++ b/pcbnew/plot_board_layers.cpp
@@ -1042,8 +1042,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
     case PLOT_FORMAT_DXF:
         DXF_PLOTTER* DXF_plotter;
         DXF_plotter = new DXF_PLOTTER();
-        DXF_plotter->SetUnits(
-                static_cast<DXF_PLOTTER::DXF_UNITS>( aPlotOpts->GetDXFPlotUnits() ) );
+        DXF_plotter->SetUnits( aPlotOpts->GetDXFPlotUnits() );
 
         plotter = DXF_plotter;
         break;
diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp
index 4e0f82c85..1cd03d0fd 100644
--- a/pcbnew/plot_brditems_plotter.cpp
+++ b/pcbnew/plot_brditems_plotter.cpp
@@ -783,7 +783,7 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
                 // ( for the future or to show a non expected shape )
                 // This must be simplified and fractured to prevent overlapping polygons
                 // from generating invalid Gerber files
-                auto tmpPoly = SHAPE_POLY_SET( aSeg->GetPolyShape() );
+                auto tmpPoly = aSeg->GetPolyShape();
                 tmpPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
 
                 for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp
index ebdf86136..a49bd0e7c 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_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index 85e6a5d7c..d42de8fc5 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -959,7 +959,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 3e06c9c98..bd058bb49 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/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 31be70fcf..77d5c9dc0 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/drc.cpp b/pcbnew/tools/drc.cpp
index c6516994e..4765d7ede 100644
--- a/pcbnew/tools/drc.cpp
+++ b/pcbnew/tools/drc.cpp
@@ -979,7 +979,7 @@ void DRC::testCopperDrawItem( 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/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp
index a54848741..1fd848f65 100644
--- a/pcbnew/tools/edit_tool.cpp
+++ b/pcbnew/tools/edit_tool.cpp
@@ -1076,7 +1076,7 @@ void EDIT_TOOL::PadFilter( 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_PAD_T )
             aCollector.Remove( i );
@@ -1088,7 +1088,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/pcb_tool_base.cpp b/pcbnew/tools/pcb_tool_base.cpp
index f86f9cf70..fb251fcb4 100644
--- a/pcbnew/tools/pcb_tool_base.cpp
+++ b/pcbnew/tools/pcb_tool_base.cpp
@@ -250,7 +250,7 @@ PCB_DISPLAY_OPTIONS* PCB_TOOL_BASE::displayOptions() const
 
 PCB_DRAW_PANEL_GAL* PCB_TOOL_BASE::canvas() const
 {
-    return static_cast<PCB_DRAW_PANEL_GAL*>( frame()->GetCanvas() );
+    return frame()->GetCanvas();
 }
 
 
diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp
index b384be540..78d0e8173 100644
--- a/pcbnew/tools/pcbnew_control.cpp
+++ b/pcbnew/tools/pcbnew_control.cpp
@@ -399,7 +399,7 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
         view->UpdateLayerColor( currentLayer );
 
         wxUpdateUIEvent dummy;
-        static_cast<PCB_BASE_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
+        m_frame->OnUpdateLayerAlpha( dummy );
     }
     else
         wxBell();
@@ -497,7 +497,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
     // Deactivate other tools; particularly important if another PICKER is currently running
     Activate();
 
-    picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
+    picker->SetCursor( wxCURSOR_BULLSEYE );
 
     picker->SetClickHandler(
         [this] ( const VECTOR2D& aPosition ) -> bool
@@ -930,7 +930,7 @@ int PCBNEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
 
     if( selection.GetSize() == 1 )
     {
-        EDA_ITEM*       item = (EDA_ITEM*) selection.Front();
+        EDA_ITEM*       item = selection.Front();
         MSG_PANEL_ITEMS msgItems;
 
         item->GetMsgPanelInfo( m_frame->GetUserUnits(), msgItems );
diff --git a/pcbnew/tools/pcbnew_picker_tool.cpp b/pcbnew/tools/pcbnew_picker_tool.cpp
index 30b1a7ffd..90b55e6ba 100644
--- a/pcbnew/tools/pcbnew_picker_tool.cpp
+++ b/pcbnew/tools/pcbnew_picker_tool.cpp
@@ -169,7 +169,7 @@ void PCBNEW_PICKER_TOOL::setTransitions()
 void PCBNEW_PICKER_TOOL::reset()
 {
     m_layerMask = LSET::AllLayersMask();
-    m_cursor = wxStockCursor( wxCURSOR_ARROW );
+    m_cursor = wxCURSOR_ARROW;
 
     m_picked = NULLOPT;
     m_clickHandler = NULLOPT;
diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp
index 1f6af0e5b..585e9f099 100644
--- a/pcbnew/undo_redo.cpp
+++ b/pcbnew/undo_redo.cpp
@@ -135,7 +135,7 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
     // Append drawings
     for( auto item : aPcb->Drawings() )
     {
-        if( aItem == static_cast<BOARD_ITEM*>( item ) )
+        if( aItem == item )
             return true;
     }
 
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 76fa5cfbe..fc9cb8f67 100644
--- a/polygon/clipper.cpp
+++ b/polygon/clipper.cpp
@@ -5222,7 +5222,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 )
         {
@@ -5268,11 +5268,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
@@ -5301,11 +5301,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/qa/libs/sexpr/test_sexpr_parser.cpp b/qa/libs/sexpr/test_sexpr_parser.cpp
index bae4b5e16..ec8190128 100644
--- a/qa/libs/sexpr/test_sexpr_parser.cpp
+++ b/qa/libs/sexpr/test_sexpr_parser.cpp
@@ -41,7 +41,7 @@ public:
      */
     std::unique_ptr<SEXPR::SEXPR> Parse( const std::string& aIn )
     {
-        return std::unique_ptr<SEXPR::SEXPR>( m_parser.Parse( aIn ) );
+        return m_parser.Parse( aIn );
     }
 
     SEXPR::PARSER m_parser;
@@ -237,4 +237,4 @@ BOOST_AUTO_TEST_CASE( StringRoundtrip )
     }
 }
 
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END()
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