From ec59361f75832c7a71589545bbe78f89bd154609 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 16 Feb 2019 14:09:21 +0100 Subject: [PATCH] Fix a few coverity errors --- common/confirm.cpp | 3 ++- common/legacy_wx/block.cpp | 1 + common/string.cpp | 8 ++++++-- pcbnew/autorouter/ar_autoplacer.cpp | 1 + pcbnew/dialogs/dialog_drclistbox.h | 1 + pcbnew/grid_layer_box_helpers.cpp | 3 +-- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/common/confirm.cpp b/common/confirm.cpp index ffc5178e33..daeb048f99 100644 --- a/common/confirm.cpp +++ b/common/confirm.cpp @@ -52,7 +52,8 @@ KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, const wxString& aCaption ) - : wxRichMessageDialog( aParent, aMessage, getCaption( aType, aCaption ), getStyle( aType ) ) + : wxRichMessageDialog( aParent, aMessage, getCaption( aType, aCaption ), getStyle( aType ) ), + m_hash( 0 ) { } diff --git a/common/legacy_wx/block.cpp b/common/legacy_wx/block.cpp index 320e21f4e1..aa3c4d8b69 100644 --- a/common/legacy_wx/block.cpp +++ b/common/legacy_wx/block.cpp @@ -45,6 +45,7 @@ BLOCK_SELECTOR::BLOCK_SELECTOR() : m_state = STATE_NO_BLOCK; // State (enum BLOCK_STATE_T) of block. m_command = BLOCK_IDLE; // Type (enum BLOCK_COMMAND_T) of operation. m_color = BROWN; + m_appendUndo = false; } diff --git a/common/string.cpp b/common/string.cpp index c7ddf606af..d9154fa788 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -48,8 +48,9 @@ static const char illegalFileNameChars[] = "\\/:\"<>|"; */ wxString EscapeString( const wxString& aSource ) { +#if 1 return aSource; - +#else wxString converted; for( wxUniChar c: aSource ) @@ -87,13 +88,15 @@ wxString EscapeString( const wxString& aSource ) } return converted; +#endif } wxString UnescapeString( const wxString& aSource ) { +#if 1 return aSource; - +#else wxString converted = aSource; converted.Replace( """, "\"" ); @@ -114,6 +117,7 @@ wxString UnescapeString( const wxString& aSource ) converted.Replace( "&", "&" ); return converted; +#endif } diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index 1fb0fb9595..0f77543bc7 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -87,6 +87,7 @@ AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard ) m_gridSize = Millimeter2iu( STEP_AR_MM ); m_progressReporter = nullptr; m_refreshCallback = nullptr; + m_minCost = 0.0; } diff --git a/pcbnew/dialogs/dialog_drclistbox.h b/pcbnew/dialogs/dialog_drclistbox.h index 178cf3aa05..24cebd5fe3 100644 --- a/pcbnew/dialogs/dialog_drclistbox.h +++ b/pcbnew/dialogs/dialog_drclistbox.h @@ -197,6 +197,7 @@ public: long style = 0, const wxString choices[] = NULL, int unused = 0) : wxHtmlListBox( parent, id, pos, size, style ) { + m_units = MILLIMETRES; m_list = 0; } diff --git a/pcbnew/grid_layer_box_helpers.cpp b/pcbnew/grid_layer_box_helpers.cpp index 6872db6b65..e4de221e46 100644 --- a/pcbnew/grid_layer_box_helpers.cpp +++ b/pcbnew/grid_layer_box_helpers.cpp @@ -78,8 +78,7 @@ void GRID_CELL_LAYER_RENDERER::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, wxDC& GRID_CELL_LAYER_SELECTOR::GRID_CELL_LAYER_SELECTOR( PCB_BASE_FRAME* aFrame, LSET aMask ) : - m_frame( aFrame ), - m_mask( aMask ) + m_frame( aFrame ), m_mask( aMask ), m_value( 0 ) { }