From a2d37998c5ea1c5712cb15d9d9ad885371ee4b5d Mon Sep 17 00:00:00 2001 From: Daniel Heckenberg Date: Sun, 9 Mar 2003 11:10:53 +0000 Subject: Minor changes for compilation using Visual C++ 6.0 (SP3) under Windows ncluding: - no array declaration with variable size - fixed signed/unsigned comparison warnings svn path=/trunk/externals/ext13/; revision=460 --- filesize.c | 2 ++ ftos.c | 4 +++- mandelbrot.c | 4 +++- openpatch.c | 7 +++++-- scramble~.c | 32 +++++++++++++++++++++----------- sfwrite13~.c | 4 ++-- streamin13~.c | 25 ++++++++++++++++++------- streamout13~.c | 13 +++++++++---- strippath.c | 2 ++ 9 files changed, 65 insertions(+), 28 deletions(-) diff --git a/filesize.c b/filesize.c index 0a87812..2a6ae6a 100644 --- a/filesize.c +++ b/filesize.c @@ -2,7 +2,9 @@ #include "m_pd.h" #include #include +#ifndef NT #include +#endif #ifdef NT #pragma warning( disable : 4244 ) diff --git a/ftos.c b/ftos.c index db64e38..bad8389 100644 --- a/ftos.c +++ b/ftos.c @@ -1,8 +1,10 @@ #include "ext13.h" #include "m_pd.h" #include -#include +#include +#ifndef NT #include +#endif #include #ifdef NT diff --git a/mandelbrot.c b/mandelbrot.c index 0b301cc..2c1d3f0 100644 --- a/mandelbrot.c +++ b/mandelbrot.c @@ -2,8 +2,10 @@ #include "m_pd.h" #include #include -#include #include +#ifndef NT +#include +#endif #ifdef NT #pragma warning( disable : 4244 ) diff --git a/openpatch.c b/openpatch.c index a9a6ddb..3828f71 100644 --- a/openpatch.c +++ b/openpatch.c @@ -1,8 +1,11 @@ #include "ext13.h" -#include "m_pd.h" +//#include "m_pd.h" +#include "m_imp.h" #include -#include +#include +#ifndef NT #include +#endif #include #ifdef NT diff --git a/scramble~.c b/scramble~.c index dd9414d..11c0793 100644 --- a/scramble~.c +++ b/scramble~.c @@ -2,12 +2,14 @@ #include "ext13.h" #include #include -#include +#ifndef NT +#include +#include +#include #include -#include -#include - - +#else +#include +#endif /* ------------------------ scramble_tilde~ ----------------------------- */ @@ -109,9 +111,13 @@ t_int *scramble_tilde_perform(t_int *w) int erg=0; int n; t_float val, valL, valR, killval; - +#ifndef NT t_float* out[x->x_channels]; t_float* in[x->x_channels]; +#else + t_float** out = (t_float**)malloc(x->x_channels*sizeof(t_float*)); + t_float** in = (t_float**)malloc(x->x_channels*sizeof(t_float*)); +#endif float n_factor, frac, a, b, c, d, cminusb; int index; @@ -441,7 +447,11 @@ t_int *scramble_tilde_perform(t_int *w) if (x->x_channels == 2) *out[1]++ = 0; }/*end if play */ - }/*end while n-- */ + }/*end while n-- */ +#ifdef NT + free(in); + free(out); +#endif return (w + x->x_channels * 2 + 3); } @@ -529,7 +539,7 @@ static void *scramble_tilde_new(t_floatarg c,t_floatarg b) return (x); } -void *scramble_tilde_float(t_scramble_tilde* x, t_float n){ +void scramble_tilde_float(t_scramble_tilde* x, t_float n){ x->play = n; if (x->playmode == 2) { x->n_grain = (int)n - 1; @@ -537,12 +547,12 @@ void *scramble_tilde_float(t_scramble_tilde* x, t_float n){ } } -void *scramble_tilde_buffer(t_scramble_tilde* x, t_float n){ +void scramble_tilde_buffer(t_scramble_tilde* x, t_float n){ if (n > 64) x->x_n = (int)n; // post ("buffersize now:%d",x->x_n); } -void *scramble_tilde_threshold(t_scramble_tilde* x, t_float t){ +void scramble_tilde_threshold(t_scramble_tilde* x, t_float t){ if (t >0) { x->lowborder = t; x->autofollow = 0; @@ -552,7 +562,7 @@ void *scramble_tilde_threshold(t_scramble_tilde* x, t_float t){ } -void *scramble_tilde_grains(t_scramble_tilde* x, t_float g){ +void scramble_tilde_grains(t_scramble_tilde* x, t_float g){ if ((g > 1) && (g < 2048) ) x->newgrains = (int)g; else post ("scramble~: minimum # of grains must be 2 an maximum # is 2048"); } diff --git a/sfwrite13~.c b/sfwrite13~.c index cec3a09..f70334f 100644 --- a/sfwrite13~.c +++ b/sfwrite13~.c @@ -221,7 +221,7 @@ static t_int *sfwrite13_perform(t_int *w) for (i=0;icbufptr++ = (short)(*(in[i])++ * 32768.); } - if ((x->cbufptr - x->cbuf) > (x->bufsize )) {sfwrite13_dowrite(x);} + if ((x->cbufptr - x->cbuf) > (int)(x->bufsize )) {sfwrite13_dowrite(x);} } } @@ -282,7 +282,7 @@ static void *sfwrite13_new(t_floatarg chan) return (x); } -static void *sfwrite13_buffersize(t_sfwrite13 *x,t_floatarg s){ +static void sfwrite13_buffersize(t_sfwrite13 *x,t_floatarg s){ sfwrite13_tempbuf(x,(int)s); } diff --git a/streamin13~.c b/streamin13~.c index 41422ee..f827694 100644 --- a/streamin13~.c +++ b/streamin13~.c @@ -14,7 +14,7 @@ #include #define SOCKET_ERROR -1 #else -#include +#include #endif @@ -92,8 +92,11 @@ static int streamin13_listen(t_streamin13 *x,int portno) int sockfd; static int on = 1; - - shutdown(x->x_connectsocket,SHUT_RDWR); +#ifndef NT + shutdown(x->x_connectsocket,SHUT_RDWR); +#else + shutdown(x->x_connectsocket,SD_BOTH); +#endif sys_closesocket(x->x_connectsocket); sockfd = socket(AF_INET, SOCK_DGRAM, 0); @@ -132,7 +135,7 @@ static int streamin13_listen(t_streamin13 *x,int portno) streamin13_tempbuf(x,64); } - + return(0); } static void *streamin13_new(t_floatarg fportno ,t_floatarg xn) @@ -166,13 +169,18 @@ static t_int *streamin13_perform(t_int *w) t_streamin13* x = (t_streamin13*) (w[1]); int offset = 3; int i,j; - t_float *out[x->x_n]; int n = (int)(w[2]); struct timeval timeout; int packsize; int ret; int length; short* cbuf; + +#ifndef NT + t_float *out[x->x_n]; +#else + t_float **out = (t_float**) malloc(x->x_n * sizeof(t_float*)); +#endif #ifndef NT fd_set fdset; @@ -203,7 +211,7 @@ static t_int *streamin13_perform(t_int *w) } } } - + free(out); return (w+offset+1+i); } else { x->x_ndone++; @@ -265,7 +273,10 @@ static t_int *streamin13_perform(t_int *w) default: break; } - } + } +#ifdef NT + free(out); +#endif return (w+offset+1+i); } diff --git a/streamout13~.c b/streamout13~.c index 22ad6f8..95bdfdf 100644 --- a/streamout13~.c +++ b/streamout13~.c @@ -150,7 +150,6 @@ static t_int *streamout13_perform(t_int *w) { t_streamout13* x = (t_streamout13*) (w[1]); int n = (int)(w[2]); - t_float *in[x->x_n]; int i,j,res = 0; int offset = 3; int sent = 0; @@ -158,8 +157,11 @@ static t_int *streamout13_perform(t_int *w) char* buf = (char *)(w[2]); short* cibuf; char* bp; - - +#ifndef NT + t_float *in[x->x_n]; +#else + t_float** in = (t_float**) malloc(x->x_n * sizeof(t_float*)); +#endif for (i=0;i < x->x_n;i++) { in[i] = (t_float *)(w[offset+i]); @@ -261,7 +263,10 @@ static t_int *streamout13_perform(t_int *w) x->blockssincesend++; } } - // post ("b-s-s:%d, length:%d, last:%d, prev:%d",x->blockssincesend,length,*cibuf,prev); + // post ("b-s-s:%d, length:%d, last:%d, prev:%d",x->blockssincesend,length,*cibuf,prev); +#ifdef NT + free(in); +#endif return (w + 2 + i * 2); } diff --git a/strippath.c b/strippath.c index f24be9e..f5bb1a6 100644 --- a/strippath.c +++ b/strippath.c @@ -2,7 +2,9 @@ #include "m_pd.h" #include #include +#ifndef NT #include +#endif #include #ifdef NT -- cgit v1.2.1