From 781de82d02d56ab0b73918aaa0dd860498e42592 Mon Sep 17 00:00:00 2001 From: James Crook Date: Tue, 23 Aug 2016 21:46:12 +0100 Subject: [PATCH] Workaround build breakers. Needs review. These changes fix a broken build in Windows. #include needed for min/max to be in std. decltype(+name) was declaring a const variable, that could not be incremented. Changed to auto. --- include/audacity/Types.h | 1 + src/Mix.cpp | 2 +- src/VoiceKey.cpp | 6 +++--- src/WaveTrack.cpp | 2 +- src/commands/CompareAudioCommand.cpp | 2 +- src/effects/Reverse.cpp | 2 +- src/effects/SBSMSEffect.cpp | 2 +- src/effects/SoundTouchEffect.cpp | 2 +- src/effects/StereoToMono.cpp | 2 +- src/effects/TruncSilence.cpp | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/audacity/Types.h b/include/audacity/Types.h index b212b117a..b53623987 100644 --- a/include/audacity/Types.h +++ b/include/audacity/Types.h @@ -42,6 +42,7 @@ #ifndef __AUDACITY_TYPES_H__ #define __AUDACITY_TYPES_H__ +#include #include #include diff --git a/src/Mix.cpp b/src/Mix.cpp index 3811164fb..5c130e3fa 100644 --- a/src/Mix.cpp +++ b/src/Mix.cpp @@ -476,7 +476,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache, *pos += getLen; } - for (decltype(+getLen) i = 0; i < getLen; i++) { + for (auto i = 0; i < getLen; i++) { queue[(*queueLen) + i] *= mEnvValues[i]; } diff --git a/src/VoiceKey.cpp b/src/VoiceKey.cpp index 0c5ba01e5..7a9b85e9c 100644 --- a/src/VoiceKey.cpp +++ b/src/VoiceKey.cpp @@ -853,7 +853,7 @@ double VoiceKey::TestEnergy (WaveTrack & t, sampleCount start, sampleCount len) t.Get((samplePtr)buffer,floatSample, s,block); //grab the block; //Now, go through the block and calculate energy - for(decltype(+block) i = 0; i< block; i++) + for(auto i = 0; i< block; i++) { sum += buffer[i]*buffer[i]; } @@ -903,7 +903,7 @@ double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount l //Now, go through the block and calculate zero crossings - for(decltype(+block) i = 0; i< block; i++) + for(auto i = 0; i< block; i++) { if( sgn(buffer[i]) != currentsign) { @@ -960,7 +960,7 @@ double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCo //Now, go through the block and calculate zero crossings - for(decltype(+block) i = 0; i< block; i++){ + for(auto i = 0; i< block; i++){ if( sgn(buffer[i]-lastval) != lastdirection) { directionchanges++; diff --git a/src/WaveTrack.cpp b/src/WaveTrack.cpp index 9d26cdc5e..11ba531b9 100644 --- a/src/WaveTrack.cpp +++ b/src/WaveTrack.cpp @@ -1463,7 +1463,7 @@ bool WaveTrack::Disjoin(double t0, double t1) clip->GetSamples( ( samplePtr )buffer, floatSample, start + done, numSamples ); - for( decltype(+numSamples) i = 0; i < numSamples; i++ ) + for( auto i = 0; i < numSamples; i++ ) { sampleCount curSamplePos = start + done + i; diff --git a/src/commands/CompareAudioCommand.cpp b/src/commands/CompareAudioCommand.cpp index 48d6bf044..b982360c7 100644 --- a/src/commands/CompareAudioCommand.cpp +++ b/src/commands/CompareAudioCommand.cpp @@ -116,7 +116,7 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context) mTrack0->Get((samplePtr)buff0, floatSample, position, block); mTrack1->Get((samplePtr)buff1, floatSample, position, block); - for (decltype(+block) buffPos = 0; buffPos < block; ++buffPos) + for (auto buffPos = 0; buffPos < block; ++buffPos) { if (CompareSample(buff0[buffPos], buff1[buffPos]) > errorThreshold) { diff --git a/src/effects/Reverse.cpp b/src/effects/Reverse.cpp index d0ddebb65..69cbeb5ff 100644 --- a/src/effects/Reverse.cpp +++ b/src/effects/Reverse.cpp @@ -235,7 +235,7 @@ bool EffectReverse::ProcessOneClip(int count, WaveTrack *track, track->Get((samplePtr)buffer1, floatSample, first, block); track->Get((samplePtr)buffer2, floatSample, second, block); - for (decltype(+block) i = 0; i < block; i++) { + for (auto i = 0; i < block; i++) { tmp = buffer1[i]; buffer1[i] = buffer2[block-i-1]; buffer2[block-i-1] = tmp; diff --git a/src/effects/SBSMSEffect.cpp b/src/effects/SBSMSEffect.cpp index 595ff5587..44d851095 100644 --- a/src/effects/SBSMSEffect.cpp +++ b/src/effects/SBSMSEffect.cpp @@ -108,7 +108,7 @@ long resampleCB(void *cb_data, SBSMSFrame *data) r->rightTrack->Get((samplePtr)(r->rightBuffer), floatSample, r->offset, blockSize); // convert to sbsms audio format - for(decltype(+blockSize) i=0; ibuf[i][0] = r->leftBuffer[i]; r->buf[i][1] = r->rightBuffer[i]; } diff --git a/src/effects/SoundTouchEffect.cpp b/src/effects/SoundTouchEffect.cpp index 6db19d725..e1e36b7d2 100644 --- a/src/effects/SoundTouchEffect.cpp +++ b/src/effects/SoundTouchEffect.cpp @@ -291,7 +291,7 @@ bool EffectSoundTouch::ProcessStereo(WaveTrack* leftTrack, WaveTrack* rightTrack rightTrack->Get((samplePtr)(rightBuffer), floatSample, sourceSampleCount, blockSize); // Interleave into soundTouchBuffer. - for (decltype(+blockSize) index = 0; index < blockSize; index++) { + for (auto index = 0; index < blockSize; index++) { soundTouchBuffer[index*2] = leftBuffer[index]; soundTouchBuffer[(index*2)+1] = rightBuffer[index]; } diff --git a/src/effects/StereoToMono.cpp b/src/effects/StereoToMono.cpp index b79d63d97..25f9c925a 100644 --- a/src/effects/StereoToMono.cpp +++ b/src/effects/StereoToMono.cpp @@ -145,7 +145,7 @@ bool EffectStereoToMono::ProcessOne(int count) bResult &= mLeftTrack->Get((samplePtr)leftBuffer, floatSample, index, idealBlockLen); bResult &= mRightTrack->Get((samplePtr)rightBuffer, floatSample, index, idealBlockLen); const auto limit = limitSampleBufferSize( idealBlockLen, mEnd - index ); - for (decltype(+limit) i = 0; i < limit; ++i) { + for (auto i = 0; i < limit; ++i) { index++; curLeftFrame = leftBuffer[i]; curRightFrame = rightBuffer[i]; diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index dd554593e..deab7f661 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -630,7 +630,7 @@ bool EffectTruncSilence::Analyze(RegionList& silenceList, wt->Get((samplePtr)(buffer), floatSample, *index, count); // Look for silenceList in current block - for (decltype(+count) i = 0; i < count; ++i) { + for (auto i = 0; i < count; ++i) { if (inputLength && ((outLength >= previewLen) || (outLength > wt->TimeToLongSamples(*minInputLength)))) { *inputLength = wt->LongSamplesToTime(*index + i) - wt->LongSamplesToTime(start); break;