More Coverity scan error fixes.

This commit is contained in:
Wayne Stambaugh 2015-02-22 16:25:29 -05:00
parent 7e80e7207c
commit 4c6ca81f2c
21 changed files with 77 additions and 63 deletions

View File

@ -3,7 +3,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2007-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -50,9 +50,10 @@ void DSNLEXER::init()
specctraMode = false;
space_in_quoted_tokens = false;
commentsAreTokens = false;
curOffset = 0;
#if 1
if( keywordCount > 11 )
{

View File

@ -761,7 +761,8 @@ void FP_LIB_TABLE::Load( const wxString& aFileName )
}
void FP_LIB_TABLE::Save( const wxString& aFileName ) const throw( IO_ERROR )
void FP_LIB_TABLE::Save( const wxString& aFileName )
const throw( IO_ERROR, boost::interprocess::lock_exception )
{
FILE_OUTPUTFORMATTER sf( aFileName );
Format( &sf, 0 );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -57,7 +57,9 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
KIWAY_HOLDER( 0 ),
m_modal( false ),
m_modal_loop( 0 ), m_modal_resultant_parent( 0 )
m_modal_loop( 0 ),
m_modal_resultant_parent( 0 ),
m_modal_ret_val( false )
{
// DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -48,7 +48,8 @@
#include <wx/choicdlg.h>
void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfReferences ) throw( IO_ERROR )
void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfReferences )
throw( IO_ERROR, boost::bad_pointer )
{
// Build a flat list of components in schematic:
SCH_REFERENCE_LIST refs;

View File

@ -53,8 +53,8 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
m_sheetNameSize = GetDefaultTextSize();
m_fileNameSize = GetDefaultTextSize();
m_screen = NULL;
m_name.Printf( wxT( "Sheet%8.8lX" ), m_TimeStamp );
m_fileName.Printf( wxT( "file%8.8lX.sch" ), m_TimeStamp );
m_name.Printf( wxT( "Sheet%8.8lX" ), (long) m_TimeStamp );
m_fileName.Printf( wxT( "file%8.8lX.sch" ), (long) m_TimeStamp );
}

View File

@ -203,7 +203,8 @@ protected:
void updateFindReplaceView( wxFindDialogEvent& aEvent );
void backAnnotateFootprints( const std::string& aChangedSetOfReferences ) throw( IO_ERROR );
void backAnnotateFootprints( const std::string& aChangedSetOfReferences )
throw( IO_ERROR, boost::bad_pointer );
public:
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007-2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2007-2015 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -581,7 +581,8 @@ public:
* writes this table to aFileName in s-expression form.
* @param aFileName is the name of the file to write to.
*/
void Save( const wxString& aFileName ) const throw( IO_ERROR );
void Save( const wxString& aFileName ) const
throw( IO_ERROR, boost::interprocess::lock_exception );
protected:

View File

@ -5,7 +5,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -47,13 +47,17 @@
MATRIX_ROUTING_HEAD::MATRIX_ROUTING_HEAD()
{
m_BoardSide[0] = m_BoardSide[1] = NULL;
m_DistSide[0] = m_DistSide[1] = NULL;
m_DirSide[0] = m_DirSide[1] = NULL;
m_InitMatrixDone = false;
m_Nrows = m_Ncols = 0;
m_MemSize = 0;
m_BoardSide[0] = m_BoardSide[1] = NULL;
m_DistSide[0] = m_DistSide[1] = NULL;
m_DirSide[0] = m_DirSide[1] = NULL;
m_opWriteCell = NULL;
m_InitMatrixDone = false;
m_Nrows = 0;
m_Ncols = 0;
m_MemSize = 0;
m_RoutingLayersCount = 1;
m_GridRouting = 0;
m_RouteCount = 0;
}
@ -96,7 +100,6 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb, bool aUseBoardEdgesOnl
}
int MATRIX_ROUTING_HEAD::InitRoutingMatrix()
{
if( m_Nrows <= 0 || m_Ncols <= 0 )

View File

@ -5,7 +5,7 @@
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -51,7 +51,11 @@ struct TSubRect : public CRectPlacement::TRect
{
int n; // Original index of this subrect, before sorting
TSubRect() { }
TSubRect() : TRect(),
n( 0 )
{
}
TSubRect( int _w, int _h, int _n ) :
TRect( 0, 0, _w, _h ), n( _n ) { }
};

View File

@ -8,7 +8,7 @@
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -48,6 +48,8 @@ static void RebuildTrackChain( BOARD* pcb );
CONNECTIONS::CONNECTIONS( BOARD * aBrd )
{
m_brd = aBrd;
m_firstTrack = NULL;
m_lastTrack = NULL;
}

View File

@ -10,7 +10,7 @@
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -7,7 +7,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -121,7 +121,9 @@ public:
public:
DRAG_LIST( BOARD* aPcb )
{
m_Brd = aPcb;
m_Brd = aPcb;
m_Module = NULL;
m_Pad = NULL;
}
/**

View File

@ -3,7 +3,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@ -1208,8 +1208,10 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const
void EAGLE_PLUGIN::init( const PROPERTIES* aProperties )
{
m_hole_count = 0;
m_hole_count = 0;
m_min_trace = 0;
m_min_via = 0;
m_min_via_hole = 0;
m_xpath->clear();
m_pads_to_nets.clear();

View File

@ -5,8 +5,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -5,7 +5,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2011 Jean-Pierre Charras.
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -55,8 +55,9 @@ void KICAD_NETLIST_READER::LoadNetlist() throw ( IO_ERROR, PARSE_ERROR, boost::b
KICAD_NETLIST_PARSER::KICAD_NETLIST_PARSER( LINE_READER* aReader, NETLIST* aNetlist ) :
NETLIST_LEXER( aReader )
{
m_lineReader = aReader;
m_netlist = aNetlist;
m_lineReader = aReader;
m_netlist = aNetlist;
token = T_NONE;
}
@ -269,7 +270,7 @@ void KICAD_NETLIST_PARSER::parseNet() throw( IO_ERROR, PARSE_ERROR )
}
void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR, boost::bad_pointer )
{
/* Parses a section like
* (comp (ref P1)

View File

@ -1773,6 +1773,8 @@ BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPER
void PCB_IO::init( const PROPERTIES* aProperties )
{
m_board = NULL;
m_reader = NULL;
m_loading_format_version = SEXPR_BOARD_FILE_VERSION;
m_props = aProperties;
}

View File

@ -9,8 +9,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras.
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>.
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>.
* Copyright (C) 2012-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -309,7 +309,7 @@ private:
* (sheetpath (names /) (tstamps /))
* (tstamp 3256759C))
*/
void parseComponent() throw( IO_ERROR, PARSE_ERROR );
void parseComponent() throw( IO_ERROR, PARSE_ERROR, boost::bad_pointer );
/**
* Function parseNet

View File

@ -188,7 +188,7 @@ wxPoint PCB_PARSER::parseXY() throw( PARSE_ERROR, IO_ERROR )
}
void PCB_PARSER::parseXY( int* aX, int* aY ) throw( PARSE_ERROR )
void PCB_PARSER::parseXY( int* aX, int* aY ) throw( PARSE_ERROR, IO_ERROR )
{
wxPoint pt = parseXY();

View File

@ -174,7 +174,7 @@ class PCB_PARSER : public PCB_LEXER
*/
wxPoint parseXY() throw( PARSE_ERROR, IO_ERROR );
void parseXY( int* aX, int* aY ) throw( PARSE_ERROR );
void parseXY( int* aX, int* aY ) throw( PARSE_ERROR, IO_ERROR );
/**
* Function parseEDA_TEXT

View File

@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras <jp.charras@wanadoo.fr>
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2007-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -204,6 +204,8 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
PICKED_ITEMS_LIST& aAuxiliaryList,
BOARD* aPcb )
{
wxLogDebug( wxT( "Inside UpdadeCopyOfZonesList()." ) );
for( unsigned kk = 0; kk < aPickList.GetCount(); kk++ )
{
UNDO_REDO_T status = aPickList.GetPickedItemStatus( kk );
@ -225,6 +227,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
if( status == UR_NEW )
{
delete ref;
ref = NULL;
aPickList.RemovePicker( kk );
kk--;
}
@ -233,10 +236,10 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk );
aPickList.SetPickedItemStatus( UR_DELETED, kk );
if( zcopy )
ref->Copy( zcopy );
else
wxMessageBox( wxT( "UpdateCopyOfZonesList() error: link = NULL" ) );
wxASSERT_MSG( zcopy != NULL,
wxT( "UpdateCopyOfZonesList() error: link = NULL" ) );
ref->Copy( zcopy );
// the copy was deleted; the link does not exists now.
aPickList.SetPickedItemLink( NULL, kk );
@ -248,7 +251,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
for( unsigned nn = 0; nn < aAuxiliaryList.GetCount(); nn++ )
{
if( aAuxiliaryList.GetPickedItem( nn ) == ref )
if( ref != NULL && aAuxiliaryList.GetPickedItem( nn ) == ref )
{
aAuxiliaryList.RemovePicker( nn );
notfound = false;
@ -256,11 +259,12 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
}
}
if( notfound )
wxMessageBox( wxT( "UpdateCopyOfZonesList() error: item not found in aAuxiliaryList" ) );
wxASSERT_MSG( notfound != true,
wxT( "UpdateCopyOfZonesList() error: item not found in "
"aAuxiliaryList" ) );
break;
}
if( zone == ref ) // picked zone found
{
if( aPickList.GetPickedItemStatus( kk ) != UR_NEW )
@ -280,7 +284,6 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
}
}
// Add new zones in main pick list, and remove pickers from Auxiliary List
for( unsigned ii = 0; ii < aAuxiliaryList.GetCount(); )
{
@ -300,17 +303,6 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
}
// Should not occur:
if( aAuxiliaryList.GetCount()> 0 )
{
wxString msg;
msg.Printf( wxT( "UpdateCopyOfZonesList() error: aAuxiliaryList not void: %d item left (status %d)" ),
aAuxiliaryList.GetCount(), aAuxiliaryList.GetPickedItemStatus( 0 ) );
wxMessageBox( msg );
while( aAuxiliaryList.GetCount() > 0 )
{
delete aAuxiliaryList.GetPickedItemLink( 0 );
aAuxiliaryList.RemovePicker( 0 );
}
}
wxASSERT_MSG( aAuxiliaryList.GetCount() == 0,
wxT( "UpdateCopyOfZonesList() error: aAuxiliaryList not empty." ) );
}