Browse Source

Fix a number of signed/unsigned comparisons

pull/16/head
Seth Hillbrand 6 years ago
parent
commit
a02d8a5993
  1. 7
      common/eda_draw_frame.cpp
  2. 3
      common/tool/common_tools.cpp
  3. 2
      common/tool/grid_menu.cpp
  4. 2
      eeschema/dialogs/dialog_set_grid.cpp

7
common/eda_draw_frame.cpp

@ -241,7 +241,8 @@ void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
int idx = config()->m_Window.grid.last_size_idx; int idx = config()->m_Window.grid.last_size_idx;
if( idx >= 0 && idx < m_gridSelectBox->GetCount() && idx != m_gridSelectBox->GetSelection() )
if( idx >= 0 && idx < int( m_gridSelectBox->GetCount() )
&& idx != m_gridSelectBox->GetSelection() )
m_gridSelectBox->SetSelection( idx ); m_gridSelectBox->SetSelection( idx );
} }
@ -261,14 +262,14 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
int idx = m_gridSelectBox->GetCurrentSelection(); int idx = m_gridSelectBox->GetCurrentSelection();
if( idx == m_gridSelectBox->GetCount() - 2 )
if( idx == int( m_gridSelectBox->GetCount() ) - 2 )
{ {
// wxWidgets will check the separator, which we don't want. // wxWidgets will check the separator, which we don't want.
// Re-check the current grid. // Re-check the current grid.
wxUpdateUIEvent dummy; wxUpdateUIEvent dummy;
OnUpdateSelectGrid( dummy ); OnUpdateSelectGrid( dummy );
} }
else if( idx == m_gridSelectBox->GetCount() - 1 )
else if( idx == int( m_gridSelectBox->GetCount() ) - 1 )
{ {
// wxWidgets will check the Grid Settings... entry, which we don't want. // wxWidgets will check the Grid Settings... entry, which we don't want.
// Re-check the current grid. // Re-check the current grid.

3
common/tool/common_tools.cpp

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014-2016 CERN * Copyright (C) 2014-2016 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -355,7 +356,7 @@ int COMMON_TOOLS::GridNext( const TOOL_EVENT& aEvent )
{ {
int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx; int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
if( currentGrid + 1 < m_grids.size() )
if( currentGrid + 1 < int( m_grids.size() ) )
currentGrid++; currentGrid++;
return OnGridChanged(); return OnGridChanged();

2
common/tool/grid_menu.cpp

@ -63,7 +63,7 @@ OPT_TOOL_EVENT GRID_MENU::eventHandler( const wxMenuEvent& aEvent )
void GRID_MENU::update() void GRID_MENU::update()
{ {
APP_SETTINGS_BASE* settings = m_parent->config(); APP_SETTINGS_BASE* settings = m_parent->config();
int current = settings->m_Window.grid.last_size_idx;
unsigned int current = settings->m_Window.grid.last_size_idx;
wxArrayString gridsList; wxArrayString gridsList;
BuildChoiceList( &gridsList, settings, m_parent->GetUserUnits() != EDA_UNITS::INCHES ); BuildChoiceList( &gridsList, settings, m_parent->GetUserUnits() != EDA_UNITS::INCHES );

2
eeschema/dialogs/dialog_set_grid.cpp

@ -60,7 +60,7 @@ bool DIALOG_SET_GRID::TransferDataToWindow()
for( const wxString& grid : grids ) for( const wxString& grid : grids )
m_choiceGridSize->Append( grid ); m_choiceGridSize->Append( grid );
if( idx >= 0 && idx < m_choiceGridSize->GetCount() )
if( idx >= 0 && idx < int( m_choiceGridSize->GetCount() ) )
m_choiceGridSize->SetSelection( idx ); m_choiceGridSize->SetSelection( idx );
return true; return true;

Loading…
Cancel
Save