mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-03 17:19:43 +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:
parent
2d96e01b3f
commit
7cb5c6e763
@ -391,9 +391,7 @@ void KeyConfigPrefs::SetKeyForSelected( const wxString & key )
|
|||||||
|
|
||||||
void KeyConfigPrefs::OnSet(wxCommandEvent & e)
|
void KeyConfigPrefs::OnSet(wxCommandEvent & e)
|
||||||
{
|
{
|
||||||
// ANSWER-ME: mCommandSelected is unsigned, so there's no point checking whether it's < 0.
|
if ( mCommandSelected >= (int)mNames.GetCount())
|
||||||
// Should it be a signed int instead or remove that check?
|
|
||||||
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString newKey = mKey->GetValue();
|
wxString newKey = mKey->GetValue();
|
||||||
@ -416,9 +414,8 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & e)
|
|||||||
void KeyConfigPrefs::OnClear(wxCommandEvent& event)
|
void KeyConfigPrefs::OnClear(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
mKey->Clear();
|
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 >= (int)mNames.GetCount()) {
|
||||||
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetKeyForSelected( wxT("") );
|
SetKeyForSelected( wxT("") );
|
||||||
@ -504,9 +501,8 @@ void KeyConfigPrefs::OnCategory(wxCommandEvent & e)
|
|||||||
void KeyConfigPrefs::OnItemSelected(wxListEvent & e)
|
void KeyConfigPrefs::OnItemSelected(wxListEvent & e)
|
||||||
{
|
{
|
||||||
mCommandSelected = e.GetIndex();
|
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 >= (int)mNames.GetCount()) {
|
||||||
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
|
|
||||||
mKey->SetLabel(wxT(""));
|
mKey->SetLabel(wxT(""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class KeyConfigPrefs:public PrefsPanel
|
|||||||
wxListCtrl *mList;
|
wxListCtrl *mList;
|
||||||
|
|
||||||
CommandManager *mManager;
|
CommandManager *mManager;
|
||||||
size_t mCommandSelected;
|
int mCommandSelected;
|
||||||
|
|
||||||
wxArrayString mCats;
|
wxArrayString mCats;
|
||||||
wxArrayString mNames;
|
wxArrayString mNames;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user