aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2014-02-12 18:34:38 +0000
committerMartin Peach <mrpeach@users.sourceforge.net>2014-02-12 18:34:38 +0000
commit02cce30ccf8b11a94f3c262d3ad456c3f446fd91 (patch)
treec6e01546243ea17fe528470e104c096133d05ffa
parent33d2322ccdfd9d651522004f60dff632fade8b06 (diff)
Make sure ntohl accesses 32 bits even on 64-bit systems.
svn path=/trunk/externals/mrpeach/; revision=17264
-rw-r--r--net/tcpclient.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/tcpclient.c b/net/tcpclient.c
index 7827001..98d6bec 100644
--- a/net/tcpclient.c
+++ b/net/tcpclient.c
@@ -96,7 +96,7 @@ typedef struct _tcpclient
char *x_hostname; // address we want to connect to as text
int x_connectstate; // 0 = not connected, 1 = connected
int x_port; // port we're connected to
- long x_addr; // address we're connected to as 32bit int
+ uint32_t x_addr; // address we're connected to as 32bit int
t_atom x_addrbytes[4]; // address we're connected to as 4 bytes
t_atom x_msgoutbuf[MAX_TCPCLIENT_SEND_BUF]; // received data as float atoms
unsigned char x_msginbuf[MAX_TCPCLIENT_SEND_BUF]; // received data as bytes
@@ -222,7 +222,7 @@ static void *tcpclient_child_connect(void *w)
return (x);
}
x->x_fd = sockfd;
- x->x_addr = ntohl(*(long *)hp->h_addr);
+ x->x_addr = ntohl(*(uint32_t *)hp->h_addr);
/* outlet_float is not threadsafe ! */
// outlet_float(x->x_obj.ob_outlet, 1);
x->x_connectstate = 1;