changeset 35249:4f9bc9acf17e

Remove nonsense casts.
author reimar
date Mon, 05 Nov 2012 20:26:12 +0000
parents b192c23ea7f1
children 7a93fe8c6956
files stream/tcp.c stream/udp.c
diffstat 2 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/stream/tcp.c	Mon Nov 05 20:14:20 2012 +0000
+++ b/stream/tcp.c	Mon Nov 05 20:26:12 2012 +0000
@@ -128,9 +128,9 @@
 #endif
 
 	switch (af) {
-		case AF_INET:  our_s_addr = (void *) &server_address.four.sin_addr; break;
+		case AF_INET:  our_s_addr = &server_address.four.sin_addr; break;
 #ifdef HAVE_AF_INET6
-		case AF_INET6: our_s_addr = (void *) &server_address.six.sin6_addr; break;
+		case AF_INET6: our_s_addr = &server_address.six.sin6_addr; break;
 #endif
 		default:
 			mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af);
@@ -151,21 +151,21 @@
 		if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ResolvingHostForAF, host, af2String(af));
 
 #ifdef HAVE_GETHOSTBYNAME2
-		hp=(struct hostent*)gethostbyname2( host, af );
+		hp=gethostbyname2( host, af );
 #else
-		hp=(struct hostent*)gethostbyname( host );
+		hp=gethostbyname( host );
 #endif
 		if( hp==NULL ) {
 			if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_CantResolv, af2String(af), host);
 			return TCP_ERROR_FATAL;
 		}
 
-		memcpy( our_s_addr, (void*)hp->h_addr_list[0], hp->h_length );
+		memcpy( our_s_addr, hp->h_addr_list[0], hp->h_length );
 	}
 #if HAVE_WINSOCK2_H
 	else {
 		unsigned long addr = inet_addr(host);
-		memcpy( our_s_addr, (void*)&addr, sizeof(addr) );
+		memcpy( our_s_addr, &addr, sizeof(addr) );
 	}
 #endif
 
--- a/stream/udp.c	Mon Nov 05 20:14:20 2012 +0000
+++ b/stream/udp.c	Mon Nov 05 20:26:12 2012 +0000
@@ -76,7 +76,7 @@
   if (isalpha (url->hostname[0]))
   {
 #if !HAVE_WINSOCK2_H
-    hp = (struct hostent *) gethostbyname (url->hostname);
+    hp = gethostbyname (url->hostname);
     if (!hp)
     {
       mp_msg (MSGT_NETWORK, MSGL_ERR,
@@ -84,8 +84,8 @@
       closesocket (socket_server_fd);
       return -1;
     }
-    memcpy ((void *) &server_address.sin_addr.s_addr,
-            (void *) hp->h_addr_list[0], hp->h_length);
+    memcpy (&server_address.sin_addr.s_addr,
+            hp->h_addr_list[0], hp->h_length);
 #else
     server_address.sin_addr.s_addr = htonl (INADDR_ANY);
 #endif /* HAVE_WINSOCK2_H */
@@ -124,7 +124,7 @@
 #if HAVE_WINSOCK2_H
   if (isalpha (url->hostname[0]))
   {
-    hp = (struct hostent *) gethostbyname (url->hostname);
+    hp = gethostbyname (url->hostname);
     if (!hp)
     {
       mp_msg (MSGT_NETWORK, MSGL_ERR,
@@ -132,13 +132,13 @@
       closesocket (socket_server_fd);
       return -1;
     }
-    memcpy ((void *) &server_address.sin_addr.s_addr,
-            (void *) hp->h_addr, hp->h_length);
+    memcpy (&server_address.sin_addr.s_addr,
+            hp->h_addr, hp->h_length);
   }
   else
   {
     unsigned int addr = inet_addr (url->hostname);
-    memcpy ((void *) &server_address.sin_addr, (void *) &addr, sizeof (addr));
+    memcpy (&server_address.sin_addr, &addr, sizeof (addr));
   }
 #endif /* HAVE_WINSOCK2_H */