aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filesize.c2
-rw-r--r--ftos.c2
-rw-r--r--mandelbrot.c2
-rw-r--r--openpatch.c2
-rw-r--r--piperead~.c2
-rw-r--r--scramble~.c6
-rw-r--r--sfread.c2
-rw-r--r--sfwrite13~.c4
-rw-r--r--streamin13~.c29
-rw-r--r--streamout13~.c23
-rw-r--r--strippath.c2
-rw-r--r--wavinfo.c2
12 files changed, 38 insertions, 40 deletions
diff --git a/filesize.c b/filesize.c
index bd4dcfa..beb8338 100644
--- a/filesize.c
+++ b/filesize.c
@@ -2,7 +2,7 @@
#include "m_pd.h"
#include <sys/stat.h>
#include <stdio.h>
-#ifndef NT
+#ifndef _WIN32
#include <unistd.h>
#endif
diff --git a/ftos.c b/ftos.c
index ee0d3d0..af91b78 100644
--- a/ftos.c
+++ b/ftos.c
@@ -2,7 +2,7 @@
#include "m_pd.h"
#include <sys/stat.h>
#include <stdio.h>
-#ifndef NT
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <string.h>
diff --git a/mandelbrot.c b/mandelbrot.c
index 67ef249..7a5c584 100644
--- a/mandelbrot.c
+++ b/mandelbrot.c
@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
-#ifndef NT
+#ifndef _WIN32
#include <unistd.h>
#endif
diff --git a/openpatch.c b/openpatch.c
index 151f0fd..0084869 100644
--- a/openpatch.c
+++ b/openpatch.c
@@ -9,7 +9,7 @@
#include <sys/stat.h>
#include <stdio.h>
-#ifndef NT
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <string.h>
diff --git a/piperead~.c b/piperead~.c
index eca559c..a4b6eb7 100644
--- a/piperead~.c
+++ b/piperead~.c
@@ -14,7 +14,7 @@
/* ------------------------ piperead_tilde~ ----------------------------- */
-#ifdef NT
+#ifdef _WIN32
#define BINREADMODE "rb"
#else
#define BINREADMODE "r"
diff --git a/scramble~.c b/scramble~.c
index 11c0793..a741494 100644
--- a/scramble~.c
+++ b/scramble~.c
@@ -2,7 +2,7 @@
#include "ext13.h"
#include <sys/types.h>
#include <string.h>
-#ifndef NT
+#ifndef _WIN32
#include <netinet/in.h>
#include <netdb.h>
#include <sys/errno.h>
@@ -111,7 +111,7 @@ t_int *scramble_tilde_perform(t_int *w)
int erg=0;
int n;
t_float val, valL, valR, killval;
-#ifndef NT
+#ifndef _WIN32
t_float* out[x->x_channels];
t_float* in[x->x_channels];
#else
@@ -448,7 +448,7 @@ t_int *scramble_tilde_perform(t_int *w)
*out[1]++ = 0;
}/*end if play */
}/*end while n-- */
-#ifdef NT
+#ifdef _WIN32
free(in);
free(out);
#endif
diff --git a/sfread.c b/sfread.c
index ee5a575..f1f3ee6 100644
--- a/sfread.c
+++ b/sfread.c
@@ -14,7 +14,7 @@
/* ------------------------ sfread~ ----------------------------- */
-#ifdef NT
+#ifdef _WIN32
#define BINREADMODE "rb"
#else
#define BINREADMODE "r"
diff --git a/sfwrite13~.c b/sfwrite13~.c
index 08dcdcc..48720df 100644
--- a/sfwrite13~.c
+++ b/sfwrite13~.c
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <string.h>
-#ifndef NT
+#ifndef _WIN32
#include <unistd.h>
#include <sys/mman.h>
#else
@@ -21,7 +21,7 @@
#include <sys/stat.h>
-#ifdef NT
+#ifdef _WIN32
#define BINREADMODE "rb"
#define OPENPARAMS O_WRONLY | O_CREAT | O_TRUNC
#else
diff --git a/streamin13~.c b/streamin13~.c
index 8f55051..0b8f4c0 100644
--- a/streamin13~.c
+++ b/streamin13~.c
@@ -5,7 +5,9 @@
#include <sys/types.h>
#include <string.h>
-#if defined(UNIX) || defined(unix)
+#ifdef _WIN32
+#include <winsock2.h>
+#else
#include <sys/socket.h>
#include <sys/errno.h>
#include <netinet/in.h>
@@ -13,8 +15,6 @@
#include <sys/time.h>
#include <unistd.h>
#define SOCKET_ERROR -1
-#else
-#include <winsock2.h>
#endif
/* these pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
@@ -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);
diff --git a/streamout13~.c b/streamout13~.c
index b7324da..2dc5725 100644
--- a/streamout13~.c
+++ b/streamout13~.c
@@ -3,14 +3,14 @@
#include <sys/types.h>
#include <string.h>
-#if defined(UNIX) || defined(unix)
+#ifdef _WIN32
+#include <winsock.h>
+#else
#include <sys/errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define SOCKET_ERROR -1
-#else
-#include <winsock.h>
#endif
#ifdef __APPLE__
@@ -28,11 +28,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);
}
@@ -41,11 +41,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
}
@@ -162,7 +161,7 @@ static t_int *streamout13_perform(t_int *w)
char* buf = (char *)(w[2]);
short* cibuf;
char* bp;
-#ifndef NT
+#ifndef _WIN32
t_float *in[x->x_n];
#else
t_float** in = (t_float**) malloc(x->x_n * sizeof(t_float*));
@@ -269,7 +268,7 @@ static t_int *streamout13_perform(t_int *w)
}
}
// post ("b-s-s:%d, length:%d, last:%d, prev:%d",x->blockssincesend,length,*cibuf,prev);
-#ifdef NT
+#ifdef _WIN32
free(in);
#endif
return (w + 2 + i * 2);
diff --git a/strippath.c b/strippath.c
index d719bc4..8af95fe 100644
--- a/strippath.c
+++ b/strippath.c
@@ -2,7 +2,7 @@
#include "m_pd.h"
#include <sys/stat.h>
#include <stdio.h>
-#ifndef NT
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <string.h>
diff --git a/wavinfo.c b/wavinfo.c
index db7188c..9d5c20d 100644
--- a/wavinfo.c
+++ b/wavinfo.c
@@ -9,7 +9,7 @@
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
-#ifndef NT
+#ifndef _WIN32
#include <sys/mman.h>
#endif