Fix a few coverity warnings.

This commit is contained in:
jean-pierre charras 2015-08-16 11:02:19 +02:00
parent 0cad702fc7
commit cc2fe47c95
2 changed files with 17 additions and 10 deletions

View File

@ -3577,7 +3577,7 @@ bool dxfRW::processPolyline()
processVertex( &pl );
}
}
// Fall through
default:
pl.parseCode( code, reader );
break;
@ -3593,7 +3593,6 @@ bool dxfRW::processVertex( DRW_Polyline* pl )
DBG( "dxfRW::processVertex" );
int code;
DRW_Vertex* v = new DRW_Vertex();
bool appended = false;
while( reader->readRec( &code, !binary ) )
{
@ -3604,7 +3603,6 @@ bool dxfRW::processVertex( DRW_Polyline* pl )
case 0:
{
pl->appendVertex( v );
appended = true;
nextentity = reader->getString();
DBG( nextentity ); DBG( "\n" );
@ -3614,14 +3612,10 @@ bool dxfRW::processVertex( DRW_Polyline* pl )
}
else if( nextentity == "VERTEX" )
{
if( !appended )
delete v;
v = new DRW_Vertex(); // another vertex
appended = false;
}
}
// Fall through
default:
v->parseCode( code, reader );
break;

View File

@ -2073,6 +2073,13 @@ void LEGACY_PLUGIN::loadPCB_LINE()
void LEGACY_PLUGIN::loadNETINFO_ITEM()
{
/* a net description is something like
* $EQUIPOT
* Na 5 "/BIT1"
* St ~
* $EndEQUIPOT
*/
char buf[1024];
NETINFO_ITEM* net = NULL;
@ -2090,14 +2097,20 @@ void LEGACY_PLUGIN::loadNETINFO_ITEM()
netCode = intParse( line + SZ( "Na" ), &data );
ReadDelimitedText( buf, data, sizeof(buf) );
net = new NETINFO_ITEM( m_board, FROM_UTF8( buf ), netCode );
if( net == NULL )
net = new NETINFO_ITEM( m_board, FROM_UTF8( buf ), netCode );
else
{
THROW_IO_ERROR( "Two net definitions in '$EQUIPOT' block" );
}
}
else if( TESTLINE( "$EndEQUIPOT" ) )
{
// net 0 should be already in list, so store this net
// if it is not the net 0, or if the net 0 does not exists.
if( net != NULL && ( net->GetNet() > 0 || m_board->FindNet( 0 ) == NULL ) )
if( net && ( net->GetNet() > 0 || m_board->FindNet( 0 ) == NULL ) )
{
m_board->AppendNet( net );