Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
54b1dfae
Commit
54b1dfae
authored
Mar 05, 2007
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gettaddrinfo.c: fixed shims on win32 (tested on XP)
parent
af5e5b18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
26 deletions
+29
-26
src/network/getaddrinfo.c
src/network/getaddrinfo.c
+29
-26
No files found.
src/network/getaddrinfo.c
View file @
54b1dfae
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
#define _WIN32_WINNT 0x501
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <stddef.h>
/* size_t */
#include <stddef.h>
/* size_t */
...
@@ -451,42 +450,41 @@ getaddrinfo (const char *node, const char *service,
...
@@ -451,42 +450,41 @@ getaddrinfo (const char *node, const char *service,
#endif
/* if !HAVE_GETADDRINFO */
#endif
/* if !HAVE_GETADDRINFO */
#endif
#endif
#if
0 &&
defined( WIN32 ) && !defined( UNDER_CE )
#if defined( WIN32 ) && !defined( UNDER_CE )
/*
/*
* Here is the kind of kludge you need to keep binary compatibility among
* Here is the kind of kludge you need to keep binary compatibility among
* varying OS versions...
* varying OS versions...
*/
*/
typedef int (
CALLBACK * GETNAMEINFO) ( const struct sockaddr
*, socklen_t,
typedef
int
(
WSAAPI
*
GETNAMEINFO
)
(
const
struct
sockaddr
FAR
*
,
socklen_t
,
char
*, DWORD, char
*, DWORD, int );
char
FAR
*
,
DWORD
,
char
FAR
*
,
DWORD
,
int
);
typedef int (
CALLBACK * GETADDRINFO) (const char *, const char
*,
typedef
int
(
WSAAPI
*
GETADDRINFO
)
(
const
char
FAR
*
,
const
char
FAR
*
,
const struct addrinfo *,
const
struct
addrinfo
FAR
*
,
struct addrinfo
*
*);
struct
addrinfo
FAR
*
FAR
*
);
typedef void (
CALLBACK * FREEADDRINFO) ( struct addrinfo
* );
typedef
void
(
WSAAPI
*
FREEADDRINFO
)
(
struct
addrinfo
FAR
*
);
static
int
WSAAPI
_ws2_getnameinfo_bind
(
const
struct
sockaddr
FAR
*
,
socklen_t
,
static WINAPI int _ws2_getnameinfo_bind( const struct sockaddr *sa, socklen_t salen,
char
FAR
*
,
DWORD
,
char
FAR
*
,
DWORD
,
int
);
char *host, DWORD hostlen, char *serv, DWORD servlen, int flags );
static
int
WSAAPI
_ws2_getaddrinfo_bind
(
const
char
FAR
*
,
const
char
FAR
*
,
const
struct
addrinfo
FAR
*
,
static WINAPI int _ws2_getaddrinfo_bind(const char *node, const char *service,
struct
addrinfo
FAR
*
FAR
*
);
const struct addrinfo *hints, struct addrinfo **res);
static
GETNAMEINFO
ws2_getnameinfo
=
_ws2_getnameinfo_bind
;
static
GETNAMEINFO
ws2_getnameinfo
=
_ws2_getnameinfo_bind
;
static
GETADDRINFO
ws2_getaddrinfo
=
_ws2_getaddrinfo_bind
;
static
GETADDRINFO
ws2_getaddrinfo
=
_ws2_getaddrinfo_bind
;
static
FREEADDRINFO
ws2_freeaddrinfo
;
static
FREEADDRINFO
ws2_freeaddrinfo
;
static FARPROC ws2_find_api (
const char *
name)
static
FARPROC
ws2_find_api
(
LPCTSTR
name
)
{
{
FARPROC
f
=
NULL
;
FARPROC
f
=
NULL
;
HMODULE m = GetModuleHandle (
"WS2_32"
);
HMODULE
m
=
GetModuleHandle
(
TEXT
(
"WS2_32"
)
);
if
(
m
!=
NULL
)
if
(
m
!=
NULL
)
f
=
GetProcAddress
(
m
,
name
);
f
=
GetProcAddress
(
m
,
name
);
if
(
f
==
NULL
)
if
(
f
==
NULL
)
{
{
/* Windows 2K IPv6 preview */
/* Windows 2K IPv6 preview */
m = LoadLibrary (
"WSHIP6"
);
m
=
LoadLibrary
(
TEXT
(
"WSHIP6"
)
);
if
(
m
!=
NULL
)
if
(
m
!=
NULL
)
f
=
GetProcAddress
(
m
,
name
);
f
=
GetProcAddress
(
m
,
name
);
}
}
...
@@ -494,14 +492,15 @@ static FARPROC ws2_find_api (const char *name)
...
@@ -494,14 +492,15 @@ static FARPROC ws2_find_api (const char *name)
return
f
;
return
f
;
}
}
static W
INAPI int _ws2_getnameinfo_bind( const struct sockaddr *
sa, socklen_t salen,
static
W
SAAPI
int
_ws2_getnameinfo_bind
(
const
struct
sockaddr
FAR
*
sa
,
socklen_t
salen
,
char
*host, DWORD hostlen, char
*serv, DWORD servlen, int flags )
char
FAR
*
host
,
DWORD
hostlen
,
char
FAR
*
serv
,
DWORD
servlen
,
int
flags
)
{
{
GETNAMEINFO entry = (GETNAMEINFO)ws2_find_api (
"getnameinfo"
);
GETNAMEINFO
entry
=
(
GETNAMEINFO
)
ws2_find_api
(
TEXT
(
"getnameinfo"
)
);
if
(
entry
!=
NULL
)
if
(
entry
!=
NULL
)
{
{
int
result
=
entry
(
sa
,
salen
,
host
,
hostlen
,
serv
,
servlen
,
flags
);
ws2_getnameinfo
=
entry
;
ws2_getnameinfo
=
entry
;
return
entry (sa, salen, host, hostlen, serv, servlen, flags)
;
return
result
;
}
}
/* return a possible error if API is not found */
/* return a possible error if API is not found */
WSASetLastError
(
WSAEAFNOSUPPORT
);
WSASetLastError
(
WSAEAFNOSUPPORT
);
...
@@ -510,17 +509,21 @@ static WINAPI int _ws2_getnameinfo_bind( const struct sockaddr *sa, socklen_t sa
...
@@ -510,17 +509,21 @@ static WINAPI int _ws2_getnameinfo_bind( const struct sockaddr *sa, socklen_t sa
#undef getnameinfo
#undef getnameinfo
#define getnameinfo ws2_getnameinfo
#define getnameinfo ws2_getnameinfo
static W
INAPI int _ws2_getaddrinfo_bind(const char *node, const char
*service,
static
W
SAAPI
int
_ws2_getaddrinfo_bind
(
const
char
FAR
*
node
,
const
char
FAR
*
service
,
const struct addrinfo
*hints, struct addrinfo *
*res)
const
struct
addrinfo
FAR
*
hints
,
struct
addrinfo
FAR
*
FAR
*
res
)
{
{
GETADDRINFO entry = (GETADDRINFO)ws2_find_api ("getaddrinfo");
GETADDRINFO
entry
;
FREEADDRINFO freentry = (FREEADDRINFO)ws2_find_api ("freeaddrinfo");
FREEADDRINFO
freentry
;
entry
=
(
GETADDRINFO
)
ws2_find_api
(
TEXT
(
"getaddrinfo"
));
freentry
=
(
FREEADDRINFO
)
ws2_find_api
(
TEXT
(
"freeaddrinfo"
));
if
((
entry
!=
NULL
)
&&
(
freentry
!=
NULL
))
if
((
entry
!=
NULL
)
&&
(
freentry
!=
NULL
))
{
{
int
result
=
entry
(
node
,
service
,
hints
,
res
);
ws2_freeaddrinfo
=
freentry
;
ws2_freeaddrinfo
=
freentry
;
ws2_getaddrinfo
=
entry
;
ws2_getaddrinfo
=
entry
;
return
entry (node, service, hints, res)
;
return
result
;
}
}
/* return a possible error if API is not found */
/* return a possible error if API is not found */
WSASetLastError
(
WSAHOST_NOT_FOUND
);
WSASetLastError
(
WSAHOST_NOT_FOUND
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment