diff data/model/FFTModel.cpp @ 1218:6b847a59d908 msvc2015_64

MSVC build fixes
author Chris Cannam
date Tue, 18 Oct 2016 15:54:56 +0100
parents 6f7a440b6218
children d8d6d01505ed
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/data/model/FFTModel.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -24,10 +24,6 @@
 #include <cassert>
 #include <deque>
 
-#ifndef __GNUC__
-#include <alloca.h>
-#endif
-
 using namespace std;
 
 FFTModel::FFTModel(const DenseTimeValueModel *model,
@@ -360,11 +356,7 @@
         int maxbin = ymax;
         if (maxbin < getHeight() - 1) maxbin = maxbin + 1;
         const int n = maxbin - minbin + 1;
-#ifdef __GNUC__
-        float values[n];
-#else
-        float *values = (float *)alloca(n * sizeof(float));
-#endif
+        float *values = new float[n];
         getMagnitudesAt(x, values, minbin, maxbin - minbin + 1);
         for (int bin = ymin; bin <= ymax; ++bin) {
             if (bin == minbin || bin == maxbin) continue;
@@ -373,6 +365,7 @@
                 peaks.insert(bin);
             }
         }
+        delete[] values;
         return peaks;
     }