aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-08-01 23:29:14 +0000
committerIOhannes m zmölnig <zmoelnig@iem.at>2015-10-14 15:23:30 +0200
commit643db65912ac1b19cafc5e6a194828132029ba79 (patch)
tree60a26041fed52e63efa59cd0c2975fffa265fdfb
parentac7266a0e930bd947d9f22af43d9c222574fe1bd (diff)
replaced NT and UNIX macros with _WIN32 and _MSC_VER where appropriate
svn path=/trunk/externals/unauthorized/; revision=15192
-rw-r--r--disto~.c2
-rw-r--r--formant~.c11
-rw-r--r--mp3amp~.c59
-rw-r--r--mp3cast~.c6
-rw-r--r--mp3fileout~.c4
-rw-r--r--mp3streamin~.c6
-rw-r--r--mp3streamout~.c6
-rw-r--r--mp3write~.c6
-rw-r--r--samplebox~.c12
-rw-r--r--speexin~.c6
-rw-r--r--wahwah~.c2
11 files changed, 56 insertions, 64 deletions
diff --git a/disto~.c b/disto~.c
index 66865db..ab0d921 100644
--- a/disto~.c
+++ b/disto~.c
@@ -39,7 +39,7 @@
#include <stdlib.h>
#include <math.h>
-#ifdef NT
+#ifdef _MSC_VER
#define M_PI 3.14159265358979323846
#endif
diff --git a/formant~.c b/formant~.c
index 686974b..67b442b 100644
--- a/formant~.c
+++ b/formant~.c
@@ -38,13 +38,12 @@
#include <malloc.h>
#endif
#include <ctype.h>
-#ifdef UNIX
-#include <unistd.h>
-#endif
-#ifdef NT
-#define M_PI 3.14159265358979323846
-#endif
#include <math.h>
+#ifdef _MSC_VER
+# define M_PI 3.14159265358979323846
+#else
+# include <unistd.h>
+#endif
#include <m_pd.h> /* standard pd stuff */
diff --git a/mp3amp~.c b/mp3amp~.c
index 36b71e9..46fcbf9 100644
--- a/mp3amp~.c
+++ b/mp3amp~.c
@@ -43,6 +43,7 @@
#include <winsock.h>
#include <winbase.h>
#include <io.h>
+#define strdup _strdup
#else
#include <sys/socket.h>
#include <netinet/in.h>
@@ -65,14 +66,6 @@
#if defined(__APPLE__) || defined(WIN32)
#define MSG_NOSIGNAL 0
#endif
-#ifdef UNIX
-#define STRDUP strdup
-#endif
-#ifdef WIN32
-#define STRDUP _strdup
-#define sys_closesocket closesocket
-#endif
-
#define LAME_AUDIO_CHUNK_SIZE 1152
#define MIN_AUDIO_INPUT 2*LAME_AUDIO_CHUNK_SIZE /* we must have at least n chunks to play a steady sound */
@@ -159,10 +152,10 @@ typedef struct _mp3amp
t_int x_standby; /* flag to freeze decoding */
t_int x_nooutput; /* flag to avoid output of connection state */
-#ifdef UNIX
- unsigned char *x_inbuffer; /* accumulation buffer for incoming mp3 frames */
-#else
+#ifdef _WIN32
char *x_inbuffer; /* accumulation buffer for incoming mp3 frames */
+#else
+ unsigned char *x_inbuffer; /* accumulation buffer for incoming mp3 frames */
#endif
t_int x_inwriteposition;
@@ -409,17 +402,17 @@ static void mp3amp_recv(t_mp3amp *x)
unsigned int a,b,c,d;
unsigned long cheader;
-#ifdef UNIX
+#ifdef _WIN32
+ if(( ret = recv(x->x_fd, (char*)x->x_inbuffer + x->x_inwriteposition,
+ (x->x_inbuffersize-x->x_inwriteposition), 0)) < 0)
+#else
if ( ( ret = recv(x->x_fd, (void*) (x->x_inbuffer + x->x_inwriteposition),
(size_t)((x->x_inbuffersize-x->x_inwriteposition)),
MSG_NOSIGNAL) ) < 0 )
-#else
- if(( ret = recv(x->x_fd, (char*)x->x_inbuffer + x->x_inwriteposition,
- (x->x_inbuffersize-x->x_inwriteposition), 0)) < 0)
#endif
{
post( "mp3amp~: receive error" );
-#ifdef UNIX
+#ifndef _MSC_VER
perror( "recv" );
#endif
mp3amp_disconnect(x);
@@ -682,7 +675,7 @@ static void *mp3amp_do_connect(void *tdata )
if ( send(sockfd, request, strlen(request), 0) < 0 ) /* say hello to server */
{
post( "mp3amp~: could not contact server... " );
-#ifdef UNIX
+#ifndef _MSC_VER
perror( "send" );
#endif
return NULL;
@@ -699,7 +692,7 @@ static void *mp3amp_do_connect(void *tdata )
if( ( ret = recv(sockfd, request+offset, STRBUF_SIZE, MSG_NOSIGNAL) ) <0)
{
error("mp3amp~: no response from server");
-#ifdef UNIX
+#ifndef _MSC_VER
perror( "recv" );
#endif
return NULL;
@@ -737,7 +730,7 @@ static void *mp3amp_do_connect(void *tdata )
post("mp3amp~: %s", request );
return NULL;
}
- url = STRDUP(cpoint + 10);
+ url = strdup(cpoint + 10);
post("mp3amp~: relocating to %s", url);
sys_closesocket(sockfd);
x->x_nooutput = 1;
@@ -759,7 +752,7 @@ static void *mp3amp_do_connect(void *tdata )
// check what we got
if( cpoint = strstr(request, "x-audiocast-mount:"))
{
- x->x_mountpoint = STRDUP(cpoint + 18);
+ x->x_mountpoint = strdup(cpoint + 18);
for ( i=0; i<(int)strlen(x->x_mountpoint); i++ )
{
if ( x->x_mountpoint[i] == '\n' )
@@ -772,7 +765,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "x-audiocast-server-url:"))
{
- sptr = STRDUP( cpoint + 24);
+ sptr = strdup( cpoint + 24);
for ( i=0; i<(int)strlen(sptr); i++ )
{
if ( sptr[i] == '\n' )
@@ -785,7 +778,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "x-audiocast-location:"))
{
- sptr = STRDUP( cpoint + 22);
+ sptr = strdup( cpoint + 22);
for ( i=0; i<(int)strlen(sptr); i++ )
{
if ( sptr[i] == '\n' )
@@ -798,7 +791,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "x-audiocast-admin:"))
{
- sptr = STRDUP( cpoint + 19);
+ sptr = strdup( cpoint + 19);
for ( i=0; i<(int)strlen(sptr); i++ )
{
if ( sptr[i] == '\n' )
@@ -811,7 +804,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "x-audiocast-name:"))
{
- x->x_bcname = STRDUP( cpoint + 17);
+ x->x_bcname = strdup( cpoint + 17);
for ( i=0; i<(int)strlen(x->x_bcname); i++ )
{
if ( x->x_bcname[i] == '\n' )
@@ -824,7 +817,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "x-audiocast-genre:"))
{
- x->x_bcgenre = STRDUP( cpoint + 18);
+ x->x_bcgenre = strdup( cpoint + 18);
for ( i=0; i<(int)strlen(x->x_bcgenre); i++ )
{
if ( x->x_bcgenre[i] == '\n' )
@@ -837,7 +830,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "x-audiocast-url:"))
{
- x->x_bcurl = STRDUP( cpoint + 16);
+ x->x_bcurl = strdup( cpoint + 16);
for ( i=0; i<(int)strlen(x->x_bcurl); i++ )
{
if ( x->x_bcurl[i] == '\n' )
@@ -858,7 +851,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "x-audiocast-bitrate:"))
{
- sptr = STRDUP( cpoint + 20);
+ sptr = strdup( cpoint + 20);
for ( i=0; i<(int)strlen(sptr); i++ )
{
if ( sptr[i] == '\n' )
@@ -916,7 +909,7 @@ static void *mp3amp_do_connect(void *tdata )
if( cpoint = strstr(request, "icy-name:"))
{
- x->x_bcname = STRDUP( cpoint + 10);
+ x->x_bcname = strdup( cpoint + 10);
for ( i=0; i<(int)strlen(x->x_bcname); i++ )
{
if ( x->x_bcname[i] == '\n' )
@@ -929,7 +922,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "x-audiocast-name:"))
{
- x->x_bcname = STRDUP( cpoint + 18);
+ x->x_bcname = strdup( cpoint + 18);
for ( i=0; i<(int)strlen(x->x_bcname); i++ )
{
if ( x->x_bcname[i] == '\n' )
@@ -942,7 +935,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "icy-genre:"))
{
- x->x_bcgenre = STRDUP( cpoint + 10);
+ x->x_bcgenre = strdup( cpoint + 10);
for ( i=0; i<(int)strlen(x->x_bcgenre); i++ )
{
if ( x->x_bcgenre[i] == '\n' )
@@ -955,7 +948,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "icy-aim:"))
{
- x->x_bcaim = STRDUP( cpoint + 8);
+ x->x_bcaim = strdup( cpoint + 8);
for ( i=0; i<(int)strlen(x->x_bcaim); i++ )
{
if ( x->x_bcaim[i] == '\n' )
@@ -968,7 +961,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "icy-url:"))
{
- x->x_bcurl = STRDUP( cpoint + 8);
+ x->x_bcurl = strdup( cpoint + 8);
for ( i=0; i<(int)strlen(x->x_bcurl); i++ )
{
if ( x->x_bcurl[i] == '\n' )
@@ -989,7 +982,7 @@ static void *mp3amp_do_connect(void *tdata )
}
if( cpoint = strstr(request, "icy-br:"))
{
- sptr = STRDUP( cpoint + 7);
+ sptr = strdup( cpoint + 7);
if(!strncmp(sptr, "320", 3))x->x_bitrate = 320;
else if(!strncmp(sptr, "256", 3))x->x_bitrate = 256;
else if(!strncmp(sptr, "224", 3))x->x_bitrate = 224;
diff --git a/mp3cast~.c b/mp3cast~.c
index 0568443..f50793d 100644
--- a/mp3cast~.c
+++ b/mp3cast~.c
@@ -135,10 +135,10 @@ static void mp3cast_encode(t_mp3cast *x)
int err = -1;
int n = x->x_lamechunk;
-#ifdef UNIX
- if(x->x_lamechunk < (int)sizeof(x->x_mp3inbuf))
-#else
+#ifdef _WIN32
if(x->x_lamechunk < sizeof(x->x_mp3inbuf))
+#else
+ if(x->x_lamechunk < (int)sizeof(x->x_mp3inbuf))
#endif
{
error("not enough memory!");
diff --git a/mp3fileout~.c b/mp3fileout~.c
index a24b448..a9c9520 100644
--- a/mp3fileout~.c
+++ b/mp3fileout~.c
@@ -81,7 +81,7 @@ extern void sys_sockerror(char *s);
void mp3fileout_closesocket(int fd)
{
-#ifdef UNIX
+#ifndef _MSC_VER
if ( close(fd) < 0 )
{
perror( "close" );
@@ -91,7 +91,7 @@ void mp3fileout_closesocket(int fd)
post( "mp3fileout~ : closed socket : %d", fd );
}
#endif
-#ifdef NT
+#ifdef _WIN32
closesocket(fd);
#else
sys_rmpollfn(fd);
diff --git a/mp3streamin~.c b/mp3streamin~.c
index c34213f..400f733 100644
--- a/mp3streamin~.c
+++ b/mp3streamin~.c
@@ -87,7 +87,7 @@ extern void sys_sockerror(char *s);
void mp3streamin_closesocket(int fd)
{
-#ifdef UNIX
+#ifndef _MSC_VER
if ( close(fd) < 0 )
{
perror( "close" );
@@ -97,7 +97,7 @@ void mp3streamin_closesocket(int fd)
post( "mp3streamin~ : closed socket : %d", fd );
}
#endif
-#ifdef NT
+#ifdef _WIN32
closesocket(fd);
#endif
sys_rmpollfn(fd);
@@ -117,7 +117,7 @@ int setsocketoptions(int sockfd)
post("mp3streamin~ : TCP_NODELAY set");
}
-#ifdef UNIX
+#ifndef _MSC_VER
sockopt = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof(int)) < 0)
{
diff --git a/mp3streamout~.c b/mp3streamout~.c
index f2ea966..eaa4bfc 100644
--- a/mp3streamout~.c
+++ b/mp3streamout~.c
@@ -121,10 +121,10 @@ static void mp3streamout_encode(t_mp3streamout *x)
int err = -1;
int n = x->x_lamechunk;
-#ifdef UNIX
- if(x->x_lamechunk < (int)sizeof(x->x_mp3inbuf))
-#else
+#ifdef _WIN32
if(x->x_lamechunk < sizeof(x->x_mp3inbuf))
+#else
+ if(x->x_lamechunk < (int)sizeof(x->x_mp3inbuf))
#endif
{
error("not enough memory!");
diff --git a/mp3write~.c b/mp3write~.c
index d16c427..c230c1e 100644
--- a/mp3write~.c
+++ b/mp3write~.c
@@ -113,10 +113,10 @@ static void mp3write_encode(t_mp3write *x)
int err = -1;
int n = x->x_lamechunk;
-#ifdef UNIX
- if(x->x_lamechunk < (int)sizeof(x->x_mp3inbuf))
-#else
+#ifdef _WIN32
if(x->x_lamechunk < sizeof(x->x_mp3inbuf))
+#else
+ if(x->x_lamechunk < (int)sizeof(x->x_mp3inbuf))
#endif
{
error("not enough memory!");
diff --git a/samplebox~.c b/samplebox~.c
index 64e656c..e18ef4d 100644
--- a/samplebox~.c
+++ b/samplebox~.c
@@ -40,14 +40,14 @@
#include <malloc.h>
#endif
#include <ctype.h>
-#ifdef UNIX
-#include <unistd.h>
-#endif
-#ifdef NT
-#define M_PI 3.14159265358979323846
-#endif
#include <math.h>
+#ifdef _MSC_VER
+# define M_PI 3.14159265358979323846
+#else
+# include <unistd.h>
+#endif
+
#include "m_pd.h" /* standard pd stuff */
static char *samplebox_version = "samplebox~: stores and plays back a sound version 0.3, written by Yves Degoyon (ydegoyon@free.fr)";
diff --git a/speexin~.c b/speexin~.c
index a2d9e82..188a36e 100644
--- a/speexin~.c
+++ b/speexin~.c
@@ -86,7 +86,7 @@ extern void sys_sockerror(char *s);
void speexin_closesocket(int fd)
{
-#ifdef UNIX
+#ifndef _WIN32
if ( close(fd) < 0 )
{
perror( "close" );
@@ -96,7 +96,7 @@ void speexin_closesocket(int fd)
post( "speexin~ : closed socket : %d", fd );
}
#endif
-#ifdef NT
+#ifdef _WIN32
closesocket(fd);
#endif
sys_rmpollfn(fd);
@@ -116,7 +116,7 @@ int setsocketoptions(int sockfd)
post("speexin~ : TCP_NODELAY set");
}
-#ifdef UNIX
+#ifdef _WIN32
sockopt = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof(int)) < 0)
{
diff --git a/wahwah~.c b/wahwah~.c
index 7f9a9ed..899d1b5 100644
--- a/wahwah~.c
+++ b/wahwah~.c
@@ -38,7 +38,7 @@
#include <stdlib.h>
#include <math.h>
-#ifdef NT
+#ifdef _MSC_VER
#define M_PI 3.14159265358979323846
#endif