[Freeswitch-svn] [commit] r13395 - in freeswitch/trunk: libs/sofia-sip/libsofia-sip-ua/sresolv libs/udns src

FreeSWITCH SVN mikej at freeswitch.org
Tue May 19 13:25:59 PDT 2009


Author: mikej
Date: Tue May 19 15:25:59 2009
New Revision: 13395

Log:
build: fix gcc-4.4.0 build failures (FSCORE-355)

Modified:
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
   freeswitch/trunk/libs/udns/udns_resolver.c
   freeswitch/trunk/src/switch_stun.c
   freeswitch/trunk/src/switch_utils.c

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	Tue May 19 15:25:59 2009
@@ -3486,15 +3486,17 @@
     if (from == NULL)
       ;
     else if (from->ss_family == AF_INET) {
-      struct sockaddr_in const *sin = (void *)from;
-      su_inet_ntop(AF_INET, &sin->sin_addr, host, sizeof host);
-      port = sin->sin_port;
+      struct sockaddr_in sin;
+      memcpy(&sin, from, sizeof sin);
+      su_inet_ntop(AF_INET, &sin.sin_addr, host, sizeof host);
+      port = sin.sin_port;
     }
 #if HAVE_SIN6
     else if (from->ss_family == AF_INET6) {
-      struct sockaddr_in6 const *sin6 = (void *)from;
-      su_inet_ntop(AF_INET6, &sin6->sin6_addr, host, sizeof host);
-      port = sin6->sin6_port;
+      struct sockaddr_in6 sin6;
+      memcpy(&sin6, from, sizeof sin6);
+      su_inet_ntop(AF_INET6, &sin6.sin6_addr, host, sizeof host);
+      port = sin6.sin6_port;
     }
 #endif
 

Modified: freeswitch/trunk/libs/udns/udns_resolver.c
==============================================================================
--- freeswitch/trunk/libs/udns/udns_resolver.c	(original)
+++ freeswitch/trunk/libs/udns/udns_resolver.c	Tue May 19 15:25:59 2009
@@ -739,7 +739,7 @@
       sns = &ctx->dnsc_serv[i];
       if (sns->sa.sa_family == AF_INET) {
         sin6.sin6_port = sns->sin.sin_port;
-        ((struct in_addr*)&sin6.sin6_addr)[3] = sns->sin.sin_addr;
+        memcpy(&sin6.sin6_addr.s6_addr[12], &sns->sin.sin_addr, sizeof(struct in_addr));
         sns->sin6 = sin6;
       }
     }

Modified: freeswitch/trunk/src/switch_stun.c
==============================================================================
--- freeswitch/trunk/src/switch_stun.c	(original)
+++ freeswitch/trunk/src/switch_stun.c	Tue May 19 15:25:59 2009
@@ -549,7 +549,8 @@
 		case SWITCH_STUN_ATTR_MAPPED_ADDRESS:
 			if (attr->type) {
 				if (funny) {
-					((switch_stun_ip_t *) attr->value)->address ^= ntohl(0xabcdabcd);
+					switch_stun_ip_t *tmp = (switch_stun_ip_t *)attr->value;
+					tmp->address ^= ntohl(0xabcdabcd);
 				}
 				switch_stun_packet_attribute_get_mapped_address(attr, rip, &rport);
 			}

Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c	(original)
+++ freeswitch/trunk/src/switch_utils.c	Tue May 19 15:25:59 2009
@@ -1151,14 +1151,15 @@
 									 int flags)
 {
 	char host[NI_MAXHOST], serv[NI_MAXSERV];
-	struct sockaddr_storage ss;
+	struct sockaddr_in6 si6;
 	const struct sockaddr *addr;
 	const char *colon;
 
 	if (flags & SWITCH_URI_NO_SCOPE && sa->family == AF_INET6) {
-		memcpy(&ss, &sa->sa, sa->salen);
-		((struct sockaddr_in6*) (intptr_t) &ss)->sin6_scope_id = 0;
-		addr = (const struct sockaddr*) (intptr_t)&ss;
+		memcpy(&si6, &sa->sa, sa->salen);
+		si6.sin6_scope_id = 0;
+
+		addr = (const struct sockaddr*) &si6;
 	} else {
 		addr = (const struct sockaddr*) (intptr_t)&sa->sa;
 	}



More information about the Freeswitch-svn mailing list