Commit 16d8d7b7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_getaddrinfo: remove useless parameter

parent 13bd0121
......@@ -260,7 +260,7 @@ VLC_API int getnameinfo ( const struct sockaddr *, socklen_t,
#endif
VLC_API int vlc_getnameinfo( const struct sockaddr *, int, char *, int, int *, int );
VLC_API int vlc_getaddrinfo (vlc_object_t *, const char *, unsigned,
VLC_API int vlc_getaddrinfo (const char *, unsigned,
const struct addrinfo *, struct addrinfo **);
......
......@@ -167,13 +167,13 @@ static void create_SDP(sout_stream_t *p_stream, sout_access_out_t *p_access)
socklen_t srclen = 0, dstlen = 0;
struct addrinfo *res;
if (!vlc_getaddrinfo ( VLC_OBJECT(p_stream), dhost, dport, &hints, &res))
if (!vlc_getaddrinfo (dhost, dport, &hints, &res))
{
memcpy (&dst, res->ai_addr, dstlen = res->ai_addrlen);
freeaddrinfo (res);
}
if (!vlc_getaddrinfo ( VLC_OBJECT(p_stream), shost, sport, &hints, &res))
if (!vlc_getaddrinfo (shost, sport, &hints, &res))
{
memcpy (&src, res->ai_addr, srclen = res->ai_addrlen);
freeaddrinfo (res);
......
......@@ -71,7 +71,6 @@ int vlc_getnameinfo( const struct sockaddr *sa, int salen,
/**
* Resolves a host name to a list of socket addresses (like getaddrinfo()).
*
* @param p_this a VLC object
* @param node host name to resolve (encoded as UTF-8), or NULL
* @param i_port port number for the socket addresses
* @param p_hints parameters (see getaddrinfo() manual page)
......@@ -80,9 +79,8 @@ int vlc_getnameinfo( const struct sockaddr *sa, int salen,
* On failure, *res is undefined. On success, it must be freed with
* freeaddrinfo().
*/
int vlc_getaddrinfo (vlc_object_t *p_this, const char *node,
unsigned port, const struct addrinfo *p_hints,
struct addrinfo **res)
int vlc_getaddrinfo (const char *node, unsigned port,
const struct addrinfo *p_hints, struct addrinfo **res)
{
struct addrinfo hints;
char psz_buf[NI_MAXHOST], portbuf[6], *servname;
......@@ -94,10 +92,7 @@ int vlc_getaddrinfo (vlc_object_t *p_this, const char *node,
if (port != 0)
{
if (port > 65535)
{
msg_Err (p_this, "invalid port number %u specified", port);
return EAI_SERVICE;
}
/* cannot overflow */
snprintf (portbuf, sizeof (portbuf), "%u", port);
servname = portbuf;
......
......@@ -137,7 +137,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
msg_Dbg (p_this, "net: listening to %s port %d",
(psz_host != NULL) ? psz_host : "*", i_port);
int i_val = vlc_getaddrinfo (p_this, psz_host, i_port, &hints, &res);
int i_val = vlc_getaddrinfo (psz_host, i_port, &hints, &res);
if (i_val)
{
msg_Err (p_this, "Cannot resolve %s port %d : %s",
......
......@@ -78,7 +78,7 @@ int net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
struct addrinfo hints, *res, *ptr;
const char *psz_realhost;
char *psz_socks;
int i_realport, i_val, i_handle = -1;
int i_realport, i_handle = -1;
int evfd = vlc_object_waitpipe (p_this);
if (evfd == -1)
......@@ -137,13 +137,13 @@ int net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
i_realport );
}
i_val = vlc_getaddrinfo( p_this, psz_realhost, i_realport, &hints, &res );
int val = vlc_getaddrinfo (psz_realhost, i_realport, &hints, &res);
free( psz_socks );
if( i_val )
if (val)
{
msg_Err( p_this, "cannot resolve %s port %d : %s", psz_realhost,
i_realport, gai_strerror( i_val ) );
msg_Err (p_this, "cannot resolve %s port %d : %s", psz_realhost,
i_realport, gai_strerror (val));
return -1;
}
......@@ -445,22 +445,22 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
if( i_socks_version == 4 )
{
struct addrinfo hints, *p_res;
struct addrinfo hints, *res;
/* v4 only support ipv4 */
memset (&hints, 0, sizeof (hints));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
if( vlc_getaddrinfo( p_obj, psz_host, 0, &hints, &p_res ) )
if (vlc_getaddrinfo (psz_host, 0, &hints, &res))
return VLC_EGENERIC;
buffer[0] = i_socks_version;
buffer[1] = 0x01; /* CONNECT */
SetWBE( &buffer[2], i_port ); /* Port */
memcpy( &buffer[4], /* Address */
&((struct sockaddr_in *)(p_res->ai_addr))->sin_addr, 4 );
freeaddrinfo( p_res );
memcpy (&buffer[4], /* Address */
&((struct sockaddr_in *)(res->ai_addr))->sin_addr, 4);
freeaddrinfo (res);
buffer[8] = 0; /* Empty user id */
......
......@@ -150,7 +150,7 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
msg_Dbg (obj, "net: opening %s datagram port %d",
host ? host : "any", port);
int val = vlc_getaddrinfo (obj, host, port, &hints, &res);
int val = vlc_getaddrinfo (host, port, &hints, &res);
if (val)
{
msg_Err (obj, "Cannot resolve %s port %d : %s", host, port,
......@@ -504,7 +504,7 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
int i_hlim, int proto )
{
struct addrinfo hints, *res, *ptr;
int i_val, i_handle = -1;
int i_handle = -1;
bool b_unreach = false;
if( i_hlim < 0 )
......@@ -516,11 +516,11 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
msg_Dbg( p_this, "net: connecting to [%s]:%d", psz_host, i_port );
i_val = vlc_getaddrinfo( p_this, psz_host, i_port, &hints, &res );
if( i_val )
int val = vlc_getaddrinfo (psz_host, i_port, &hints, &res);
if (val)
{
msg_Err( p_this, "cannot resolve [%s]:%d : %s", psz_host, i_port,
gai_strerror( i_val ) );
msg_Err (p_this, "cannot resolve [%s]:%d : %s", psz_host, i_port,
gai_strerror (val));
return -1;
}
......@@ -602,13 +602,12 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
psz_server, i_server, psz_bind, i_bind);
struct addrinfo hints, *loc, *rem;
int val;
memset (&hints, 0, sizeof (hints));
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = protocol;
val = vlc_getaddrinfo (obj, psz_server, i_server, &hints, &rem);
int val = vlc_getaddrinfo (psz_server, i_server, &hints, &rem);
if (val)
{
msg_Err (obj, "cannot resolve %s port %d : %s", psz_bind, i_bind,
......@@ -617,7 +616,7 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
}
hints.ai_flags = AI_PASSIVE;
val = vlc_getaddrinfo (obj, psz_bind, i_bind, &hints, &loc);
val = vlc_getaddrinfo (psz_bind, i_bind, &hints, &loc);
if (val)
{
msg_Err (obj, "cannot resolve %s port %d : %s", psz_bind, i_bind,
......
......@@ -68,7 +68,7 @@ sout_AnnounceRegisterSDP( vlc_object_t *obj, const char *psz_sdp,
/* GRUIK. We should not convert back-and-forth from string to numbers */
struct addrinfo *res;
if (vlc_getaddrinfo (obj, psz_dst, 0, NULL, &res) == 0)
if (vlc_getaddrinfo (psz_dst, 0, NULL, &res) == 0)
{
if (res->ai_addrlen <= sizeof (p_session->addr))
memcpy (&p_session->addr, res->ai_addr,
......
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