Commit b748d47b authored by Steve Lhomme's avatar Steve Lhomme

getaddrinfo.c: fix MSVC compilation

parent 4ed95dfa
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
*****************************************************************************/ *****************************************************************************/
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include "network.h"
#include <stddef.h> /* size_t */ #include <stddef.h> /* size_t */
#include <string.h> /* strncpy(), strlen(), memcpy(), memset(), strchr() */ #include <string.h> /* strncpy(), strlen(), memcpy(), memset(), strchr() */
...@@ -37,15 +36,24 @@ ...@@ -37,15 +36,24 @@
#endif #endif
#include <errno.h> #include <errno.h>
#if defined (UNDER_CE) #if defined( WIN32 ) || defined( UNDER_CE )
# include <winsock.h> # include <winsock2.h>
#elif defined WIN32 # include <ws2tcpip.h>
# include <winsock2.h>
# include <ws2tcpip.h>
#else #else
# include <netdb.h> # include <sys/socket.h>
# include <netinet/in.h>
# ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
# endif
# include <netdb.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif #endif
#include "network.h"
#ifdef SYS_BEOS #ifdef SYS_BEOS
#define NO_ADDRESS NO_DATA #define NO_ADDRESS NO_DATA
#define PF_INET AF_INET #define PF_INET AF_INET
...@@ -597,28 +605,30 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node, ...@@ -597,28 +605,30 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
service = "0"; service = "0";
#ifdef WIN32 #ifdef WIN32
typedef int (CALLBACK * GETADDRINFO) ( const char *, const char *,
const struct addrinfo *,
struct addrinfo ** );
HINSTANCE wship6_module;
GETADDRINFO ws2_getaddrinfo;
wship6_module = LoadLibrary( "wship6.dll" );
if( wship6_module != NULL )
{ {
ws2_getaddrinfo = (GETADDRINFO)GetProcAddress( wship6_module, typedef int (CALLBACK * GETADDRINFO) ( const char *, const char *,
"getaddrinfo" ); const struct addrinfo *,
struct addrinfo ** );
if( ws2_getaddrinfo != NULL ) HINSTANCE wship6_module;
GETADDRINFO ws2_getaddrinfo;
wship6_module = LoadLibrary( "wship6.dll" );
if( wship6_module != NULL )
{ {
int i_ret; ws2_getaddrinfo = (GETADDRINFO)GetProcAddress( wship6_module,
"getaddrinfo" );
i_ret = ws2_getaddrinfo( psz_node, service, &hints, res ); if( ws2_getaddrinfo != NULL )
FreeLibrary( wship6_module ); /* is this wise ? */ {
return i_ret; int i_ret;
}
FreeLibrary( wship6_module ); i_ret = ws2_getaddrinfo( psz_node, service, &hints, res );
FreeLibrary( wship6_module ); /* is this wise ? */
return i_ret;
}
FreeLibrary( wship6_module );
}
} }
#endif #endif
#if HAVE_GETADDRINFO #if HAVE_GETADDRINFO
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment