diff options
author | Martin Peach <mrpeach@users.sourceforge.net> | 2015-01-06 21:40:27 +0000 |
---|---|---|
committer | Martin Peach <mrpeach@users.sourceforge.net> | 2015-01-06 21:40:27 +0000 |
commit | 564e05eda5d2f5ea3dbc59829920116b299118c4 (patch) | |
tree | f20a84b0fc91d8d6286d2bba0dffbb206e77dd54 | |
parent | 4e22347c254c8cd776c24aca99b3d96f16d32f61 (diff) |
Check for null pointer in unpackOSC_PrintTypeTaggedArgs, use uint32_t for OSC timetag components.
svn path=/trunk/externals/mrpeach/; revision=17404
-rw-r--r-- | osc/packingOSC.h | 10 | ||||
-rw-r--r-- | osc/unpackOSC.c | 12 |
2 files changed, 10 insertions, 12 deletions
diff --git a/osc/packingOSC.h b/osc/packingOSC.h index 1900226..a7b831c 100644 --- a/osc/packingOSC.h +++ b/osc/packingOSC.h @@ -27,13 +27,10 @@ This is the size of a static array. If you exceed this limit you'll get an error message. */ #define MAX_BUNDLE_NESTING 32 -/* You may have to redefine this typedef if ints on your system - aren't 4 bytes. */ -typedef unsigned int uint4; typedef struct { - uint4 seconds; - uint4 fraction; + uint32_t seconds; + uint32_t fraction; } OSCTimeTag; typedef union @@ -42,4 +39,5 @@ typedef union float f; } intfloat32; -#endif // _PACKINGOSC
\ No newline at end of file +#endif // _PACKINGOSC +/* end of packingOSC.h */ diff --git a/osc/unpackOSC.c b/osc/unpackOSC.c index 45405a7..a378b0e 100644 --- a/osc/unpackOSC.c +++ b/osc/unpackOSC.c @@ -64,7 +64,7 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl on OSX anyway. */ - +//#define DEBUG #include "packingOSC.h" @@ -188,12 +188,12 @@ static void unpackOSC_list(t_unpackOSC *x, t_symbol *s, int argc, t_atom *argv) /* Print the time tag */ #ifdef DEBUG - printf("unpackOSC: [ %lx%08lx\n", ntohl(*((unsigned long *)(buf+8))), - ntohl(*((unsigned long *)(buf+12)))); + printf("unpackOSC: [ %x.%0x\n", ntohl(*((uint32_t *)(buf+8))), + ntohl(*((uint32_t *)(buf+12)))); #endif /* convert the timetag into a millisecond delay from now */ - tt.seconds = ntohl(*((unsigned long *)(buf+8))); - tt.fraction = ntohl(*((unsigned long *)(buf+12))); + tt.seconds = ntohl(*((uint32_t *)(buf+8))); + tt.fraction = ntohl(*((uint32_t *)(buf+12))); /* pd can use a delay in milliseconds */ outlet_float(x->x_delay_out, unpackOSC_DeltaTime(tt)); /* Note: if we wanted to actually use the time tag as a little-endian @@ -347,7 +347,7 @@ static void unpackOSC_PrintTypeTaggedArgs(t_unpackOSC *x, void *v, int n) } p = unpackOSC_DataAfterAlignedString(typeTags, typeTags+n); - + if (p == NULL) return; /* malformed message */ for (thisType = typeTags + 1; *thisType != 0; ++thisType) { switch (*thisType) |