]> git.sesse.net Git - vlc/blobdiff - src/network/udp.c
Clone video filter : fix potential memleak.
[vlc] / src / network / udp.c
index 624d28e662dcad529f8094a97ca13bbd9e9cfb3c..d0938b9a9cc070118f26fdd3024299644177174d 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
 
 #include <errno.h>
 
@@ -612,10 +616,7 @@ int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
 {
     struct addrinfo hints, *res, *ptr;
     int             i_val, i_handle = -1;
-    vlc_bool_t      b_unreach = VLC_FALSE;
-
-    if( i_port == 0 )
-        i_port = 1234; /* historical VLC thing */
+    bool      b_unreach = false;
 
     if( i_hlim < 1 )
         i_hlim = var_CreateGetInteger( p_this, "ttl" );
@@ -623,12 +624,12 @@ int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
     memset( &hints, 0, sizeof( hints ) );
     hints.ai_socktype = SOCK_DGRAM;
 
-    msg_Dbg( p_this, "net: connecting to %s port %d", psz_host, 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 )
     {
-        msg_Err( p_this, "cannot resolve %s port %d : %s", psz_host, i_port,
+        msg_Err( p_this, "cannot resolve [%s]:%d : %s", psz_host, i_port,
                  vlc_gai_strerror( i_val ) );
         return -1;
     }
@@ -682,7 +683,7 @@ int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
 #else
         if( errno == ENETUNREACH )
 #endif
-            b_unreach = VLC_TRUE;
+            b_unreach = true;
         else
         {
             msg_Warn( p_this, "%s port %d : %m", psz_host, i_port);
@@ -878,6 +879,10 @@ int net_SetCSCov (int fd, int sendcov, int recvcov)
             return VLC_SUCCESS;
 #endif
     }
+#if !defined( UDPLITE_RECV_CSCOV ) && !defined( DCCP_SOCKOPT_SEND_CSCOV )
+    VLC_UNUSED(sendcov);
+    VLC_UNUSED(recvcov);
+#endif
 
     return VLC_EGENERIC;
 }