[vlc-commits] sap: remove useless source socket address
Rémi Denis-Courmont
git at videolan.org
Fri Jun 20 19:01:25 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jun 20 18:57:09 2014 +0300| [e5cadc53076e37c3c095f0d2024063a0a3c39310] | committer: Rémi Denis-Courmont
sap: remove useless source socket address
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5cadc53076e37c3c095f0d2024063a0a3c39310
---
src/stream_output/sap.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/src/stream_output/sap.c b/src/stream_output/sap.c
index cd8ade6..4f59b1e 100644
--- a/src/stream_output/sap.c
+++ b/src/stream_output/sap.c
@@ -44,8 +44,6 @@
struct session_descriptor_t
{
- struct sockaddr_storage orig;
- socklen_t origlen;
struct sockaddr_storage addr;
socklen_t addrlen;
@@ -328,11 +326,8 @@ static int SAP_Add (sap_handler_t *p_sap, session_descriptor_t *p_session,
vlc_mutex_lock (&sap_addr->lock);
vlc_mutex_unlock (&p_sap->lock);
- memcpy (&p_session->orig, &sap_addr->orig, sap_addr->origlen);
- p_session->origlen = sap_addr->origlen;
-
size_t headsize = 20, length;
- switch (p_session->orig.ss_family)
+ switch (sap_addr->orig.ss_family)
{
#ifdef AF_INET6
case AF_INET6:
@@ -371,13 +366,13 @@ static int SAP_Add (sap_handler_t *p_sap, session_descriptor_t *p_session,
psz_head[3] = i_hash; /* Msg id hash 2 */
headsize = 4;
- switch (p_session->orig.ss_family)
+ switch (sap_addr->orig.ss_family)
{
#ifdef AF_INET6
case AF_INET6:
{
- struct in6_addr *a6 =
- &((struct sockaddr_in6 *)&p_session->orig)->sin6_addr;
+ const struct in6_addr *a6 =
+ &((const struct sockaddr_in6 *)&sap_addr->orig)->sin6_addr;
memcpy (psz_head + headsize, a6, 16);
psz_head[0] |= 0x10; /* IPv6 flag */
headsize += 16;
@@ -386,9 +381,9 @@ static int SAP_Add (sap_handler_t *p_sap, session_descriptor_t *p_session,
#endif
case AF_INET:
{
- uint32_t ipv4 =
- (((struct sockaddr_in *)&p_session->orig)->sin_addr.s_addr);
- memcpy (psz_head + headsize, &ipv4, 4);
+ const struct in_addr *a4 =
+ &((const struct sockaddr_in *)&sap_addr->orig)->sin_addr;
+ memcpy (psz_head + headsize, a4, 4);
headsize += 4;
break;
}
More information about the vlc-commits
mailing list