Rename to inet_ntop_compat
This commit is contained in:
parent
2749a6ada2
commit
be22290495
|
@ -238,8 +238,6 @@ bool network_init(void);
|
||||||
**/
|
**/
|
||||||
void network_deinit(void);
|
void network_deinit(void);
|
||||||
|
|
||||||
#ifdef _WIN32
|
const char *inet_ntop_compat(int af, const void *src, char *dst, socklen_t cnt);
|
||||||
const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -355,8 +355,7 @@ int inet_ptrton(int af, const char *src, void *dst)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
const char *inet_ntop_compat(int af, const void *src, char *dst, socklen_t cnt)
|
||||||
const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
|
|
||||||
{
|
{
|
||||||
if (af == AF_INET)
|
if (af == AF_INET)
|
||||||
{
|
{
|
||||||
|
@ -380,4 +379,3 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -3502,6 +3502,7 @@ finish:
|
||||||
if (lan_room_count != 0)
|
if (lan_room_count != 0)
|
||||||
{
|
{
|
||||||
struct netplay_host *host = NULL;
|
struct netplay_host *host = NULL;
|
||||||
|
|
||||||
for (host = &lan_hosts->hosts[k]; i < netplay_room_count + lan_room_count; i++)
|
for (host = &lan_hosts->hosts[k]; i < netplay_room_count + lan_room_count; i++)
|
||||||
{
|
{
|
||||||
struct sockaddr *address = NULL;
|
struct sockaddr *address = NULL;
|
||||||
|
@ -3512,28 +3513,18 @@ finish:
|
||||||
|
|
||||||
address = &host->addr;
|
address = &host->addr;
|
||||||
|
|
||||||
#ifdef INET6_ADDRSTRLEN
|
|
||||||
/* TODO/FIXME - inet_ntop is not portable. Need to create
|
|
||||||
* a wrapper function in libretro-common which will wrap
|
|
||||||
* this and ensure that it will work on most platforms.
|
|
||||||
*/
|
|
||||||
if (address->sa_family == AF_INET)
|
if (address->sa_family == AF_INET)
|
||||||
{
|
{
|
||||||
struct sockaddr_in *sin = (struct sockaddr_in *) address;
|
struct sockaddr_in *sin = (struct sockaddr_in *) address;
|
||||||
inet_ntop(AF_INET, &sin->sin_addr,
|
inet_ntop_compat(AF_INET, &sin->sin_addr,
|
||||||
netplay_room_list[i].address, INET6_ADDRSTRLEN);
|
netplay_room_list[i].address, INET6_ADDRSTRLEN);
|
||||||
}
|
}
|
||||||
else if (address->sa_family == AF_INET6)
|
else if (address->sa_family == AF_INET6)
|
||||||
{
|
{
|
||||||
struct sockaddr_in6 *sin = (struct sockaddr_in6 *) address;
|
struct sockaddr_in6 *sin = (struct sockaddr_in6 *) address;
|
||||||
inet_ntop(AF_INET6, &sin->sin6_addr,
|
inet_ntop_compat(AF_INET6, &sin->sin6_addr,
|
||||||
netplay_room_list[i].address, INET6_ADDRSTRLEN);
|
netplay_room_list[i].address, INET6_ADDRSTRLEN);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
strlcpy(netplay_room_list[i].address,
|
|
||||||
inet_ntoa(((struct sockaddr_in*)(address))->sin_addr),
|
|
||||||
sizeof(netplay_room_list[i].address));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
strlcpy(netplay_room_list[i].corename,
|
strlcpy(netplay_room_list[i].corename,
|
||||||
host->core,
|
host->core,
|
||||||
|
|
Loading…
Reference in New Issue