From 23f05c618c0b8b1f49c05245dd7f35100e1836c5 Mon Sep 17 00:00:00 2001 From: James Crook Date: Fri, 6 Dec 2019 11:33:22 +0000 Subject: [PATCH] Fix signed/unsigned comparison warnings. --- src/Prefs.cpp | 6 +++--- src/ProjectWindow.cpp | 2 -- src/ShuttleGui.cpp | 8 ++++---- src/SoundActivatedRecord.cpp | 1 - src/commands/SetLabelCommand.cpp | 2 +- src/tracks/labeltrack/ui/LabelTrackView.cpp | 2 +- src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp | 4 ++-- 7 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Prefs.cpp b/src/Prefs.cpp index 5f0e8c66e..44f97566d 100755 --- a/src/Prefs.cpp +++ b/src/Prefs.cpp @@ -278,7 +278,7 @@ const wxArrayStringEx &EnumValueSymbols::GetInternals() const ////////// const EnumValueSymbol &ChoiceSetting::Default() const { - if ( mDefaultSymbol >= 0 && mDefaultSymbol < mSymbols.size() ) + if ( mDefaultSymbol >= 0 && mDefaultSymbol < (long)mSymbols.size() ) return mSymbols[ mDefaultSymbol ]; static EnumValueSymbol empty; return empty; @@ -399,9 +399,9 @@ void EnumSettingBase::Migrate( wxString &value ) // Audacity. But further changes will be stored only to the NEW key // and won't be seen then. auto index = (long) FindInt( intValue ); - if ( index >= mSymbols.size() ) + if ( index >= (long)mSymbols.size() ) index = mDefaultSymbol; - if ( index >= 0 && index < mSymbols.size() ) { + if ( index >= 0 && index < (long)mSymbols.size() ) { value = mSymbols[index].Internal(); Write(value); gPrefs->Flush(); diff --git a/src/ProjectWindow.cpp b/src/ProjectWindow.cpp index dd0523c83..719e33991 100644 --- a/src/ProjectWindow.cpp +++ b/src/ProjectWindow.cpp @@ -1242,8 +1242,6 @@ void ProjectWindow::OnIconize(wxIconizeEvent &event) // void return? I don't know. mIconized = event.IsIconized(); - unsigned int i; - // VisibileProjectCount seems to be just a counter for debugging. // It's not used outside this function. auto VisibleProjectCount = std::count_if( diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 6b65db004..896527e92 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -395,7 +395,7 @@ wxChoice * ShuttleGuiBase::AddChoice( const wxString &Prompt, #endif #endif pChoice->SetName(wxStripMenuCodes(Prompt)); - if ( Selected >= 0 && Selected < choices.size() ) + if ( Selected >= 0 && Selected < (int)choices.size() ) pChoice->SetSelection( Selected ); UpdateSizers(); @@ -1499,7 +1499,7 @@ wxRadioButton * ShuttleGuiBase::TieRadioButton() wxASSERT( mRadioCount >= 0); // Did you remember to use StartRadioButtonGroup() ? EnumValueSymbol symbol; - if (mRadioCount >= 0 && mRadioCount < mRadioSymbols.size() ) + if (mRadioCount >= 0 && mRadioCount < (int)mRadioSymbols.size() ) symbol = mRadioSymbols[ mRadioCount ]; // In what follows, WrappedRef is used in read only mode, but we @@ -1976,7 +1976,7 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice( InternalChoices = transform_container(*pInternalChoices, fn); else - for ( int ii = 0; ii < Choices.size(); ++ii ) + for ( int ii = 0; ii < (int)Choices.size(); ++ii ) InternalChoices.push_back( fn( ii ) ); @@ -1989,7 +1989,7 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice( defaultIndex = make_iterator_range( *pInternalChoices ).index( Default ); else defaultIndex = Default; - if ( defaultIndex < 0 || defaultIndex >= Choices.size() ) + if ( defaultIndex < 0 || defaultIndex >= (int)Choices.size() ) defaultIndex = -1; ChoiceSetting choiceSetting{ diff --git a/src/SoundActivatedRecord.cpp b/src/SoundActivatedRecord.cpp index 4436a0b1c..a65b1ced7 100644 --- a/src/SoundActivatedRecord.cpp +++ b/src/SoundActivatedRecord.cpp @@ -48,7 +48,6 @@ SoundActivatedRecordDialog::~SoundActivatedRecordDialog() void SoundActivatedRecordDialog::PopulateOrExchange(ShuttleGui & S) { S.SetBorder(5); - int dBRange; S.StartVerticalLay(); { diff --git a/src/commands/SetLabelCommand.cpp b/src/commands/SetLabelCommand.cpp index 1ac0f958b..0cee9055e 100644 --- a/src/commands/SetLabelCommand.cpp +++ b/src/commands/SetLabelCommand.cpp @@ -76,7 +76,7 @@ bool SetLabelCommand::Apply(const CommandContext & context) for (auto lt : tracks.Any()) { const auto &labels = lt->GetLabels(); const auto nLabels = labels.size(); - if( ii >= nLabels ) + if( ii >= (int)nLabels ) ii -= nLabels; else { labelTrack = lt; diff --git a/src/tracks/labeltrack/ui/LabelTrackView.cpp b/src/tracks/labeltrack/ui/LabelTrackView.cpp index 97350d2e5..4270bf72f 100644 --- a/src/tracks/labeltrack/ui/LabelTrackView.cpp +++ b/src/tracks/labeltrack/ui/LabelTrackView.cpp @@ -844,7 +844,7 @@ void LabelTrackView::Draw( void LabelTrackView::SetSelectedIndex( int index ) { - if ( index >= 0 && index < FindLabelTrack()->GetLabels().size() ) + if ( index >= 0 && index < (int)FindLabelTrack()->GetLabels().size() ) mSelIndex = index; else mSelIndex = -1; diff --git a/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp b/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp index 9a6b6d246..7ab744cc0 100644 --- a/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp +++ b/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp @@ -133,14 +133,14 @@ struct SubViewAdjuster } ); auto index = iter - begin; auto size = mPermutation.size(); - if ( index < size ) { + if ( index < (int)size ) { yy -= top; if ( yy >= 0 && yy < HotZoneSize && index > 0 ) return { index, true }; // top hit if ( yy < height && yy >= height - HotZoneSize && // Have not yet called ModifyPermutation; dragging bottom of // bottommost view allowed only if at least one view is invisible - ( index < size - 1 || mFirstSubView > 0 ) ) + ( index < (int)size - 1 || mFirstSubView > 0 ) ) return { index, false }; // bottom hit } return { size, false }; // not hit