From ee5a0db9ff13c2d88e1fb9dc5fc59e08e3ce9d91 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 24 Aug 2016 10:43:43 -0400 Subject: [PATCH] some uses of size_t --- src/WaveTrack.cpp | 2 +- src/blockfile/LegacyBlockFile.cpp | 3 ++- src/effects/AutoDuck.cpp | 4 ++-- src/effects/Compressor.cpp | 2 +- src/effects/DtmfGen.cpp | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/WaveTrack.cpp b/src/WaveTrack.cpp index eba186d1f..1c9d409f4 100644 --- a/src/WaveTrack.cpp +++ b/src/WaveTrack.cpp @@ -1429,7 +1429,7 @@ bool WaveTrack::InsertSilence(double t, double len) bool WaveTrack::Disjoin(double t0, double t1) { sampleCount minSamples = TimeToLongSamples( WAVETRACK_MERGE_POINT_TOLERANCE ); - sampleCount maxAtOnce = 1048576; + size_t maxAtOnce = 1048576; float *buffer = new float[ maxAtOnce ]; Regions regions; diff --git a/src/blockfile/LegacyBlockFile.cpp b/src/blockfile/LegacyBlockFile.cpp index 873694d61..0924db58f 100644 --- a/src/blockfile/LegacyBlockFile.cpp +++ b/src/blockfile/LegacyBlockFile.cpp @@ -298,7 +298,7 @@ BlockFilePtr LegacyBlockFile::BuildFromXML(const wxString &projDir, const wxChar sampleCount len, sampleFormat format) { wxFileNameWrapper fileName; - sampleCount summaryLen = 0; + size_t summaryLen = 0; bool noRMS = false; long nValue; @@ -324,6 +324,7 @@ BlockFilePtr LegacyBlockFile::BuildFromXML(const wxString &projDir, const wxChar else if (!wxStrcmp(attr, wxT("format")) && XMLValueChecker::IsValidSampleFormat(nValue)) format = (sampleFormat)nValue; else if (!wxStrcmp(attr, wxT("summarylen")) && (nValue > 0)) + // Note attribute "summarylen" was written as int, no need for 64 bits summaryLen = nValue; } } diff --git a/src/effects/AutoDuck.cpp b/src/effects/AutoDuck.cpp index fb1396a33..fc02860d5 100644 --- a/src/effects/AutoDuck.cpp +++ b/src/effects/AutoDuck.cpp @@ -288,7 +288,7 @@ bool EffectAutoDuck::Process() int rmsPos = 0; float rmsSum = 0; float *rmsWindow = new float[kRMSWindowSize]; - for (i = 0; i < kRMSWindowSize; i++) + for (size_t i = 0; i < kRMSWindowSize; i++) rmsWindow[i] = 0; float *buf = new float[kBufSize]; @@ -393,7 +393,7 @@ bool EffectAutoDuck::Process() WaveTrack* t = (WaveTrack*)iterTrack; - for (i = 0; i < (int)regions.GetCount(); i++) + for (size_t i = 0; i < regions.GetCount(); i++) { const AutoDuckRegion& region = regions[i]; if (ApplyDuckFade(trackNumber, t, region.t0, region.t1)) diff --git a/src/effects/Compressor.cpp b/src/effects/Compressor.cpp index 350d1a64d..87827bdde 100644 --- a/src/effects/Compressor.cpp +++ b/src/effects/Compressor.cpp @@ -366,7 +366,7 @@ bool EffectCompressor::InitPass1() DisableSecondPass(); // Find the maximum block length required for any track - sampleCount maxlen=0; + size_t maxlen = 0; SelectedTrackListOfKindIterator iter(Track::Wave, mTracks); WaveTrack *track = (WaveTrack *) iter.First(); while (track) { diff --git a/src/effects/DtmfGen.cpp b/src/effects/DtmfGen.cpp index 53fca7129..93933fc15 100644 --- a/src/effects/DtmfGen.cpp +++ b/src/effects/DtmfGen.cpp @@ -534,7 +534,7 @@ bool EffectDtmf::MakeDtmfTone(float *buffer, sampleCount len, float fs, wxChar t // generate a fade-in of duration 1/250th of second if (last == 0) { A = (fs / kFadeInOut); - for(sampleCount i = 0; i < A; i++) { + for(size_t i = 0; i < A; i++) { buffer[i] *= i/A; } } @@ -548,7 +548,7 @@ bool EffectDtmf::MakeDtmfTone(float *buffer, sampleCount len, float fs, wxChar t // protect against negative offset, which can occur if too a // small selection is made if (offset >= 0) { - for(sampleCount i = 0; i < A; i++) { + for(size_t i = 0; i < A; i++) { buffer[i + offset] *= (1 - (i / A)); } }