From 02cce30ccf8b11a94f3c262d3ad456c3f446fd91 Mon Sep 17 00:00:00 2001 From: Martin Peach Date: Wed, 12 Feb 2014 18:34:38 +0000 Subject: Make sure ntohl accesses 32 bits even on 64-bit systems. svn path=/trunk/externals/mrpeach/; revision=17264 --- net/tcpclient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net') 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; -- cgit v1.2.1