Coverity warnings fixes.

This commit is contained in:
jean-pierre charras 2021-06-10 10:34:27 +02:00
parent 5f1e9bc8a7
commit 1c3df973d6
6 changed files with 39 additions and 36 deletions

View File

@ -38,8 +38,8 @@
typedef struct typedef struct
{ {
SFVEC2F m_Start; SFVEC2F m_Start;
float m_inv_JY_minus_IY; float m_inv_JY_minus_IY = 0.0;
float m_JX_minus_IX; float m_JX_minus_IX = 0.0;
} POLYSEGMENT; } POLYSEGMENT;

View File

@ -53,15 +53,6 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
m_Parent = aParent; m_Parent = aParent;
m_CurrentText = aTextItem; m_CurrentText = aTextItem;
switch( m_CurrentText->Type() )
{
case SCH_GLOBAL_LABEL_T: SetTitle( _( "Global Label Properties" ) ); break;
case SCH_HIER_LABEL_T: SetTitle( _( "Hierarchical Label Properties" ) ); break;
case SCH_LABEL_T: SetTitle( _( "Label Properties" ) ); break;
case SCH_SHEET_PIN_T: SetTitle( _( "Hierarchical Sheet Pin Properties" ) ); break;
default: SetTitle( _( "Text Properties" ) ); break;
}
m_valueMultiLine->SetEOLMode( wxSTC_EOL_LF ); m_valueMultiLine->SetEOLMode( wxSTC_EOL_LF );
m_scintillaTricks = new SCINTILLA_TRICKS( m_valueMultiLine, wxT( "()" ) ); m_scintillaTricks = new SCINTILLA_TRICKS( m_valueMultiLine, wxT( "()" ) );
@ -104,6 +95,15 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
m_valueCombo->SetValidator( m_netNameValidator ); m_valueCombo->SetValidator( m_netNameValidator );
} }
switch( m_CurrentText->Type() )
{
case SCH_GLOBAL_LABEL_T: SetTitle( _( "Global Label Properties" ) ); break;
case SCH_HIER_LABEL_T: SetTitle( _( "Hierarchical Label Properties" ) ); break;
case SCH_LABEL_T: SetTitle( _( "Label Properties" ) ); break;
case SCH_SHEET_PIN_T: SetTitle( _( "Hierarchical Sheet Pin Properties" ) ); break;
default: SetTitle( _( "Text Properties" ) ); break;
}
SetInitialFocus( m_activeTextCtrl ); SetInitialFocus( m_activeTextCtrl );
m_TextShape->Show( m_CurrentText->Type() == SCH_GLOBAL_LABEL_T || m_TextShape->Show( m_CurrentText->Type() == SCH_GLOBAL_LABEL_T ||
@ -155,6 +155,28 @@ DIALOG_LABEL_EDITOR::~DIALOG_LABEL_EDITOR()
} }
void DIALOG_LABEL_EDITOR::SetTitle( const wxString& aTitle )
{
// This class is shared for numerous tasks: a couple of single line labels and
// multi-line text fields. Since the desired size of the multi-line text field editor
// is often larger, we retain separate sizes based on the dialog titles.
switch( m_CurrentText->Type() )
{
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_LABEL_T:
// labels can share retained settings probably.
break;
default:
m_hash_key = TO_UTF8( aTitle );
m_hash_key += typeid(*this).name();
}
DIALOG_LABEL_EDITOR_BASE::SetTitle( aTitle );
}
bool DIALOG_LABEL_EDITOR::TransferDataToWindow() bool DIALOG_LABEL_EDITOR::TransferDataToWindow()
{ {
if( !wxDialog::TransferDataToWindow() ) if( !wxDialog::TransferDataToWindow() )

View File

@ -42,26 +42,10 @@ public:
DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem ); DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
~DIALOG_LABEL_EDITOR(); ~DIALOG_LABEL_EDITOR();
void SetTitle( const wxString& aTitle ) override // This class is shared for numerous tasks: a couple of single line labels and
{ // multi-line text fields. Since the desired size of the multi-line text field editor
// This class is shared for numerous tasks: a couple of single line labels and // is often larger, we retain separate sizes based on the dialog titles.
// multi-line text fields. Since the desired size of the multi-line text field editor void SetTitle( const wxString& aTitle ) override;
// is often larger, we retain separate sizes based on the dialog titles.
switch( m_CurrentText->Type() )
{
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_LABEL_T:
// labels can share retained settings probably.
break;
default:
m_hash_key = TO_UTF8( aTitle );
m_hash_key += typeid(*this).name();
}
DIALOG_LABEL_EDITOR_BASE::SetTitle( aTitle );
}
private: private:
void onScintillaCharAdded( wxStyledTextEvent &aEvent ); void onScintillaCharAdded( wxStyledTextEvent &aEvent );

View File

@ -316,7 +316,7 @@ protected:
union { union {
double DblArg[MAX_CAIRO_ARGUMENTS]; ///< Arguments for Cairo commands double DblArg[MAX_CAIRO_ARGUMENTS]; ///< Arguments for Cairo commands
bool BoolArg; ///< A bool argument bool BoolArg; ///< A bool argument
int IntArg; ///< An int argument int IntArg = 0; ///< An int argument
} m_Argument; } m_Argument;
cairo_path_t* m_CairoPath = nullptr; ///< Pointer to a Cairo path cairo_path_t* m_CairoPath = nullptr; ///< Pointer to a Cairo path
} GROUP_ELEMENT; } GROUP_ELEMENT;

View File

@ -102,12 +102,10 @@ DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame )
: DIALOG_BOARD_REANNOTATE_BASE( aParentFrame ), : DIALOG_BOARD_REANNOTATE_BASE( aParentFrame ),
m_footprints( aParentFrame->GetBoard()->Footprints() ) m_footprints( aParentFrame->GetBoard()->Footprints() )
{ {
m_frame = aParentFrame;
m_Config = Kiface().KifaceSettings(); m_Config = Kiface().KifaceSettings();
InitValues(); InitValues();
m_frame = aParentFrame;
m_screen = m_frame->GetScreen();
m_FrontRefDesStart->SetValidator( wxTextValidator( wxFILTER_DIGITS ) ); m_FrontRefDesStart->SetValidator( wxTextValidator( wxFILTER_DIGITS ) );
m_BackRefDesStart->SetValidator( wxTextValidator( wxFILTER_DIGITS ) ); m_BackRefDesStart->SetValidator( wxTextValidator( wxFILTER_DIGITS ) );

View File

@ -182,7 +182,6 @@ private:
PCB_EDIT_FRAME* m_frame; PCB_EDIT_FRAME* m_frame;
FOOTPRINTS m_footprints; FOOTPRINTS m_footprints;
PCB_SCREEN* m_screen;
PCB_SELECTION m_selection; PCB_SELECTION m_selection;
std::vector<RefDesChange> m_changeArray; std::vector<RefDesChange> m_changeArray;