Commit 51002a6c authored by gbazin's avatar gbazin
Browse files

* src/*: WinCE compilation fixes.

parent 5cfa1480
......@@ -59,7 +59,7 @@ typedef union
vlc_object_t * p_object;
vlc_list_t * p_list;
#if defined( WIN32 ) && !defined( __MINGW32__ )
#if (defined( WIN32 ) && !defined( __MINGW32__ )) || defined( UNDER_CE )
signed __int64 i_time;
# else
signed long long i_time;
......
......@@ -922,7 +922,7 @@ int config_CreateDir( vlc_object_t *p_this, char *psz_dirname )
MultiByteToWideChar( CP_ACP, 0, psz_dirname, -1, psz_new, MAX_PATH );
if( CreateDirectory( psz_new, NULL ) )
{
msg_Err( p_this, "could not create %s", psz_filename );
msg_Err( p_this, "could not create %s", psz_dirname );
}
}
......@@ -1554,9 +1554,15 @@ char *config_GetHomeDir( void )
#if defined(WIN32) || defined(UNDER_CE)
typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
LPSTR );
#ifndef CSIDL_FLAG_CREATE
# define CSIDL_FLAG_CREATE 0x8000
#endif
#ifndef CSIDL_APPDATA
# define CSIDL_APPDATA 0x1A
#endif
#ifndef SHGFP_TYPE_CURRENT
# define SHGFP_TYPE_CURRENT 0
#endif
HINSTANCE shfolder_dll;
SHGETFOLDERPATH SHGetFolderPath ;
......
......@@ -29,11 +29,16 @@
#include "network.h"
#include <string.h>
#include <errno.h>
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#if defined( UNDER_CE )
# include <winsock.h>
......@@ -2337,7 +2342,11 @@ static void httpd_HostThread( httpd_host_t *host )
i_ret = select( i_handle_max + 1,
&fds_read, &fds_write, NULL, &timeout );
#if defined( WIN32 ) || defined( UNDER_CE )
if( i_ret == -1 )
#else
if( i_ret == -1 && errno != EINTR )
#endif
{
msg_Warn( host, "cannot select sockets" );
msleep( 1000 );
......
......@@ -188,14 +188,18 @@ int __net_Accept( vlc_object_t *p_this, int fd, mtime_t i_wait )
timeout.tv_usec = b_block ? 500000 : i_wait;
i_ret = select(fd + 1, &fds_r, NULL, &fds_e, &timeout);
#ifdef HAVE_ERRNO_H
if( (i_ret < 0 && errno == EINTR) || i_ret == 0 )
#else
if( i_ret == 0 )
#endif
{
if( b_block ) continue;
else return -1;
}
else if( i_ret < 0 )
{
#ifdef WIN32
#if defined(WIN32) || defined(UNDER_CE)
msg_Err( p_this, "network select error (%i)", WSAGetLastError() );
#else
msg_Err( p_this, "network select error (%s)", strerror(errno) );
......@@ -205,7 +209,7 @@ int __net_Accept( vlc_object_t *p_this, int fd, mtime_t i_wait )
if( ( i_ret = accept( fd, 0, 0 ) ) <= 0 )
{
#ifdef WIN32
#if defined(WIN32) || defined(UNDER_CE)
msg_Err( p_this, "accept failed (%i)", WSAGetLastError() );
#else
msg_Err( p_this, "accept failed (%s)", strerror(errno) );
......@@ -329,17 +333,25 @@ int __net_Read( vlc_object_t *p_this, int fd, uint8_t *p_data, int i_data,
timeout.tv_usec = 500000;
} while( (i_ret = select(fd + 1, &fds_r, NULL, &fds_e, &timeout)) == 0
#ifdef HAVE_ERRNO_H
|| ( i_ret < 0 && errno == EINTR ) );
#else
);
#endif
if( i_ret < 0 )
{
#if defined(WIN32) || defined(UNDER_CE)
msg_Err( p_this, "network select error" );
#else
msg_Err( p_this, "network select error (%s)", strerror(errno) );
#endif
return i_total > 0 ? i_total : -1;
}
if( ( i_recv = recv( fd, p_data, i_data, 0 ) ) < 0 )
{
#ifdef WIN32
#if defined(WIN32) || defined(UNDER_CE)
/* For udp only */
/* On win32 recv() will fail if the datagram doesn't fit inside
* the passed buffer, even though the buffer will be filled with
......@@ -398,13 +410,21 @@ int __net_ReadNonBlock( vlc_object_t *p_this, int fd, uint8_t *p_data,
i_ret = select(fd + 1, &fds_r, NULL, &fds_e, &timeout);
#ifdef HAVE_ERRNO_H
if( i_ret < 0 && errno == EINTR )
#else
if( 0 )
#endif
{
return 0;
}
else if( i_ret < 0 )
{
#if defined(WIN32) || defined(UNDER_CE)
msg_Err( p_this, "network select error" );
#else
msg_Err( p_this, "network select error (%s)", strerror(errno) );
#endif
return -1;
}
else if( i_ret == 0)
......@@ -413,10 +433,12 @@ int __net_ReadNonBlock( vlc_object_t *p_this, int fd, uint8_t *p_data,
}
else
{
if( fd == 0 /*STDIN_FILENO*/ ) i_recv = read( fd, p_data, i_data ); else
#if !defined(UNDER_CE)
if( fd == 0/*STDIN_FILENO*/ ) i_recv = read( fd, p_data, i_data ); else
#endif
if( ( i_recv = recv( fd, p_data, i_data, 0 ) ) <= 0 )
{
#ifdef WIN32
#if defined(WIN32) || defined(UNDER_CE)
/* For udp only */
/* On win32 recv() will fail if the datagram doesn't fit inside
* the passed buffer, even though the buffer will be filled with
......@@ -472,11 +494,19 @@ int __net_Write( vlc_object_t *p_this, int fd, uint8_t *p_data, int i_data )
timeout.tv_usec = 500000;
} while( (i_ret = select(fd + 1, NULL, &fds_w, &fds_e, &timeout)) == 0
#ifdef HAVE_ERRNO_H
|| ( i_ret < 0 && errno == EINTR ) );
#else
);
#endif
if( i_ret < 0 )
{
#if defined(WIN32) || defined(UNDER_CE)
msg_Err( p_this, "network select error" );
#else
msg_Err( p_this, "network select error (%s)", strerror(errno) );
#endif
return i_total > 0 ? i_total : -1;
}
......
......@@ -1130,6 +1130,7 @@ static int vlm_ScheduleSetup( vlm_schedule_t *schedule, char *psz_cmd,
{
schedule->b_enabled = VLC_FALSE;
}
#if !defined( UNDER_CE )
else if( strcmp( psz_cmd, "date" ) == 0 )
{
struct tm time;
......@@ -1281,6 +1282,7 @@ static int vlm_ScheduleSetup( vlm_schedule_t *schedule, char *psz_cmd,
date = (((( time.tm_year * 12 + time.tm_mon ) * 30 + time.tm_mday ) * 24 + time.tm_hour ) * 60 + time.tm_min ) * 60 + time.tm_sec ;
schedule->i_period = ((mtime_t) date) * 1000000;
}
#endif /* UNDER_CE */
else if( strcmp( psz_cmd, "repeat" ) == 0 )
{
int i;
......@@ -1452,6 +1454,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_t *media,
vlm_MessageNew( "enabled", schedule->b_enabled ?
"yes" : "no" ) );
#if !defined( UNDER_CE )
if( schedule->i_date != 0 )
{
struct tm date;
......@@ -1505,6 +1508,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_t *media,
{
vlm_MessageAdd( msg_schedule, vlm_MessageNew("period", "0") );
}
#endif /* UNDER_CE */
sprintf( buffer, "%d", schedule->i_repeat );
vlm_MessageAdd( msg_schedule, vlm_MessageNew( "repeat", buffer ) );
......@@ -1617,6 +1621,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_t *media,
{
time_t i_date = (time_t) (i_next_date / 1000000) ;
#if !defined( UNDER_CE )
#ifdef HAVE_CTIME_R
char psz_date[500];
ctime_r( &i_date, psz_date );
......@@ -1626,6 +1631,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_t *media,
vlm_MessageAdd( msg_schedule,
vlm_MessageNew( "next launch", psz_date ) );
#endif
}
}
......@@ -1892,7 +1898,7 @@ static char *vlm_Save( vlm_t *vlm )
}
/* and now, the schedule scripts */
#if !defined( UNDER_CE )
for( i = 0; i < vlm->i_schedule; i++ )
{
vlm_schedule_t *schedule = vlm->schedule[i];
......@@ -1962,6 +1968,7 @@ static char *vlm_Save( vlm_t *vlm )
}
}
#endif /* UNDER_CE */
return save;
}
......
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