From 72eff0941e6dc95cdc3ff059178bd15aa582b319 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 23 Jun 2017 19:22:44 +0200 Subject: [PATCH] Code formatting and warning fixes --- pcbnew/class_board.cpp | 16 +++++++++++----- pcbnew/connectivity.cpp | 4 ++-- pcbnew/connectivity_algo.cpp | 2 +- pcbnew/connectivity_algo.h | 4 ++-- pcbnew/edit.cpp | 2 +- pcbnew/ratsnest_data.cpp | 8 ++++---- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 9958aa8ab2..141cdaa2cb 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -750,19 +750,24 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID LAYER_aPCB, bool isEnabled ) switch( LAYER_aPCB ) { case LAYER_RATSNEST: - { + { bool visible = IsElementVisible( LAYER_RATSNEST ); // we must clear or set the CH_VISIBLE flags to hide/show ratsnest // because we have a tool to show/hide ratsnest relative to a pad or a module // so the hide/show option is a per item selection - for ( int net = 1; net < GetNetCount(); net++ ) + for( unsigned int net = 1; net < GetNetCount(); net++ ) GetConnectivity()->GetRatsnestForNet( net )->SetVisible( visible ); - for ( auto track : Tracks() ) + + for( auto track : Tracks() ) track->SetLocalRatsnestVisible( isEnabled ); + for( auto mod : Modules() ) - for ( auto pad : mod->Pads() ) + { + for( auto pad : mod->Pads() ) pad->SetLocalRatsnestVisible( isEnabled ); + } + for( int i = 0; iGetNodeCount(); } - else if( aNet < m_nets.size() ) + else if( aNet < (int) m_nets.size() ) { sum = m_nets[aNet]->GetNodeCount(); } diff --git a/pcbnew/connectivity_algo.cpp b/pcbnew/connectivity_algo.cpp index fafb1d99e1..dbf74a7a5b 100644 --- a/pcbnew/connectivity_algo.cpp +++ b/pcbnew/connectivity_algo.cpp @@ -831,7 +831,7 @@ void CN_CONNECTIVITY_ALGO::markNetAsDirty( int aNet ) if( aNet <= 0 ) return; - if(m_dirtyNets.size() <= aNet ) + if( (int) m_dirtyNets.size() <= aNet ) m_dirtyNets.resize( aNet + 1 ); m_dirtyNets[aNet] = true; diff --git a/pcbnew/connectivity_algo.h b/pcbnew/connectivity_algo.h index 505b52e7c9..a2a526803a 100644 --- a/pcbnew/connectivity_algo.h +++ b/pcbnew/connectivity_algo.h @@ -574,8 +574,8 @@ public: return m_cachedPoly->BBox(); } - virtual int AnchorCount() const; - virtual const VECTOR2I GetAnchor( int n ) const; + virtual int AnchorCount() const override; + virtual const VECTOR2I GetAnchor( int n ) const override; private: std::vector m_testOutlinePoints; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 0b3ed18461..7993142687 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1451,8 +1451,8 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) ); else SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) ); - Compile_Ratsnest( &dc, true ); + Compile_Ratsnest( &dc, true ); break; case ID_PCB_MODULE_BUTT: diff --git a/pcbnew/ratsnest_data.cpp b/pcbnew/ratsnest_data.cpp index 119e6aceb6..3fa53c21fd 100644 --- a/pcbnew/ratsnest_data.cpp +++ b/pcbnew/ratsnest_data.cpp @@ -248,7 +248,7 @@ public: mstEdges.emplace_back( src, dst, getDistance( src, dst ) ); } - for( int i = 0; i < anchorChains.size(); i++ ) + for( unsigned int i = 0; i < anchorChains.size(); i++ ) { auto& chain = anchorChains[i]; @@ -260,7 +260,7 @@ public: return a->GetCluster().get() < b->GetCluster().get(); } ); - for( auto j = 1; j < chain.size(); j++ ) + for( unsigned int j = 1; j < chain.size(); j++ ) { const auto& prevNode = chain[j - 1]; const auto& curNode = chain[j]; @@ -368,7 +368,7 @@ void RN_NET::AddCluster( CN_CLUSTER_PTR aCluster ) { bool isZone = dynamic_cast(item) != nullptr; auto& anchors = item->Anchors(); - int nAnchors = isZone ? 1 : anchors.size(); + unsigned int nAnchors = isZone ? 1 : anchors.size(); if( nAnchors > anchors.size() ) nAnchors = anchors.size(); @@ -376,7 +376,7 @@ void RN_NET::AddCluster( CN_CLUSTER_PTR aCluster ) //printf("item %p anchors : %d\n", item, anchors.size() ); //printf("add item %p anchors : %d net : %d\n", item, item->Anchors().size(), item->Parent()->GetNetCode() ); - for( int i = 0; i < nAnchors; i++ ) + for( unsigned int i = 0; i < nAnchors; i++ ) { // printf("add anchor %p\n", anchors[i].get() );