]> git.sesse.net Git - vlc/commitdiff
* ./src/misc/modules.c: support for Unicode filenames under WinCE; VLC now
authorSam Hocevar <sam@videolan.org>
Mon, 18 Nov 2002 18:05:13 +0000 (18:05 +0000)
committerSam Hocevar <sam@videolan.org>
Mon, 18 Nov 2002 18:05:13 +0000 (18:05 +0000)
    successfully opens plugins.
  * ./modules/misc/dummy/*: hacked the dummy plugin so that it compiles for
    WinCE.

evc/vlc.vcp
evc/vlc.vcw
include/modules_inner.h
modules/misc/dummy/decoder.c
modules/misc/dummy/input.c
modules/misc/dummy/vout.c
src/misc/modules.c
src/misc/modules_plugin.h.in

index 489d543a1dfbfa72cf1f63fb7ae854fe9982114e..c9cf7739f8c5b99653adf942ecc3dc022816d62b 100644 (file)
@@ -357,7 +357,7 @@ 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\r
 CPP=cl.exe\r
 # 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\r
-# 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\r
+# 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" /FR /Gz /c\r
 # SUBTRACT CPP /YX /Yc /Yu\r
 MTL=midl.exe\r
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32\r
@@ -383,14 +383,257 @@ LINK32=link.exe
 # Name "vlc - Win32 (WCE ARM) Debug"\r
 # Name "vlc - Win32 (WCE x86em) Release"\r
 # Name "vlc - Win32 (WCE x86em) Debug"\r
-\r
 # Begin Group "Source Files"\r
+\r
 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
 # Begin Source File\r
+\r
 SOURCE="..\evc\vlc.c"\r
+\r
+!IF  "$(CFG)" == "vlc - Win32 (WCE MIPS) Release"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE MIPS) Debug"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE SH4) Release"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE SH4) Debug"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE SH3) Release"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE SH3) Debug"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE ARM) Release"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE ARM) Debug"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE x86em) Release"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ELSEIF  "$(CFG)" == "vlc - Win32 (WCE x86em) Debug"\r
+\r
+DEP_CPP_VLC_C=\\r
+       "..\include\beos_specific.h"\\r
+       "..\include\configuration.h"\\r
+       "..\include\darwin_specific.h"\\r
+       "..\include\main.h"\\r
+       "..\include\modules.h"\\r
+       "..\include\modules_inner.h"\\r
+       "..\include\mtime.h"\\r
+       "..\include\os_specific.h"\\r
+       "..\include\variables.h"\\r
+       "..\include\vlc\vlc.h"\\r
+       "..\include\vlc_common.h"\\r
+       "..\include\vlc_config.h"\\r
+       "..\include\vlc_messages.h"\\r
+       "..\include\vlc_objects.h"\\r
+       "..\include\vlc_symbols.h"\\r
+       "..\include\vlc_threads.h"\\r
+       "..\include\vlc_threads_funcs.h"\\r
+       "..\include\win32_specific.h"\\r
+       ".\config.h"\\r
+       \r
+\r
+!ENDIF \r
+\r
 # End Source File\r
 # End Group\r
-\r
 # Begin Group "Resource Files"\r
 \r
 # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
index 7269f588c7113e34b48876f331f0ed240d7dced8..17cbe4df028e47d07f7cfc1b1ea684461a9fce5c 100644 (file)
@@ -15,7 +15,7 @@ Package=<4>
 \r
 ###############################################################################\r
 \r
-Project: "plugin_foo"=.\plugin_foo\plugin_foo.vcp - Package Owner=<4>\r
+Project: "plugin_dummy"=.\plugin_dummy.vcp - Package Owner=<4>\r
 \r
 Package=<5>\r
 {{{\r
@@ -27,21 +27,6 @@ Package=<4>
 \r
 ###############################################################################\r
 \r
-Project: "plugins"=.\plugins.vcp - Package Owner=<4>\r
-\r
-Package=<5>\r
-{{{\r
-}}}\r
-\r
-Package=<4>\r
-{{{\r
-    Begin Project Dependency\r
-    Project_Dep_Name libvlc\r
-    End Project Dependency\r
-}}}\r
-\r
-###############################################################################\r
-\r
 Project: "vlc"=.\vlc.vcp - Package Owner=<4>\r
 \r
 Package=<5>\r
index e5bd723c0e7c7a21333577a40b68a4e72a6b2575..91e42f261e515fa0c21608f4f0a42b085c33445d 100644 (file)
@@ -2,7 +2,7 @@
  * modules_inner.h : Macros used from within a module.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules_inner.h,v 1.32 2002/09/30 11:05:33 sam Exp $
+ * $Id: modules_inner.h,v 1.33 2002/11/18 18:05:13 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
 #   define STORE_SYMBOLS           p_symbols = p_module->p_symbols
 #endif
 
+#if defined( __PLUGIN__ ) && ( defined( WIN32 ) || defined( UNDER_CE ) )
+#   define DLL_SYMBOL              __declspec(dllexport)
+#   define CDECL_SYMBOL            __cdecl
+#else
+#   define DLL_SYMBOL
+#   define CDECL_SYMBOL
+#endif
+
 #if defined( __cplusplus )
 #   define EXTERN_SYMBOL           extern "C"
 #else
@@ -80,7 +88,8 @@
  */
 #define vlc_module_begin( )                                                   \
     DECLARE_SYMBOLS;                                                          \
-    EXTERN_SYMBOL int __VLC_SYMBOL(vlc_entry) ( module_t *p_module )          \
+    EXTERN_SYMBOL DLL_SYMBOL int CDECL_SYMBOL                                 \
+    __VLC_SYMBOL(vlc_entry) ( module_t *p_module )                            \
     {                                                                         \
         int i_shortcut = 1, i_config = 0;                                     \
         module_config_t p_config[ 100 ];                                      \
         }                                                                     \
         return 0 && i_shortcut;                                               \
     }                                                                         \
-    int __VLC_SYMBOL(vlc_entry) ( module_t * ) /* the ; gets added */
+    struct _u_n_u_s_e_d_ /* the ; gets added */
 
 
 #define add_submodule( )                                                      \
index e96e4d45fa78a1995b893364a6949adb8f6b7c0d..45870b5bd9ffba13b37aab25e3a6db774ad3aa51 100644 (file)
@@ -2,7 +2,7 @@
  * dec_dummy.c: dummy decoder plugin for vlc.
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: decoder.c,v 1.3 2002/10/27 16:58:13 gbazin Exp $
+ * $Id: decoder.c,v 1.4 2002/11/18 18:05:13 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h> /* write(), close() */
 #endif
-
-#include <sys/types.h> /* open() */
-#include <sys/stat.h>
-#include <fcntl.h>
+#ifdef HAVE_SYS_TYPES_H
+#   include <sys/types.h> /* open() */
+#endif
+#ifdef HAVE_SYS_STAT_H
+#   include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#   include <fcntl.h>
+#endif
 
 #include <stdio.h> /* sprintf() */
 
@@ -66,9 +71,12 @@ static int Run ( decoder_fifo_t *p_fifo )
     size_t       i_bytes = 0;
 
     char         psz_file[100];
+#ifndef UNDER_CE
     int          i_fd;
+#endif
 
     sprintf( psz_file, "stream.%i", p_fifo->i_object_id );
+#ifndef UNDER_CE
     i_fd = open( psz_file, O_WRONLY | O_CREAT | O_TRUNC, 00644 );
 
     if( i_fd == -1 )
@@ -78,6 +86,7 @@ static int Run ( decoder_fifo_t *p_fifo )
         DecoderError( p_fifo );
         return -1;
     }
+#endif
 
     msg_Dbg( p_fifo, "dumping stream to file `%s'", psz_file );
 
@@ -86,16 +95,20 @@ static int Run ( decoder_fifo_t *p_fifo )
         msg_Err( p_fifo, "cannot initialize bitstream" );
         p_fifo->b_error = 1;
         DecoderError( p_fifo );
+#ifndef UNDER_CE
         close( i_fd );
+#endif
         return -1;
     }
 
     while( !p_fifo->b_die && !p_fifo->b_error )
     {
         GetChunk( &bit_stream, p_buffer, 1024 );
+#ifndef UNDER_CE
         write( i_fd, p_buffer, 1024 );
 
         i_bytes += 1024;
+#endif
 
         if( mdate() < last_date + 2000000 )
         {
@@ -113,7 +126,9 @@ static int Run ( decoder_fifo_t *p_fifo )
         msg_Dbg( p_fifo, "dumped %i bytes", i_bytes );
     }
 
+#ifndef UNDER_CE
     close( i_fd );
+#endif
     CloseBitstream( &bit_stream );
 
     if( p_fifo->b_error )
index 7d6cfa8235f8160c12435fe264ab5eafa9b8ac9d..83776e174448be1192f25f9fcff459b878db7f61 100644 (file)
@@ -2,7 +2,7 @@
  * input_dummy.c: dummy input plugin, to manage "vlc:***" special options
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: input.c,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * $Id: input.c,v 1.2 2002/11/18 18:05:13 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
  * Preamble
  *****************************************************************************/
 #include <stdlib.h>
-#include <sys/types.h>
 #include <string.h>
-#include <errno.h>
 
 #include <vlc/vlc.h>
 #include <vlc/intf.h>
 #include <vlc/input.h>
 
+#ifndef HAVE_STRNCASECMP
+#   define strncasecmp(a,b,c) strcmp(a,b)
+#endif
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
index b83364a5bea700036a7ebf48b36c705aa88a9567..c4b4aa11bb1c85edc3e38077b26d32f07638e99a 100644 (file)
@@ -2,7 +2,7 @@
  * vout_dummy.c: Dummy video output display method for testing purposes
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout.c,v 1.2 2002/09/10 12:58:42 sam Exp $
+ * $Id: vout.c,v 1.3 2002/11/18 18:05:13 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -24,7 +24,6 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <errno.h>                                                 /* ENOMEM */
 #include <stdlib.h>                                                /* free() */
 #include <string.h>                                            /* strerror() */
 
index 4e2228ba94078ab7d3a8de964d61c0dc9bc89bab..138761cd16d215ef6dff7979864a0fb03c7f466c 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Builtin and plugin modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.104 2002/11/13 15:28:24 sam Exp $
+ * $Id: modules.c,v 1.105 2002/11/18 18:05:13 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -37,6 +37,8 @@
 
 #ifdef HAVE_DIRENT_H
 #   include <dirent.h>
+#elif defined( UNDER_CE )
+#   include <windows.h>                               /* GetFileAttributes() */
 #else
 #   include "../extras/dirent.h"
 #endif
 
 #include "iso_lang.h"
 
+#if defined( UNDER_CE )
+#   define MYCHAR wchar_t
+#else
+#   define MYCHAR char
+#endif
+
 #ifdef HAVE_DYNAMIC_PLUGINS
 #   include "modules_plugin.h"
 #endif
  *****************************************************************************/
 #ifdef HAVE_DYNAMIC_PLUGINS
 static void AllocateAllPlugins   ( vlc_object_t * );
-static void AllocatePluginDir    ( vlc_object_t *, const char *, int );
-static int  AllocatePluginFile   ( vlc_object_t *, char * );
+static void AllocatePluginDir    ( vlc_object_t *, const MYCHAR *, int );
+static int  AllocatePluginFile   ( vlc_object_t *, MYCHAR * );
 #endif
 static int  AllocateBuiltinModule( vlc_object_t *, int ( * ) ( module_t * ) );
 static int  DeleteModule ( module_t * );
@@ -550,6 +558,10 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
     vlc_bool_t      b_notinroot;
 #endif
 
+#if defined( UNDER_CE )
+    wchar_t   psz_dir[MAX_PATH];
+#endif
+
     /* If the user provided a plugin path, we add it to the list */
     path[ sizeof(path)/sizeof(char*) - 2 ] = config_GetPsz( p_this,
                                                             "plugin-path" );
@@ -584,7 +596,12 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
         msg_Dbg( p_this, "recursively browsing `%s'", psz_fullpath );
 
         /* Don't go deeper than 5 subdirectories */
+#if defined( UNDER_CE )
+        MultiByteToWideChar( CP_ACP, 0, psz_fullpath, -1, psz_dir, MAX_PATH );
+        AllocatePluginDir( p_this, psz_dir, 5 );
+#else
         AllocatePluginDir( p_this, psz_fullpath, 5 );
+#endif
 
 #if defined( SYS_BEOS ) || defined( SYS_DARWIN )
         if( b_notinroot )
@@ -602,22 +619,66 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
 /*****************************************************************************
  * AllocatePluginDir: recursively parse a directory to look for plugins
  *****************************************************************************/
-static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
+static void AllocatePluginDir( vlc_object_t *p_this, const MYCHAR *psz_dir,
                                int i_maxdepth )
 {
+#ifdef UNDER_CE
+    MYCHAR psz_path[MAX_PATH + 256];
+    WIN32_FIND_DATA finddata;
+    HANDLE handle;
+    unsigned int rc;
+#else
     int    i_dirlen;
     DIR *  dir;
     char * psz_file;
-
     struct dirent * file;
+#endif
 
     if( i_maxdepth < 0 )
     {
         return;
     }
 
-    dir = opendir( psz_dir );
+#ifdef UNDER_CE
+    rc = GetFileAttributes( psz_dir );
+    if( !(rc & FILE_ATTRIBUTE_DIRECTORY) )
+    {
+        /* Not a directory */
+        return;
+    }
+
+    /* Parse all files in the directory */
+    swprintf( psz_path, L"%s\\*.*", psz_dir );
+    handle = FindFirstFile( psz_path, &finddata );
+    if( handle == INVALID_HANDLE_VALUE )
+    {
+        /* Empty directory */
+        return;
+    }
+
+    /* Parse the directory and try to load all files it contains. */
+    do
+    {
+        unsigned int i_len = wcslen( finddata.cFileName );
+
+        swprintf( psz_path, L"%s\\%s", psz_dir, finddata.cFileName );
+
+        if( GetFileAttributes( psz_path ) & FILE_ATTRIBUTE_DIRECTORY )
+        {
+            AllocatePluginDir( p_this, psz_path, i_maxdepth - 1 );
+        }
+        else if( i_len > strlen( LIBEXT ) )
+        {
+            AllocatePluginFile( p_this, psz_path );
+        }
+    }
+    while( FindNextFile( handle, &finddata ) ); 
 
+    /* Close the directory */
+    FindClose( handle );
+
+#else
+    dir = opendir( psz_dir );
     if( !dir )
     {
         return;
@@ -628,9 +689,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
     /* Parse the directory and try to load all files it contains. */
     while( (file = readdir( dir )) )
     {
-#ifndef UNDER_CE
         struct stat statbuf;
-#endif
         unsigned int i_len;
 
         /* Skip ".", ".." and anything starting with "." */
@@ -640,15 +699,10 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
         }
 
         i_len = strlen( file->d_name );
-
-        psz_file = malloc( i_dirlen + 1 /* / */ + i_len + 1 /* \0 */ );
+        psz_file = malloc( i_dirlen + 1 + i_len + 1 );
         sprintf( psz_file, "%s/%s", psz_dir, file->d_name );
 
-#ifdef UNDER_CE
-        if( GetFileAttributes( psz_file ) & FILE_ATTRIBUTE_DIRECTORY )
-#else
         if( !stat( psz_file, &statbuf ) && statbuf.st_mode & S_IFDIR )
-#endif
         {
             AllocatePluginDir( p_this, psz_file, i_maxdepth - 1 );
         }
@@ -657,7 +711,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
                   && !strncasecmp( file->d_name + i_len - strlen( LIBEXT ),
                                    LIBEXT, strlen( LIBEXT ) ) )
         {
-            AllocatePluginFile( p_this, psz_file );
+            AllocatePluginFile( p_this, psz_file )
         }
 
         free( psz_file );
@@ -665,6 +719,8 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
 
     /* Close the directory */
     closedir( dir );
+
+#endif
 }
 
 /*****************************************************************************
@@ -674,7 +730,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
  * for its information data. The module can then be handled by module_Need
  * and module_Unneed. It can be removed by DeleteModule.
  *****************************************************************************/
-static int AllocatePluginFile( vlc_object_t * p_this, char * psz_file )
+static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file )
 {
     module_t * p_module;
     module_handle_t handle;
@@ -701,7 +757,8 @@ static int AllocatePluginFile( vlc_object_t * p_this, char * psz_file )
     }
 
     /* We need to fill these since they may be needed by CallEntry() */
-    p_module->psz_filename = psz_file;
+    /* FIXME: this is not unicode-compliant */
+    p_module->psz_filename = (char *)psz_file;
     p_module->handle = handle;
     p_module->p_symbols = &p_this->p_libvlc->p_module_bank->symbols;
 
index 05a9676a709d8decb74c779dc7cdf75ed19ef7ab..11eb5a7073c96b8e05667f09e9c111c11c0370ef 100644 (file)
@@ -2,7 +2,7 @@
  * modules_plugin.h : Plugin management functions used by the core application.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules_plugin.h.in,v 1.6 2002/11/11 14:39:12 sam Exp $
+ * $Id: modules_plugin.h.in,v 1.7 2002/11/18 18:05:13 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -31,7 +31,7 @@
  * This function loads a dynamically linked library using a system dependant
  * method, and returns a non-zero value on error, zero otherwise.
  *****************************************************************************/
-static int module_load( const char * psz_filename, module_handle_t * handle )
+static int module_load( const MYCHAR * psz_filename, module_handle_t * handle )
 {
 #ifdef SYS_BEOS
     *handle = load_add_on( psz_filename );
@@ -99,18 +99,24 @@ static void * _module_getsymbol( module_handle_t handle,
     if( B_OK == get_image_symbol( handle, psz_function,
                                   B_SYMBOL_TYPE_TEXT, &p_symbol ) )
     {
-        return( p_symbol );
+        return p_symbol;
     }
     else
     {
-        return( NULL );
+        return NULL;
     }
 
-#elif defined(WIN32) || defined(UNDER_CE)
-    return( (void *)GetProcAddress( handle, psz_function ) );
+#elif defined( UNDER_CE )
+    wchar_t psz_real[256];
+    MultiByteToWideChar( CP_ACP, 0, psz_function, -1, psz_real, 256 );
+
+    return (void *)GetProcAddress( handle, psz_real );
+
+#elif defined( WIN32 )
+    return (void *)GetProcAddress( handle, (MYCHAR*)psz_function );
 
 #else
-    return( dlsym( handle, psz_function ) );
+    return dlsym( handle, psz_function );
 
 #endif
 }
@@ -149,12 +155,37 @@ static const char * module_error( char *psz_buffer )
 #if defined(SYS_BEOS)
     return( "failed" );
 
-#elif defined(WIN32) || defined(UNDER_CE)
+#elif defined(UNDER_CE)
+    wchar_t psz_tmp[256];
+
+    int i, i_error = GetLastError();
+
+    FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+                   NULL, i_error, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
+                   (LPTSTR) psz_tmp, 256, NULL );
+
+    /* Go to the end of the string */
+    for( i = 0;
+         psz_tmp[i] && psz_tmp[i] != L'\r' && psz_tmp[i] != L'\n';
+         i++ ) {};
+
+    if( psz_tmp[i] )
+    {
+        swprintf( psz_tmp + i, L" (error %i)", i_error );
+        psz_tmp[ 255 ] = L'\0';
+    }
+    
+    WideCharToMultiByte( CP_ACP, WC_DEFAULTCHAR, psz_tmp, -1,
+                         psz_buffer, 256, NULL, NULL );
+
+    return psz_buffer;
+
+#elif defined(WIN32)
     int i, i_error = GetLastError();
 
     FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
                    NULL, i_error, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
-                   (LPTSTR) psz_buffer, 256, NULL);
+                   (LPTSTR) psz_buffer, 256, NULL );
 
     /* Go to the end of the string */
     for( i = 0;
@@ -164,7 +195,7 @@ static const char * module_error( char *psz_buffer )
     if( psz_buffer[i] )
     {
         snprintf( psz_buffer + i, 256 - i, " (error %i)", i_error );
-       psz_buffer[ 255 ] = '\0';
+        psz_buffer[ 255 ] = '\0';
     }
     
     return psz_buffer;