aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-18 18:57:13 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-18 18:57:13 +0000
commitaa82236dd093743bd2973f8b61127582aaf6e96f (patch)
treedc74f2de6e61dc04861b8d6df53daf8ed6feb2ee
parentb13e2d6c3a525918ed0816c41433509477c9912a (diff)
lots of MinGW fixes for RC6
svn path=/trunk/externals/unauthorized/; revision=4250
-rw-r--r--cooled~/cooled~.c10
-rw-r--r--exciter/exciter.c6
-rwxr-xr-xexciter/timeval.h76
-rw-r--r--filterbank~/filterbank~.c5
-rw-r--r--mp3amp~/mp3amp~.c12
-rw-r--r--mp3live~/mp3fileout~.c14
-rw-r--r--mp3live~/mp3streamin~.c11
-rw-r--r--mp3live~/mp3streamout~.c14
-rw-r--r--mp3write~/mp3write~.c16
-rw-r--r--playlist/playlist.c10
-rw-r--r--probalizer/probalizer.c5
-rw-r--r--scratcher~/scratcher~.c14
-rwxr-xr-xscratcher~/timeval.h76
-rwxr-xr-xscrolllist/scrolllist.c3
-rw-r--r--sonogram~/sonogram~-joge.c2
-rw-r--r--sonogram~/sonogram~-yves.c13
-rw-r--r--sonogram~/sonogram~.c31
-rw-r--r--speex~/speexin~.c5
-rw-r--r--speex~/speexout~.c6
19 files changed, 253 insertions, 76 deletions
diff --git a/cooled~/cooled~.c b/cooled~/cooled~.c
index 87b5a68..f0d966b 100644
--- a/cooled~/cooled~.c
+++ b/cooled~/cooled~.c
@@ -45,13 +45,17 @@
#include <ctype.h>
#include <pthread.h>
-#ifdef UNIX
+#ifdef _WIN32
+#include <io.h>
+#define usleep(a) _sleep(a/1000)
+#else
#include <unistd.h>
#endif
-#ifdef NT
+
+#include <math.h>
+#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
-#include <math.h>
#include "m_pd.h"
#include "m_imp.h"
diff --git a/exciter/exciter.c b/exciter/exciter.c
index a7bd528..a8fdeda 100644
--- a/exciter/exciter.c
+++ b/exciter/exciter.c
@@ -44,8 +44,9 @@
#include "t_tk.h"
#include "exciter.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
+#include "timeval.h"
#else
#include <unistd.h>
#endif
@@ -349,7 +350,8 @@ static void exciter_properties(t_gobj *z, t_glist *owner)
t_exciter *x=(t_exciter *)z;
sprintf(buf, "pdtk_exciter_dialog %%s %d %d %d %.2f %d %d\n",
- x->x_width, x->x_height, x->x_nbevents, x->x_timegrain, x->x_loop, x->x_save );
+ (int)x->x_width, (int)x->x_height, (int)x->x_nbevents,
+ x->x_timegrain, x->x_loop, x->x_save );
// post("exciter_properties : %s", buf );
gfxstub_new(&x->x_obj.ob_pd, x, buf);
}
diff --git a/exciter/timeval.h b/exciter/timeval.h
new file mode 100755
index 0000000..ff04962
--- /dev/null
+++ b/exciter/timeval.h
@@ -0,0 +1,76 @@
+/*
+ * timeval.h 1.0 01/12/19
+ *
+ * Defines gettimeofday, timeval, etc. for Win32
+ *
+ * By Wu Yongwei
+ *
+ */
+
+#ifndef _TIMEVAL_H
+#define _TIMEVAL_H
+
+#ifdef _WIN32
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <time.h>
+
+#ifndef __GNUC__
+#define EPOCHFILETIME (116444736000000000i64)
+#else
+#define EPOCHFILETIME (116444736000000000LL)
+#endif /* not __GNUC__ */
+
+#if 0
+struct timeval {
+ long tv_sec; /* seconds */
+ long tv_usec; /* microseconds */
+};
+#endif /* 0 */
+
+struct timezone {
+ int tz_minuteswest; /* minutes W of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ FILETIME ft;
+ LARGE_INTEGER li;
+ __int64 t;
+ static int tzflag;
+
+ if (tv)
+ {
+ GetSystemTimeAsFileTime(&ft);
+ li.LowPart = ft.dwLowDateTime;
+ li.HighPart = ft.dwHighDateTime;
+ t = li.QuadPart; /* In 100-nanosecond intervals */
+ t -= EPOCHFILETIME; /* Offset to the Epoch time */
+ t /= 10; /* In microseconds */
+ tv->tv_sec = (long)(t / 1000000);
+ tv->tv_usec = (long)(t % 1000000);
+ }
+
+ if (tz)
+ {
+ if (!tzflag)
+ {
+ _tzset();
+ tzflag++;
+ }
+ tz->tz_minuteswest = _timezone / 60;
+ tz->tz_dsttime = _daylight;
+ }
+
+ return 0;
+}
+
+#else /* _WIN32 */
+
+#include <sys/time.h>
+
+#endif /* _WIN32 */
+
+#endif /* _TIMEVAL_H */
diff --git a/filterbank~/filterbank~.c b/filterbank~/filterbank~.c
index 51a2998..86bf5b9 100644
--- a/filterbank~/filterbank~.c
+++ b/filterbank~/filterbank~.c
@@ -33,11 +33,12 @@
#include "filterbank~.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
+#define random rand
#else
#include <unistd.h>
-#endif
+#endif /* _WIN32 */
#define DEFAULT_FILTERBANK_LOWFREQ 0
#define DEFAULT_FILTERBANK_HIGHFREQ 1600
diff --git a/mp3amp~/mp3amp~.c b/mp3amp~/mp3amp~.c
index c1f79be..9dfc54e 100644
--- a/mp3amp~/mp3amp~.c
+++ b/mp3amp~/mp3amp~.c
@@ -39,7 +39,11 @@
#include "mpg123.h" /* mpg123 decoding library from lame 3.92 */
#include "mpglib.h" /* mpglib decoding library from lame 3.92 */
#include "interface.h" /* mpglib decoding library from lame 3.92 */
-#ifdef UNIX
+#ifdef _WIN32
+#include <winsock.h>
+#include <winbase.h>
+#include <io.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -51,11 +55,7 @@
#include <ctype.h>
#include <stdlib.h>
#define SOCKET_ERROR -1
-#else
-#include <winsock.h>
-#include <winbase.h>
-#include <io.h>
-#endif
+#endif /* _WIN32 */
#ifdef _MSC_VER
#pragma warning( disable : 4244 )
diff --git a/mp3live~/mp3fileout~.c b/mp3live~/mp3fileout~.c
index e8e1c6b..bd2d431 100644
--- a/mp3live~/mp3fileout~.c
+++ b/mp3live~/mp3fileout~.c
@@ -36,7 +36,11 @@
#include <sys/types.h>
#include <string.h>
-#ifdef UNIX
+#ifdef _WIN32
+#include <winsock.h>
+#include <io.h>
+#include <fcntl.h>
+#else
#include <sys/socket.h>
#include <errno.h>
#include <netinet/in.h>
@@ -48,13 +52,9 @@
#include <fcntl.h>
#include <stdio.h>
#define SOCKET_ERROR -1
-#else
-#include <winsock.h>
-#include <io.h>
-#include <fcntl.h>
-#endif
+#endif /* _WIN32 */
-#if defined(__APPLE__) || defined(WIN32)
+#if defined(__APPLE__) || defined(_WIN32)
#define MSG_NOSIGNAL 0
#endif
diff --git a/mp3live~/mp3streamin~.c b/mp3live~/mp3streamin~.c
index d34150b..b01a576 100644
--- a/mp3live~/mp3streamin~.c
+++ b/mp3live~/mp3streamin~.c
@@ -40,7 +40,10 @@
#include <sys/types.h>
#include <string.h>
-#ifndef WIN32
+#ifdef _WIN32
+#include <io.h>
+#include <winsock.h>
+#else
#include <sys/socket.h>
#include <errno.h>
#include <netinet/in.h>
@@ -52,11 +55,9 @@
#include <fcntl.h>
#include <stdio.h>
#define SOCKET_ERROR -1
-#else
-#include <winsock.h>
-#endif
+#endif /* _WIN32 */
-#if defined(__APPLE__) || defined(WIN32)
+#if defined(__APPLE__) || defined(_WIN32)
#define MSG_NOSIGNAL 0
#define SOL_TCP IPPROTO_TCP
#endif
diff --git a/mp3live~/mp3streamout~.c b/mp3live~/mp3streamout~.c
index 0ed908a..33555ce 100644
--- a/mp3live~/mp3streamout~.c
+++ b/mp3live~/mp3streamout~.c
@@ -40,7 +40,12 @@
#include <malloc.h>
#endif
#include <ctype.h>
-#ifdef UNIX
+#ifdef _WIN32
+#include <io.h>
+#include <windows.h>
+#include <winsock.h>
+#include <windef.h>
+#else
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -48,14 +53,9 @@
#include <time.h>
#include <sys/time.h>
#define SOCKET_ERROR -1
-#else
-#include <io.h>
-#include <windows.h>
-#include <winsock.h>
-#include <windef.h>
#endif
-#if defined(__APPLE__) || defined(WIN32)
+#if defined(__APPLE__) || defined(_WIN32)
#define MSG_NOSIGNAL 0
#endif
diff --git a/mp3write~/mp3write~.c b/mp3write~/mp3write~.c
index e11eddd..b65abed 100644
--- a/mp3write~/mp3write~.c
+++ b/mp3write~/mp3write~.c
@@ -39,21 +39,21 @@
#include <malloc.h>
#endif
#include <ctype.h>
-#ifdef UNIX
+#ifdef _WIN32
+#include <io.h>
+#include <windows.h>
+#include <winsock.h>
+#include <windef.h>
+#else
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <time.h>
-#include <sys/time.h>
#define SOCKET_ERROR -1
-#else
-#include <io.h>
-#include <windows.h>
-#include <winsock.h>
-#include <windef.h>
-#endif
+#endif /* _WIN32 */
+#include <sys/time.h>
#include <lame/lame.h> /* lame encoder stuff */
#include "m_pd.h" /* standard pd stuff */
diff --git a/playlist/playlist.c b/playlist/playlist.c
index d8f7791..b6dde1d 100644
--- a/playlist/playlist.c
+++ b/playlist/playlist.c
@@ -29,6 +29,8 @@
/* Gang Of Four -- Guns Before Butter */
/* ---------------------------------------------------------------------------- */
+#ifndef _WIN32 /* this object doesn't compile on Windows because of alphasort() */
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -42,11 +44,15 @@
#include "g_canvas.h"
#include "t_tk.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
+#include <pthread.h>
#else
#include <unistd.h>
#include <sys/types.h>
+#endif
+
+#ifndef _MSC_VER
#include <dirent.h>
#endif
@@ -1017,3 +1023,5 @@ void playlist_setup(void)
class_setwidget(playlist_class, &playlist_widgetbehavior);
class_sethelpsymbol(playlist_class, gensym("playlist.pd"));
}
+
+#endif /* not _WIN32 */
diff --git a/probalizer/probalizer.c b/probalizer/probalizer.c
index 86ce42d..96a225b 100644
--- a/probalizer/probalizer.c
+++ b/probalizer/probalizer.c
@@ -42,11 +42,12 @@
#include "t_tk.h"
#include "probalizer.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
+#define random rand
#else
#include <unistd.h>
-#endif
+#endif /* _WIN32 */
#define DEFAULT_PROBALIZER_WIDTH 200
#define DEFAULT_PROBALIZER_HEIGHT 200
diff --git a/scratcher~/scratcher~.c b/scratcher~/scratcher~.c
index 4448389..bd970a7 100644
--- a/scratcher~/scratcher~.c
+++ b/scratcher~/scratcher~.c
@@ -48,14 +48,18 @@
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
-#ifdef UNIX
+#ifdef _WIN32
+#include <io.h>
+#include "timeval.h"
+#else
#include <unistd.h>
-#endif
-#ifdef NT
-#define M_PI 3.14159265358979323846
-#endif
+#endif /* _WIN32 */
#include <math.h>
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif /* not M_PI */
+
#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
diff --git a/scratcher~/timeval.h b/scratcher~/timeval.h
new file mode 100755
index 0000000..ff04962
--- /dev/null
+++ b/scratcher~/timeval.h
@@ -0,0 +1,76 @@
+/*
+ * timeval.h 1.0 01/12/19
+ *
+ * Defines gettimeofday, timeval, etc. for Win32
+ *
+ * By Wu Yongwei
+ *
+ */
+
+#ifndef _TIMEVAL_H
+#define _TIMEVAL_H
+
+#ifdef _WIN32
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <time.h>
+
+#ifndef __GNUC__
+#define EPOCHFILETIME (116444736000000000i64)
+#else
+#define EPOCHFILETIME (116444736000000000LL)
+#endif /* not __GNUC__ */
+
+#if 0
+struct timeval {
+ long tv_sec; /* seconds */
+ long tv_usec; /* microseconds */
+};
+#endif /* 0 */
+
+struct timezone {
+ int tz_minuteswest; /* minutes W of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ FILETIME ft;
+ LARGE_INTEGER li;
+ __int64 t;
+ static int tzflag;
+
+ if (tv)
+ {
+ GetSystemTimeAsFileTime(&ft);
+ li.LowPart = ft.dwLowDateTime;
+ li.HighPart = ft.dwHighDateTime;
+ t = li.QuadPart; /* In 100-nanosecond intervals */
+ t -= EPOCHFILETIME; /* Offset to the Epoch time */
+ t /= 10; /* In microseconds */
+ tv->tv_sec = (long)(t / 1000000);
+ tv->tv_usec = (long)(t % 1000000);
+ }
+
+ if (tz)
+ {
+ if (!tzflag)
+ {
+ _tzset();
+ tzflag++;
+ }
+ tz->tz_minuteswest = _timezone / 60;
+ tz->tz_dsttime = _daylight;
+ }
+
+ return 0;
+}
+
+#else /* _WIN32 */
+
+#include <sys/time.h>
+
+#endif /* _WIN32 */
+
+#endif /* _TIMEVAL_H */
diff --git a/scrolllist/scrolllist.c b/scrolllist/scrolllist.c
index 412f062..f1ccc84 100755
--- a/scrolllist/scrolllist.c
+++ b/scrolllist/scrolllist.c
@@ -41,8 +41,9 @@
#include "g_canvas.h"
#include "t_tk.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
+#include <pthread.h>
#else
#include <unistd.h>
#include <sys/types.h>
diff --git a/sonogram~/sonogram~-joge.c b/sonogram~/sonogram~-joge.c
index 4216c4d..f420698 100644
--- a/sonogram~/sonogram~-joge.c
+++ b/sonogram~/sonogram~-joge.c
@@ -45,7 +45,7 @@
#include <unistd.h>
#include <pthread.h>
#endif
-#ifdef NT
+#ifdef _WIN32
#define M_PI 3.14159265358979323846
#include "pthread.h"
#include <windows.h>
diff --git a/sonogram~/sonogram~-yves.c b/sonogram~/sonogram~-yves.c
index 59cbeed..d2ce944 100644
--- a/sonogram~/sonogram~-yves.c
+++ b/sonogram~/sonogram~-yves.c
@@ -42,16 +42,13 @@
#endif
#include <ctype.h>
#include <pthread.h>
-#ifdef UNIX
-#include <unistd.h>
-#endif
-#ifdef NT
+#ifdef WIN32
#define random rand
+#define usleep(a) _sleep(a/1000)
+#include <io.h>
#include <windows.h>
-static int usleep (unsigned int us) {
- Sleep((long)(us/1000.));
- return 0;
-}
+#else
+#include <unistd.h>
#endif
#include <math.h>
diff --git a/sonogram~/sonogram~.c b/sonogram~/sonogram~.c
index fedf88c..75d17e4 100644
--- a/sonogram~/sonogram~.c
+++ b/sonogram~/sonogram~.c
@@ -46,13 +46,18 @@
#include <ctype.h>
#include <pthread.h>
-#ifdef UNIX
+#ifdef _WIN32
+#include <io.h>
+#define random rand
+#define usleep(a) _sleep(a/1000)
+#else
#include <unistd.h>
#endif
-#ifdef NT
+#include <math.h>
+
+#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
-#include <math.h>
#include "m_pd.h"
#include "m_imp.h"
@@ -326,7 +331,7 @@ static void sonogram_update_block(t_sonogram *x, t_glist *glist, t_int bnumber)
}
for ( i=0; i<x->x_zoom; i++ )
{
- sprintf( x->x_guicommand, "SONIMAGE%x put {%s} -to %d 0\n", (unsigned int)x, x->x_gifdata, (bnumber*x->x_zoom)+i );
+ sprintf( x->x_guicommand, "SONIMAGE%x put {%s} -to %d 0\n", (unsigned int)x, x->x_gifdata, (int) ((bnumber*x->x_zoom)+i) );
sys_gui( x->x_guicommand );
}
@@ -346,7 +351,7 @@ static void sonogram_update_block(t_sonogram *x, t_glist *glist, t_int bnumber)
}
for ( i=0; i<x->x_zoom; i++ )
{
- sprintf( x->x_guicommand, "FAZIMAGE%x put {%s} -to %d 0\n", (unsigned int)x, x->x_gifdata, (bnumber*x->x_zoom)+i );
+ sprintf( x->x_guicommand, "FAZIMAGE%x put {%s} -to %d 0\n", (unsigned int)x, x->x_gifdata, (int) ((bnumber*x->x_zoom)+i) );
sys_gui( x->x_guicommand );
}
}
@@ -377,15 +382,15 @@ static void sonogram_erase_block(t_sonogram *x, t_glist *glist, t_int bnumber )
static void *sonogram_do_update_part(void *tdata)
{
- t_sonogram *x = (t_sonogram*) tdata;
- t_int si;
- t_int nbpoints = 0;
- t_float percentage = 0, opercentage = 0;
- t_canvas *canvas=glist_getcanvas(x->x_glist);
-
-
+ t_sonogram *x = (t_sonogram*) tdata;
+ t_int si;
+ t_int nbpoints = 0;
+ t_float percentage = 0, opercentage = 0;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+
+
// loose synchro
- usleep( THREAD_SLEEP_TIME );
+ usleep( THREAD_SLEEP_TIME );
// check boundaries
if ( x->x_updateend > x->x_size-1 ) x->x_updateend = x->x_size-1;
diff --git a/speex~/speexin~.c b/speex~/speexin~.c
index 786a9e7..eff2601 100644
--- a/speex~/speexin~.c
+++ b/speex~/speexin~.c
@@ -33,7 +33,8 @@
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
-#ifdef WIN32
+#ifdef _WIN32
+#include <io.h>
#include <winsock.h>
#else
#include <sys/socket.h>
@@ -49,7 +50,7 @@
#define SOCKET_ERROR -1
#endif
-#if defined(__APPLE__) || defined(WIN32)
+#if defined(__APPLE__) || defined(_WIN32)
#define MSG_NOSIGNAL 0
#define SOL_TCP IPPROTO_TCP
#endif
diff --git a/speex~/speexout~.c b/speex~/speexout~.c
index 2d2c104..2391e6f 100644
--- a/speex~/speexout~.c
+++ b/speex~/speexout~.c
@@ -31,7 +31,7 @@
-#ifdef NT
+#ifdef _MSC_VER
#pragma warning( disable : 4244 )
#pragma warning( disable : 4305 )
#endif
@@ -47,7 +47,7 @@
#include <malloc.h>
#endif
#include <ctype.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <io.h>
#include <windows.h>
#include <winsock.h>
@@ -62,7 +62,7 @@
#define SOCKET_ERROR -1
#endif
-#if defined(__APPLE__) || defined(WIN32)
+#if defined(__APPLE__) || defined(_WIN32)
#define MSG_NOSIGNAL 0
#endif