mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-11-04 16:14:00 +01: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:
		@@ -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;
 | 
			
		||||
   }
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ class KeyConfigPrefs:public PrefsPanel
 | 
			
		||||
   wxListCtrl *mList;
 | 
			
		||||
 | 
			
		||||
   CommandManager *mManager;
 | 
			
		||||
   size_t mCommandSelected;
 | 
			
		||||
   int mCommandSelected;
 | 
			
		||||
 | 
			
		||||
   wxArrayString mCats;
 | 
			
		||||
   wxArrayString mNames;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user