From c856bf200f64502de6dc77d24f96040a4e42c7fe Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 19 Oct 2006 04:13:27 +0000 Subject: fixed up to hopefully build on MinGW gcc 3.4.5 since currently it crashes gcc. I have to say this code is ugly, so its hard to blame gcc. Too many peole just doing quick fixes, and no one caring... I am also guilty as charged. But I did take a moment to remove some warnings svn path=/trunk/externals/OSCx/; revision=6142 --- src/OSC-common.h | 12 ++++++++---- src/OSC.c | 1 + src/OSCroute.c | 9 +++++++-- src/dumpOSC.c | 35 ++++++++++++++--------------------- src/sendOSC.c | 5 ++--- 5 files changed, 32 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/OSC-common.h b/src/OSC-common.h index 46c66a9..abea838 100644 --- a/src/OSC-common.h +++ b/src/OSC-common.h @@ -48,15 +48,19 @@ typedef int Boolean; #ifdef _WIN32 #include + #ifdef _DEBUG + #define DEBUG + #endif +#endif /* _WIN32 */ + +/* only needed on Microsoft compilers */ +#ifdef _MSC_VER #ifdef OSC_EXPORTS #define OSC_API __declspec(dllexport) #else #define OSC_API __declspec(dllimport) #endif - #ifdef _DEBUG - #define DEBUG - #endif -#endif +#endif /* _MSC_VER */ //#define int32_t t_int diff --git a/src/OSC.c b/src/OSC.c index 9063dc3..70bf84a 100644 --- a/src/OSC.c +++ b/src/OSC.c @@ -17,6 +17,7 @@ #define VERSION "0.3" +/* this is for when building with non-Microsoft compilers */ #ifndef OSC_API #define OSC_API #endif diff --git a/src/OSCroute.c b/src/OSCroute.c index 5c4bd40..536d7d6 100644 --- a/src/OSCroute.c +++ b/src/OSCroute.c @@ -53,7 +53,7 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl #include "OSC-common.h" #include "OSC-pattern-match.h" -#ifdef WIN32 +#ifdef _WIN32 #include #include #include @@ -111,6 +111,11 @@ void OSCroute_version (t_OSCroute *x); /* void OSCroute_assist (OSCroute *x, void *box, long msg, long arg, */ /* char *dstString); */ void OSCroute_allmessages(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); +#ifdef _MSC_VER +OSC_API void OSCroute_setup(void); +#else +void OSCroute_setup(void); +#endif /* _MSC_VER */ static char *NextSlashOrNull(char *p); static void StrCopyUntilSlash(char *target, const char *source); @@ -125,7 +130,7 @@ static void OSCroute_free(t_OSCroute *x) /* initialization routine */ // setup -#ifdef WIN32 +#ifdef _MSC_VER OSC_API void OSCroute_setup(void) { #else void OSCroute_setup(void) { diff --git a/src/dumpOSC.c b/src/dumpOSC.c index 8d34896..05e117f 100644 --- a/src/dumpOSC.c +++ b/src/dumpOSC.c @@ -143,11 +143,11 @@ Boolean ShowBytes = FALSE; Boolean Silent = FALSE; /* Declarations */ -#ifndef WIN32 +#ifndef _WIN32 static int unixinitudp(int chan); #endif -#ifdef WIN32 +#ifdef _WIN32 typedef unsigned __int64 osc_time_t; #else typedef unsigned long long osc_time_t; @@ -222,7 +222,7 @@ static void dumpOSC_read(t_dumpOSC *x, int sockfd) { //while( (n = recvfrom(sockfd, mbuf, MAXMESG, 0, &cl_addr, &clilen)) >0) // while(( - #ifdef WIN32 + #ifdef _WIN32 if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (SOCKADDR*)&x->x_server, &clilen)) >0) #else if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (struct sockaddr *)&x->x_server, &clilen)) >0) @@ -345,7 +345,7 @@ void dumpOSC_setup(void) } -#ifndef WIN32 +#ifndef _WIN32 #define UNIXDG_PATH "/tmp/htm" #define UNIXDG_TMP "/tmp/htm.XXXXXX" static int unixinitudp(int chan) @@ -370,14 +370,14 @@ void dumpOSC_setup(void) fcntl(sockfd, F_SETFL, FNDELAY); return sockfd; } -#endif // #ifndef WIN32 +#endif // #ifndef _WIN32 static int initudp(int chan) { -#ifdef WIN32 +#ifdef _WIN32 struct sockaddr_in serv_addr; unsigned int sockfd; ULONG nonBlocking = (ULONG) TRUE; @@ -420,15 +420,8 @@ static int initudp(int chan) #endif } - - - - - - - static void closeudp(int sockfd) { - #ifdef WIN32 + #ifdef _WIN32 closesocket(sockfd); #else close(sockfd); @@ -694,12 +687,12 @@ void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr) static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr) { char *chars = v; - t_atom at; + //t_atom at; //t_atom myargv[50]; - int myargc = x->x_outatc; - t_atom* mya = x->x_outat; - int myi; + //int myargc = x->x_outatc; + //t_atom* mya = x->x_outat; + //int myi; #ifdef DEBUG printf("%s ", address); @@ -741,7 +734,7 @@ static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n) { int myargc = x->x_outatc; t_atom* mya = x->x_outat; - int myi; + //int myi; typeTags = v; @@ -863,7 +856,7 @@ static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int int myargc= x->x_outatc; t_atom* mya = x->x_outat; - int myi; + //int myi; /* Go through the arguments 32 bits at a time */ @@ -1010,4 +1003,4 @@ void complain(char *s, ...) { va_end(ap); } -#endif /* __sgi or LINUX or WIN32 */ +#endif /* __sgi or LINUX or _WIN32 */ diff --git a/src/sendOSC.c b/src/sendOSC.c index 4340f8a..10c22c9 100644 --- a/src/sendOSC.c +++ b/src/sendOSC.c @@ -87,7 +87,7 @@ typedef struct } typedArg; -static int exitStatus = 0; +//static int exitStatus = 0; static int useTypeTags = 0; static char bufferForOSCbuf[SC_BUFFER_SIZE]; @@ -245,7 +245,7 @@ void sendOSC_disconnect(t_sendOSC *x) static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) { char messageName[MAXPDSTRING]; - char *token; + // char *token; typedArg args[MAX_ARGS]; int i; @@ -417,7 +417,6 @@ typedArg ParseAtom(t_atom *a) int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args) { int j, returnVal; - const int wmERROR = -1; returnVal = 0; -- cgit v1.2.1