diff data/model/FFTModel.cpp @ 608:d7f3dfe6f9a4

* solaris build fixes
author Chris Cannam
date Thu, 10 Sep 2009 18:44:45 +0000
parents 408e56d30f58
children e802e550a1f2
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Thu Sep 10 14:31:49 2009 +0000
+++ b/data/model/FFTModel.cpp	Thu Sep 10 18:44:45 2009 +0000
@@ -24,6 +24,10 @@
 
 #include <cassert>
 
+#ifndef __GNUC__
+#include <alloca.h>
+#endif
+
 FFTModel::FFTModel(const DenseTimeValueModel *model,
                    int channel,
                    WindowType windowType,
@@ -172,7 +176,11 @@
     size_t h = getHeight();
     result.reserve(h);
 
+#ifdef __GNUC__
     float magnitudes[h];
+#else
+    float *magnitudes = (float *)alloca(h * sizeof(float));
+#endif
 
     if (m_server->getMagnitudesAt(x << m_xshift, magnitudes)) {
 
@@ -256,7 +264,11 @@
         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
         getMagnitudesAt(x, values, minbin, maxbin - minbin + 1);
         for (size_t bin = ymin; bin <= ymax; ++bin) {
             if (bin == minbin || bin == maxbin) continue;