From 643db65912ac1b19cafc5e6a194828132029ba79 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 1 Aug 2011 23:29:14 +0000 Subject: replaced NT and UNIX macros with _WIN32 and _MSC_VER where appropriate svn path=/trunk/externals/unauthorized/; revision=15192 --- disto~.c | 2 +- formant~.c | 11 +++++------ mp3amp~.c | 59 +++++++++++++++++++++++++-------------------------------- mp3cast~.c | 6 +++--- mp3fileout~.c | 4 ++-- mp3streamin~.c | 6 +++--- mp3streamout~.c | 6 +++--- mp3write~.c | 6 +++--- samplebox~.c | 12 ++++++------ speexin~.c | 6 +++--- wahwah~.c | 2 +- 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 #include -#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 #endif #include -#ifdef UNIX -#include -#endif -#ifdef NT -#define M_PI 3.14159265358979323846 -#endif #include +#ifdef _MSC_VER +# define M_PI 3.14159265358979323846 +#else +# include +#endif #include /* 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 #include #include +#define strdup _strdup #else #include #include @@ -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 #endif #include -#ifdef UNIX -#include -#endif -#ifdef NT -#define M_PI 3.14159265358979323846 -#endif #include +#ifdef _MSC_VER +# define M_PI 3.14159265358979323846 +#else +# include +#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 #include -#ifdef NT +#ifdef _MSC_VER #define M_PI 3.14159265358979323846 #endif -- cgit v1.2.1