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
16d8d7b7
Commit
16d8d7b7
authored
Aug 19, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc_getaddrinfo: remove useless parameter
parent
13bd0121
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
31 deletions
+25
-31
include/vlc_network.h
include/vlc_network.h
+1
-1
modules/stream_out/standard.c
modules/stream_out/standard.c
+2
-2
src/network/getaddrinfo.c
src/network/getaddrinfo.c
+2
-7
src/network/io.c
src/network/io.c
+1
-1
src/network/tcp.c
src/network/tcp.c
+10
-10
src/network/udp.c
src/network/udp.c
+8
-9
src/stream_output/announce.c
src/stream_output/announce.c
+1
-1
No files found.
include/vlc_network.h
View file @
16d8d7b7
...
...
@@ -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
**
);
...
...
modules/stream_out/standard.c
View file @
16d8d7b7
...
...
@@ -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
);
...
...
src/network/getaddrinfo.c
View file @
16d8d7b7
...
...
@@ -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
;
...
...
src/network/io.c
View file @
16d8d7b7
...
...
@@ -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
,
p
sz_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"
,
...
...
src/network/tcp.c
View file @
16d8d7b7
...
...
@@ -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
);
i
nt
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 */
...
...
src/network/udp.c
View file @
16d8d7b7
...
...
@@ -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
)
i
nt
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
,
...
...
src/stream_output/announce.c
View file @
16d8d7b7
...
...
@@ -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
,
...
...
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