coverity common folder fixes (mainly not initialized members).

This commit is contained in:
unknown 2015-03-11 17:04:20 +01:00 committed by jean-pierre charras
parent f16e083ecf
commit b3b791961a
10 changed files with 52 additions and 32 deletions

View File

@ -374,14 +374,10 @@ const char* ${LEXERCLASS}::TokenName( T aTok )
{ {
const char* ret; const char* ret;
if( (unsigned) aTok < keyword_count ) if( aTok < 0 )
{
ret = keywords[aTok].name;
}
else if( aTok < 0 )
{
ret = DSNLEXER::Syntax( aTok ); ret = DSNLEXER::Syntax( aTok );
} else if( (unsigned) aTok < keyword_count )
ret = keywords[aTok].name;
else else
ret = \"token too big\"; ret = \"token too big\";

View File

@ -35,10 +35,10 @@
#include <class_layer_box_selector.h> #include <class_layer_box_selector.h>
LAYER_SELECTOR::LAYER_SELECTOR() LAYER_SELECTOR::LAYER_SELECTOR() :
m_layerhotkeys( true ),
m_hotkeys( NULL )
{ {
m_layerhotkeys = true;
m_hotkeys = NULL;
} }
@ -81,8 +81,6 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
{ {
if( choices != NULL ) if( choices != NULL )
ResyncBitmapOnly(); ResyncBitmapOnly();
m_hotkeys = NULL;
} }

View File

@ -203,8 +203,10 @@ static const double PLUsPERDECIMIL = 0.102041;
HPGL_PLOTTER::HPGL_PLOTTER() HPGL_PLOTTER::HPGL_PLOTTER()
{ {
SetPenSpeed( 40 ); // Default pen speed = 40 cm/s SetPenSpeed( 40 ); // Default pen speed = 40 cm/s; Pen speed is *always* in cm
SetPenNumber( 1 ); // Default pen num = 1 SetPenNumber( 1 ); // Default pen num = 1
SetPenDiameter( 0.0 );
SetPenOverlap( 0.0 );
} }
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,

View File

@ -76,6 +76,10 @@ void DSNLEXER::init()
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
FILE* aFile, const wxString& aFilename ) : FILE* aFile, const wxString& aFilename ) :
iOwnReaders( true ), iOwnReaders( true ),
start( NULL ),
next( NULL ),
limit( NULL ),
reader( NULL ),
keywords( aKeywordTable ), keywords( aKeywordTable ),
keywordCount( aKeywordCount ) keywordCount( aKeywordCount )
{ {
@ -88,6 +92,10 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
const std::string& aClipboardTxt, const wxString& aSource ) : const std::string& aClipboardTxt, const wxString& aSource ) :
iOwnReaders( true ), iOwnReaders( true ),
start( NULL ),
next( NULL ),
limit( NULL ),
reader( NULL ),
keywords( aKeywordTable ), keywords( aKeywordTable ),
keywordCount( aKeywordCount ) keywordCount( aKeywordCount )
{ {
@ -101,6 +109,10 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
LINE_READER* aLineReader ) : LINE_READER* aLineReader ) :
iOwnReaders( false ), iOwnReaders( false ),
start( NULL ),
next( NULL ),
limit( NULL ),
reader( NULL ),
keywords( aKeywordTable ), keywords( aKeywordTable ),
keywordCount( aKeywordCount ) keywordCount( aKeywordCount )
{ {
@ -114,6 +126,10 @@ static const KEYWORD empty_keywords[1] = {};
DSNLEXER::DSNLEXER( const std::string& aSExpression, const wxString& aSource ) : DSNLEXER::DSNLEXER( const std::string& aSExpression, const wxString& aSource ) :
iOwnReaders( true ), iOwnReaders( true ),
start( NULL ),
next( NULL ),
limit( NULL ),
reader( NULL ),
keywords( empty_keywords ), keywords( empty_keywords ),
keywordCount( 0 ) keywordCount( 0 )
{ {

View File

@ -120,18 +120,15 @@ void PARSE_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc,
//-----<LINE_READER>------------------------------------------------------ //-----<LINE_READER>------------------------------------------------------
LINE_READER::LINE_READER( unsigned aMaxLineLength ) LINE_READER::LINE_READER( unsigned aMaxLineLength ) :
length( 0 ),
lineNum( 0 ),
line( NULL ),
capacity( 0 ),
maxLineLength( aMaxLineLength )
{ {
lineNum = 0; if( aMaxLineLength != 0 )
if( aMaxLineLength == 0 )
{ {
line = 0;
}
else
{
maxLineLength = aMaxLineLength;
// start at the INITIAL size, expand as needed up to the MAX size in maxLineLength // start at the INITIAL size, expand as needed up to the MAX size in maxLineLength
capacity = LINE_READER_LINE_INITIAL_SIZE; capacity = LINE_READER_LINE_INITIAL_SIZE;
@ -143,8 +140,6 @@ LINE_READER::LINE_READER( unsigned aMaxLineLength )
line[0] = '\0'; line[0] = '\0';
} }
length = 0;
} }

View File

@ -42,6 +42,9 @@ struct TOOL_DISPATCHER::BUTTON_STATE
{ {
BUTTON_STATE( TOOL_MOUSE_BUTTONS aButton, const wxEventType& aDownEvent, BUTTON_STATE( TOOL_MOUSE_BUTTONS aButton, const wxEventType& aDownEvent,
const wxEventType& aUpEvent, const wxEventType& aDblClickEvent ) : const wxEventType& aUpEvent, const wxEventType& aDblClickEvent ) :
dragging( false ),
pressed( false ),
dragMaxDelta( 0.0f ),
button( aButton ), button( aButton ),
downEvent( aDownEvent ), downEvent( aDownEvent ),
upEvent( aUpEvent ), upEvent( aUpEvent ),

View File

@ -195,7 +195,11 @@ private:
TOOL_MANAGER::TOOL_MANAGER() : TOOL_MANAGER::TOOL_MANAGER() :
m_model( NULL ), m_view( NULL ), m_viewControls( NULL ), m_editFrame( NULL ) m_model( NULL ),
m_view( NULL ),
m_viewControls( NULL ),
m_editFrame( NULL ),
m_passEvent( false )
{ {
m_actionMgr = new ACTION_MANAGER( this ); m_actionMgr = new ACTION_MANAGER( this );

View File

@ -35,13 +35,17 @@
#include "wx_unit_binder.h" #include "wx_unit_binder.h"
WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput, wxStaticText* aUnitLabel, wxSpinButton* aSpinButton ) WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput,
wxStaticText* aUnitLabel, wxSpinButton* aSpinButton ) :
m_textCtrl( aTextInput ),
m_unitLabel( aUnitLabel ),
m_units( g_UserUnit ),
m_step( 1 ),
m_min( 0 ),
m_max( 1 )
{ {
// Use the currently selected units // Use the currently selected units
m_units = g_UserUnit;
m_textCtrl = aTextInput;
m_textCtrl->SetValue( wxT( "0" ) ); m_textCtrl->SetValue( wxT( "0" ) );
m_unitLabel = aUnitLabel;
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) ); m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
} }
@ -73,4 +77,4 @@ void WX_UNIT_BINDER::Enable( bool aEnable )
{ {
m_textCtrl->Enable( aEnable ); m_textCtrl->Enable( aEnable );
m_unitLabel->Enable( aEnable ); m_unitLabel->Enable( aEnable );
} }

View File

@ -459,6 +459,8 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
// Moving a marker has no sense // Moving a marker has no sense
wxFAIL_MSG( wxString::Format( wxT( "Cannot move item type %s" ), wxFAIL_MSG( wxString::Format( wxT( "Cannot move item type %s" ),
GetChars( item->GetClass() ) ) ); GetChars( item->GetClass() ) ) );
break;
default: default:
// Unknown items cannot be moved // Unknown items cannot be moved
wxFAIL_MSG( wxString::Format( wxFAIL_MSG( wxString::Format(

View File

@ -99,7 +99,7 @@ void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
m_settings.m_targetLength = m_targetLength.GetValue(); m_settings.m_targetLength = m_targetLength.GetValue();
if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude ) if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
m_settings.m_maxAmplitude = m_settings.m_maxAmplitude; m_settings.m_maxAmplitude = m_settings.m_minAmplitude;
m_settings.m_cornerType = m_miterStyle->GetSelection() ? PNS_MEANDER_SETTINGS::CHAMFER : PNS_MEANDER_SETTINGS::ROUND; m_settings.m_cornerType = m_miterStyle->GetSelection() ? PNS_MEANDER_SETTINGS::CHAMFER : PNS_MEANDER_SETTINGS::ROUND;