Cleanup compiler warnings

This commit is contained in:
Ian McInerney 2020-12-09 23:12:44 +00:00
parent 31c5776fc0
commit be4b6ec06a
8 changed files with 61 additions and 54 deletions

View File

@ -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<wxString> 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() );

View File

@ -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<SHAPE_CIRCLE, SHAPE_ARC>( 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 )

View File

@ -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;

View File

@ -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 );

View File

@ -2251,7 +2251,6 @@ void SHAPE_POLY_SET:: GetIndexableSubshapes( std::vector<SHAPE*>& aSubshapes )
{
for ( auto& tri : tpoly->Triangles() )
{
SHAPE *s = static_cast<SHAPE*> ( &tri );
aSubshapes.push_back( &tri );
}
}

View File

@ -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<PCB_BASE_EDIT_FRAME*>( m_parent ) )
settings()->m_colorSettings = pcbframe->GetColorSettings();
else
settings()->m_colorSettings = m_parent->GetColorSettings();
settings()->m_colorSettings = m_parent->GetColorSettings();
}
DIALOG_PRINT_GENERIC::saveSettings();

View File

@ -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<BOARD_CONNECTED_ITEM*> itemsP, itemsN;
std::vector<DIFF_PAIR_COUPLED_SEGMENTS> coupled;
int totalCoupled;
int totalLengthN;
int totalLengthP;
};
DIFF_PAIR_COUPLED_SEGMENTS() :
parentN( nullptr ),
parentP( nullptr )
{}
};
struct DIFF_PAIR_ITEMS
{
std::set<BOARD_CONNECTED_ITEM*> itemsP, itemsN;
std::vector<DIFF_PAIR_COUPLED_SEGMENTS> coupled;
int totalCoupled;
int totalLengthN;
int totalLengthP;
};
static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp, DRC_RTREE& aTree )
{

View File

@ -920,7 +920,7 @@ std::unique_ptr<PNS::VIA> PNS_KICAD_IFACE_BASE::syncVia( VIA* aVia )
if( aVia->IsLocked() )
via->Mark( PNS::MK_LOCKED );
return std::move( via );
return via;
}