From 438893fb6f0e147c633132dcc67de594ce6458be Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Wed, 16 Sep 2020 17:47:30 +0100 Subject: [PATCH] Avoid some compiler warnings --- src/audiocurves/HighFrequencyAudioCurve.cpp | 4 ++-- src/audiocurves/PercussiveAudioCurve.cpp | 4 ++-- src/audiocurves/SpectralDifferenceAudioCurve.cpp | 4 ++-- src/system/Allocators.h | 16 ++++++++++++---- src/system/Thread.cpp | 12 ++++++++++-- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/audiocurves/HighFrequencyAudioCurve.cpp b/src/audiocurves/HighFrequencyAudioCurve.cpp index bae61f5..dbe3c24 100644 --- a/src/audiocurves/HighFrequencyAudioCurve.cpp +++ b/src/audiocurves/HighFrequencyAudioCurve.cpp @@ -42,7 +42,7 @@ HighFrequencyAudioCurve::reset() } float -HighFrequencyAudioCurve::processFloat(const float *R__ mag, int increment) +HighFrequencyAudioCurve::processFloat(const float *R__ mag, int) { float result = 0.0; @@ -56,7 +56,7 @@ HighFrequencyAudioCurve::processFloat(const float *R__ mag, int increment) } double -HighFrequencyAudioCurve::processDouble(const double *R__ mag, int increment) +HighFrequencyAudioCurve::processDouble(const double *R__ mag, int) { float result = 0.0; diff --git a/src/audiocurves/PercussiveAudioCurve.cpp b/src/audiocurves/PercussiveAudioCurve.cpp index c1190fb..5d3efcb 100644 --- a/src/audiocurves/PercussiveAudioCurve.cpp +++ b/src/audiocurves/PercussiveAudioCurve.cpp @@ -58,7 +58,7 @@ PercussiveAudioCurve::setFftSize(int newSize) } float -PercussiveAudioCurve::processFloat(const float *R__ mag, int increment) +PercussiveAudioCurve::processFloat(const float *R__ mag, int) { static float threshold = powf(10.f, 0.15f); // 3dB rise in square of magnitude static float zeroThresh = powf(10.f, -8); @@ -84,7 +84,7 @@ PercussiveAudioCurve::processFloat(const float *R__ mag, int increment) } double -PercussiveAudioCurve::processDouble(const double *R__ mag, int increment) +PercussiveAudioCurve::processDouble(const double *R__ mag, int) { static double threshold = pow(10., 0.15); // 3dB rise in square of magnitude static double zeroThresh = pow(10., -8); diff --git a/src/audiocurves/SpectralDifferenceAudioCurve.cpp b/src/audiocurves/SpectralDifferenceAudioCurve.cpp index cb10ee6..91fc81f 100644 --- a/src/audiocurves/SpectralDifferenceAudioCurve.cpp +++ b/src/audiocurves/SpectralDifferenceAudioCurve.cpp @@ -62,7 +62,7 @@ SpectralDifferenceAudioCurve::setFftSize(int newSize) } float -SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int increment) +SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int) { double result = 0.0; @@ -83,7 +83,7 @@ SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int increment) } double -SpectralDifferenceAudioCurve::processDouble(const double *R__ mag, int increment) +SpectralDifferenceAudioCurve::processDouble(const double *R__ mag, int) { double result = 0.0; diff --git a/src/system/Allocators.h b/src/system/Allocators.h index c431f78..2f1fbbf 100644 --- a/src/system/Allocators.h +++ b/src/system/Allocators.h @@ -271,9 +271,13 @@ T **reallocate_channels(T **ptr, { T **newptr = allocate_channels(channels, count); if (oldcount && ptr) { - v_copy_channels(newptr, ptr, channels, oldcount < count ? oldcount : count); + for (size_t c = 0; c < oldchannels && c < channels; ++c) { + for (size_t i = 0; i < oldcount && i < count; ++i) { + newptr[c][i] = ptr[c][i]; + } + } } - if (ptr) deallocate_channels(ptr, channels); + if (ptr) deallocate_channels(ptr, oldchannels); return newptr; } @@ -284,9 +288,13 @@ T **reallocate_and_zero_extend_channels(T **ptr, { T **newptr = allocate_and_zero_channels(channels, count); if (oldcount && ptr) { - v_copy_channels(newptr, ptr, channels, oldcount < count ? oldcount : count); + for (size_t c = 0; c < oldchannels && c < channels; ++c) { + for (size_t i = 0; i < oldcount && i < count; ++i) { + newptr[c][i] = ptr[c][i]; + } + } } - if (ptr) deallocate_channels(ptr, channels); + if (ptr) deallocate_channels(ptr, oldchannels); return newptr; } diff --git a/src/system/Thread.cpp b/src/system/Thread.cpp index 8d35647..eb65731 100644 --- a/src/system/Thread.cpp +++ b/src/system/Thread.cpp @@ -200,7 +200,11 @@ Mutex::trylock() } } -Condition::Condition(string name) : +Condition::Condition(string +#ifdef DEBUG_CONDITION + name +#endif + ) : m_locked(false) #ifdef DEBUG_CONDITION , m_name(name) @@ -456,7 +460,11 @@ Mutex::trylock() } } -Condition::Condition(string name) : +Condition::Condition(string +#ifdef DEBUG_CONDITION + name +#endif + ) : m_locked(false) #ifdef DEBUG_CONDITION , m_name(name)