]> git.sesse.net Git - vlc/commitdiff
* src/*: bunch of portability fixes.
authorGildas Bazin <gbazin@videolan.org>
Fri, 1 Oct 2004 10:03:29 +0000 (10:03 +0000)
committerGildas Bazin <gbazin@videolan.org>
Fri, 1 Oct 2004 10:03:29 +0000 (10:03 +0000)
src/input/es_out.c
src/misc/httpd.c
src/misc/modules.c
src/misc/net.c
src/video_output/video_output.c

index 47887b523c270420342d5b13c83ce95337738a22..8d7e76ff5991bb344aa3b29ee7cf8dcc0277d0a7 100644 (file)
@@ -1073,14 +1073,13 @@ static char *LanguageGetName( const char *psz_code )
  ****************************************************************************/
 static void EsOutAddInfo( es_out_t *out, es_out_id_t *es )
 {
-    es_out_sys_t      *p_sys = out->p_sys;
-    input_thread_t    *p_input = p_sys->p_input;
-    es_format_t       *fmt = &es->fmt;
-
-    char psz_cat[strlen(_("Stream %d")) + 12];
+    es_out_sys_t   *p_sys = out->p_sys;
+    input_thread_t *p_input = p_sys->p_input;
+    es_format_t    *fmt = &es->fmt;
+    char           *psz_cat;
 
     /* Add stream info */
-    sprintf( psz_cat, _("Stream %d"), out->p_sys->i_id - 1 );
+    asprintf( &psz_cat, _("Stream %d"), out->p_sys->i_id - 1 );
 
     input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Codec"),
                    "%.4s", (char*)&fmt->i_codec );
@@ -1138,4 +1137,6 @@ static void EsOutAddInfo( es_out_t *out, es_out_id_t *es )
     default:
         break;
     }
+
+    free( psz_cat );
 }
index fcb33674697e2c3e8b22baee99e336abc67f10c8..984f2e1e84faa64d2d2d8d030ed87b076baa95a6 100644 (file)
@@ -1108,7 +1108,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
         break; // success
 
 socket_error:
-        close( fd );
+        net_Close( fd );
         fd = -1;
     }
 
index ef201efa667f57ad6fc51d688e76d3ddc5310bc3..95697c4a44cd8fcedb949c9c42855c8d02752fe5 100644 (file)
@@ -763,21 +763,23 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
     }
 
 #if defined( UNDER_CE ) || defined( _MSC_VER )
+#ifdef UNDER_CE
     MultiByteToWideChar( CP_ACP, 0, psz_dir, -1, psz_wdir, MAX_PATH );
 
     rc = GetFileAttributes( psz_wdir );
-    if( !(rc & FILE_ATTRIBUTE_DIRECTORY) )
-    {
-        /* Not a directory */
-        return;
-    }
+    if( !(rc & FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
 
     /* Parse all files in the directory */
-#ifdef UNDER_CE
     swprintf( psz_path, L"%s\\*.*", psz_dir );
+
 #else
+    rc = GetFileAttributes( psz_dir );
+    if( !(rc & FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
+
+    /* Parse all files in the directory */
     sprintf( psz_path, "%s\\*.*", psz_dir );
 #endif
+
     handle = FindFirstFile( psz_path, &finddata );
     if( handle == INVALID_HANDLE_VALUE )
     {
index 606617a59eeafa8b9544689e9d2a809d965598dd..ebe98d4a5fa227949ae86518a33b3f8241406189 100644 (file)
@@ -53,6 +53,8 @@
 
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h>
+#elif defined( WIN32 ) && !defined( UNDER_CE )
+#   include <io.h>
 #endif
 
 #include "network.h"
@@ -411,8 +413,7 @@ int __net_ReadNonBlock( vlc_object_t *p_this, int fd, uint8_t *p_data,
     }
     else
     {
-        if( fd == STDIN_FILENO ) i_recv = read( fd, p_data, i_data ); else
-
+        if( fd == 0 /*STDIN_FILENO*/ ) i_recv = read( fd, p_data, i_data ); else
         if( ( i_recv = recv( fd, p_data, i_data, 0 ) ) <= 0 )
         {
 #ifdef WIN32
index 5bdbb12b854f351f3517551f97d0cee79cc4cbf5..0dcfd2a38ada322bbfb63f5736aeb23a4e38317c 100644 (file)
@@ -1354,8 +1354,10 @@ static int DeinterlaceCallback( vlc_object_t *p_this, char const *psz_cmd,
     var_Get( p_input, "video-es", &val );
     if( val.i_int >= 0 )
     {
+        vlc_value_t val_es;
+        val_es.i_int = -VIDEO_ES;
         p_vout->b_filter_change = VLC_TRUE;
-        var_Set( p_input, "video-es", (vlc_value_t)-VIDEO_ES );
+        var_Set( p_input, "video-es", val_es );
         var_Set( p_input, "video-es", val );
     }
 
@@ -1386,8 +1388,10 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd,
     var_Get( p_input, "video-es", &val );
     if( val.i_int >= 0 )
     {
+        vlc_value_t val_es;
+        val_es.i_int = -VIDEO_ES;
         p_vout->b_filter_change = VLC_TRUE;
-        var_Set( p_input, "video-es", (vlc_value_t)-VIDEO_ES );
+        var_Set( p_input, "video-es", val_es );
         var_Set( p_input, "video-es", val );
     }