Commit 77c667f4 authored by Sam Hocevar's avatar Sam Hocevar

* ALL: libvlc now compiles and run under WinCE. I haven't ported any modules

    yet so there's little that can be tested, but threads work at least.
  * ./src/extras/libc.c: renamed strndup.c to libc.c because a few other
    libc functions were added (strcasecmp, atof, getenv...).
parent be8ca6e9
...@@ -288,7 +288,7 @@ show-vlc-sources: FORCE ...@@ -288,7 +288,7 @@ show-vlc-sources: FORCE
@echo X: $(vlc_SOURCES) @echo X: $(vlc_SOURCES)
show-libvlc-sources: FORCE show-libvlc-sources: FORCE
@echo X: $(SOURCES_libvlc_common) $(SOURCES_libvlc_win32) $(SOURCES_libvlc_dirent) $(SOURCES_libvlc_getopt) $(SOURCES_libvlc_strndup) @echo X: $(SOURCES_libvlc_common) $(SOURCES_libvlc_win32) $(SOURCES_libvlc_dirent) $(SOURCES_libvlc_getopt) $(SOURCES_libvlc_libc)
show-libvlc-headers: FORCE show-libvlc-headers: FORCE
@echo X: $(HEADERS_include) $(HEADERS_include_built) @echo X: $(HEADERS_include) $(HEADERS_include_built)
...@@ -327,8 +327,8 @@ endif ...@@ -327,8 +327,8 @@ endif
if BUILD_GETOPT if BUILD_GETOPT
OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt) OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
endif endif
if BUILD_STRNDUP if BUILD_LIBC
OPT_SOURCES_libvlc_strndup = $(SOURCES_libvlc_strndup) OPT_SOURCES_libvlc_libc = $(SOURCES_libvlc_libc)
endif endif
if BUILD_MOZILLA if BUILD_MOZILLA
LIBRARIES_libvlc_pic = lib/libvlc_pic.a LIBRARIES_libvlc_pic = lib/libvlc_pic.a
...@@ -340,7 +340,7 @@ EXTRA_DIST += \ ...@@ -340,7 +340,7 @@ EXTRA_DIST += \
$(SOURCES_libvlc_win32) \ $(SOURCES_libvlc_win32) \
$(SOURCES_libvlc_dirent) \ $(SOURCES_libvlc_dirent) \
$(SOURCES_libvlc_getopt) \ $(SOURCES_libvlc_getopt) \
$(SOURCES_libvlc_strndup) \ $(SOURCES_libvlc_libc) \
$(NULL) $(NULL)
SOURCES_libvlc_beos = \ SOURCES_libvlc_beos = \
...@@ -366,8 +366,8 @@ SOURCES_libvlc_getopt = \ ...@@ -366,8 +366,8 @@ SOURCES_libvlc_getopt = \
src/extras/getopt1.c \ src/extras/getopt1.c \
$(NULL) $(NULL)
SOURCES_libvlc_strndup = \ SOURCES_libvlc_libc = \
src/extras/strndup.c src/extras/libc.c
$(NULL) $(NULL)
SOURCES_libvlc_common = \ SOURCES_libvlc_common = \
...@@ -419,7 +419,7 @@ SOURCES_libvlc = \ ...@@ -419,7 +419,7 @@ SOURCES_libvlc = \
$(OPT_SOURCES_libvlc_win32) \ $(OPT_SOURCES_libvlc_win32) \
$(OPT_SOURCES_libvlc_dirent) \ $(OPT_SOURCES_libvlc_dirent) \
$(OPT_SOURCES_libvlc_getopt) \ $(OPT_SOURCES_libvlc_getopt) \
$(OPT_SOURCES_libvlc_strndup) \ $(OPT_SOURCES_libvlc_libc) \
$(NULL) $(NULL)
############################################################################### ###############################################################################
......
...@@ -214,12 +214,19 @@ dnl The -DSYS_FOO flag ...@@ -214,12 +214,19 @@ dnl The -DSYS_FOO flag
CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}" CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
dnl Check for system libs needed dnl Check for system libs needed
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll) need_libc=false
dnl Check for strndup AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll getenv putenv setenv)
need_strndup=false
AC_CHECK_FUNCS(strndup,,[need_strndup=:]) dnl Check for usual libc functions
AM_CONDITIONAL(BUILD_STRNDUP, ${need_strndup}) AC_CHECK_FUNCS(strdup,,[need_libc=:])
AC_CHECK_FUNCS(strndup,,[need_libc=:])
AC_CHECK_FUNCS(atof,,[need_libc=:])
AC_CHECK_FUNCS(lseek,,[need_libc=:])
AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp,,[need_libc=:])])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp,,[need_libc=:])])
AM_CONDITIONAL(BUILD_LIBC, ${need_libc})
AC_CHECK_FUNC(connect,,[ AC_CHECK_FUNC(connect,,[
AC_CHECK_LIB(socket,connect, AC_CHECK_LIB(socket,connect,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.35 2002/11/08 10:26:52 gbazin Exp $ * $Id: vlc_common.h,v 1.36 2002/11/10 23:41:53 sam Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -467,9 +467,39 @@ static inline uint64_t U64_AT( void * _p ) ...@@ -467,9 +467,39 @@ static inline uint64_t U64_AT( void * _p )
#endif #endif
/* strndup (defined in src/misc/extras.c) */ /* strdup/strndup (defined in src/extras/libc.c) */
#ifndef HAVE_STRDUP
char * strdup( const char *s );
#endif
#ifndef HAVE_STRNDUP #ifndef HAVE_STRNDUP
char * strndup( const char *s, size_t n ); char * strndup( const char *s, size_t n );
#endif
/* atof (defined in src/extras/libc.c) */
#ifndef HAVE_ATOF
double atof( const char *nptr );
#endif
/* getenv - always returns NULL */
#ifndef HAVE_GETENV
char *getenv( const char *name );
#endif
/* strncasecmp/strcasecmp (defined in src/extras/libc.c) */
#ifndef HAVE_STRCASECMP
# ifdef HAVE_STRICMP
# define strcasecmp stricmp
# else
int strcasecmp( const char *s1, const char *s2 );
# endif
#endif
#ifndef HAVE_STRNCASECMP
# ifdef HAVE_STRNICMP
# define strncasecmp strnicmp
# else
int strncasecmp( const char *s1, const char *s2, size_t n );
# endif
#endif #endif
/* Format type specifiers for 64 bits numbers */ /* Format type specifiers for 64 bits numbers */
...@@ -501,8 +531,6 @@ char * strndup( const char *s, size_t n ); ...@@ -501,8 +531,6 @@ char * strndup( const char *s, size_t n );
# if defined( _MSC_VER ) || !defined( __MINGW32__ ) # if defined( _MSC_VER ) || !defined( __MINGW32__ )
# define __attribute__(x) # define __attribute__(x)
# define __inline__ __inline # define __inline__ __inline
# define strncasecmp strnicmp
# define strcasecmp stricmp
# define S_IFBLK 0x3000 /* Block */ # define S_IFBLK 0x3000 /* Block */
# define S_ISBLK(m) (0) # define S_ISBLK(m) (0)
# define S_ISCHR(m) (0) # define S_ISCHR(m) (0)
...@@ -549,6 +577,11 @@ typedef __int64 off_t; ...@@ -549,6 +577,11 @@ typedef __int64 off_t;
#endif #endif
/* lseek (defined in src/extras/libc.c) */
#ifndef HAVE_ATOF
off_t lseek( int fildes, off_t offset, int whence );
#endif
/***************************************************************************** /*****************************************************************************
* CPU capabilities * CPU capabilities
*****************************************************************************/ *****************************************************************************/
......
...@@ -236,7 +236,7 @@ SOURCE="..\src\extras\getopt1.c" ...@@ -236,7 +236,7 @@ SOURCE="..\src\extras\getopt1.c"
!ENDIF !ENDIF
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE="..\src\extras\strndup.c" SOURCE="..\src\extras\libc.c"
# ADD CPP /D "__VLC__" /D PLUGIN_PATH=\"plugins\" /D DATA_PATH=\"share\" # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\"plugins\" /D DATA_PATH=\"share\"
!IF "$(CFG)" == "vlc - Win32 Release" !IF "$(CFG)" == "vlc - Win32 Release"
# PROP Intermediate_Dir "Release\extras" # PROP Intermediate_Dir "Release\extras"
...@@ -440,7 +440,7 @@ SOURCE="..\src\misc\iso_lang.c" ...@@ -440,7 +440,7 @@ SOURCE="..\src\misc\iso_lang.c"
!ENDIF !ENDIF
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE="..\src\misc\iso-639.def" SOURCE="..\src\misc\iso-639_def.h"
# ADD CPP /D "__VLC__" /D PLUGIN_PATH=\"plugins\" /D DATA_PATH=\"share\" # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\"plugins\" /D DATA_PATH=\"share\"
!IF "$(CFG)" == "vlc - Win32 Release" !IF "$(CFG)" == "vlc - Win32 Release"
# PROP Intermediate_Dir "Release\misc" # PROP Intermediate_Dir "Release\misc"
......
This diff is collapsed.
This diff is collapsed.
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
* Significantly revised and rewinddir, seekdir and telldir added by Colin * Significantly revised and rewinddir, seekdir and telldir added by Colin
* Peters <colin@fu.is.saga-u.ac.jp> * Peters <colin@fu.is.saga-u.ac.jp>
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* $Author: sam $ * $Author: sam $
* $Date: 2002/11/10 18:04:23 $ * $Date: 2002/11/10 23:41:53 $
* *
*/ */
...@@ -89,12 +89,13 @@ opendir (const CHAR *szPath) ...@@ -89,12 +89,13 @@ opendir (const CHAR *szPath)
#if defined( UNDER_CE ) #if defined( UNDER_CE )
if (szPath[0] == '\\' || szPath[0] == '/') if (szPath[0] == '\\' || szPath[0] == '/')
{ {
snprintf (szFullPath, MAX_PATH, "%s", szPath); sprintf (szFullPath, MAX_PATH, "%s", szPath);
szFullPath[0] = '\\'; szFullPath[0] = '\\';
} }
else else
{ {
snprintf (szFullPath, MAX_PATH, "\\%s", szPath ); /* FIXME: if I wasn't lazy, I'dcheck for overflows here. */
sprintf (szFullPath, MAX_PATH, "\\%s", szPath );
} }
#else #else
_fullpath (szFullPath, szPath, MAX_PATH); _fullpath (szFullPath, szPath, MAX_PATH);
......
/***************************************************************************** /*****************************************************************************
* strndup.c: Extra strndup function for some systems. * libc.c: Extra libc function for some systems.
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: strndup.c,v 1.1 2002/11/09 16:34:52 sam Exp $ * $Id: libc.c,v 1.1 2002/11/10 23:41:53 sam Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Samuel Hocevar <sam@zoy.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -25,10 +26,31 @@ ...@@ -25,10 +26,31 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
/*****************************************************************************
* getenv: just in case, but it should never be called
*****************************************************************************/
#ifndef HAVE_GETENV
char *getenv( const char *name )
{
return NULL;
}
#endif
/*****************************************************************************
* strdup: returns a malloc'd copy of a string
*****************************************************************************/
#ifndef HAVE_STRDUP
char *strdup( const char *string )
{
return strndup( string, strlen( string ) );
}
#endif
/***************************************************************************** /*****************************************************************************
* strndup: returns a malloc'd copy of at most n bytes of string * strndup: returns a malloc'd copy of at most n bytes of string
* Does anyone know whether or not it will be present in Jaguar? * Does anyone know whether or not it will be present in Jaguar?
*****************************************************************************/ *****************************************************************************/
#ifndef HAVE_STRDUP
char *strndup( const char *string, size_t n ) char *strndup( const char *string, size_t n )
{ {
char *psz; char *psz;
...@@ -45,4 +67,90 @@ char *strndup( const char *string, size_t n ) ...@@ -45,4 +67,90 @@ char *strndup( const char *string, size_t n )
return( psz ); return( psz );
} }
#endif
/*****************************************************************************
* strcasecmp: compare two strings ignoring case
*****************************************************************************/
#if !defined( HAVE_STRCASECMP ) && !defined( HAVE_STRICMP )
int strcasecmp( const char *s1, const char *s2 )
{
int i_delta = 0;
while( !i_delta && *s1 && *s2 )
{
i_delta = *s1 - *s2;
if( *s1 >= 'A' && *s1 <= 'Z' )
{
i_delta -= 'A' - 'a';
}
if( *s2 >= 'A' && *s2 <= 'Z' )
{
i_delta += 'A' - 'a';
}
}
return i_delta;
}
#endif
/*****************************************************************************
* strncasecmp: compare n chars from two strings ignoring case
*****************************************************************************/
#if !defined( HAVE_STRNCASECMP ) && !defined( HAVE_STRNICMP )
int strncasecmp( const char *s1, const char *s2, size_t n )
{
int i_delta = 0;
while( n-- && !i_delta && *s1 )
{
i_delta = *s1 - *s2;
if( *s1 >= 'A' && *s1 <= 'Z' )
{
i_delta -= 'A' - 'a';
}
if( *s2 >= 'A' && *s2 <= 'Z' )
{
i_delta += 'A' - 'a';
}
}
return i_delta;
}
#endif
/*****************************************************************************
* atof: convert a string to a double.
*****************************************************************************/
#ifndef HAVE_ATOF
double atof( const char *nptr )
{
double f_result;
wchar_t *psz_tmp;
int i_len = strlen( nptr ) + 1;
psz_tmp = malloc( i_len * sizeof(wchar_t) );
MultiByteToWideChar( CP_ACP, 0, nptr, -1, psz_tmp, i_len );
f_result = wcstod( psz_tmp, NULL );
free( psz_tmp );
return f_result;
}
#endif
/*****************************************************************************
* lseek: reposition read/write file offset.
*****************************************************************************
* FIXME: this cast sucks!
*****************************************************************************/
#if !defined( HAVE_LSEEK )
off_t lseek( int fildes, off_t offset, int whence )
{
return SetFilePointer( (HANDLE)fildes, offset, NULL, whence );
}
#endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-plugins.c: useful functions for access and demux plug-ins * input_ext-plugins.c: useful functions for access and demux plug-ins
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: input_ext-plugins.c,v 1.20 2002/11/10 18:04:23 sam Exp $ * $Id: input_ext-plugins.c,v 1.21 2002/11/10 23:41:53 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -669,7 +669,12 @@ void __input_FDClose( vlc_object_t * p_this ) ...@@ -669,7 +669,12 @@ void __input_FDClose( vlc_object_t * p_this )
msg_Info( p_input, "closing `%s/%s://%s'", msg_Info( p_input, "closing `%s/%s://%s'",
p_input->psz_access, p_input->psz_demux, p_input->psz_name ); p_input->psz_access, p_input->psz_demux, p_input->psz_name );
#ifdef UNDER_CE
CloseHandle( (HANDLE)p_access_data->i_handle );
#else
close( p_access_data->i_handle ); close( p_access_data->i_handle );
#endif
free( p_access_data ); free( p_access_data );
} }
...@@ -684,7 +689,9 @@ void __input_FDNetworkClose( vlc_object_t * p_this ) ...@@ -684,7 +689,9 @@ void __input_FDNetworkClose( vlc_object_t * p_this )
msg_Info( p_input, "closing network `%s/%s://%s'", msg_Info( p_input, "closing network `%s/%s://%s'",
p_input->psz_access, p_input->psz_demux, p_input->psz_name ); p_input->psz_access, p_input->psz_demux, p_input->psz_name );
#if defined( WIN32 ) && !defined( UNDER_CE ) #ifdef UNDER_CE
CloseHandle( (HANDLE)p_access_data->i_handle );
#elif defined( WIN32 )
closesocket( p_access_data->i_handle ); closesocket( p_access_data->i_handle );
#else #else
close( p_access_data->i_handle ); close( p_access_data->i_handle );
...@@ -699,16 +706,25 @@ void __input_FDNetworkClose( vlc_object_t * p_this ) ...@@ -699,16 +706,25 @@ void __input_FDNetworkClose( vlc_object_t * p_this )
ssize_t input_FDRead( input_thread_t * p_input, byte_t * p_buffer, size_t i_len ) ssize_t input_FDRead( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
{ {
input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data; input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data;
ssize_t i_ret;
ssize_t i_ret = read( p_access_data->i_handle, p_buffer, i_len ); #ifdef UNDER_CE
if( !ReadFile( (HANDLE)p_access_data->i_handle, p_buffer, i_len,
(LPWORD)&i_ret, NULL ) )
{
i_ret = -1;
}
#else
i_ret = read( p_access_data->i_handle, p_buffer, i_len );
#endif
if( i_ret < 0 ) if( i_ret < 0 )
{ {
#ifdef HAVE_ERRNO_H # ifdef HAVE_ERRNO_H
msg_Err( p_input, "read failed (%s)", strerror(errno) ); msg_Err( p_input, "read failed (%s)", strerror(errno) );
#else # else
msg_Err( p_input, "read failed" ); msg_Err( p_input, "read failed" );
#endif # endif
} }
return i_ret; return i_ret;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source * libvlc.c: main libvlc source
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.45 2002/11/10 18:04:23 sam Exp $ * $Id: libvlc.c,v 1.46 2002/11/10 23:41:53 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -1265,10 +1265,12 @@ static void Version( void ) ...@@ -1265,10 +1265,12 @@ static void Version( void )
#ifdef WIN32 /* */ #ifdef WIN32 /* */
static void ShowConsole( void ) static void ShowConsole( void )
{ {
# ifndef UNDER_CE
AllocConsole(); AllocConsole();
freopen( "CONOUT$", "w", stdout ); freopen( "CONOUT$", "w", stdout );
freopen( "CONOUT$", "w", stderr ); freopen( "CONOUT$", "w", stderr );
freopen( "CONIN$", "r", stdin ); freopen( "CONIN$", "r", stdin );
# endif
return; return;
} }
#endif #endif
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration * configuration.c management of the modules configuration
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.43 2002/11/10 18:04:23 sam Exp $ * $Id: configuration.c,v 1.44 2002/11/10 23:41:53 sam Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -520,7 +520,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) ...@@ -520,7 +520,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
/* The config file is organized in sections, one per module. Look for /* The config file is organized in sections, one per module. Look for
* the interesting section ( a section is of the form [foo] ) */ * the interesting section ( a section is of the form [foo] ) */
rewind( file ); fseek( file, 0L, SEEK_SET );
while( fgets( line, 1024, file ) ) while( fgets( line, 1024, file ) )
{ {
if( (line[0] == '[') if( (line[0] == '[')
...@@ -687,7 +687,17 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) ...@@ -687,7 +687,17 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
} }
sprintf( psz_filename, "%s/" CONFIG_DIR, psz_homedir ); sprintf( psz_filename, "%s/" CONFIG_DIR, psz_homedir );
#ifdef HAVE_ERRNO_H #if defined( UNDER_CE )
{
wchar_t psz_new[ MAX_PATH ];
MultiByteToWideChar( CP_ACP, 0, psz_filename, -1, psz_new, MAX_PATH );
if( CreateDirectory( psz_new, NULL ) )
{
msg_Err( p_this, "could not create %s", psz_filename );
}
}
#elif defined( HAVE_ERRNO_H )
# if defined( WIN32 ) # if defined( WIN32 )
if( mkdir( psz_filename ) && errno != EEXIST ) if( mkdir( psz_filename ) && errno != EEXIST )
# else # else
...@@ -719,9 +729,9 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) ...@@ -719,9 +729,9 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
else else
{ {
/* look for file size */ /* look for file size */
fseek( file, 0, SEEK_END ); fseek( file, 0L, SEEK_END );
i_sizebuf = ftell( file ); i_sizebuf = ftell( file );
rewind( file ); fseek( file, 0L, SEEK_SET );
} }
p_bigbuffer = p_index = malloc( i_sizebuf+1 ); p_bigbuffer = p_index = malloc( i_sizebuf+1 );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* threads.c : threads implementation for the VideoLAN client * threads.c : threads implementation for the VideoLAN client
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: threads.c,v 1.24 2002/11/10 18:04:24 sam Exp $ * $Id: threads.c,v 1.25 2002/11/10 23:41:53 sam Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -77,6 +77,7 @@ int __vlc_threads_init( vlc_object_t *p_this ) ...@@ -77,6 +77,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
* hope nothing wrong happens. */ * hope nothing wrong happens. */
#if defined( PTH_INIT_IN_PTH_H ) #if defined( PTH_INIT_IN_PTH_H )
#elif defined( ST_INIT_IN_ST_H ) #elif defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#elif defined( WIN32 ) #elif defined( WIN32 )
HINSTANCE hInstLib; HINSTANCE hInstLib;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
...@@ -556,10 +557,16 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line, ...@@ -556,10 +557,16 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
unsigned threadID; unsigned threadID;
/* When using the MSVCRT C library you have to use the _beginthreadex /* When using the MSVCRT C library you have to use the _beginthreadex
* function instead of CreateThread, otherwise you'll end up with * function instead of CreateThread, otherwise you'll end up with
* memory leaks and the signal functions not working */ * memory leaks and the signal functions not working (see Microsoft
* Knowledge Base, article 104641) */
p_this->thread_id = p_this->thread_id =
#if defined( UNDER_CE )
(HANDLE)CreateThread( NULL, 0, (PTHREAD_START) func,
(void *)p_this, 0, &threadID );
#else
(HANDLE)_beginthreadex( NULL, 0, (PTHREAD_START) func, (HANDLE)_beginthreadex( NULL, 0, (PTHREAD_START) func,
(void *)p_this, 0, &threadID ); (void *)p_this, 0, &threadID );
#endif
} }
if ( p_this->thread_id && i_priority ) if ( p_this->thread_id && i_priority )
...@@ -628,8 +635,13 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line, ...@@ -628,8 +635,13 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
} }
else else
{ {
#ifdef HAVE_STRERROR
msg_Err( p_this, "%s thread could not be created at %s:%d (%s)", msg_Err( p_this, "%s thread could not be created at %s:%d (%s)",
psz_name, psz_file, i_line, strerror(i_ret) ); psz_name, psz_file, i_line, strerror(i_ret) );
#else
msg_Err( p_this, "%s thread could not be created at %s:%d",
psz_name, psz_file, i_line );
#endif
vlc_mutex_unlock( &p_this->object_lock ); vlc_mutex_unlock( &p_this->object_lock );
} }
...@@ -677,8 +689,13 @@ void __vlc_thread_join( vlc_object_t *p_this, char * psz_file, int i_line ) ...@@ -677,8 +689,13 @@ void __vlc_thread_join( vlc_object_t *p_this, char * psz_file, int i_line )
if( i_ret ) if( i_ret )
{ {
#ifdef HAVE_STRERROR
msg_Err( p_this, "thread_join(%d) failed at %s:%d (%s)", msg_Err( p_this, "thread_join(%d) failed at %s:%d (%s)",
p_this->thread_id, psz_file, i_line, strerror(i_ret) ); p_this->thread_id, psz_file, i_line, strerror(i_ret) );
#else
msg_Err( p_this, "thread_join(%d) failed at %s:%d",
p_this->thread_id, psz_file, i_line );
#endif
} }
else else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_text.c : text manipulation functions * video_text.c : text manipulation functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: video_text.c,v 1.38 2002/11/10 18:04:24 sam Exp $ * $Id: video_text.c,v 1.39 2002/11/10 23:41:54 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -277,19 +277,23 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name ) ...@@ -277,19 +277,23 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name )
} }
/* Read magic number */ /* Read magic number */
#ifndef UNDER_CE /* FIXME */
if( read( i_file, pi_buffer, 2 ) != 2 ) if( read( i_file, pi_buffer, 2 ) != 2 )
{ {
msg_Err( p_vout, "unexpected end of file in '%s'", psz_name ); msg_Err( p_vout, "unexpected end of file in '%s'", psz_name );
close( i_file ); close( i_file );
return( NULL ); return( NULL );
} }
#endif
/* Allocate font descriptor */ /* Allocate font descriptor */
p_font = malloc( sizeof( vout_font_t ) ); p_font = malloc( sizeof( vout_font_t ) );
if( p_font == NULL ) if( p_font == NULL )
{ {
msg_Err( p_vout, "out of memory" ); msg_Err( p_vout, "out of memory" );
#ifndef UNDER_CE /* FIXME */
close( i_file ); close( i_file );
#endif
return( NULL ); return( NULL );
} }
...@@ -303,6 +307,7 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name ) ...@@ -303,6 +307,7 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name )
*/ */
/* Read font header - two bytes indicate the font properties */ /* Read font header - two bytes indicate the font properties */
#ifndef UNDER_CE /* FIXME */
if( read( i_file, pi_buffer, 2 ) != 2) if( read( i_file, pi_buffer, 2 ) != 2)
{ {
msg_Err( p_vout, "unexpected end of file in '%s'", psz_name ); msg_Err( p_vout, "unexpected end of file in '%s'", psz_name );
...@@ -310,6 +315,7 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name ) ...@@ -310,6 +315,7 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name )
close( i_file ); close( i_file );
return( NULL ); return( NULL );
} }
#endif
/* Copy font properties */ /* Copy font properties */
p_font->i_type = VOUT_FIXED_FONT; p_font->i_type = VOUT_FIXED_FONT;
...@@ -327,11 +333,14 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name ) ...@@ -327,11 +333,14 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name )
{ {
msg_Err( p_vout, "out of memory" ); msg_Err( p_vout, "out of memory" );
free( p_font ); free( p_font );
#ifndef UNDER_CE /* FIXME */
close( i_file ); close( i_file );
#endif
return( NULL ); return( NULL );
} }
/* Copy raw data */ /* Copy raw data */
#ifndef UNDER_CE /* FIXME */
if( read( i_file, p_font->p_data, 256 * pi_buffer[1] ) != 256 * pi_buffer[1] ) if( read( i_file, p_font->p_data, 256 * pi_buffer[1] ) != 256 * pi_buffer[1] )
{ {
msg_Err( p_vout, "unexpected end of file in '%s'", psz_name ); msg_Err( p_vout, "unexpected end of file in '%s'", psz_name );
...@@ -340,6 +349,7 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name ) ...@@ -340,6 +349,7 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name )
close( i_file ); close( i_file );
return( NULL ); return( NULL );
} }
#endif
/* Compute border masks - remember that masks have the same matrix as /* Compute border masks - remember that masks have the same matrix as
* characters, so an empty character border is required to have a * characters, so an empty character border is required to have a
...@@ -362,7 +372,9 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name ) ...@@ -362,7 +372,9 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name )
default: default:
msg_Err( p_vout, "file '%s' has an unknown format", psz_name ); msg_Err( p_vout, "file '%s' has an unknown format", psz_name );
free( p_font ); free( p_font );
#ifndef UNDER_CE /* FIXME */
close( i_file ); close( i_file );
#endif
return( NULL ); return( NULL );
break; break;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc.c: the vlc player * vlc.c: the vlc player
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: vlc.c,v 1.16 2002/11/10 18:04:23 sam Exp $ * $Id: vlc.c,v 1.17 2002/11/10 23:41:53 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -35,6 +35,12 @@ ...@@ -35,6 +35,12 @@
# include <time.h> /* time() */ # include <time.h> /* time() */
#endif #endif
#ifdef UNDER_CE
/* WinCE needs a WINAPI declaration */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
#include <vlc/vlc.h> #include <vlc/vlc.h>
/***************************************************************************** /*****************************************************************************
...@@ -47,9 +53,18 @@ static void SigHandler ( int i_signal ); ...@@ -47,9 +53,18 @@ static void SigHandler ( int i_signal );
/***************************************************************************** /*****************************************************************************
* main: parse command line, start interface and spawn threads * main: parse command line, start interface and spawn threads
*****************************************************************************/ *****************************************************************************/
#ifdef UNDER_CE
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow )
#else
int main( int i_argc, char *ppsz_argv[] ) int main( int i_argc, char *ppsz_argv[] )
#endif
{ {
int i_ret; int i_ret;
#ifdef UNDER_CE
int i_argc = 1;
char *ppsz_argv[] = { lpCmdLine, NULL };
#endif
fprintf( stderr, "VideoLAN Client %s\n", VLC_Version() ); fprintf( stderr, "VideoLAN Client %s\n", VLC_Version() );
......
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