[MPlayer-cvslog] r35343 - in trunk/stream: tcp.c udp.c

reimar subversion at mplayerhq.hu
Mon Nov 5 21:26:13 CET 2012


Author: reimar
Date: Mon Nov  5 21:26:12 2012
New Revision: 35343

Log:
Remove nonsense casts.

Modified:
   trunk/stream/tcp.c
   trunk/stream/udp.c

Modified: trunk/stream/tcp.c
==============================================================================
--- trunk/stream/tcp.c	Mon Nov  5 21:14:20 2012	(r35342)
+++ trunk/stream/tcp.c	Mon Nov  5 21:26:12 2012	(r35343)
@@ -128,9 +128,9 @@ connect2Server_with_af(char *host, int p
 #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 @@ connect2Server_with_af(char *host, int p
 		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
 

Modified: trunk/stream/udp.c
==============================================================================
--- trunk/stream/udp.c	Mon Nov  5 21:14:20 2012	(r35342)
+++ trunk/stream/udp.c	Mon Nov  5 21:26:12 2012	(r35343)
@@ -76,7 +76,7 @@ udp_open_socket (URL_t *url)
   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 @@ udp_open_socket (URL_t *url)
       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 @@ udp_open_socket (URL_t *url)
 #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 @@ udp_open_socket (URL_t *url)
       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 */
 


More information about the MPlayer-cvslog mailing list