Fix a few compil minor warnings and Coverity minor issues

This commit is contained in:
jean-pierre charras 2020-03-22 09:45:51 +01:00
parent 8245398a3e
commit 4d9d1a5380
7 changed files with 14 additions and 8 deletions

View File

@ -680,7 +680,7 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
if( manager ) if( manager )
static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel ); static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel );
for( int i = 0; i < book->GetPageCount(); ++i ) for( size_t i = 0; i < book->GetPageCount(); ++i )
book->GetPage( i )->Layout(); book->GetPage( i )->Layout();
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )

View File

@ -69,7 +69,7 @@ MARKER_BASE::MARKER_BASE( int aScalingFactor, RC_ITEM* aItem, TYPEMARKER aType )
wxPoint start( point_shape->x, point_shape->y ); wxPoint start( point_shape->x, point_shape->y );
wxPoint end = start; wxPoint end = start;
for( int ii = 1; ii < CORNERS_COUNT; ii++ ) for( unsigned ii = 1; ii < CORNERS_COUNT; ii++ )
{ {
++point_shape; ++point_shape;
start.x = std::min( start.x, point_shape->x); start.x = std::min( start.x, point_shape->x);

View File

@ -131,6 +131,9 @@ public:
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ); auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxASSERT( cfg ); wxASSERT( cfg );
m_allow_rejustify = false;
m_align_to_grid = true;
if( cfg ) if( cfg )
{ {
m_allow_rejustify = cfg->m_AutoplaceFields.allow_rejustify; m_allow_rejustify = cfg->m_AutoplaceFields.allow_rejustify;

View File

@ -884,7 +884,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::AddField( const wxString& aName,
wxVector<wxVariant> fieldsCtrlRow; wxVector<wxVariant> fieldsCtrlRow;
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ); auto cfg = static_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
bool show = defaultShow; bool show = defaultShow;
bool sort_by = defaultSortBy; bool sort_by = defaultSortBy;
@ -932,6 +932,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames()
// Force References to always be shown // Force References to always be shown
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ); auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxASSERT( cfg );
cfg->m_FieldEditorPanel.fields_show["Reference"] = true; cfg->m_FieldEditorPanel.fields_show["Reference"] = true;
// *DO NOT* use translated mandatory field names: // *DO NOT* use translated mandatory field names:
@ -986,7 +987,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnAddField( wxCommandEvent& event )
std::string key( fieldName.ToUTF8() ); std::string key( fieldName.ToUTF8() );
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ); auto cfg = static_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
cfg->m_FieldEditorPanel.fields_show[key] = true; cfg->m_FieldEditorPanel.fields_show[key] = true;
AddField( fieldName, true, false ); AddField( fieldName, true, false );
@ -1006,7 +1007,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnAddField( wxCommandEvent& event )
void DIALOG_FIELDS_EDITOR_GLOBAL::OnColumnItemToggled( wxDataViewEvent& event ) void DIALOG_FIELDS_EDITOR_GLOBAL::OnColumnItemToggled( wxDataViewEvent& event )
{ {
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ); auto cfg = static_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxDataViewItem item = event.GetItem(); wxDataViewItem item = event.GetItem();
int row = m_fieldsCtrl->ItemToRow( item ); int row = m_fieldsCtrl->ItemToRow( item );

View File

@ -148,7 +148,7 @@ void PANEL_SETUP_PINMAP::ReBuildMatrixPanel()
wxPoint txtpos; wxPoint txtpos;
txtpos.x = x + (bitmap_size.x / 2); txtpos.x = x + (bitmap_size.x / 2);
txtpos.y = y - text_height; txtpos.y = y - text_height;
WX_ANGLE_TEXT* txt = new WX_ANGLE_TEXT( m_matrixPanel, wxID_ANY, CommentERC_V[ii], new WX_ANGLE_TEXT( m_matrixPanel, wxID_ANY, CommentERC_V[ii],
txtpos, 450 ); txtpos, 450 );
} }

View File

@ -309,6 +309,7 @@ void GERBVIEW_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
EDA_DRAW_FRAME::LoadSettings( aCfg ); EDA_DRAW_FRAME::LoadSettings( aCfg );
GERBVIEW_SETTINGS* cfg = dynamic_cast<GERBVIEW_SETTINGS*>( aCfg ); GERBVIEW_SETTINGS* cfg = dynamic_cast<GERBVIEW_SETTINGS*>( aCfg );
wxCHECK( cfg, /*void*/ );
SetElementVisibility( LAYER_WORKSHEET, cfg->m_Appearance.show_border_and_titleblock ); SetElementVisibility( LAYER_WORKSHEET, cfg->m_Appearance.show_border_and_titleblock );
@ -330,6 +331,7 @@ void GERBVIEW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
EDA_DRAW_FRAME::SaveSettings( aCfg ); EDA_DRAW_FRAME::SaveSettings( aCfg );
GERBVIEW_SETTINGS* cfg = dynamic_cast<GERBVIEW_SETTINGS*>( aCfg ); GERBVIEW_SETTINGS* cfg = dynamic_cast<GERBVIEW_SETTINGS*>( aCfg );
wxCHECK( cfg, /*void*/ );
cfg->m_Appearance.page_type = GetPageSettings().GetType(); cfg->m_Appearance.page_type = GetPageSettings().GetType();
cfg->m_Appearance.show_border_and_titleblock = m_showBorderAndTitleBlock; cfg->m_Appearance.show_border_and_titleblock = m_showBorderAndTitleBlock;

View File

@ -745,7 +745,7 @@ void PCB_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
EDA_DRAW_FRAME::SaveSettings( aCfg ); EDA_DRAW_FRAME::SaveSettings( aCfg );
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg ); auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
wxASSERT( cfg ); wxCHECK( cfg, /*void*/ );
cfg->m_UserGrid.size_x = To_User_Unit( m_userUnits, m_UserGridSize.x ); cfg->m_UserGrid.size_x = To_User_Unit( m_userUnits, m_UserGridSize.x );
cfg->m_UserGrid.size_y = To_User_Unit( m_userUnits, m_UserGridSize.y ); cfg->m_UserGrid.size_y = To_User_Unit( m_userUnits, m_UserGridSize.y );