Rename HAVE_WINSOCK preprocessor condition to HAVE_WINSOCK_H.

This is what it is called in FFmpeg and more consistent with other
names for similar conditionals. This fixes a potential compilation
failure on MinGW, as described in Bugzilla #1262.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27493 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2008-08-29 20:05:08 +00:00
parent 6c30638aa1
commit 3af860b877
23 changed files with 60 additions and 59 deletions

View File

@ -28,7 +28,7 @@
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>

24
configure vendored
View File

@ -239,7 +239,7 @@ Optional features:
--disable-pvr disable Video4Linux2 MPEG PVR [autodetect] --disable-pvr disable Video4Linux2 MPEG PVR [autodetect]
--disable-rtc disable RTC (/dev/rtc) on Linux [autodetect] --disable-rtc disable RTC (/dev/rtc) on Linux [autodetect]
--disable-network disable networking [enable] --disable-network disable networking [enable]
--enable-winsock2 enable winsock2 [autodetect] --enable-winsock2_h enable winsock2_h [autodetect]
--enable-smb enable Samba (SMB) input [autodetect] --enable-smb enable Samba (SMB) input [autodetect]
--enable-live enable LIVE555 Streaming Media [autodetect] --enable-live enable LIVE555 Streaming Media [autodetect]
--enable-nemesi enable Nemesi Streaming Media [autodetect] --enable-nemesi enable Nemesi Streaming Media [autodetect]
@ -621,7 +621,7 @@ _tv_dshow=auto
_tv_teletext=auto _tv_teletext=auto
_pvr=auto _pvr=auto
_network=yes _network=yes
_winsock2=auto _winsock2_h=auto
_smb=auto _smb=auto
_vidix=auto _vidix=auto
_vidix_pcidb=yes _vidix_pcidb=yes
@ -1022,8 +1022,8 @@ for ac_option do
--disable-fastmemcpy) _fastmemcpy=no ;; --disable-fastmemcpy) _fastmemcpy=no ;;
--enable-network) _network=yes ;; --enable-network) _network=yes ;;
--disable-network) _network=no ;; --disable-network) _network=no ;;
--enable-winsock2) _winsock2=yes ;; --enable-winsock2_h) _winsock2_h=yes ;;
--disable-winsock2) _winsock2=no ;; --disable-winsock2_h) _winsock2_h=no ;;
--enable-smb) _smb=yes ;; --enable-smb) _smb=yes ;;
--disable-smb) _smb=no ;; --disable-smb) _smb=no ;;
--enable-vidix) _vidix=yes ;; --enable-vidix) _vidix=yes ;;
@ -2802,23 +2802,23 @@ _socklib=no
for _ld_tmp in "" "-lsocket -lbind" "-lsocket -ldnet" "-lsocket -lnsl" "-lnsl" "-lsocket" ; do for _ld_tmp in "" "-lsocket -lbind" "-lsocket -ldnet" "-lsocket -lnsl" "-lnsl" "-lsocket" ; do
cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && _socklib=yes && break cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && _socklib=yes && break
done done
if test $_winsock2 = auto && ! cygwin ; then if test $_winsock2_h = auto && ! cygwin ; then
_winsock2=no _winsock2_h=no
cat > $TMPC << EOF cat > $TMPC << EOF
#include <winsock2.h> #include <winsock2.h>
int main(void) { (void) gethostbyname(0); return 0; } int main(void) { (void) gethostbyname(0); return 0; }
EOF EOF
cc_check -lws2_32 && _ld_sock="-lws2_32" && _winsock2=yes cc_check -lws2_32 && _ld_sock="-lws2_32" && _winsock2_h=yes
fi fi
test "$_ld_sock" && _res_comment="using $_ld_sock" test "$_ld_sock" && _res_comment="using $_ld_sock"
echores "$_socklib" echores "$_socklib"
if test $_winsock2 = yes ; then if test $_winsock2_h = yes ; then
_ld_sock="-lws2_32" _ld_sock="-lws2_32"
_def_winsock2='#define HAVE_WINSOCK2 1' _def_winsock2_h='#define HAVE_WINSOCK2_H 1'
else else
_def_winsock2='#undef HAVE_WINSOCK2' _def_winsock2_h='#undef HAVE_WINSOCK2_H'
fi fi
@ -2830,7 +2830,7 @@ cat > $TMPC << EOF
#include <arpa/inet.h> #include <arpa/inet.h>
int main(void) { (void) inet_pton(0, 0, 0); return 0; } int main(void) { (void) inet_pton(0, 0, 0); return 0; }
EOF EOF
if test "$_winsock2" = yes ; then if test "$_winsock2_h" = yes ; then
_res_comment="using winsock2 functions instead" _res_comment="using winsock2 functions instead"
echores "no" echores "no"
elif cc_check $_ld_sock ; then elif cc_check $_ld_sock ; then
@ -8630,7 +8630,7 @@ $_def_ftp
$_def_vstream $_def_vstream
/* enable winsock2 instead of Unix functions*/ /* enable winsock2 instead of Unix functions*/
$_def_winsock2 $_def_winsock2_h
/* define this to use inet_aton() instead of inet_pton() */ /* define this to use inet_aton() instead of inet_pton() */
$_def_use_aton $_def_use_aton

View File

@ -34,7 +34,7 @@
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#include <netdb.h> #include <netdb.h>
#include <sys/socket.h> #include <sys/socket.h>

View File

@ -39,7 +39,7 @@
#include "mp_msg.h" #include "mp_msg.h"
#include "help_mp.h" #include "help_mp.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#else #else
#include <winsock2.h> #include <winsock2.h>

View File

@ -9,7 +9,7 @@
#include "mp_msg.h" #include "mp_msg.h"
#include "help_mp.h" #include "help_mp.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#else #else
#include <winsock2.h> #include <winsock2.h>

View File

@ -11,7 +11,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#else #else
#include <winsock2.h> #include <winsock2.h>

View File

@ -42,7 +42,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <inttypes.h> #include <inttypes.h>
#ifdef HAVE_WINSOCK2 #ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <sys/socket.h> #include <sys/socket.h>
@ -72,7 +72,7 @@ static int write_stream(int s, const char *buf, int len) {
if (n > 0) if (n > 0)
total += n; total += n;
else if (n < 0) { else if (n < 0) {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
if ((timeout>0) && ((errno == EAGAIN) || (errno == EINPROGRESS))) { if ((timeout>0) && ((errno == EAGAIN) || (errno == EINPROGRESS))) {
#else #else
if ((timeout>0) && ((errno == EAGAIN) || (WSAGetLastError() == WSAEINPROGRESS))) { if ((timeout>0) && ((errno == EAGAIN) || (WSAGetLastError() == WSAEINPROGRESS))) {

View File

@ -28,7 +28,7 @@
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -250,7 +250,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname)
if (bind (s, (struct sockaddr *) &sin, sizeof (sin))) if (bind (s, (struct sockaddr *) &sin, sizeof (sin)))
{ {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
if (errno != EINPROGRESS) if (errno != EINPROGRESS)
#else #else
if (WSAGetLastError() != WSAEINPROGRESS) if (WSAGetLastError() != WSAEINPROGRESS)
@ -296,7 +296,7 @@ rtp_connect (char *hostname, int port)
if (!hostname || !strcmp (hostname, "0.0.0.0")) if (!hostname || !strcmp (hostname, "0.0.0.0"))
sin.sin_addr.s_addr = htonl (INADDR_ANY); sin.sin_addr.s_addr = htonl (INADDR_ANY);
else else
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#ifdef HAVE_ATON #ifdef HAVE_ATON
inet_aton (hostname, &sin.sin_addr); inet_aton (hostname, &sin.sin_addr);
#else #else
@ -331,7 +331,7 @@ rtp_connect (char *hostname, int port)
/* datagram socket */ /* datagram socket */
if (bind (s, (struct sockaddr *) &sin, sizeof (sin))) if (bind (s, (struct sockaddr *) &sin, sizeof (sin)))
{ {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
if (errno != EINPROGRESS) if (errno != EINPROGRESS)
#else #else
if (WSAGetLastError() != WSAEINPROGRESS) if (WSAGetLastError() != WSAEINPROGRESS)
@ -385,7 +385,7 @@ is_multicast_address (char *addr)
sin.sin_family = AF_INET; sin.sin_family = AF_INET;
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#ifdef HAVE_ATON #ifdef HAVE_ATON
inet_aton (addr, &sin.sin_addr); inet_aton (addr, &sin.sin_addr);
#else #else

View File

@ -30,7 +30,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>

View File

@ -14,7 +14,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#include "mp_msg.h" #include "mp_msg.h"

View File

@ -19,7 +19,7 @@
#include "mp_msg.h" #include "mp_msg.h"
#include "help_mp.h" #include "help_mp.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#else #else
#include <winsock2.h> #include <winsock2.h>

View File

@ -12,7 +12,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>

View File

@ -35,7 +35,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/time.h> #include <sys/time.h>
#include <inttypes.h> #include <inttypes.h>
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#include <sys/socket.h> #include <sys/socket.h>
//#include <netinet/in.h> //#include <netinet/in.h>
@ -205,7 +205,7 @@ static int rm_write(int s, const char *buf, int len) {
if (n > 0) if (n > 0)
total += n; total += n;
else if (n < 0) { else if (n < 0) {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
if (timeout>0 && (errno == EAGAIN || errno == EINPROGRESS)) { if (timeout>0 && (errno == EAGAIN || errno == EINPROGRESS)) {
#else #else
if (timeout>0 && (errno == EAGAIN || WSAGetLastError() == WSAEINPROGRESS)) { if (timeout>0 && (errno == EAGAIN || WSAGetLastError() == WSAEINPROGRESS)) {

View File

@ -31,7 +31,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>

View File

@ -13,7 +13,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <ctype.h> #include <ctype.h>
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <arpa/inet.h> #include <arpa/inet.h>

View File

@ -14,7 +14,7 @@
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#else #else
#include <winsock2.h> #include <winsock2.h>
@ -410,7 +410,7 @@ stream_t* new_stream(int fd,int type){
if(s==NULL) return NULL; if(s==NULL) return NULL;
memset(s,0,sizeof(stream_t)); memset(s,0,sizeof(stream_t));
#ifdef HAVE_WINSOCK2 #ifdef HAVE_WINSOCK2_H
{ {
WSADATA wsdata; WSADATA wsdata;
int temp = WSAStartup(0x0202, &wsdata); // there might be a better place for this (-> later) int temp = WSAStartup(0x0202, &wsdata); // there might be a better place for this (-> later)
@ -445,7 +445,7 @@ void free_stream(stream_t *s){
closesocket(s->fd); closesocket(s->fd);
else close(s->fd); else close(s->fd);
} }
#ifdef HAVE_WINSOCK2 #ifdef HAVE_WINSOCK2_H
mp_msg(MSGT_STREAM,MSGL_V,"WINSOCK2 uninit\n"); mp_msg(MSGT_STREAM,MSGL_V,"WINSOCK2 uninit\n");
WSACleanup(); // there might be a better place for this (-> later) WSACleanup(); // there might be a better place for this (-> later)
#endif #endif

View File

@ -27,7 +27,7 @@
#define mkdir(a,b) mkdir(a) #define mkdir(a,b) mkdir(a)
#endif #endif
#include <windows.h> #include <windows.h>
#ifdef HAVE_WINSOCK2 #ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#else #else

View File

@ -9,7 +9,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <sys/socket.h> #include <sys/socket.h>
#define closesocket close #define closesocket close
#else #else

View File

@ -42,7 +42,7 @@
#include <inttypes.h> #include <inttypes.h>
#include <errno.h> #include <errno.h>
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#define closesocket close #define closesocket close
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -90,7 +90,7 @@ static const struct m_struct_st stream_opts = {
//// When the cache is running we need a lock as //// When the cache is running we need a lock as
//// fill_buffer is called from another proccess //// fill_buffer is called from another proccess
static int lock_fd(int fd) { static int lock_fd(int fd) {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
struct flock lock; struct flock lock;
memset(&lock,0,sizeof(struct flock)); memset(&lock,0,sizeof(struct flock));
@ -113,7 +113,7 @@ printf("FIXME? should lock here\n");
} }
static int unlock_fd(int fd) { static int unlock_fd(int fd) {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
struct flock lock; struct flock lock;
memset(&lock,0,sizeof(struct flock)); memset(&lock,0,sizeof(struct flock));

View File

@ -28,7 +28,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <ctype.h> #include <ctype.h>
#include "config.h" #include "config.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <arpa/inet.h> #include <arpa/inet.h>

View File

@ -20,7 +20,7 @@
#include "mp_msg.h" #include "mp_msg.h"
#include "help_mp.h" #include "help_mp.h"
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -75,7 +75,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
struct hostent *hp=NULL; struct hostent *hp=NULL;
char buf[255]; char buf[255];
#ifdef HAVE_WINSOCK2 #ifdef HAVE_WINSOCK2_H
u_long val; u_long val;
int to; int to;
#else #else
@ -91,7 +91,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
} }
#if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO) #if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO)
#ifdef HAVE_WINSOCK2 #ifdef HAVE_WINSOCK2_H
/* timeout in milliseconds */ /* timeout in milliseconds */
to = 10 * 1000; to = 10 * 1000;
#else #else
@ -115,7 +115,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
memset(&server_address, 0, sizeof(server_address)); memset(&server_address, 0, sizeof(server_address));
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#ifdef HAVE_ATON #ifdef HAVE_ATON
if (inet_aton(host, our_s_addr)!=1) if (inet_aton(host, our_s_addr)!=1)
#else #else
@ -139,7 +139,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
memcpy( our_s_addr, (void*)hp->h_addr_list[0], hp->h_length ); memcpy( our_s_addr, (void*)hp->h_addr_list[0], hp->h_length );
} }
#ifdef HAVE_WINSOCK2 #ifdef HAVE_WINSOCK2_H
else { else {
unsigned long addr = inet_addr(host); unsigned long addr = inet_addr(host);
memcpy( our_s_addr, (void*)&addr, sizeof(addr) ); memcpy( our_s_addr, (void*)&addr, sizeof(addr) );
@ -164,7 +164,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
return TCP_ERROR_FATAL; return TCP_ERROR_FATAL;
} }
#if defined(HAVE_ATON) || defined(HAVE_WINSOCK2) #if defined(HAVE_ATON) || defined(HAVE_WINSOCK2_H)
strncpy( buf, inet_ntoa( *((struct in_addr*)our_s_addr) ), 255); strncpy( buf, inet_ntoa( *((struct in_addr*)our_s_addr) ), 255);
#else #else
inet_ntop(af, our_s_addr, buf, 255); inet_ntop(af, our_s_addr, buf, 255);
@ -172,14 +172,14 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port ); if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port );
// Turn the socket as non blocking so we can timeout on the connection // Turn the socket as non blocking so we can timeout on the connection
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) | O_NONBLOCK ); fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) | O_NONBLOCK );
#else #else
val = 1; val = 1;
ioctlsocket( socket_server_fd, FIONBIO, &val ); ioctlsocket( socket_server_fd, FIONBIO, &val );
#endif #endif
if( connect( socket_server_fd, (struct sockaddr*)&server_address, server_address_size )==-1 ) { if( connect( socket_server_fd, (struct sockaddr*)&server_address, server_address_size )==-1 ) {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
if( errno!=EINPROGRESS ) { if( errno!=EINPROGRESS ) {
#else #else
if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) { if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) {
@ -211,7 +211,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
if (ret < 0) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_SelectFailed); if (ret < 0) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_SelectFailed);
// Turn back the socket as blocking // Turn back the socket as blocking
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) & ~O_NONBLOCK ); fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) & ~O_NONBLOCK );
#else #else
val = 0; val = 0;

View File

@ -35,6 +35,7 @@ known issues:
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <math.h>
#ifdef HAVE_SYS_SYSINFO_H #ifdef HAVE_SYS_SYSINFO_H
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#endif #endif

View File

@ -31,7 +31,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <ctype.h> #include <ctype.h>
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -74,7 +74,7 @@ udp_open_socket (URL_t *url)
if (isalpha (url->hostname[0])) if (isalpha (url->hostname[0]))
{ {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
hp = (struct hostent *) gethostbyname (url->hostname); hp = (struct hostent *) gethostbyname (url->hostname);
if (!hp) if (!hp)
{ {
@ -87,11 +87,11 @@ udp_open_socket (URL_t *url)
(void *) hp->h_addr_list[0], hp->h_length); (void *) hp->h_addr_list[0], hp->h_length);
#else #else
server_address.sin_addr.s_addr = htonl (INADDR_ANY); server_address.sin_addr.s_addr = htonl (INADDR_ANY);
#endif /* HAVE_WINSOCK2 */ #endif /* HAVE_WINSOCK2_H */
} }
else else
{ {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
#ifdef HAVE_ATON #ifdef HAVE_ATON
inet_aton (url->hostname, &server_address.sin_addr); inet_aton (url->hostname, &server_address.sin_addr);
#else #else
@ -99,7 +99,7 @@ udp_open_socket (URL_t *url)
#endif /* HAVE_ATON */ #endif /* HAVE_ATON */
#else #else
server_address.sin_addr.s_addr = htonl(INADDR_ANY); server_address.sin_addr.s_addr = htonl(INADDR_ANY);
#endif /* HAVE_WINSOCK2 */ #endif /* HAVE_WINSOCK2_H */
} }
server_address.sin_family = AF_INET; server_address.sin_family = AF_INET;
server_address.sin_port = htons (url->port); server_address.sin_port = htons (url->port);
@ -110,11 +110,11 @@ udp_open_socket (URL_t *url)
if (bind (socket_server_fd, (struct sockaddr *) &server_address, if (bind (socket_server_fd, (struct sockaddr *) &server_address,
sizeof (server_address)) == -1) sizeof (server_address)) == -1)
{ {
#ifndef HAVE_WINSOCK2 #ifndef HAVE_WINSOCK2_H
if (errno != EINPROGRESS) if (errno != EINPROGRESS)
#else #else
if (WSAGetLastError () != WSAEINPROGRESS) if (WSAGetLastError () != WSAEINPROGRESS)
#endif /* HAVE_WINSOCK2 */ #endif /* HAVE_WINSOCK2_H */
{ {
mp_msg (MSGT_NETWORK, MSGL_ERR, "Failed to connect to server\n"); mp_msg (MSGT_NETWORK, MSGL_ERR, "Failed to connect to server\n");
closesocket (socket_server_fd); closesocket (socket_server_fd);
@ -122,7 +122,7 @@ udp_open_socket (URL_t *url)
} }
} }
#ifdef HAVE_WINSOCK2 #ifdef HAVE_WINSOCK2_H
if (isalpha (url->hostname[0])) if (isalpha (url->hostname[0]))
{ {
hp = (struct hostent *) gethostbyname (url->hostname); hp = (struct hostent *) gethostbyname (url->hostname);
@ -141,7 +141,7 @@ udp_open_socket (URL_t *url)
unsigned int addr = inet_addr (url->hostname); unsigned int addr = inet_addr (url->hostname);
memcpy ((void *) &server_address.sin_addr, (void *) &addr, sizeof (addr)); memcpy ((void *) &server_address.sin_addr, (void *) &addr, sizeof (addr));
} }
#endif /* HAVE_WINSOCK2 */ #endif /* HAVE_WINSOCK2_H */
/* Increase the socket rx buffer size to maximum -- this is UDP */ /* Increase the socket rx buffer size to maximum -- this is UDP */
rxsockbufsz = 240 * 1024; rxsockbufsz = 240 * 1024;