diff --git a/common/eda_doc.cpp b/common/eda_doc.cpp index cdc3e8d851..d1f0f89e9a 100644 --- a/common/eda_doc.cpp +++ b/common/eda_doc.cpp @@ -90,7 +90,8 @@ bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT #endif // Is an internet url - static const wxChar* url_header[] = { + static const std::vector url_header = + { wxT( "http:" ), wxT( "https:" ), wxT( "ftp:" ), @@ -103,7 +104,7 @@ bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT for( const wxString& proc : url_header) { - if( docname.First( proc ) == 0 ) // looks like an internet url + if( docname.StartsWith( proc ) ) // looks like an internet url { wxURI uri( docname ); wxLaunchDefaultBrowser( uri.BuildURI() ); diff --git a/libs/kimath/src/geometry/shape_collisions.cpp b/libs/kimath/src/geometry/shape_collisions.cpp index eb9c7fa60d..3cac31016e 100644 --- a/libs/kimath/src/geometry/shape_collisions.cpp +++ b/libs/kimath/src/geometry/shape_collisions.cpp @@ -184,7 +184,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_LINE_CHAIN_BASE& } else { - for( int s = 0; s < aB.GetSegmentCount(); s++ ) + for( size_t s = 0; s < aB.GetSegmentCount(); s++ ) { int collision_dist = 0; VECTOR2I pn; @@ -222,7 +222,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_LINE_CHAIN_BASE& SHAPE_CIRCLE cmoved( aA ); VECTOR2I f_total( 0, 0 ); - for( int s = 0; s < aB.GetSegmentCount(); s++ ) + for( size_t s = 0; s < aB.GetSegmentCount(); s++ ) { VECTOR2I f = pushoutForce( cmoved, aB.GetSegment( s ), aClearance ); cmoved.SetCenter( cmoved.GetCenter() + f ); @@ -272,7 +272,7 @@ static inline bool Collide( const SHAPE_LINE_CHAIN_BASE& aA, const SHAPE_LINE_CH } else { - for( int i = 0; i < aB.GetSegmentCount(); i++ ) + for( size_t i = 0; i < aB.GetSegmentCount(); i++ ) { int collision_dist = 0; VECTOR2I pn; @@ -327,7 +327,7 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_LINE_CHAIN_BASE& a } else { - for( int s = 0; s < aB.GetSegmentCount(); s++ ) + for( size_t s = 0; s < aB.GetSegmentCount(); s++ ) { int collision_dist = 0; VECTOR2I pn; @@ -501,7 +501,7 @@ static bool collideSingleShapes( const SHAPE* aA, const SHAPE* aB, int aClearanc { switch( aA->Type() ) { - case SH_NULL: + case SH_NULL: return false; case SH_RECT: @@ -555,7 +555,7 @@ static bool collideSingleShapes( const SHAPE* aA, const SHAPE* aB, int aClearanc case SH_ARC: return CollCaseReversed( aA, aB, aClearance, aActual, aLocation, aMTV ); - + case SH_NULL: return false; @@ -805,7 +805,7 @@ static bool collideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, int { return collideSingleShapes( aA, aB, aClearance, aActual, aLocation, aMTV ); } - + if( colliding ) { if( aLocation ) diff --git a/libs/kimath/src/geometry/shape_compound.cpp b/libs/kimath/src/geometry/shape_compound.cpp index a3f128aeae..1bf6bb198c 100644 --- a/libs/kimath/src/geometry/shape_compound.cpp +++ b/libs/kimath/src/geometry/shape_compound.cpp @@ -82,7 +82,7 @@ const BOX2I SHAPE_COMPOUND::BBox( int aClearance ) const bb = m_shapes[0]->BBox(); - for( int i = 1; i < m_shapes.size(); i++ ) + for( size_t i = 1; i < m_shapes.size(); i++ ) bb.Merge( m_shapes[i]->BBox() ); return bb; diff --git a/libs/kimath/src/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp index f4288b52b1..949f4ede0c 100644 --- a/libs/kimath/src/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -103,7 +103,7 @@ bool SHAPE_LINE_CHAIN_BASE::Collide( const VECTOR2I& aP, int aClearance, int* aA SEG::ecoord clearance_sq = SEG::Square( aClearance ); VECTOR2I nearest; - for( int i = 0; i < GetSegmentCount(); i++ ) + for( size_t i = 0; i < GetSegmentCount(); i++ ) { const SEG& s = GetSegment( i ); VECTOR2I pn = s.NearestPoint( aP ); @@ -170,7 +170,7 @@ bool SHAPE_LINE_CHAIN_BASE::Collide( const SEG& aSeg, int aClearance, int* aActu SEG::ecoord clearance_sq = SEG::Square( aClearance ); VECTOR2I nearest; - for( int i = 0; i < GetSegmentCount(); i++ ) + for( size_t i = 0; i < GetSegmentCount(); i++ ) { const SEG& s = GetSegment( i ); SEG::ecoord dist_sq =s.SquaredDistance( aSeg ); @@ -354,7 +354,7 @@ SEG::ecoord SHAPE_LINE_CHAIN_BASE::SquaredDistance( const VECTOR2I& aP, bool aOu if( IsClosed() && PointInside( aP ) && !aOutlineOnly ) return 0; - for( int s = 0; s < GetSegmentCount(); s++ ) + for( size_t s = 0; s < GetSegmentCount(); s++ ) d = std::min( d, GetSegment( s ).SquaredDistance( aP ) ); return d; @@ -726,7 +726,7 @@ int SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint( const VECTOR2I& aPt, int aAccura return ( hypot( dist.x, dist.y ) <= aAccuracy + 1 ) ? 0 : -1; } - for( int i = 0; i < GetSegmentCount(); i++ ) + for( size_t i = 0; i < GetSegmentCount(); i++ ) { const SEG s = GetSegment( i ); diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp index 48077d55a2..e629d72625 100644 --- a/libs/kimath/src/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -2251,7 +2251,6 @@ void SHAPE_POLY_SET:: GetIndexableSubshapes( std::vector& aSubshapes ) { for ( auto& tri : tpoly->Triangles() ) { - SHAPE *s = static_cast ( &tri ); aSubshapes.push_back( &tri ); } } diff --git a/pcbnew/dialogs/dialog_print_pcbnew.cpp b/pcbnew/dialogs/dialog_print_pcbnew.cpp index 0ec0bea2e1..f8496baef8 100644 --- a/pcbnew/dialogs/dialog_print_pcbnew.cpp +++ b/pcbnew/dialogs/dialog_print_pcbnew.cpp @@ -428,11 +428,7 @@ void DIALOG_PRINT_PCBNEW::saveSettings() } else { - // This should always work, but in case it doesn't we fall back on default colors - if( PCB_BASE_EDIT_FRAME* pcbframe = dynamic_cast( m_parent ) ) - settings()->m_colorSettings = pcbframe->GetColorSettings(); - else - settings()->m_colorSettings = m_parent->GetColorSettings(); + settings()->m_colorSettings = m_parent->GetColorSettings(); } DIALOG_PRINT_GENERIC::saveSettings(); diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index fbb2db4d6f..4ac412c03d 100644 --- a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp +++ b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp @@ -131,45 +131,56 @@ static bool commonParallelProjection( SEG p, SEG n, SEG &pClip, SEG& nClip ) struct DIFF_PAIR_KEY +{ + bool operator<( const DIFF_PAIR_KEY& b ) const { - bool operator<( const DIFF_PAIR_KEY& b ) const + if( netP < b.netP ) { - if( netP < b.netP ) - return true; - else if( netP > b.netP ) - return false; - else // netP == b.netP - { - if( netN < b.netN ) - return true; - else if( netN > b.netN ) - return false; - else - return parentRule < b.parentRule; - } + return true; } + else if( netP > b.netP ) + { + return false; + } + else // netP == b.netP + { + if( netN < b.netN ) + return true; + else if( netN > b.netN ) + return false; + else + return parentRule < b.parentRule; + } + } - int netP, netN; - DRC_RULE* parentRule; - }; + int netP, netN; + DRC_RULE* parentRule; +}; - struct DIFF_PAIR_COUPLED_SEGMENTS - { - SEG coupledN, coupledP; - TRACK* parentN, *parentP; - int computedGap; - PCB_LAYER_ID layer; - bool couplingOK; - }; +struct DIFF_PAIR_COUPLED_SEGMENTS +{ + SEG coupledN; + SEG coupledP; + TRACK* parentN; + TRACK* parentP; + int computedGap; + PCB_LAYER_ID layer; + bool couplingOK; - struct DIFF_PAIR_ITEMS - { - std::set itemsP, itemsN; - std::vector coupled; - int totalCoupled; - int totalLengthN; - int totalLengthP; - }; + DIFF_PAIR_COUPLED_SEGMENTS() : + parentN( nullptr ), + parentP( nullptr ) + {} +}; + +struct DIFF_PAIR_ITEMS +{ + std::set itemsP, itemsN; + std::vector coupled; + int totalCoupled; + int totalLengthN; + int totalLengthP; +}; static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp, DRC_RTREE& aTree ) { diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index ee0f06ce44..2924d97a9d 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -920,7 +920,7 @@ std::unique_ptr PNS_KICAD_IFACE_BASE::syncVia( VIA* aVia ) if( aVia->IsLocked() ) via->Mark( PNS::MK_LOCKED ); - return std::move( via ); + return via; }