Fix a few compil and Coverity warnings.
This commit is contained in:
parent
dbcb1ecdb7
commit
d6f91c810f
|
@ -41,6 +41,7 @@ WS_PROXY_VIEW_ITEM::WS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO
|
||||||
m_pageInfo( aPageInfo ),
|
m_pageInfo( aPageInfo ),
|
||||||
m_pageNumber( "1" ),
|
m_pageNumber( "1" ),
|
||||||
m_sheetCount( 1 ),
|
m_sheetCount( 1 ),
|
||||||
|
m_isFirstPage( false ),
|
||||||
m_project( aProject ),
|
m_project( aProject ),
|
||||||
m_colorLayer( LAYER_WORKSHEET ),
|
m_colorLayer( LAYER_WORKSHEET ),
|
||||||
m_pageBorderColorLayer( LAYER_GRID )
|
m_pageBorderColorLayer( LAYER_GRID )
|
||||||
|
|
|
@ -168,7 +168,7 @@ protected:
|
||||||
wxPanel* ConstructRightPanel( wxWindow* aParent );
|
wxPanel* ConstructRightPanel( wxWindow* aParent );
|
||||||
|
|
||||||
void OnInitDialog( wxInitDialogEvent& aEvent );
|
void OnInitDialog( wxInitDialogEvent& aEvent );
|
||||||
void OnCharHook( wxKeyEvent& aEvt );
|
void OnCharHook( wxKeyEvent& aEvt ) override;
|
||||||
void OnCloseTimer( wxTimerEvent& aEvent );
|
void OnCloseTimer( wxTimerEvent& aEvent );
|
||||||
void OnUseBrowser( wxCommandEvent& aEvent );
|
void OnUseBrowser( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
|
|
|
@ -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_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, int aWidth )
|
||||||
: SHAPE( SH_ARC )
|
: SHAPE( SH_ARC )
|
||||||
{
|
{
|
||||||
|
m_width = aWidth;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct an arc that is tangent to two segments with a given radius.
|
* Construct an arc that is tangent to two segments with a given radius.
|
||||||
*
|
*
|
||||||
* p
|
* p
|
||||||
* A
|
* A
|
||||||
* A \
|
* A \
|
||||||
|
@ -71,27 +73,27 @@ SHAPE_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, i
|
||||||
* /
|
* /
|
||||||
* /
|
* /
|
||||||
* B
|
* B
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* segA is the fist segment (with its points A and B)
|
* segA is the fist segment (with its points A and B)
|
||||||
* segB is the second 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
|
* 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
|
* c is the centre of the arc to be constructed
|
||||||
* rad is the radius 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
|
* 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
|
* 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
|
* 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 )
|
* alpha = angle( pToA ) - angle( pToB )
|
||||||
*
|
*
|
||||||
* The distance PC can be computed as
|
* The distance PC can be computed as
|
||||||
* distPC = rad / abs( sin( alpha / 2 ) )
|
* distPC = rad / abs( sin( alpha / 2 ) )
|
||||||
*
|
*
|
||||||
* The polar angle of the vector PC can be computed as:
|
* The polar angle of the vector PC can be computed as:
|
||||||
* anglePC = angle( pToA ) + alpha / 2
|
* anglePC = angle( pToA ) + alpha / 2
|
||||||
*
|
*
|
||||||
* Therefore:
|
* Therefore:
|
||||||
* C.x = P.x + distPC*cos( anglePC )
|
* C.x = P.x + distPC*cos( anglePC )
|
||||||
* C.y = P.y + distPC*sin( 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 )
|
if( pToA.EuclideanNorm() == 0 )
|
||||||
pToA = aSegmentA.A - p.get();
|
pToA = aSegmentA.A - p.get();
|
||||||
|
|
||||||
if( pToB.EuclideanNorm() == 0 )
|
if( pToB.EuclideanNorm() == 0 )
|
||||||
pToB = aSegmentB.A - p.get();
|
pToB = aSegmentB.A - p.get();
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ private:
|
||||||
bool TransferDataToWindow() override;
|
bool TransferDataToWindow() override;
|
||||||
bool TransferDataFromWindow() override;
|
bool TransferDataFromWindow() override;
|
||||||
|
|
||||||
void OnCharHook( wxKeyEvent& aEvent );
|
void OnCharHook( wxKeyEvent& aEvent ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
- DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE
|
- DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE
|
||||||
- DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
|
- DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
|
||||||
- DRCE_TOO_MANY_VIAS
|
- DRCE_TOO_MANY_VIAS
|
||||||
Todo:
|
Todo:
|
||||||
- arc support.
|
- arc support.
|
||||||
- improve recognition of coupled segments (now anything that's parallel is considered coupled, causing
|
- improve recognition of coupled segments (now anything that's parallel is considered coupled, causing
|
||||||
DRC errors on meanders)
|
DRC errors on meanders)
|
||||||
|
@ -55,17 +55,18 @@ namespace test {
|
||||||
class DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING : public DRC_TEST_PROVIDER
|
class DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING : public DRC_TEST_PROVIDER
|
||||||
{
|
{
|
||||||
public:
|
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 bool Run() override;
|
||||||
|
|
||||||
virtual const wxString GetName() const override
|
virtual const wxString GetName() const override
|
||||||
{
|
{
|
||||||
return "diff_pair_coupling";
|
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 );
|
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() )
|
|| bci->GetNetCode() == bestCoupled->parentP->GetNetCode() )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -270,7 +271,7 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
|
||||||
{
|
{
|
||||||
m_board = m_drcEngine->GetBoard();
|
m_board = m_drcEngine->GetBoard();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::map<DIFF_PAIR_KEY, DIFF_PAIR_ITEMS> dpRuleMatches;
|
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 );
|
int totalLen = std::max( it.second.totalLengthN, it.second.totalLengthP );
|
||||||
reportAux( wxString::Format( " - coupled length: %s, total length: %s",
|
reportAux( wxString::Format( " - coupled length: %s, total length: %s",
|
||||||
|
|
||||||
MessageTextFromValue( userUnits(), it.second.totalCoupled ),
|
MessageTextFromValue( userUnits(), it.second.totalCoupled ),
|
||||||
MessageTextFromValue( userUnits(), totalLen ) ) );
|
MessageTextFromValue( userUnits(), totalLen ) ) );
|
||||||
|
|
||||||
int totalUncoupled = totalLen - it.second.totalCoupled;
|
int totalUncoupled = totalLen - it.second.totalCoupled;
|
||||||
|
|
|
@ -47,7 +47,8 @@ namespace test {
|
||||||
class DRC_TEST_PROVIDER_MATCHED_LENGTH : public DRC_TEST_PROVIDER
|
class DRC_TEST_PROVIDER_MATCHED_LENGTH : public DRC_TEST_PROVIDER
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DRC_TEST_PROVIDER_MATCHED_LENGTH ()
|
DRC_TEST_PROVIDER_MATCHED_LENGTH () :
|
||||||
|
m_board( nullptr )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ protected:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Width %s, via gap %s " ),
|
msg.Printf( _( "Width %s, via gap %s" ),
|
||||||
MessageTextFromValue( units, diffPair.m_Width ),
|
MessageTextFromValue( units, diffPair.m_Width ),
|
||||||
MessageTextFromValue( units, diffPair.m_ViaGap ) );
|
MessageTextFromValue( units, diffPair.m_ViaGap ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) :
|
||||||
m_brdOutlinesValid( false ),
|
m_brdOutlinesValid( false ),
|
||||||
m_commit( aCommit ),
|
m_commit( aCommit ),
|
||||||
m_progressReporter( nullptr ),
|
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.
|
// To enable add "DebugZoneFiller=1" to kicad_advanced settings file.
|
||||||
m_debugZoneFiller = ADVANCED_CFG::GetCfg().m_DebugZoneFiller;
|
m_debugZoneFiller = ADVANCED_CFG::GetCfg().m_DebugZoneFiller;
|
||||||
|
|
Loading…
Reference in New Issue