From 92649e745cbbe710ffa3bec1504f877f93fa34aa 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/cxc/; revision=460 --- ascseq.c | 2 +- ascwave.c | 19 ++++++++++++++++--- mean.c | 6 +++--- microtime.c | 24 +++++++++++++++++++++++- randomix.c | 8 ++++---- 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/ascseq.c b/ascseq.c index 7213d43..2a6e21c 100644 --- a/ascseq.c +++ b/ascseq.c @@ -84,7 +84,7 @@ void ascseq_anything(t_ascseq *x, t_symbol* s, t_int argc, t_atom* argv) void ascseq_symbol(t_ascseq *x, t_symbol *s) { - t_atom* a; + t_atom* a = NULL; ascseq_anything(x, s, 0, a); } diff --git a/ascwave.c b/ascwave.c index 8003db5..662f8e7 100644 --- a/ascwave.c +++ b/ascwave.c @@ -59,9 +59,17 @@ void ascwave_ft1(t_ascwave *x, t_floatarg g) int sz = x->x_julp; int lchr = x->x_chr; int schr = 32; + int i = 0; +#ifndef NT char xip[sz+1]; - char xap[sz+1]; - int i = 0; + char xap[sz+1]; +#else + char* xip; + char* xap; + xip = (char*)malloc((sz+1)*sizeof(char)); + xap = (char*)malloc((sz+1)*sizeof(char)); +#endif + for (i = 0;i <= sz; ++i) { if (i == sz-1) { xip[i] = lchr; @@ -91,7 +99,12 @@ void ascwave_ft1(t_ascwave *x, t_floatarg g) outlet_symbol(x->t_ob.ob_outlet, gensym(xap)); if (g > 1) outlet_symbol(x->t_ob.ob_outlet, gensym(xip)); - x->x_jodel = g; + x->x_jodel = g; + +#ifdef NT + free(xip); + free(xap); +#endif } static void ascwave_width(t_ascwave *x, t_floatarg g) diff --git a/mean.c b/mean.c index 4441920..a94e472 100644 --- a/mean.c +++ b/mean.c @@ -94,7 +94,7 @@ void cxmean_setup(void) sizeof(t_cxmean), CLASS_DEFAULT, A_DEFSYM, 0); - class_addcreator(cxmean_new,gensym("cx.mean"),A_DEFSYM, 0); + class_addcreator((t_newmethod)cxmean_new,gensym("cx.mean"),A_DEFSYM, 0); class_addmethod(cxmean_class, (t_method)cxmean_set, gensym("set"), A_DEFSYM, 0); @@ -199,7 +199,7 @@ void cxavgdev_setup(void) CLASS_DEFAULT, A_DEFSYM, 0); - class_addcreator(cxavgdev_new,gensym("cx.avgdev"),A_DEFSYM, 0); + class_addcreator((t_newmethod)cxavgdev_new,gensym("cx.avgdev"),A_DEFSYM, 0); class_addmethod(cxavgdev_class, (t_method)cxavgdev_set, gensym("set"), A_DEFSYM, 0); /* class_addmethod(cxavgdev_class, (t_method)cxavgdev_mean, */ @@ -303,7 +303,7 @@ void cxstddev_setup(void) CLASS_DEFAULT, A_DEFSYM, 0); - class_addcreator(cxstddev_new,gensym("cx.stddev"),A_DEFSYM, 0); + class_addcreator((t_newmethod)cxstddev_new,gensym("cx.stddev"),A_DEFSYM, 0); class_addmethod(cxstddev_class, (t_method)cxstddev_set, gensym("set"), A_DEFSYM, 0); /* class_addmethod(cxstddev_class, (t_method)cxstddev_mean, */ diff --git a/microtime.c b/microtime.c index bccdf0c..dea2bb6 100644 --- a/microtime.c +++ b/microtime.c @@ -4,7 +4,11 @@ */ #include +#ifdef NT +#include +#else #include +#endif #include /* ----------------------- utime --------------------- */ @@ -24,7 +28,8 @@ static void *utime_new(t_symbol *s, int argc, t_atom *argv) { x->x_outlet2 = outlet_new(&x->x_obj, &s_float); return (x); } - + +#ifndef NT static void utime_bang(t_utime *x) { struct timeval myutime; @@ -34,6 +39,23 @@ static void utime_bang(t_utime *x) outlet_float(x->x_outlet2, (t_float)myutime.tv_usec); outlet_float(x->x_outlet1, (t_float)myutime.tv_sec); } +#else +static void utime_bang(t_utime *x) +{ + FILETIME myfiletime; + ULARGE_INTEGER ulfiletime, ulSec, uluSec; + + GetSystemTimeAsFileTime(&myfiletime); + ulfiletime.LowPart = myfiletime.dwLowDateTime; + ulfiletime.HighPart = myfiletime.dwHighDateTime; + ulfiletime.QuadPart -= 116444736000000000; // number of 100ns ticks from 1601-01-01 to 1970-01-01 + ulSec.QuadPart = ulfiletime.QuadPart / (10 * 1000 * 1000); // FILETIME uses 100ns ticks + uluSec.QuadPart = (ulfiletime.QuadPart - ulSec.QuadPart * 10 * 1000 * 1000) / 10; // FILETIME uses 100ns ticks + + outlet_float(x->x_outlet2, (t_float)(__int64)ulSec.QuadPart ); + outlet_float(x->x_outlet1, (t_float)(__int64)uluSec.QuadPart); +} +#endif static void help_utime(t_utime *x) { diff --git a/randomix.c b/randomix.c index f6dd46a..4700766 100644 --- a/randomix.c +++ b/randomix.c @@ -629,9 +629,9 @@ void random_tw_rand_seed (t_random_tw *x, unsigned int a, unsigned int b, unsign x->x_mask1 = zf << (32-x->x_k1); x->x_mask2 = zf << (32-x->x_k2); x->x_mask3 = zf << (32-x->x_k3); - if (a > (1<x_shft1)) x->x_s1 = a; - if (b > (1<x_shft2)) x->x_s2 = b; - if (c > (1<x_shft3)) x->x_s3 = c; + if (a > (unsigned int)(1<x_shft1)) x->x_s1 = a; + if (b > (unsigned int)(1<x_shft2)) x->x_s2 = b; + if (c > (unsigned int)(1<x_shft3)) x->x_s3 = c; // rand(); } @@ -717,7 +717,7 @@ static void random_tw_seed(t_random_tw *x, float f, float glob) { //x->x_state = f; // questionable .. dont quite get how this one's seeded .. - random_tw_rand_seed(x, f, (f*0.455777), f); + random_tw_rand_seed(x, (int)f, (int)(f*0.455777), (int)f); } static void random_tw_help(t_random_tw *x) -- cgit v1.2.1