changeset 545:be5c35d3f409

* solaris build fixes
author Chris Cannam
date Thu, 10 Sep 2009 18:44:45 +0000
parents 1dd2cddc32eb
children 24d1d1528717
files layer/Colour3DPlotLayer.cpp layer/Layer.cpp layer/SpectrogramLayer.cpp view/View.cpp widgets/PluginParameterDialog.cpp widgets/WindowShapePreview.cpp
diffstat 6 files changed, 44 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Tue Aug 18 11:01:57 2009 +0000
+++ b/layer/Colour3DPlotLayer.cpp	Thu Sep 10 18:44:45 2009 +0000
@@ -30,6 +30,10 @@
 
 #include <cassert>
 
+#ifndef __GNUC__
+#include <alloca.h>
+#endif
+
 //#define DEBUG_COLOUR_3D_PLOT_LAYER_PAINT 1
 
 
@@ -1372,7 +1376,11 @@
 
     float epsilon = 0.000001;
 
+#ifdef __GNUC__
     float sxa[w * 2];
+#else
+    float *sxa = (float *)alloca(w * 2 * sizeof(float));
+#endif
     for (int x = 0; x < w; ++x) {
 
         xf = nxf;
--- a/layer/Layer.cpp	Tue Aug 18 11:01:57 2009 +0000
+++ b/layer/Layer.cpp	Thu Sep 10 18:44:45 2009 +0000
@@ -554,7 +554,7 @@
         int xd = focusPoint.x() - cx;
         int yd = focusPoint.y() - cy;
         
-        float d = sqrt(xd * xd + yd * yd);
+        float d = sqrt(float(xd * xd + yd * yd));
         
         if (focusRectItr == m_measureRects.end() || d < frDist) {
             focusRectItr = i;
--- a/layer/SpectrogramLayer.cpp	Tue Aug 18 11:01:57 2009 +0000
+++ b/layer/SpectrogramLayer.cpp	Thu Sep 10 18:44:45 2009 +0000
@@ -45,6 +45,10 @@
 #include <cassert>
 #include <cmath>
 
+#ifndef __GNUC__
+#include <alloca.h>
+#endif
+
 //#define DEBUG_SPECTROGRAM_REPAINT 1
 
 SpectrogramLayer::SpectrogramLayer(Configuration config) :
@@ -2256,8 +2260,13 @@
         bufwid = w;
     }
 
+#ifdef __GNUC__
     int binforx[bufwid];
     float binfory[h];
+#else
+    int *binforx = (int *)alloca(bufwid * sizeof(int));
+    float *binfory = (float *)alloca(h * sizeof(float));
+#endif
 
     bool usePeaksCache = false;
 
@@ -2502,7 +2511,12 @@
     FFTModel::PeakSet peakfreqs;
 
     int px = -1, psx = -1;
+
+#ifdef __GNUC__
     float values[maxbin - minbin + 1];
+#else
+    float *values = (float *)alloca((maxbin - minbin + 1) * sizeof(float));
+#endif
 
     for (int x = 0; x < w; ++x) {
         
@@ -2642,10 +2656,17 @@
     }
 
     int psx = -1;
+
+#ifdef __GNUC__
     float autoarray[maxbin - minbin + 1];
+    float peaks[h];
+#else
+    float *autoarray = (float *)alloca((maxbin - minbin + 1) * sizeof(float));
+    float *peaks = (float *)alloca(h * sizeof(float));
+#endif
+
     const float *values = autoarray;
     DenseThreeDimensionalModel::Column c;
-    float peaks[h];
 
     for (int x = 0; x < w; ++x) {
         
--- a/view/View.cpp	Tue Aug 18 11:01:57 2009 +0000
+++ b/view/View.cpp	Thu Sep 10 18:44:45 2009 +0000
@@ -38,6 +38,8 @@
 #include <cassert>
 #include <cmath>
 
+#include <unistd.h>
+
 //#define DEBUG_VIEW_WIDGET_PAINT 1
 
 using std::cerr;
--- a/widgets/PluginParameterDialog.cpp	Tue Aug 18 11:01:57 2009 +0000
+++ b/widgets/PluginParameterDialog.cpp	Thu Sep 10 18:44:45 2009 +0000
@@ -423,7 +423,7 @@
             blockSizeCombo->addItem(QString("%1").arg(size));
             blockSizeCombo->setCurrentIndex(blockSizeCombo->count() - 1);
         }
-        blockSizeCombo->setValidator(new QIntValidator(1, int(pow(2, 18)), this));
+        blockSizeCombo->setValidator(new QIntValidator(1, int(pow(2., 18)), this));
         connect(blockSizeCombo, SIGNAL(editTextChanged(const QString &)),
                 this, SLOT(blockSizeComboChanged(const QString &)));
         windowLayout->addWidget(blockSizeCombo, 0, 1);
@@ -445,7 +445,7 @@
             incrementCombo->addItem(QString("%1").arg(increment));
             incrementCombo->setCurrentIndex(incrementCombo->count() - 1);
         }
-        incrementCombo->setValidator(new QIntValidator(1, int(pow(2, 18)), this));
+        incrementCombo->setValidator(new QIntValidator(1, int(pow(2., 18)), this));
         connect(incrementCombo, SIGNAL(editTextChanged(const QString &)),
                 this, SLOT(incrementComboChanged(const QString &)));
         windowLayout->addWidget(incrementCombo, 1, 1);
--- a/widgets/WindowShapePreview.cpp	Tue Aug 18 11:01:57 2009 +0000
+++ b/widgets/WindowShapePreview.cpp	Thu Sep 10 18:44:45 2009 +0000
@@ -26,6 +26,10 @@
 
 #include <iostream>
 
+#ifndef __GNUC__
+#include <alloca.h>
+#endif
+
 WindowShapePreview::WindowShapePreview(QWidget *parent) :
     QFrame(parent),
     m_windowType(WindowType(999))
@@ -67,7 +71,12 @@
     
     path = QPainterPath();
 
+#ifdef __GNUC__
     float acc[w];
+#else
+    float *acc = (float *)alloca(w * sizeof(float));
+#endif
+
     for (int i = 0; i < w; ++i) acc[i] = 0.f;
     for (int j = 0; j < 3; ++j) {
         for (int i = 0; i < step * 2; ++i) {