Commit 2ba646a5 authored by Gildas Bazin's avatar Gildas Bazin

* src/*: bunch of portability fixes.

parent 75a2edbf
...@@ -1073,14 +1073,13 @@ static char *LanguageGetName( const char *psz_code ) ...@@ -1073,14 +1073,13 @@ static char *LanguageGetName( const char *psz_code )
****************************************************************************/ ****************************************************************************/
static void EsOutAddInfo( es_out_t *out, es_out_id_t *es ) static void EsOutAddInfo( es_out_t *out, es_out_id_t *es )
{ {
es_out_sys_t *p_sys = out->p_sys; es_out_sys_t *p_sys = out->p_sys;
input_thread_t *p_input = p_sys->p_input; input_thread_t *p_input = p_sys->p_input;
es_format_t *fmt = &es->fmt; es_format_t *fmt = &es->fmt;
char *psz_cat;
char psz_cat[strlen(_("Stream %d")) + 12];
/* Add stream info */ /* 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"), input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Codec"),
"%.4s", (char*)&fmt->i_codec ); "%.4s", (char*)&fmt->i_codec );
...@@ -1138,4 +1137,6 @@ static void EsOutAddInfo( es_out_t *out, es_out_id_t *es ) ...@@ -1138,4 +1137,6 @@ static void EsOutAddInfo( es_out_t *out, es_out_id_t *es )
default: default:
break; break;
} }
free( psz_cat );
} }
...@@ -1108,7 +1108,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port ) ...@@ -1108,7 +1108,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
break; // success break; // success
socket_error: socket_error:
close( fd ); net_Close( fd );
fd = -1; fd = -1;
} }
......
...@@ -763,21 +763,23 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir, ...@@ -763,21 +763,23 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
} }
#if defined( UNDER_CE ) || defined( _MSC_VER ) #if defined( UNDER_CE ) || defined( _MSC_VER )
#ifdef UNDER_CE
MultiByteToWideChar( CP_ACP, 0, psz_dir, -1, psz_wdir, MAX_PATH ); MultiByteToWideChar( CP_ACP, 0, psz_dir, -1, psz_wdir, MAX_PATH );
rc = GetFileAttributes( psz_wdir ); rc = GetFileAttributes( psz_wdir );
if( !(rc & FILE_ATTRIBUTE_DIRECTORY) ) if( !(rc & FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
{
/* Not a directory */
return;
}
/* Parse all files in the directory */ /* Parse all files in the directory */
#ifdef UNDER_CE
swprintf( psz_path, L"%s\\*.*", psz_dir ); swprintf( psz_path, L"%s\\*.*", psz_dir );
#else #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 ); sprintf( psz_path, "%s\\*.*", psz_dir );
#endif #endif
handle = FindFirstFile( psz_path, &finddata ); handle = FindFirstFile( psz_path, &finddata );
if( handle == INVALID_HANDLE_VALUE ) if( handle == INVALID_HANDLE_VALUE )
{ {
......
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#elif defined( WIN32 ) && !defined( UNDER_CE )
# include <io.h>
#endif #endif
#include "network.h" #include "network.h"
...@@ -411,8 +413,7 @@ int __net_ReadNonBlock( vlc_object_t *p_this, int fd, uint8_t *p_data, ...@@ -411,8 +413,7 @@ int __net_ReadNonBlock( vlc_object_t *p_this, int fd, uint8_t *p_data,
} }
else 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 ) if( ( i_recv = recv( fd, p_data, i_data, 0 ) ) <= 0 )
{ {
#ifdef WIN32 #ifdef WIN32
......
...@@ -1354,8 +1354,10 @@ static int DeinterlaceCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -1354,8 +1354,10 @@ static int DeinterlaceCallback( vlc_object_t *p_this, char const *psz_cmd,
var_Get( p_input, "video-es", &val ); var_Get( p_input, "video-es", &val );
if( val.i_int >= 0 ) if( val.i_int >= 0 )
{ {
vlc_value_t val_es;
val_es.i_int = -VIDEO_ES;
p_vout->b_filter_change = VLC_TRUE; 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 ); var_Set( p_input, "video-es", val );
} }
...@@ -1386,8 +1388,10 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -1386,8 +1388,10 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd,
var_Get( p_input, "video-es", &val ); var_Get( p_input, "video-es", &val );
if( val.i_int >= 0 ) if( val.i_int >= 0 )
{ {
vlc_value_t val_es;
val_es.i_int = -VIDEO_ES;
p_vout->b_filter_change = VLC_TRUE; 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 ); var_Set( p_input, "video-es", val );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment