From 77c667f4093a67cca8e77b4cb76a5fd2a674a5bf Mon Sep 17 00:00:00 2001 From: Sam Hocevar <sam@videolan.org> Date: Sun, 10 Nov 2002 23:41:54 +0000 Subject: [PATCH] * 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...). --- Makefile.am | 14 +-- configure.ac.in | 17 ++-- include/vlc_common.h | 43 ++++++++-- msvc/vlc.dsp | 4 +- msvc/vlc.vcp | 34 +++++--- msvc/vlc.vcp.in | 30 ++++--- src/extras/dirent.c | 9 +- src/extras/libc.c | 156 ++++++++++++++++++++++++++++++++++ src/extras/strndup.c | 48 ----------- src/input/input_ext-plugins.c | 28 ++++-- src/libvlc.c | 4 +- src/misc/configuration.c | 20 +++-- src/misc/threads.c | 21 ++++- src/video_output/video_text.c | 14 ++- src/vlc.c | 17 +++- 15 files changed, 350 insertions(+), 109 deletions(-) create mode 100644 src/extras/libc.c delete mode 100644 src/extras/strndup.c diff --git a/Makefile.am b/Makefile.am index 8553e4d264..81272a8343 100644 --- a/Makefile.am +++ b/Makefile.am @@ -288,7 +288,7 @@ show-vlc-sources: FORCE @echo X: $(vlc_SOURCES) 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 @echo X: $(HEADERS_include) $(HEADERS_include_built) @@ -327,8 +327,8 @@ endif if BUILD_GETOPT OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt) endif -if BUILD_STRNDUP -OPT_SOURCES_libvlc_strndup = $(SOURCES_libvlc_strndup) +if BUILD_LIBC +OPT_SOURCES_libvlc_libc = $(SOURCES_libvlc_libc) endif if BUILD_MOZILLA LIBRARIES_libvlc_pic = lib/libvlc_pic.a @@ -340,7 +340,7 @@ EXTRA_DIST += \ $(SOURCES_libvlc_win32) \ $(SOURCES_libvlc_dirent) \ $(SOURCES_libvlc_getopt) \ - $(SOURCES_libvlc_strndup) \ + $(SOURCES_libvlc_libc) \ $(NULL) SOURCES_libvlc_beos = \ @@ -366,8 +366,8 @@ SOURCES_libvlc_getopt = \ src/extras/getopt1.c \ $(NULL) -SOURCES_libvlc_strndup = \ - src/extras/strndup.c +SOURCES_libvlc_libc = \ + src/extras/libc.c $(NULL) SOURCES_libvlc_common = \ @@ -419,7 +419,7 @@ SOURCES_libvlc = \ $(OPT_SOURCES_libvlc_win32) \ $(OPT_SOURCES_libvlc_dirent) \ $(OPT_SOURCES_libvlc_getopt) \ - $(OPT_SOURCES_libvlc_strndup) \ + $(OPT_SOURCES_libvlc_libc) \ $(NULL) ############################################################################### diff --git a/configure.ac.in b/configure.ac.in index bf09fd5c0e..f66d6d3f8e 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -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}" 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 -need_strndup=false -AC_CHECK_FUNCS(strndup,,[need_strndup=:]) -AM_CONDITIONAL(BUILD_STRNDUP, ${need_strndup}) +AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll getenv putenv setenv) + +dnl Check for usual libc functions +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_LIB(socket,connect, diff --git a/include/vlc_common.h b/include/vlc_common.h index b39128b197..d206019c66 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -3,7 +3,7 @@ * Collection of useful common types and macros definitions ***************************************************************************** * 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> * Vincent Seguin <seguin@via.ecp.fr> @@ -467,9 +467,39 @@ static inline uint64_t U64_AT( void * _p ) #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 -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 /* Format type specifiers for 64 bits numbers */ @@ -501,8 +531,6 @@ char * strndup( const char *s, size_t n ); # if defined( _MSC_VER ) || !defined( __MINGW32__ ) # define __attribute__(x) # define __inline__ __inline -# define strncasecmp strnicmp -# define strcasecmp stricmp # define S_IFBLK 0x3000 /* Block */ # define S_ISBLK(m) (0) # define S_ISCHR(m) (0) @@ -549,6 +577,11 @@ typedef __int64 off_t; #endif +/* lseek (defined in src/extras/libc.c) */ +#ifndef HAVE_ATOF + off_t lseek( int fildes, off_t offset, int whence ); +#endif + /***************************************************************************** * CPU capabilities *****************************************************************************/ diff --git a/msvc/vlc.dsp b/msvc/vlc.dsp index ac4ef4233d..3abbd5abec 100644 --- a/msvc/vlc.dsp +++ b/msvc/vlc.dsp @@ -236,7 +236,7 @@ SOURCE="..\src\extras\getopt1.c" !ENDIF # End 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\" !IF "$(CFG)" == "vlc - Win32 Release" # PROP Intermediate_Dir "Release\extras" @@ -440,7 +440,7 @@ SOURCE="..\src\misc\iso_lang.c" !ENDIF # End 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\" !IF "$(CFG)" == "vlc - Win32 Release" # PROP Intermediate_Dir "Release\misc" diff --git a/msvc/vlc.vcp b/msvc/vlc.vcp index 58b43944c7..ba5ffc5480 100644 --- a/msvc/vlc.vcp +++ b/msvc/vlc.vcp @@ -60,7 +60,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "MIPS" /d "_MIPS_" /r CPP=clmips.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Oxs /M$(CECrtMT) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -92,7 +93,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "MIPS" /d "_MIPS_" /r CPP=clmips.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /M$(CECrtMTDebug) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -124,7 +126,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "NDEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "SHx" /d "SH4" /d "_SH4_" /r CPP=shcl.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Qsh4 /Oxs /M$(CECrtMT) /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Qsh4 /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Qsh4 /Oxs /M$(CECrtMT) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -156,7 +159,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "DEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "SHx" /d "SH4" /d "_SH4_" /r CPP=shcl.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /Qsh4 /M$(CECrtMTDebug) /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /Qsh4 /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Qsh4 /M$(CECrtMTDebug) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -188,7 +192,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "SHx" /d "SH3" /d "_SH3_" /r CPP=shcl.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Oxs /M$(CECrtMT) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -220,7 +225,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "SHx" /d "SH3" /d "_SH3_" /r CPP=shcl.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /M$(CECrtMTDebug) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -252,7 +258,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /r CPP=clarm.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Oxs /M$(CECrtMT) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -284,7 +291,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /r CPP=clarm.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /M$(CECrtMTDebug) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -316,7 +324,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "_X86_" /d "x86" /d "i486" /r CPP=cl.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "i486" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /Yu"stdafx.h" /Gz /Oxs /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "i486" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /Yu"stdafx.h" /Gz /Oxs /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "i486" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /Gz /Oxs /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -348,7 +357,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "_X86_" /d "x86" /d "i486" /r CPP=cl.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "i486" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /Yu"stdafx.h" /Gz /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "i486" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /Yu"stdafx.h" /Gz /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "i486" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /Gz /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -814,7 +824,7 @@ SOURCE="..\src\extras\getopt1.c" !ENDIF # End 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\" !IF "$(CFG)" == "vlc - Win32 (WCE MIPS) Release" # PROP Intermediate_Dir "Release\extras" @@ -1450,7 +1460,7 @@ SOURCE="..\src\misc\iso_lang.c" !ENDIF # End 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\" !IF "$(CFG)" == "vlc - Win32 (WCE MIPS) Release" # PROP Intermediate_Dir "Release\misc" diff --git a/msvc/vlc.vcp.in b/msvc/vlc.vcp.in index ef97f22864..da2454d767 100644 --- a/msvc/vlc.vcp.in +++ b/msvc/vlc.vcp.in @@ -60,7 +60,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "MIPS" /d "_MIPS_" /r CPP=clmips.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Oxs /M$(CECrtMT) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -92,7 +93,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "MIPS" /d "_MIPS_" /r CPP=clmips.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /M$(CECrtMTDebug) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -124,7 +126,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "NDEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "SHx" /d "SH4" /d "_SH4_" /r CPP=shcl.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Qsh4 /Oxs /M$(CECrtMT) /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Qsh4 /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Qsh4 /Oxs /M$(CECrtMT) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -156,7 +159,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "DEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "SHx" /d "SH4" /d "_SH4_" /r CPP=shcl.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /Qsh4 /M$(CECrtMTDebug) /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /Qsh4 /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Qsh4 /M$(CECrtMTDebug) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -188,7 +192,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "SHx" /d "SH3" /d "_SH3_" /r CPP=shcl.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Oxs /M$(CECrtMT) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -220,7 +225,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "SHx" /d "SH3" /d "_SH3_" /r CPP=shcl.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /M$(CECrtMTDebug) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -252,7 +258,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /r CPP=clarm.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Yu"stdafx.h" /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /Oxs /M$(CECrtMT) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -284,7 +291,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /r CPP=clarm.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /Yu"stdafx.h" /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /M$(CECrtMTDebug) /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 @@ -316,7 +324,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "_X86_" /d "x86" /d "i486" /r CPP=cl.exe # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "i486" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /Yu"stdafx.h" /Gz /Oxs /c -# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "i486" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /Yu"stdafx.h" /Gz /Oxs /c +# ADD CPP /nologo /W3 /I "." /I "..\include" /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "i486" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /Gz /Oxs /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -348,7 +357,8 @@ RSC=rc.exe # ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "_X86_" /d "x86" /d "i486" /r CPP=cl.exe # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "i486" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /Yu"stdafx.h" /Gz /c -# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "i486" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /Yu"stdafx.h" /Gz /c +# ADD CPP /nologo /W3 /Zi /Od /I "." /I "..\include" /D "DEBUG" /D "i486" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /Gz /c +# SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 diff --git a/src/extras/dirent.c b/src/extras/dirent.c index 3be39fa1ce..0ef479604d 100644 --- a/src/extras/dirent.c +++ b/src/extras/dirent.c @@ -9,9 +9,9 @@ * Significantly revised and rewinddir, seekdir and telldir added by Colin * Peters <colin@fu.is.saga-u.ac.jp> * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * $Author: sam $ - * $Date: 2002/11/10 18:04:23 $ + * $Date: 2002/11/10 23:41:53 $ * */ @@ -89,12 +89,13 @@ opendir (const CHAR *szPath) #if defined( UNDER_CE ) if (szPath[0] == '\\' || szPath[0] == '/') { - snprintf (szFullPath, MAX_PATH, "%s", szPath); + sprintf (szFullPath, MAX_PATH, "%s", szPath); szFullPath[0] = '\\'; } 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 _fullpath (szFullPath, szPath, MAX_PATH); diff --git a/src/extras/libc.c b/src/extras/libc.c new file mode 100644 index 0000000000..0b66f61bb2 --- /dev/null +++ b/src/extras/libc.c @@ -0,0 +1,156 @@ +/***************************************************************************** + * libc.c: Extra libc function for some systems. + ***************************************************************************** + * Copyright (C) 2002 VideoLAN + * $Id: libc.c,v 1.1 2002/11/10 23:41:53 sam Exp $ + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ +#include <string.h> /* strdup() */ +#include <stdlib.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 + * Does anyone know whether or not it will be present in Jaguar? + *****************************************************************************/ +#ifndef HAVE_STRDUP +char *strndup( const char *string, size_t n ) +{ + char *psz; + size_t len = strlen( string ); + + len = __MIN( len, n ); + psz = (char*)malloc( len + 1 ); + + if( psz != NULL ) + { + memcpy( (void*)psz, (const void*)string, len ); + psz[ len ] = 0; + } + + 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 + diff --git a/src/extras/strndup.c b/src/extras/strndup.c deleted file mode 100644 index 5cced1ddf9..0000000000 --- a/src/extras/strndup.c +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * strndup.c: Extra strndup function for some systems. - ***************************************************************************** - * Copyright (C) 2002 VideoLAN - * $Id: strndup.c,v 1.1 2002/11/09 16:34:52 sam Exp $ - * - * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ -#include <string.h> /* strdup() */ -#include <stdlib.h> - -#include <vlc/vlc.h> - -/***************************************************************************** - * 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? - *****************************************************************************/ -char *strndup( const char *string, size_t n ) -{ - char *psz; - size_t len = strlen( string ); - - len = __MIN( len, n ); - psz = (char*)malloc( len + 1 ); - - if( psz != NULL ) - { - memcpy( (void*)psz, (const void*)string, len ); - psz[ len ] = 0; - } - - return( psz ); -} - diff --git a/src/input/input_ext-plugins.c b/src/input/input_ext-plugins.c index a4fdbfc10b..c262704274 100644 --- a/src/input/input_ext-plugins.c +++ b/src/input/input_ext-plugins.c @@ -2,7 +2,7 @@ * input_ext-plugins.c: useful functions for access and demux plug-ins ***************************************************************************** * 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> * @@ -669,7 +669,12 @@ void __input_FDClose( vlc_object_t * p_this ) msg_Info( p_input, "closing `%s/%s://%s'", 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 ); +#endif + free( p_access_data ); } @@ -684,7 +689,9 @@ void __input_FDNetworkClose( vlc_object_t * p_this ) msg_Info( p_input, "closing network `%s/%s://%s'", 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 ); #else close( p_access_data->i_handle ); @@ -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 ) { 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 ) { -#ifdef HAVE_ERRNO_H +# ifdef HAVE_ERRNO_H msg_Err( p_input, "read failed (%s)", strerror(errno) ); -#else +# else msg_Err( p_input, "read failed" ); -#endif +# endif } return i_ret; diff --git a/src/libvlc.c b/src/libvlc.c index 2e77f5b41c..4439ed00ec 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -2,7 +2,7 @@ * libvlc.c: main libvlc source ***************************************************************************** * 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> * Samuel Hocevar <sam@zoy.org> @@ -1265,10 +1265,12 @@ static void Version( void ) #ifdef WIN32 /* */ static void ShowConsole( void ) { +# ifndef UNDER_CE AllocConsole(); freopen( "CONOUT$", "w", stdout ); freopen( "CONOUT$", "w", stderr ); freopen( "CONIN$", "r", stdin ); +# endif return; } #endif diff --git a/src/misc/configuration.c b/src/misc/configuration.c index 455f05552b..b1163474e3 100644 --- a/src/misc/configuration.c +++ b/src/misc/configuration.c @@ -2,7 +2,7 @@ * configuration.c management of the modules configuration ***************************************************************************** * 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> * @@ -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 interesting section ( a section is of the form [foo] ) */ - rewind( file ); + fseek( file, 0L, SEEK_SET ); while( fgets( line, 1024, file ) ) { if( (line[0] == '[') @@ -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 ); -#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( mkdir( psz_filename ) && errno != EEXIST ) # else @@ -719,9 +729,9 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) else { /* look for file size */ - fseek( file, 0, SEEK_END ); + fseek( file, 0L, SEEK_END ); i_sizebuf = ftell( file ); - rewind( file ); + fseek( file, 0L, SEEK_SET ); } p_bigbuffer = p_index = malloc( i_sizebuf+1 ); diff --git a/src/misc/threads.c b/src/misc/threads.c index 5141bd56ba..68d556414f 100644 --- a/src/misc/threads.c +++ b/src/misc/threads.c @@ -2,7 +2,7 @@ * threads.c : threads implementation for the VideoLAN client ***************************************************************************** * 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> * Samuel Hocevar <sam@zoy.org> @@ -77,6 +77,7 @@ int __vlc_threads_init( vlc_object_t *p_this ) * hope nothing wrong happens. */ #if defined( PTH_INIT_IN_PTH_H ) #elif defined( ST_INIT_IN_ST_H ) +#elif defined( UNDER_CE ) #elif defined( WIN32 ) HINSTANCE hInstLib; #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, unsigned threadID; /* When using the MSVCRT C library you have to use the _beginthreadex * 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 = +#if defined( UNDER_CE ) + (HANDLE)CreateThread( NULL, 0, (PTHREAD_START) func, + (void *)p_this, 0, &threadID ); +#else (HANDLE)_beginthreadex( NULL, 0, (PTHREAD_START) func, (void *)p_this, 0, &threadID ); +#endif } 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, } else { +#ifdef HAVE_STRERROR msg_Err( p_this, "%s thread could not be created at %s:%d (%s)", 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 ); } @@ -677,8 +689,13 @@ void __vlc_thread_join( vlc_object_t *p_this, char * psz_file, int i_line ) if( i_ret ) { +#ifdef HAVE_STRERROR msg_Err( p_this, "thread_join(%d) failed at %s:%d (%s)", 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 { diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c index 712b759115..6d4aed1bb6 100644 --- a/src/video_output/video_text.c +++ b/src/video_output/video_text.c @@ -2,7 +2,7 @@ * video_text.c : text manipulation functions ***************************************************************************** * 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> * Samuel Hocevar <sam@zoy.org> @@ -277,19 +277,23 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name ) } /* Read magic number */ +#ifndef UNDER_CE /* FIXME */ if( read( i_file, pi_buffer, 2 ) != 2 ) { msg_Err( p_vout, "unexpected end of file in '%s'", psz_name ); close( i_file ); return( NULL ); } +#endif /* Allocate font descriptor */ p_font = malloc( sizeof( vout_font_t ) ); if( p_font == NULL ) { msg_Err( p_vout, "out of memory" ); +#ifndef UNDER_CE /* FIXME */ close( i_file ); +#endif return( NULL ); } @@ -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 */ +#ifndef UNDER_CE /* FIXME */ if( read( i_file, pi_buffer, 2 ) != 2) { 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 ) close( i_file ); return( NULL ); } +#endif /* Copy font properties */ 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 ) { msg_Err( p_vout, "out of memory" ); free( p_font ); +#ifndef UNDER_CE /* FIXME */ close( i_file ); +#endif return( NULL ); } /* Copy raw data */ +#ifndef UNDER_CE /* FIXME */ 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 ); @@ -340,6 +349,7 @@ vout_font_t *vout_LoadFont( vout_thread_t *p_vout, const char *psz_name ) close( i_file ); return( NULL ); } +#endif /* Compute border masks - remember that masks have the same matrix as * 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 ) default: msg_Err( p_vout, "file '%s' has an unknown format", psz_name ); free( p_font ); +#ifndef UNDER_CE /* FIXME */ close( i_file ); +#endif return( NULL ); break; } diff --git a/src/vlc.c b/src/vlc.c index 8f49a91b96..5f01a83c24 100644 --- a/src/vlc.c +++ b/src/vlc.c @@ -2,7 +2,7 @@ * vlc.c: the vlc player ***************************************************************************** * 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> * Samuel Hocevar <sam@zoy.org> @@ -35,6 +35,12 @@ # include <time.h> /* time() */ #endif +#ifdef UNDER_CE + /* WinCE needs a WINAPI declaration */ +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif + #include <vlc/vlc.h> /***************************************************************************** @@ -47,9 +53,18 @@ static void SigHandler ( int i_signal ); /***************************************************************************** * 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[] ) +#endif { int i_ret; +#ifdef UNDER_CE + int i_argc = 1; + char *ppsz_argv[] = { lpCmdLine, NULL }; +#endif fprintf( stderr, "VideoLAN Client %s\n", VLC_Version() ); -- 2.25.4