On Thu, Jan 22, 2009 at 3:41 PM, Nick Guenther <[email protected]> wrote:
> The build script -D'd __MACX__ and a bunch of source files used it,
> which is silly when Apple's gcc defines __APPLE__. The patch below
> fixes this.
>
> Also, there's a bunch of places in the code that use __WIN__ and
> there's other places that use __WIN32__. I *think* __WIN32__ is the
> canonical #define. Both are defined by the SConscript, though. I'm
> going to clean these up but I'm not entirely sure which to standardize
> on. Also, the sconscript line that makes __WIN__ reads
> env.Append(CXXFLAGS = '-DWIN32 -D__WIN__ -DUNICODE -D_WINDOWS') #for 
> soundtouch
> but I don't see where this is important. Also there's Q_WS_WIN which I
> am guessing is a Qt #define.
>
> FURTHER some places use __UNIX__ and some places use __LINUX__. I'm
> planning to add __OpenBSD__ too. What should we do about all this?
>
>[patch snipped]



Whoo, windows patch done. I've killed the other three #defines there,
and have replaced __WIN__ with __WIN32__. I don't have a Windows
environment, so someone pleaseplasepaslepaslepalspela test it.

Oh, the files in lib/soundtouch use WIN32 a bit, and the cmetrics code
uses it a lot, so I've left that one in (for now?).

Index: lib/libsamplerate/config.h
===================================================================
--- lib/libsamplerate/config.h  (revision 2471)
+++ lib/libsamplerate/config.h  (working copy)
@@ -3,7 +3,7 @@

 // Merges between win32 and linux version by Tue

-#ifdef __WIN__
+#ifdef __WIN32__

 #pragma warning(disable: 4305)

Index: src/mididevicehandler.cpp
===================================================================
--- src/mididevicehandler.cpp   (revision 2471)
+++ src/mididevicehandler.cpp   (working copy)
@@ -35,7 +35,7 @@
 #ifdef __LINUX__
 #include "powermatelinux.h"
 #endif
-#ifdef __WIN__
+#ifdef __WIN32__
 #include "powermatewin.h"
 #endif

Index: src/dlgprefmidi.cpp
===================================================================
--- src/dlgprefmidi.cpp (revision 2471)
+++ src/dlgprefmidi.cpp (working copy)
@@ -69,7 +69,7 @@
 #ifdef __LINUX__
 #include "powermatelinux.h"
 #endif
-#ifdef __WIN__
+#ifdef __WIN32__
 #include "powermatewin.h"
 #endif

@@ -178,7 +178,7 @@
     m_pPowerMate1 = new PowerMateLinux();
     m_pPowerMate2 = new PowerMateLinux();
 #endif
-#ifdef __WIN__
+#ifdef __WIN32__
 //    m_pPowerMate1 = new PowerMateWin();
 //    m_pPowerMate2 = new PowerMateWin();
 #endif
@@ -430,7 +430,7 @@

     // Close MIDI
 #ifndef __LINUX__
-#ifndef __WIN__
+#ifndef __WIN32__
     // Deadly hack attack
     m_pMidi->devClose();
 #endif
Index: src/soundsourceoggvorbis.cpp
===================================================================
--- src/soundsourceoggvorbis.cpp        (revision 2471)
+++ src/soundsourceoggvorbis.cpp        (working copy)
@@ -17,12 +17,12 @@
 #include "trackinfoobject.h"
 #include "soundsourceoggvorbis.h"
 #include <QtDebug>
-#ifdef __WIN__
+#ifdef __WIN32__
 #include <io.h>
 #include <fcntl.h>
 #endif

-#ifdef __MACX__
+#ifdef __APPLE__
 #ifdef __i386
 #define OV_ENDIAN_ARG 0
 #else
@@ -52,7 +52,7 @@
 {
     QByteArray qBAFilename = qFilename.toUtf8();

-#ifdef __WIN__
+#ifdef __WIN32__
     if(ov_fopen(qBAFilename.data(), &vf) < 0) {
         qDebug() << "oggvorbis: Input does not appear to be an Ogg bitstream.";
         filelength = 0;
@@ -190,7 +190,7 @@
     vorbis_comment *comment = NULL;
     OggVorbis_File vf;

-#ifdef __WIN__
+#ifdef __WIN32__
     if (ov_fopen(qBAFilename.data(), &vf) < 0) {
         qDebug() << "oggvorbis: Input does not appear to be an Ogg
bitstream.";
         return ERR;
Index: src/mixxx.vcproj
===================================================================
--- src/mixxx.vcproj    (revision 2471)
+++ src/mixxx.vcproj    (working copy)
@@ -45,7 +45,7 @@
                                AdditionalOptions="-Zm200 -GX -EHsc -EHsc 
-w34100 -w34189"
                                Optimization="2"
                                
AdditionalIncludeDirectories="..\lib\vbrheadersdk,..\lib\kissfft,..\lib\soundtouch,..\lib\soundtouch,..\..\mixxx-winlib,..\lib,.,$(QTDIR)\include,.,D:\qt\mkspecs\win32-msvc2005"
-                               
PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,__PORTAUDIO__,__WINMIDI__,__SNDFILE__,__WIN__,TEMPORAL,SETTINGS_FILE=\&quot;mixxx.cfg\&quot;,TRACK_FILE=\&quot;mixxxtrack.xml\&quot;,__NO_INTTYPES__,T_MSVC,QT_THREAD_SUPPORT,NDEBUG,QT_NO_DEBUG"
+                               
PreprocessorDefinitions="WIN32,__PORTAUDIO__,__WINMIDI__,__SNDFILE__,__WIN32__,TEMPORAL,SETTINGS_FILE=\&quot;mixxx.cfg\&quot;,TRACK_FILE=\&quot;mixxxtrack.xml\&quot;,__NO_INTTYPES__,T_MSVC,QT_THREAD_SUPPORT,NDEBUG,QT_NO_DEBUG"
                                GeneratePreprocessedFile="0"
                                MinimalRebuild="true"
                                ExceptionHandling="1"
@@ -141,7 +141,7 @@
                                AdditionalOptions="-Zm200 -GX -EHsc -EHsc 
-w34100 -w34189"
                                Optimization="4"
                                
AdditionalIncludeDirectories="..\lib\vbrheadersdk,..\lib\kissfft,..\lib\soundtouch,..\lib\soundtouch,..\..\mixxx-winlib,..\lib,.,$(QTDIR)\include,.,D:\qt\mkspecs\win32-msvc2005"
-                               
PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,__PORTAUDIO__,__WINMIDI__,__SNDFILE__,__WIN__,TEMPORAL,SETTINGS_FILE=\&quot;mixxx.cfg\&quot;,TRACK_FILE=\&quot;mixxxtrack.xml\&quot;,__NO_INTTYPES__,T_MSVC,QT_THREAD_SUPPORT"
+                               
PreprocessorDefinitions="WIN32,__PORTAUDIO__,__WINMIDI__,__SNDFILE__,__WIN32__,TEMPORAL,SETTINGS_FILE=\&quot;mixxx.cfg\&quot;,TRACK_FILE=\&quot;mixxxtrack.xml\&quot;,__NO_INTTYPES__,T_MSVC,QT_THREAD_SUPPORT"
                                GeneratePreprocessedFile="0"
                                MinimalRebuild="true"
                                ExceptionHandling="1"
Index: src/configobject.cpp
===================================================================
--- src/configobject.cpp        (revision 2471)
+++ src/configobject.cpp        (working copy)
@@ -24,11 +24,11 @@
 #include "cmetrics.h"
 #endif

-#ifdef __WIN__
+#ifdef __WIN32__
 #include <windows.h>
 #endif

-#ifdef __MACX__
+#ifdef __APPLE__
 #include <CoreFoundation/CoreFoundation.h>
 #endif

@@ -677,13 +677,13 @@
         qConfigPath = UNIX_SHARE_PATH;
     }
 #endif
-#ifdef __WIN__
+#ifdef __WIN32__
     // On Windows, set the config dir relative to the application dir
     char * str = new char[200];
     GetModuleFileName(NULL, (WCHAR *)str, 200);
     qConfigPath = QFileInfo(str).dirPath();
 #endif
-#ifdef __MACX__
+#ifdef __APPLE__
     // Set the path relative to the bundle directory
     CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
     CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef,
kCFURLPOSIXPathStyle);
Index: src/SConscript
===================================================================
--- src/SConscript      (revision 2471)
+++ src/SConscript      (working copy)
@@ -506,7 +506,7 @@
        env.Append(CXXFLAGS = '-DTEMPORAL -D__UNIX__ -D__LINUX__
-DBPMSCHEME_FILE=\\".mixxxbpmscheme.xml\\"
-DSETTINGS_FILE=\\".mixxx.cfg\\" -DTRACK_FILE=\\".mixxxtrack.xml\\"')
        env.Append(CXXFLAGS = '-DUNIX_SHARE_PATH=\\"' +
ARGUMENTS.get('prefix', '/usr/local') + '/share/mixxx\\"')
 elif platform == 'osx':
-       env.Append(CXXFLAGS = '-D__MACX__
-DBPMSCHEME_FILE=\\".mixxxbpmscheme.xml\\"
-DSETTINGS_FILE=\\".mixxx.cfg\\" -DTRACK_FILE=\\".mixxxtrack.xml\\"')
+       env.Append(CXXFLAGS = '-DBPMSCHEME_FILE=\\".mixxxbpmscheme.xml\\"
-DSETTINGS_FILE=\\".mixxx.cfg\\" -DTRACK_FILE=\\".mixxxtrack.xml\\"')
 elif platform == 'win32':
        env.Append(CXXFLAGS = '-D__WIN32__
-DBPMSCHEME_FILE=\\"mixxxbpmschemes.xml\\"
-DSETTINGS_FILE=\\"mixxx.cfg\\" -DTRACK_FILE=\\"mixxxtrack.xml\\"')

@@ -549,8 +549,8 @@
        env.Append(CCFLAGS = Split(""" -pipe -Wall -W -g -D_REENTRANT """)) # 
omghax
        env.Append(LINKFLAGS = Split(""" -pipe -Wall -W -g 
-Wl,-rpath,$QTDIR/lib"""))
 if platform == 'win32':
-       env.Append(CXXFLAGS = '-DWIN32 -D__WIN__ -DUNICODE -D_WINDOWS') #for
soundtouch
-       env.Append(CCFLAGS  = '-DWIN32 -D__WIN__ -DUNICODE -D_WINDOWS') #for
soundtouch
+       env.Append(CXXFLAGS = '-DWIN32') #for soundtouch
+       env.Append(CCFLAGS  = '-DWIN32') #for soundtouch

 #Uic these guys (they're moc'd automatically after this) - Generates
the code for the QT UI forms
 env.Uic4('dlgpreferencesdlg.ui')
Index: src/enginespectralback.h
===================================================================
--- src/enginespectralback.h    (revision 2471)
+++ src/enginespectralback.h    (working copy)
@@ -12,14 +12,13 @@

 #include "engineobject.h"
 #include <math.h>
-#ifndef __MACX__
+#ifdef __APPLE__
+#include <fftw.h>
+#include <rfftw.h>
+#else
 #include <sfftw.h>
 #include <srfftw.h>
 #endif
-#ifdef __MACX__
-#include <fftw.h>
-#include <rfftw.h>
-#endif

 /**
   * Perfoms an inverse FFT on data in polar coordinates.
Index: src/old/wvisualwaveform.cpp
===================================================================
--- src/old/wvisualwaveform.cpp (revision 2471)
+++ src/old/wvisualwaveform.cpp (working copy)
@@ -34,7 +34,7 @@

     installEventFilter(this);

-#ifdef __MACX__
+#ifdef __APPLE__
     // Hack to reduce load in GUI thread. This makes the system behave
     // "correctly" on MacOS X, where it would otherwise stall the system
     // for some seconds now and then.
@@ -44,7 +44,7 @@
     //I'm going to experiment a bit with the timings - Albert:
     m_iTimerID = startTimer(30);
 #endif
-#ifdef __WIN__
+#ifdef __WIN32__
     m_iTimerID = startTimer(30);
 #endif
 #ifdef __LINUX__
Index: src/old/playerportaudio.cpp
===================================================================
--- src/old/playerportaudio.cpp (revision 2471)
+++ src/old/playerportaudio.cpp (working copy)
@@ -740,10 +740,10 @@
      #ifdef __LINUX__
        return QStringList("OSS (PA)");
      #endif
-     #ifdef __MACX__
+     #ifdef __APPLE__
        return QStringList("CoreAudio (PA)");
      #endif
-     #ifdef __WIN__
+     #ifdef __WIN32__
        return QStringList("WMME (PA)");
      #endif
      */
Index: src/old/playerrtaudio.cpp
===================================================================
--- src/old/playerrtaudio.cpp   (revision 2471)
+++ src/old/playerrtaudio.cpp   (working copy)
@@ -343,7 +343,7 @@

 QString PlayerRtAudio::getSoundApi()
 {
-#ifdef __WIN__
+#ifdef __WIN32__
     return QString("DirectSound");
 #endif
 #ifdef __LINUX__
Index: src/rtthread.h
===================================================================
--- src/rtthread.h      (revision 2471)
+++ src/rtthread.h      (working copy)
@@ -22,7 +22,7 @@
 #ifndef RTTHREAD_H
 #define RTTHREAD_H

-#ifdef __MACX__
+#ifdef __APPLE__
   #include <mach/mach_init.h>
   #include <mach/task_policy.h>
   #include <mach/thread_act.h>
@@ -35,7 +35,7 @@
   #include <sys/resource.h>
 #endif

-#ifdef __MACX__
+#ifdef __APPLE__
   int get_bus_speed();
 #endif

Index: src/soundmanager.cpp
===================================================================
--- src/soundmanager.cpp        (revision 2471)
+++ src/soundmanager.cpp        (working copy)
@@ -335,7 +335,7 @@
 //Do something more advanced one day if you like - Adam
             setHostAPI(MIXXX_PORTAUDIO_DIRECTSOUND_STRING);
 #endif
-#ifdef __MACX__
+#ifdef __APPLE__
         setHostAPI(MIXXX_PORTAUDIO_COREAUDIO_STRING);
 #endif
     }
Index: src/soundsourceffmpeg.cpp
===================================================================
--- src/soundsourceffmpeg.cpp   (revision 2471)
+++ src/soundsourceffmpeg.cpp   (working copy)
@@ -17,7 +17,7 @@

 #include "trackinfoobject.h"
 #include "soundsourceffmpeg.h"
-//#ifdef __WIN__
+//#ifdef __WIN32__
 //#include <io.h>
 //#include <fcntl.h>
 //#endif
Index: src/mixxxview.cpp
===================================================================
--- src/mixxxview.cpp   (revision 2471)
+++ src/mixxxview.cpp   (working copy)
@@ -71,7 +71,7 @@
     // Try to open the file pointed to by qSkinPath
     QDomElement docElem = openSkin(qSkinPath);

-#ifdef __WIN__
+#ifdef __WIN32__
 #ifndef QT3_SUPPORT
     // QPixmap fix needed on Windows 9x
     QPixmap::setDefaultOptimization(QPixmap::MemoryOptim);
@@ -104,7 +104,7 @@
     // Load all widgets defined in the XML file
     createAllWidgets(docElem, parent, pConfig);

-#ifdef __WIN__
+#ifdef __WIN32__
 #ifndef QT3_SUPPORT
     // QPixmap fix needed on Windows 9x
     QPixmap::setDefaultOptimization(QPixmap::NormalOptim);
Index: src/mathstuff.cpp
===================================================================
--- src/mathstuff.cpp   (revision 2471)
+++ src/mathstuff.cpp   (working copy)
@@ -109,7 +109,7 @@
     return(r);
 }

-#ifdef __WIN__
+#ifdef __WIN32__
 // Rounds a CSAMPLE to nearest integer, and returns as int
 int round(CSAMPLE x)
 {
Index: src/reader.cpp
===================================================================
--- src/reader.cpp      (revision 2471)
+++ src/reader.cpp      (working copy)
@@ -238,7 +238,7 @@
 void Reader::run()
 {
     //qDebug() << "Reader running...";
-#ifdef __MACX__
+#ifdef __APPLE__
     rtThread();
 #endif

Index: src/dlgprefplaylist.cpp
===================================================================
--- src/dlgprefplaylist.cpp     (revision 2471)
+++ src/dlgprefplaylist.cpp     (working copy)
@@ -64,7 +64,7 @@
 {
 QString iPodMountPoint;
 QFileInfoList mountpoints;
-#ifdef __WINDOWS__
+#ifdef __WIN32__
   // Windows iPod Detection
   mountpoints = QDir::drives();
 #elif __LINUX__
Index: src/rtthread.cpp
===================================================================
--- src/rtthread.cpp    (revision 2471)
+++ src/rtthread.cpp    (working copy)
@@ -16,14 +16,14 @@

 #include "rtthread.h"

-#ifdef __WIN__
+#ifdef __WIN32__
   #include "windows.h"
 #endif
 #include <string.h>
 #include <qobject.h>
 #include <QDebug>

-#ifdef __MACX__
+#ifdef __APPLE__
 int get_bus_speed()
 {
     int mib[2];
@@ -43,7 +43,7 @@

 void rtThread()
 {
-#ifdef __MACX__
+#ifdef __APPLE__
     struct thread_time_constraint_policy ttcpolicy;
     kern_return_t theError;
     /* This is in AbsoluteTime units, which are equal to
@@ -64,7 +64,7 @@
         qDebug() << "Can't do thread_policy_set";
 #endif
 #ifdef __UNIX__
-#ifndef __MACX__
+#ifndef __APPLE__
     // Try to set realtime priority on the current executing thread.
This should be used in time-critical
     // producer threads.
     struct sched_param schp;
@@ -80,7 +80,7 @@
         qDebug() << "Not possible to give audio producer thread high prioriy.";
 #endif
 #endif
-#ifdef __WIN__
+#ifdef __WIN32__
 //    HANDLE h = GetCurrentThread();
 //    SetThreadPriority(h,THREAD_PRIORITY_BELOW_NORMAL);
 #endif
Index: src/powermate.h
===================================================================
--- src/powermate.h     (revision 2471)
+++ src/powermate.h     (working copy)
@@ -18,7 +18,7 @@
 #ifndef POWERMATE_H
 #define POWERMATE_H

-#ifdef __WIN__
+#ifdef __WIN32__
 #ifndef _MSC_VER
 /* Not MSVC, one of these:
    __MINGW32__
Index: src/ladspaloader.cpp
===================================================================
--- src/ladspaloader.cpp        (revision 2471)
+++ src/ladspaloader.cpp        (working copy)
@@ -32,7 +32,7 @@
 #ifdef __LINUX__
         paths.push_back ("/usr/lib/ladspa/");
         paths.push_back ("/usr/lib64/ladspa/");
-#elif __MACX__
+#elif __APPLE__
         paths.push_back ("/Library/Audio/Plug-ins/LADSPA");
         paths.push_back ("../../ladspa_plugins"); //ladspa_plugins
directory in Mixxx.app bundle
         paths.push_back ("Mixxx.app/ladspa_plugins");
//ladspa_plugins directory in Mixxx.app bundle
Index: src/tonal/CircularPeaksToPCP.hxx
===================================================================
--- src/tonal/CircularPeaksToPCP.hxx    (revision 2471)
+++ src/tonal/CircularPeaksToPCP.hxx    (working copy)
@@ -25,7 +25,7 @@
 #include <vector>
 #include <cmath>

-#ifdef __WIN__
+#ifdef __WIN32__
 #define _USE_MATH_DEFINES
 #include <math.h>
 #endif
Index: src/tonal/ConstantQTransform.hxx
===================================================================
--- src/tonal/ConstantQTransform.hxx    (revision 2471)
+++ src/tonal/ConstantQTransform.hxx    (working copy)
@@ -25,7 +25,7 @@
 #include <vector>
 #include <cmath>

-#ifdef __WIN__
+#ifdef __WIN32__
 #define _USE_MATH_DEFINES
 #include <math.h>
 #endif
Index: src/track.cpp
===================================================================
--- src/track.cpp       (revision 2471)
+++ src/track.cpp       (working copy)
@@ -10,7 +10,7 @@
 //
 //

-#ifdef __WIN__
+#ifdef __WIN32__
 #include <windows.h> // for Sleep()  on Windows
 #endif

@@ -1450,7 +1450,7 @@
     while (m_pBpmDetector->queueCount()) {
       // TODO: convert the qDebug statement to a status dialog box.
       qDebug() << "---- waiting for BPM detection queue to empty... "
<< m_pBpmDetector->queueCount() << " to go.";
-#ifdef __WIN__
+#ifdef __WIN32__
       Sleep(3000);
 #else
       sleep(3);
Index: src/hercules.h
===================================================================
--- src/hercules.h      (revision 2471)
+++ src/hercules.h      (working copy)
@@ -18,7 +18,7 @@
 #ifndef HERCULES_H
 #define HERCULES_H

-#ifdef __WIN__
+#ifdef __WIN32__
 #ifndef _MSC_VER
 /* Not MSVC, one of these:
    __MINGW32__
Index: src/mathstuff.h
===================================================================
--- src/mathstuff.h     (revision 2471)
+++ src/mathstuff.h     (working copy)
@@ -28,7 +28,7 @@
 int invmatrix(CSAMPLE *);
 void polcoe(CSAMPLE x[], CSAMPLE y[], int n, CSAMPLE cof[]);
 CSAMPLE mod2pi(CSAMPLE);
-#ifdef __WIN__
+#ifdef __WIN32__
 int round(CSAMPLE x);
 #endif
 CSAMPLE arctan2(CSAMPLE y, CSAMPLE x);
Index: src/mixxx.cpp
===================================================================
--- src/mixxx.cpp       (revision 2471)
+++ src/mixxx.cpp       (working copy)
@@ -86,12 +86,7 @@

     qDebug() << "Mixxx" << VERSION << buildRevision << "is starting...";
     setWindowTitle(tr("Mixxx " VERSION));
-#ifdef __MACX__
     setWindowIcon(QIcon(":icon.svg"));
-#else
-    setWindowIcon(QIcon(":icon.svg"));
-    //setWindowIcon(QIcon(":iconsmall.png")); //This is a smaller
16x16 icon, looks cleaner...
-#endif

     //Reset pointer to players
     soundmanager = 0;
@@ -332,7 +327,7 @@
 #endif

     // Set up socket interface
-//#ifndef __WIN__
+//#ifndef __WIN32__
 //    new MixxxSocketServer(m_pTrack);
 //#endif

@@ -442,7 +437,7 @@
     qDebug() << "delete config, " << qTime.elapsed();
     delete config;

-#ifdef __WIN__
+#ifdef __WIN32__
     _exit(0);
 #endif
 }
Index: src/soundsourcem4a.cpp
===================================================================
--- src/soundsourcem4a.cpp      (revision 2471)
+++ src/soundsourcem4a.cpp      (working copy)
@@ -19,7 +19,7 @@
 #include <QtDebug>
 #include "neaacdec.h"

-#ifdef __WIN__
+#ifdef __WIN32__
 #include <io.h>
 #include <fcntl.h>
 #endif
Index: src/main.cpp
===================================================================
--- src/main.cpp        (revision 2471)
+++ src/main.cpp        (working copy)
@@ -153,7 +153,7 @@

 //Hack to make QT4 find the plugins when packaging in the Mixxx.app
bundle on OS X.
 //See http://doc.trolltech.com/4.3/deployment-mac.html for details.
-#ifdef __MACX__
+#ifdef __APPLE__
     QDir dir(QApplication::applicationDirPath());
     dir.cdUp();
     dir.cd("plugins");
Index: src/bpmdetect.h
===================================================================
--- src/bpmdetect.h     (revision 2471)
+++ src/bpmdetect.h     (working copy)
@@ -77,7 +77,7 @@
 #include "STTypes.h"
 #include "FIFOSampleBuffer.h"

-#ifdef __WIN__
+#ifdef __WIN32__
 typedef signed char int8_t;
 typedef unsigned char uint8_t;
 typedef short int16_t;

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to