1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 16:49:41 +02:00

mCommandSelected can be set to -1, so changed to be an int. Also some casting to avoid warnings about int/unsigned mismatches.

This commit is contained in:
james.k.crook@gmail.com 2012-02-09 18:29:36 +00:00
parent 2d96e01b3f
commit 7cb5c6e763
2 changed files with 6 additions and 10 deletions

View File

@ -391,9 +391,7 @@ void KeyConfigPrefs::SetKeyForSelected( const wxString & key )
void KeyConfigPrefs::OnSet(wxCommandEvent & e)
{
// ANSWER-ME: mCommandSelected is unsigned, so there's no point checking whether it's < 0.
// Should it be a signed int instead or remove that check?
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount())
if ( mCommandSelected >= (int)mNames.GetCount())
return;
wxString newKey = mKey->GetValue();
@ -416,9 +414,8 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & e)
void KeyConfigPrefs::OnClear(wxCommandEvent& event)
{
mKey->Clear();
// ANSWER-ME: mCommandSelected is unsigned, so there's no point checking whether it's < 0.
// Should it be a signed int instead or remove that check?
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
if (mCommandSelected < 0 || mCommandSelected >= (int)mNames.GetCount()) {
return;
}
SetKeyForSelected( wxT("") );
@ -504,9 +501,8 @@ void KeyConfigPrefs::OnCategory(wxCommandEvent & e)
void KeyConfigPrefs::OnItemSelected(wxListEvent & e)
{
mCommandSelected = e.GetIndex();
// ANSWER-ME: mCommandSelected is unsigned, so there's no point checking whether it's < 0.
// Should it be a signed int instead or remove that check?
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
if (mCommandSelected < 0 || mCommandSelected >= (int)mNames.GetCount()) {
mKey->SetLabel(wxT(""));
return;
}

View File

@ -55,7 +55,7 @@ class KeyConfigPrefs:public PrefsPanel
wxListCtrl *mList;
CommandManager *mManager;
size_t mCommandSelected;
int mCommandSelected;
wxArrayString mCats;
wxArrayString mNames;