]> git.sesse.net Git - vlc/blobdiff - src/network/io.c
Parse vlcrc following American standards for numbers
[vlc] / src / network / io.c
index 7d7ce7163b8f314c9c5d52f24724293084a91436..8bbb1bca24cbaeae1d2277ec0aa37423953dc61e 100644 (file)
@@ -54,7 +54,6 @@
 #   include <poll.h>
 #endif
 
-#include <vlc_common.h>
 #include <vlc_network.h>
 
 #ifndef INADDR_ANY
@@ -126,12 +125,15 @@ int net_Socket (vlc_object_t *p_this, int family, int socktype,
 #endif
 
 #ifdef DCCP_SOCKOPT_SERVICE
-    char *dccps = var_CreateGetNonEmptyString (p_this, "dccp-service");
-    if (dccps != NULL)
+    if (socktype == SOL_DCCP)
     {
-        setsockopt (fd, SOL_DCCP, DCCP_SOCKOPT_SERVICE, dccps,
-                    (strlen (dccps) + 3) & ~3);
-        free (dccps);
+        char *dccps = var_CreateGetNonEmptyString (p_this, "dccp-service");
+        if (dccps != NULL)
+        {
+            setsockopt (fd, SOL_DCCP, DCCP_SOCKOPT_SERVICE, dccps,
+                        (strlen (dccps) + 3) & ~3);
+            free (dccps);
+        }
     }
 #endif
 
@@ -284,7 +286,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
  *****************************************************************************/
 ssize_t
 __net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
-            uint8_t *restrict p_buf, size_t i_buflen, vlc_bool_t waitall)
+            uint8_t *restrict p_buf, size_t i_buflen, bool waitall)
 {
     size_t i_total = 0;
     struct pollfd ufd[2] = {
@@ -330,7 +332,7 @@ __net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
 #else
                 errno = EINTR;
 #endif
-                goto error;
+                goto silent;
             }
         }
 
@@ -401,6 +403,7 @@ __net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
 
 error:
     msg_Err (p_this, "Read error: %m");
+silent:
     return -1;
 }
 
@@ -494,7 +497,7 @@ char *__net_Gets( vlc_object_t *p_this, int fd, const v_socket_t *p_vs )
             ptr = psz_line + i_line;
         }
 
-        if( net_Read( p_this, fd, p_vs, (uint8_t *)ptr, 1, VLC_TRUE ) != 1 )
+        if( net_Read( p_this, fd, p_vs, (uint8_t *)ptr, 1, true ) != 1 )
         {
             if( i_line == 0 )
             {
@@ -568,7 +571,7 @@ int inet_pton(int af, const char *src, void *dst)
     char *workaround_for_ill_designed_api = strdup( src );
 #endif
 
-    if( !WSAStringToAddress( workaround_for_ill_designed_api, af, NULL,
+    if( WSAStringToAddress( workaround_for_ill_designed_api, af, NULL,
                              (LPSOCKADDR)&addr, &len ) )
     {
         free( workaround_for_ill_designed_api );