Commit 51002a6c authored by Gildas Bazin's avatar Gildas Bazin

* src/*: WinCE compilation fixes.

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