changeset 14:de970142809f tip

Fix some warnings
author Chris Cannam
date Wed, 10 Jul 2019 10:39:57 +0100
parents 456842723db6
children
files ConstrainedHarmonicPeak.cpp
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ConstrainedHarmonicPeak.cpp	Thu Aug 20 16:06:09 2015 +0100
+++ b/ConstrainedHarmonicPeak.cpp	Wed Jul 10 10:39:57 2019 +0100
@@ -26,6 +26,7 @@
 
 #include <cmath>
 #include <cstdio>
+#include <climits>
 
 using std::cerr;
 using std::endl;
@@ -158,7 +159,7 @@
     } else if (identifier == "maxfreq") {
 	return m_maxFreq;
     } else if (identifier == "harmonics") {
-	return m_harmonics;
+	return float(m_harmonics);
     }
     return 0;
 }
@@ -189,7 +190,7 @@
 }
 
 void
-ConstrainedHarmonicPeak::selectProgram(string name)
+ConstrainedHarmonicPeak::selectProgram(string)
 {
 }
 
@@ -211,7 +212,7 @@
 }
 
 bool
-ConstrainedHarmonicPeak::initialise(size_t channels, size_t stepSize, size_t blockSize)
+ConstrainedHarmonicPeak::initialise(size_t channels, size_t, size_t blockSize)
 {
     if (channels < getMinChannelCount() ||
 	channels > getMaxChannelCount()) {
@@ -221,7 +222,11 @@
 	return false;
     }
 
-    m_fftSize = blockSize;
+    if (blockSize > INT_MAX) {
+        return false; // arf
+    }
+    
+    m_fftSize = int(blockSize);
 
     return true;
 }
@@ -261,7 +266,7 @@
 }
 
 ConstrainedHarmonicPeak::FeatureSet
-ConstrainedHarmonicPeak::process(const float *const *inputBuffers, Vamp::RealTime timestamp)
+ConstrainedHarmonicPeak::process(const float *const *inputBuffers, Vamp::RealTime)
 {
     FeatureSet fs;
 
@@ -307,8 +312,8 @@
 
     // bin freq is bin * samplerate / fftsize
 
-    int minbin = int(floor((m_minFreq * m_fftSize) / m_inputSampleRate));
-    int maxbin = int(ceil((m_maxFreq * m_fftSize) / m_inputSampleRate));
+    int minbin = int(floor((double(m_minFreq) * m_fftSize) / m_inputSampleRate));
+    int maxbin = int(ceil((double(m_maxFreq) * m_fftSize) / m_inputSampleRate));
     if (minbin > hs) minbin = hs;
     if (maxbin > hs) maxbin = hs;
     if (maxbin <= minbin) return fs;
@@ -361,7 +366,7 @@
     }
 
     Feature f;
-    f.values.push_back(freq);
+    f.values.push_back(float(freq));
     fs[0].push_back(f);
 
     return fs;