]> git.sesse.net Git - vlc/blobdiff - src/misc/modules.c
* ./src/misc/modules.c: restored plugins hiding as the problem is fixed.
[vlc] / src / misc / modules.c
index db9c3d73d3e7848cc7b6d38b43c153d732c36af3..8e5347486554f710b5b155efd12ab0f85b76db3b 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Built-in and plugin modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.56 2002/03/01 16:07:00 sam Exp $
+ * $Id: modules.c,v 1.62 2002/05/22 19:31:33 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -35,9 +35,7 @@
 
 #include <videolan/vlc.h>
 
-#if !defined( _MSC_VER )
 #include <dirent.h>
-#endif
 
 #if defined(HAVE_DLFCN_H)                                /* Linux, BSD, Hurd */
 #   include <dlfcn.h>                        /* dlopen(), dlsym(), dlclose() */
@@ -45,7 +43,7 @@
 #elif defined(HAVE_IMAGE_H)                                          /* BeOS */
 #   include <image.h>
 #   define HAVE_DYNAMIC_PLUGINS
-#elif defined(WIN32) && defined( __MINGW32__ )
+#elif defined(WIN32)
 #   define HAVE_DYNAMIC_PLUGINS
 #else
 #   undef HAVE_DYNAMIC_PLUGINS
 #ifdef HAVE_DYNAMIC_PLUGINS
 #   include "modules_plugin.h"
 #endif
-#include "modules_builtin.h"
+
+#if !defined( _MSC_VER )
+#    include "modules_builtin.h"
+#else
+#    include "modules_builtin_msvc.h"
+#endif
 
 /*****************************************************************************
  * Local prototypes
@@ -307,24 +310,29 @@ module_t * module_Need( int i_capability, char *psz_name, void *p_data )
             continue;
         }
 
-        /* Test if this plugin exports the required shortcut */
+        /* If we required a shortcut, check this plugin provides it. */
         if( psz_name != NULL && *psz_name )
         {
-            boolean_t b_ok = 0;
+            boolean_t b_trash = 1;
             int i_dummy;
 
             for( i_dummy = 0;
-                 !b_ok && p_module->pp_shortcuts[i_dummy];
+                 b_trash && p_module->pp_shortcuts[i_dummy];
                  i_dummy++ )
             {
-                b_ok = !strcmp( psz_name, p_module->pp_shortcuts[i_dummy] );
+                b_trash = strcmp( psz_name, p_module->pp_shortcuts[i_dummy] );
             }
 
-            if( !b_ok )
+            if( b_trash )
             {
                 continue;
             }
         }
+        /* If we didn't require a shortcut, trash zero-scored plugins */
+        else if( !p_module->pi_score[i_capability] )
+        {
+            continue;
+        }
 
         /* Special case: test if we requested a particular intf plugin */
         if( i_capability == MODULE_CAPABILITY_INTF )
@@ -646,9 +654,11 @@ static int AllocatePluginModule( char * psz_filename )
     /* Try to dynamically load the module. */
     if( module_load( psz_filename, &handle ) )
     {
+        char psz_buffer[256];
+
         /* The plugin module couldn't be opened */
         intf_WarnMsg( 1, "module warning: cannot open %s (%s)",
-                         psz_filename, module_error() );
+                         psz_filename, module_error( psz_buffer ) );
         return( -1 );
     }
 
@@ -965,9 +975,12 @@ static int LockModule( module_t * p_module )
     if( module_load( p_module->is.plugin.psz_filename,
                      &p_module->is.plugin.handle ) )
     {
+        char psz_buffer[256];
+
         /* The plugin module couldn't be opened */
         intf_ErrMsg( "module error: cannot open %s (%s)",
-                     p_module->is.plugin.psz_filename, module_error() );
+                     p_module->is.plugin.psz_filename,
+                     module_error( psz_buffer ) );
         return( -1 );
     }
 
@@ -1080,11 +1093,13 @@ static int CallSymbol( module_t * p_module, char * psz_name )
 
     if( pf_symbol == NULL )
     {
+        char psz_buffer[256];
+
         /* We couldn't load the symbol */
         intf_WarnMsg( 1, "module warning: "
                          "cannot find symbol %s in module %s (%s)",
                          psz_name, p_module->is.plugin.psz_filename,
-                         module_error() );
+                         module_error( psz_buffer ) );
         return( -1 );
     }