Fix a few compil and Coverity warnings.

This commit is contained in:
jean-pierre charras 2020-10-25 10:02:07 +01:00
parent dbcb1ecdb7
commit d6f91c810f
8 changed files with 27 additions and 21 deletions

View File

@ -41,6 +41,7 @@ WS_PROXY_VIEW_ITEM::WS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO
m_pageInfo( aPageInfo ),
m_pageNumber( "1" ),
m_sheetCount( 1 ),
m_isFirstPage( false ),
m_project( aProject ),
m_colorLayer( LAYER_WORKSHEET ),
m_pageBorderColorLayer( LAYER_GRID )

View File

@ -168,7 +168,7 @@ protected:
wxPanel* ConstructRightPanel( wxWindow* aParent );
void OnInitDialog( wxInitDialogEvent& aEvent );
void OnCharHook( wxKeyEvent& aEvt );
void OnCharHook( wxKeyEvent& aEvt ) override;
void OnCloseTimer( wxTimerEvent& aEvent );
void OnUseBrowser( wxCommandEvent& aEvent );

View File

@ -57,9 +57,11 @@ SHAPE_ARC::SHAPE_ARC( const VECTOR2I& aArcStart, const VECTOR2I& aArcMid,
SHAPE_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, int aWidth )
: SHAPE( SH_ARC )
{
m_width = aWidth;
/*
* Construct an arc that is tangent to two segments with a given radius.
*
*
* p
* A
* A \
@ -71,27 +73,27 @@ SHAPE_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, i
* /
* /
* B
*
*
*
* segA is the fist segment (with its points A and B)
* segB is the second segment (with its points A and B)
* p is the point at which segA and segB would intersect if they were projected
* c is the centre of the arc to be constructed
* rad is the radius of the arc to be constructed
*
*
* We can create two vectors, betweeen point p and segA /segB
* pToA = p - segA.B //< note that segA.A would also be valid as it is colinear
* pToB = p - segB.B //< note that segB.A would also be valid as it is colinear
*
* Let the angle formed by segA and segB be called 'alpha':
*
* Let the angle formed by segA and segB be called 'alpha':
* alpha = angle( pToA ) - angle( pToB )
*
*
* The distance PC can be computed as
* distPC = rad / abs( sin( alpha / 2 ) )
*
*
* The polar angle of the vector PC can be computed as:
* anglePC = angle( pToA ) + alpha / 2
*
*
* Therefore:
* C.x = P.x + distPC*cos( anglePC )
* C.y = P.y + distPC*sin( anglePC )
@ -119,7 +121,7 @@ SHAPE_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, i
if( pToA.EuclideanNorm() == 0 )
pToA = aSegmentA.A - p.get();
if( pToB.EuclideanNorm() == 0 )
pToB = aSegmentB.A - p.get();

View File

@ -63,7 +63,7 @@ private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void OnCharHook( wxKeyEvent& aEvent );
void OnCharHook( wxKeyEvent& aEvent ) override;
};

View File

@ -44,7 +44,7 @@
- DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE
- DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
- DRCE_TOO_MANY_VIAS
Todo:
Todo:
- arc support.
- improve recognition of coupled segments (now anything that's parallel is considered coupled, causing
DRC errors on meanders)
@ -55,17 +55,18 @@ namespace test {
class DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING : public DRC_TEST_PROVIDER
{
public:
DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING ()
DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING () :
m_board( nullptr )
{
}
virtual ~DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING()
virtual ~DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING()
{
}
virtual bool Run() override;
virtual const wxString GetName() const override
virtual const wxString GetName() const override
{
return "diff_pair_coupling";
};
@ -240,7 +241,7 @@ static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp, DRC_RTREE& aTree
{
auto bci = static_cast<BOARD_CONNECTED_ITEM*>( aItem );
if( bci->GetNetCode() == bestCoupled->parentN->GetNetCode()
if( bci->GetNetCode() == bestCoupled->parentN->GetNetCode()
|| bci->GetNetCode() == bestCoupled->parentP->GetNetCode() )
return false;
}
@ -270,7 +271,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
{
m_board = m_drcEngine->GetBoard();
std::map<DIFF_PAIR_KEY, DIFF_PAIR_ITEMS> dpRuleMatches;
@ -424,7 +425,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
int totalLen = std::max( it.second.totalLengthN, it.second.totalLengthP );
reportAux( wxString::Format( " - coupled length: %s, total length: %s",
MessageTextFromValue( userUnits(), it.second.totalCoupled ),
MessageTextFromValue( userUnits(), it.second.totalCoupled ),
MessageTextFromValue( userUnits(), totalLen ) ) );
int totalUncoupled = totalLen - it.second.totalCoupled;

View File

@ -47,7 +47,8 @@ namespace test {
class DRC_TEST_PROVIDER_MATCHED_LENGTH : public DRC_TEST_PROVIDER
{
public:
DRC_TEST_PROVIDER_MATCHED_LENGTH ()
DRC_TEST_PROVIDER_MATCHED_LENGTH () :
m_board( nullptr )
{
}

View File

@ -344,7 +344,7 @@ protected:
}
else
{
msg.Printf( _( "Width %s, via gap %s " ),
msg.Printf( _( "Width %s, via gap %s" ),
MessageTextFromValue( units, diffPair.m_Width ),
MessageTextFromValue( units, diffPair.m_ViaGap ) );
}

View File

@ -56,7 +56,8 @@ ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) :
m_brdOutlinesValid( false ),
m_commit( aCommit ),
m_progressReporter( nullptr ),
m_maxError( ARC_HIGH_DEF )
m_maxError( ARC_HIGH_DEF ),
m_worstClearance( 0 )
{
// To enable add "DebugZoneFiller=1" to kicad_advanced settings file.
m_debugZoneFiller = ADVANCED_CFG::GetCfg().m_DebugZoneFiller;