Some small fixes suggested by Coverity Scan

This commit is contained in:
Chris Cannam
2014-09-03 17:11:07 +01:00
parent bd7e32b34c
commit 7ad3bcd729
8 changed files with 25 additions and 8 deletions

View File

@@ -12,4 +12,5 @@ lib/*
config.status
doc/html
*.rej
cov-int
*~

View File

@@ -253,6 +253,12 @@ RubberBandPitchShifter::RubberBandPitchShifter(int sampleRate, size_t channels)
m_sampleRate(sampleRate),
m_channels(channels)
{
m_input = new float *[m_channels];
m_output = new float *[m_channels];
m_outputBuffer = new RingBuffer<float> *[m_channels];
m_scratch = new float *[m_channels];
for (size_t c = 0; c < m_channels; ++c) {
m_input[c] = 0;
@@ -276,6 +282,10 @@ RubberBandPitchShifter::~RubberBandPitchShifter()
delete m_outputBuffer[c];
delete[] m_scratch[c];
}
delete[] m_outputBuffer;
delete[] m_scratch;
delete[] m_output;
delete[] m_input;
}
LADSPA_Handle

View File

@@ -85,8 +85,8 @@ protected:
void updateFormant();
void updateFast();
float *m_input[2];
float *m_output[2];
float **m_input;
float **m_output;
float *m_latency;
float *m_cents;
float *m_semitones;
@@ -105,8 +105,8 @@ protected:
size_t m_minfill;
RubberBand::RubberBandStretcher *m_stretcher;
RubberBand::RingBuffer<float> *m_outputBuffer[2];
float *m_scratch[2];
RubberBand::RingBuffer<float> **m_outputBuffer;
float **m_scratch;
int m_sampleRate;
size_t m_channels;

View File

@@ -45,6 +45,7 @@ StretchCalculator::StretchCalculator(size_t sampleRate,
m_recovery(0),
m_prevRatio(1.0),
m_transientAmnesty(0),
m_debugLevel(0),
m_useHardPeaks(useHardPeaks)
{
// std::cerr << "StretchCalculator::StretchCalculator: useHardPeaks = " << useHardPeaks << std::endl;

View File

@@ -102,7 +102,6 @@ protected:
float adj) const;
size_t m_sampleRate;
size_t m_blockSize;
size_t m_increment;
float m_prevDf;
double m_divergence;

View File

@@ -249,6 +249,7 @@ RubberBandStretcher::Impl::ChannelData::~ChannelData()
deallocate(accumulator);
deallocate(windowAccumulator);
deallocate(fltbuf);
deallocate(dblbuf);
for (std::map<size_t, FFT *>::iterator i = ffts.begin();
i != ffts.end(); ++i) {

View File

@@ -1118,11 +1118,15 @@ RubberBandStretcher::Impl::calculateStretch()
double prdm = 0, sdm = 0;
if (!m_phaseResetDf.empty()) {
for (int i = 0; i < m_phaseResetDf.size(); ++i) prdm += m_phaseResetDf[i];
for (int i = 0; i < (int)m_phaseResetDf.size(); ++i) {
prdm += m_phaseResetDf[i];
}
prdm /= m_phaseResetDf.size();
}
if (!m_stretchDf.empty()) {
for (int i = 0; i < m_stretchDf.size(); ++i) sdm += m_stretchDf[i];
for (int i = 0; i < (int)m_stretchDf.size(); ++i) {
sdm += m_stretchDf[i];
}
sdm /= m_stretchDf.size();
}
// std::cerr << "phase reset df mean = " << prdm << ", stretch df mean = " << sdm << std::endl;

View File

@@ -130,6 +130,7 @@ template <typename T>
Scavenger<T>::Scavenger(int sec, int defaultObjectListSize) :
m_objects(ObjectTimeList(defaultObjectListSize)),
m_sec(sec),
m_lastExcess(0),
m_claimed(0),
m_scavenged(0),
m_asExcess(0)