The long awaited BeOS cleanup, phase 1

Originally committed as revision 7581 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
François Revol
2007-01-18 17:22:30 +00:00
parent 453cd7a496
commit e9d511dc7e
8 changed files with 34 additions and 54 deletions

View File

@ -23,11 +23,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifndef __BEOS__
# include <arpa/inet.h>
#else
# include "barpainet.h"
#endif
#include <netdb.h>
#ifndef IPV6_ADD_MEMBERSHIP
@ -214,11 +210,7 @@ static int udp_ipv6_set_local(URLContext *h) {
fail:
if (udp_fd >= 0)
#ifdef CONFIG_BEOS_NETSERVER
closesocket(udp_fd);
#else
close(udp_fd);
#endif
if(res0)
freeaddrinfo(res0);
return -1;
@ -421,11 +413,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
return 0;
fail:
if (udp_fd >= 0)
#ifdef CONFIG_BEOS_NETSERVER
closesocket(udp_fd);
#else
close(udp_fd);
#endif
av_free(s);
return AVERROR_IO;
}
@ -482,22 +470,20 @@ static int udp_close(URLContext *h)
{
UDPContext *s = h->priv_data;
#ifndef CONFIG_BEOS_NETSERVER
#ifndef CONFIG_IPV6
#ifdef IP_DROP_MEMBERSHIP
if (s->is_multicast && !(h->flags & URL_WRONLY)) {
if (setsockopt(s->udp_fd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
&s->mreq, sizeof(s->mreq)) < 0) {
perror("IP_DROP_MEMBERSHIP");
}
}
#endif
#else
if (s->is_multicast && !(h->flags & URL_WRONLY))
udp_ipv6_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
#endif
close(s->udp_fd);
#else
closesocket(s->udp_fd);
#endif
av_free(s);
return 0;
}