changeset 2738:1f5c5c223764 libavformat

Remove some ifdefs by using the "dest_addr_len" field in both the IPv4-only code and the protocol-independent code
author lucabe
date Wed, 14 Nov 2007 07:35:36 +0000
parents 1e7edb0c6cfc
children 091af9f47edf
files udp.c
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/udp.c	Wed Nov 14 07:31:25 2007 +0000
+++ b/udp.c	Wed Nov 14 07:35:36 2007 +0000
@@ -38,8 +38,8 @@
     struct sockaddr_in dest_addr;
 #else
     struct sockaddr_storage dest_addr;
+#endif
     size_t dest_addr_len;
-#endif
 } UDPContext;
 
 #define UDP_TX_BUF_SIZE 32768
@@ -234,6 +234,7 @@
         return AVERROR(EIO);
     s->dest_addr.sin_family = AF_INET;
     s->dest_addr.sin_port = htons(port);
+    s->dest_addr_len = sizeof(s->dest_addr);
     return 0;
 #endif
 }
@@ -441,11 +442,7 @@
     for(;;) {
         ret = sendto (s->udp_fd, buf, size, 0,
                       (struct sockaddr *) &s->dest_addr,
-#ifndef CONFIG_IPV6
-                      sizeof (s->dest_addr));
-#else
                       s->dest_addr_len);
-#endif
         if (ret < 0) {
             if (ff_neterrno() != FF_NETERROR(EINTR) &&
                 ff_neterrno() != FF_NETERROR(EAGAIN))