From d959d608b12f8d032c389628cb7a2710594eb2c3 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Mon, 8 Nov 2010 21:59:23 +0000 Subject: [PATCH] Update the IP address copy macro so it never relies on any byte alignment. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1138 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/Common/ethernet/FreeTCPIP/net/uip.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Demo/Common/ethernet/FreeTCPIP/net/uip.h b/Demo/Common/ethernet/FreeTCPIP/net/uip.h index 12e8242e3..88d8645a4 100644 --- a/Demo/Common/ethernet/FreeTCPIP/net/uip.h +++ b/Demo/Common/ethernet/FreeTCPIP/net/uip.h @@ -73,9 +73,6 @@ { u8_t u8[4]; /* Initializer, must come first!!! */ u16_t u16[2]; - #if 0 - u32_t u32; - #endif } uip_ip4addr_t; typedef uip_ip4addr_t uip_ipaddr_t; #endif /* UIP_CONF_IPV6 */ @@ -1017,7 +1014,14 @@ CCIF void uip_send( const void *data, int len ); * \hideinitializer */ #ifndef uip_ipaddr_copy - #define uip_ipaddr_copy( dest, src ) ( ((unsigned long*)dest)[ 0 ] = ((unsigned long *)src)[ 0 ] ) + #define uip_ipaddr_copy( dest, src ) \ + do \ + { \ + (dest)->u8[0] = (src)->u8[0]; \ + (dest)->u8[1] = (src)->u8[1]; \ + (dest)->u8[2] = (src)->u8[2]; \ + (dest)->u8[3] = (src)->u8[3]; \ + } while( 0 ) #endif /** -- 2.39.5