changeset 1218:6b847a59d908 msvc2015_64

MSVC build fixes
author Chris Cannam
date Tue, 18 Oct 2016 15:54:56 +0100
parents 046f05fa31f3
children 794b64e62e58
files base/Scavenger.h data/fileio/FileSource.cpp data/fileio/MP3FileReader.cpp data/midi/MIDIInput.cpp data/model/FFTModel.cpp data/model/ReadOnlyWaveFileModel.cpp data/model/SparseModel.h data/osc/OSCQueue.cpp plugin/DSSIPluginFactory.cpp plugin/LADSPAPluginFactory.cpp plugin/api/alsa/seq_event.h svcore.pro system/System.cpp system/System.h
diffstat 14 files changed, 31 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/base/Scavenger.h	Tue Oct 18 14:04:06 2016 +0100
+++ b/base/Scavenger.h	Tue Oct 18 15:54:56 2016 +0100
@@ -26,7 +26,6 @@
 
 #include <vector>
 #include <list>
-#include <sys/time.h>
 #include <QMutex>
 #include <iostream>
 
--- a/data/fileio/FileSource.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/data/fileio/FileSource.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -30,7 +30,7 @@
 #include <iostream>
 #include <cstdlib>
 
-#include <unistd.h>
+//#include <unistd.h>
 
 //#define DEBUG_FILE_SOURCE 1
 
--- a/data/fileio/MP3FileReader.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/data/fileio/MP3FileReader.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -27,7 +27,7 @@
 #include <iostream>
 
 #include <cstdlib>
-#include <unistd.h>
+//#include <unistd.h>
 
 #ifdef HAVE_ID3TAG
 #include <id3tag.h>
@@ -37,6 +37,11 @@
 
 #include <QFileInfo>
 
+#ifdef _MSC_VER
+#include <io.h>
+#define open _open
+#endif
+
 MP3FileReader::MP3FileReader(FileSource source, DecodeMode decodeMode, 
                              CacheMode mode, sv_samplerate_t targetRate,
                              bool normalised,
--- a/data/midi/MIDIInput.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/data/midi/MIDIInput.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -17,7 +17,7 @@
 
 #include "rtmidi/RtMidi.h"
 
-#include <unistd.h>
+//#include <unistd.h>
 
 MIDIInput::MIDIInput(QString name, FrameTimer *timer) :
     m_rtmidi(),
--- 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;
     }
 
--- a/data/model/ReadOnlyWaveFileModel.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/data/model/ReadOnlyWaveFileModel.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -26,7 +26,7 @@
 #include <QTextStream>
 
 #include <iostream>
-#include <unistd.h>
+//#include <unistd.h>
 #include <cmath>
 #include <sndfile.h>
 
--- a/data/model/SparseModel.h	Tue Oct 18 14:04:06 2016 +0100
+++ b/data/model/SparseModel.h	Tue Oct 18 15:54:56 2016 +0100
@@ -20,6 +20,7 @@
 #include "TabularModel.h"
 #include "base/Command.h"
 #include "base/RealTime.h"
+#include "system/System.h"
 
 #include <iostream>
 
--- a/data/osc/OSCQueue.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/data/osc/OSCQueue.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -23,12 +23,13 @@
 #include "base/Profiler.h"
 
 #include <iostream>
-#include <unistd.h>
 
 #define OSC_MESSAGE_QUEUE_SIZE 1023
 
 #ifdef HAVE_LIBLO
 
+#include <unistd.h>
+
 void
 OSCQueue::oscError(int num, const char *msg, const char *path)
 {
--- a/plugin/DSSIPluginFactory.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/plugin/DSSIPluginFactory.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -225,7 +225,7 @@
         }
 
 #ifdef _WIN32
-        char *pfiles = getenv("ProgramFiles");
+        const char *pfiles = getenv("ProgramFiles");
         if (!pfiles) pfiles = "C:\\Program Files";
         {
         std::string::size_type f;
--- a/plugin/LADSPAPluginFactory.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/plugin/LADSPAPluginFactory.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -579,7 +579,7 @@
         }
 
 #ifdef _WIN32
-        char *pfiles = getenv("ProgramFiles");
+        const char *pfiles = getenv("ProgramFiles");
         if (!pfiles) pfiles = "C:\\Program Files";
         {
         std::string::size_type f;
--- a/plugin/api/alsa/seq_event.h	Tue Oct 18 14:04:06 2016 +0100
+++ b/plugin/api/alsa/seq_event.h	Tue Oct 18 15:54:56 2016 +0100
@@ -321,7 +321,11 @@
 typedef struct snd_seq_ev_ext {
 	unsigned int len;		/**< length of data */
 	void *ptr;			/**< pointer to data (note: can be 64-bit) */
-} __attribute__((packed)) snd_seq_ev_ext_t;
+}
+#ifdef __GNUC__
+__attribute__((packed))
+#endif
+snd_seq_ev_ext_t;
 
 /** Instrument cluster type */
 typedef unsigned int snd_seq_instr_cluster_t;
--- a/svcore.pro	Tue Oct 18 14:04:06 2016 +0100
+++ b/svcore.pro	Tue Oct 18 15:54:56 2016 +0100
@@ -33,7 +33,8 @@
         DEFINES += HAVE_COREAUDIO
     }
     win32-msvc* {
-        DEFINES += NOMINMAX
+        DEFINES += NOMINMAX _USE_MATH_DEFINES
+        DEFINES -= HAVE_LIBLO
     }
 }
 
--- a/system/System.cpp	Tue Oct 18 14:04:06 2016 +0100
+++ b/system/System.cpp	Tue Oct 18 15:54:56 2016 +0100
@@ -56,12 +56,12 @@
 
 extern "C" {
 
-/* usleep is now in mingw
+#ifdef _MSC_VER
 void usleep(unsigned long usec)
 {
     ::Sleep(usec / 1000);
 }
-*/
+#endif
 
 int gettimeofday(struct timeval *tv, void *tz)
 {
@@ -119,7 +119,7 @@
     DWORDLONG ullAvailVirtual;
     DWORDLONG ullAvailExtendedVirtual;
 } lMEMORYSTATUSEX;
-typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
+typedef BOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
 #endif
 
 void
@@ -277,7 +277,7 @@
 #ifdef _WIN32
 extern void SystemMemoryBarrier()
 {
-#ifdef __MSVC__
+#ifdef _MSC_VER
     MemoryBarrier();
 #else /* mingw */
     LONG Barrier = 0;
--- a/system/System.h	Tue Oct 18 14:04:06 2016 +0100
+++ b/system/System.h	Tue Oct 18 15:54:56 2016 +0100
@@ -65,9 +65,11 @@
 #endif
 
 extern "C" {
-/* usleep is now in mingw
+
+#ifdef _MSC_VER
 void usleep(unsigned long usec);
-*/
+#endif
+
 int gettimeofday(struct timeval *p, void *tz);
 }