Tidy up some Coverity issues.
This commit is contained in:
parent
840cab4eec
commit
8eb15fe911
|
@ -465,27 +465,23 @@ FP_LIB_TABLE* PROJECT::PcbFootprintLibs( KIWAY& aKiway )
|
|||
|
||||
FP_LIB_TABLE* tbl = (FP_LIB_TABLE*) GetElem( ELEM_FPTBL );
|
||||
|
||||
// its gotta be NULL or a FP_LIB_TABLE, or a bug.
|
||||
wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T );
|
||||
|
||||
if( !tbl )
|
||||
if( tbl )
|
||||
{
|
||||
wxASSERT( tbl->Type() == FP_LIB_TABLE_T );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// Build a new project specific FP_LIB_TABLE with the global table as a fallback.
|
||||
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
|
||||
// stack this way, all using the same global fallback table.
|
||||
KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
|
||||
|
||||
if( kiface )
|
||||
tbl = (FP_LIB_TABLE*) kiface->IfaceOrAddress( KIFACE_NEW_FOOTPRINT_TABLE );
|
||||
tbl->Load( FootprintLibTblName() );
|
||||
|
||||
wxASSERT( tbl );
|
||||
SetElem( ELEM_FPTBL, tbl );
|
||||
|
||||
wxString projectFpLibTableFileName = FootprintLibTblName();
|
||||
|
||||
try
|
||||
{
|
||||
tbl->Load( projectFpLibTableFileName );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
|
|
|
@ -1580,23 +1580,7 @@ void mpScaleY::Plot( wxDC& dc, mpWindow& w )
|
|||
m_pen.SetStyle( wxPENSTYLE_DOT );
|
||||
dc.SetPen( m_pen );
|
||||
|
||||
if( (m_flags == mpALIGN_LEFT) && !m_drawOutsideMargins )
|
||||
{
|
||||
dc.DrawLine( orgx - 4, p, endPx, p );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (m_flags == mpALIGN_RIGHT) && !m_drawOutsideMargins )
|
||||
{
|
||||
// dc.DrawLine( orgX-4, p, orgx+4, p);
|
||||
dc.DrawLine( orgx - 4, p, endPx, p );
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.DrawLine( orgx - 4, p, endPx, p );
|
||||
// dc.DrawLine( orgx-4/*-w.GetScrX()*/, p, w.GetScrX(), p);
|
||||
}
|
||||
}
|
||||
|
||||
m_pen.SetStyle( wxPENSTYLE_SOLID );
|
||||
dc.SetPen( m_pen );
|
||||
|
|
|
@ -584,7 +584,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType
|
|||
segment = startSegments( aType, VECTOR2D( cursorPos ) );
|
||||
}
|
||||
// Create a new segment if we're out of previously-created ones
|
||||
else if( !segment->IsNull() || ( forceHV && !m_wires.end()[-2]->IsNull() ) )
|
||||
else if( !segment->IsNull() || ( forceHV && !m_wires[ m_wires.size() - 2 ]->IsNull() ) )
|
||||
{
|
||||
// Terminate the command if the end point is on a pin, junction, or another
|
||||
// wire or bus.
|
||||
|
@ -611,7 +611,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType
|
|||
if( evt->IsDblClick( BUT_LEFT ) && segment )
|
||||
{
|
||||
if( forceHV && m_wires.size() >= 2 )
|
||||
computeBreakPoint( { m_wires.end()[-2], segment }, cursorPos );
|
||||
computeBreakPoint( { m_wires[ m_wires.size() - 2 ], segment }, cursorPos );
|
||||
|
||||
finishSegments();
|
||||
segment = nullptr;
|
||||
|
@ -665,7 +665,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType
|
|||
{
|
||||
// Coerce the line to vertical or horizontal if necessary
|
||||
if( forceHV && m_wires.size() >= 2 )
|
||||
computeBreakPoint( { m_wires.end()[-2], segment }, cursorPos );
|
||||
computeBreakPoint( { m_wires[ m_wires.size() - 2 ], segment }, cursorPos );
|
||||
else
|
||||
segment->SetEndPoint( cursorPos );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue