diff options
author | Martin Storsjö <martin@martin.st> | 2010-10-07 11:58:56 +0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-10-07 11:58:56 +0400 |
commit | 55b6bd1c01be167f0fcea2ec181d644e24c31454 (patch) | |
tree | ee1f2c3cd4008d12b54f53ca9ffbcd4d4b9081bc /libavformat | |
parent | 7ac57fa5eb117d43f95be80acd9df310eecc6d07 (diff) |
Convert ff_is_multicast_address to take a struct sockaddr parameter
Not all users of this function will have a full struct sockaddr_storage
available, and casting other sockaddrs to sockaddr_storage is wrong,
while any sockaddr can be cast to a base sockaddr.
Originally committed as revision 25388 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/network.h | 6 | ||||
-rw-r--r-- | libavformat/udp.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/network.h b/libavformat/network.h index 1ad7319649..d6aee93121 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -162,13 +162,13 @@ const char *ff_gai_strerror(int ecode); #define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff) #endif -static inline int ff_is_multicast_address(struct sockaddr_storage *addr) +static inline int ff_is_multicast_address(struct sockaddr *addr) { - if (addr->ss_family == AF_INET) { + if (addr->sa_family == AF_INET) { return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr)); } #if HAVE_STRUCT_SOCKADDR_IN6 - if (addr->ss_family == AF_INET6) { + if (addr->sa_family == AF_INET6) { return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr); } #endif diff --git a/libavformat/udp.c b/libavformat/udp.c index bfb9b77495..2a4a885600 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -254,7 +254,7 @@ int udp_set_remote_url(URLContext *h, const char *uri) if (s->dest_addr_len < 0) { return AVERROR(EIO); } - s->is_multicast = ff_is_multicast_address(&s->dest_addr); + s->is_multicast = ff_is_multicast_address((struct sockaddr*) &s->dest_addr); return 0; } |