From 3a7e12ea0f7a96e74d4b9b4431314e0f5720590d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sun, 24 Sep 2006 23:05:22 +0000 Subject: MinGW cleanups svn path=/trunk/externals/ext13/; revision=6013 --- streamin13~.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'streamin13~.c') diff --git a/streamin13~.c b/streamin13~.c index 8f55051..0b8f4c0 100644 --- a/streamin13~.c +++ b/streamin13~.c @@ -5,7 +5,9 @@ #include #include -#if defined(UNIX) || defined(unix) +#ifdef _WIN32 +#include +#else #include #include #include @@ -13,8 +15,6 @@ #include #include #define SOCKET_ERROR -1 -#else -#include #endif /* these pragmas are only used for MSVC, not MinGW or Cygwin */ @@ -30,11 +30,11 @@ static void sys_sockerror(char *s) { -#if defined(UNIX) || defined(unix) - int err = errno; -#else +#ifdef _WIN32 int err = WSAGetLastError(); if (err == 10054) return; +#else + int err = errno; #endif post("%s: %s (%d)\n", s, strerror(err), err); } @@ -42,11 +42,10 @@ static void sys_sockerror(char *s) static void sys_closesocket(int fd) { -#if defined(UNIX) || defined(unix) - close(fd); -#endif -#ifdef NT +#ifdef _WIN32 closesocket(fd); +#else + close(fd); #endif } @@ -91,7 +90,7 @@ static int streamin13_listen(t_streamin13 *x,int portno) int sockfd; static int on = 1; -#ifndef NT +#ifndef _WIN32 shutdown(x->x_connectsocket,SHUT_RDWR); #else shutdown(x->x_connectsocket,SD_BOTH); @@ -175,13 +174,13 @@ static t_int *streamin13_perform(t_int *w) int length; short* cbuf; -#ifndef NT +#ifndef _WIN32 t_float *out[x->x_n]; #else t_float **out = (t_float**) malloc(x->x_n * sizeof(t_float*)); #endif -#ifndef NT +#ifndef _WIN32 fd_set fdset; #endif for (i=0;i < x->x_n;i++) { @@ -197,7 +196,7 @@ static t_int *streamin13_perform(t_int *w) // cbuf = x->cbuf + x->blockssincereceive * n * x->x_n; - #ifndef NT + #ifndef _WIN32 FD_SET(x->x_connectsocket,&fdset); if (!select(x->x_connectsocket+1,&fdset,NULL,NULL,&timeout) || !FD_ISSET(x->x_connectsocket,&fdset)) { @@ -273,7 +272,7 @@ static t_int *streamin13_perform(t_int *w) break; } } -#ifdef NT +#ifdef _WIN32 free(out); #endif return (w+offset+1+i); -- cgit v1.2.1