]> git.sesse.net Git - vlc/commitdiff
* src/misc/modules.c: module_Need() now only raises the scores of the
authorGildas Bazin <gbazin@videolan.org>
Tue, 25 Mar 2003 15:38:14 +0000 (15:38 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 25 Mar 2003 15:38:14 +0000 (15:38 +0000)
   plugins matching the given shortcuts list, unless "none" is closing the
   list (in which case only the plugins matching the list can be selected).

   Which means that users will stop complaining vlc doesn't launch anymore
   or can't play anything after they have fiddled with their config
   options :))

src/misc/modules.c

index d5e1c070b5e9191eeee2c34ff97d8a44cf7ef354..b2e6f0abb3103c779560b048d20b362ca73aed4b 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Builtin and plugin modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.116 2003/03/12 05:26:46 sam Exp $
+ * $Id: modules.c,v 1.117 2003/03/25 15:38:14 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -340,23 +340,40 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
         /* If we required a shortcut, check this plugin provides it. */
         if( i_shortcuts )
         {
-            vlc_bool_t b_trash = VLC_TRUE;
+            vlc_bool_t b_trash;
             int i_dummy, i_short = i_shortcuts;
             char *psz_name = psz_shortcuts;
 
+            /* Let's drop modules with a 0 score (unless they are
+             * explicitly requested) */
+            b_trash = !p_module->i_score;
+
             while( i_short )
             {
-                for( i_dummy = 0;
-                     b_trash && p_module->pp_shortcuts[i_dummy];
-                     i_dummy++ )
+                /* If the last given shortcut is "none" and we couldn't
+                 * find the module in the list of provided shortcuts,
+                 * then kick the bastard out of here!!! */
+                if( (i_short == 1) && !strcmp(psz_name, "none") )
+                {
+                    b_trash = VLC_TRUE;
+                    break;
+                }
+
+                for( i_dummy = 0; p_module->pp_shortcuts[i_dummy]; i_dummy++ )
                 {
-                    b_trash = ( strcmp(psz_name, "any") || !p_module->i_score )
-                        && strcmp( psz_name, p_module->pp_shortcuts[i_dummy] );
+                    if( !strcmp( psz_name,
+                                 p_module->pp_shortcuts[i_dummy] ) )
+                    {
+                        /* Found it */
+                        b_trash = VLC_FALSE;
+                        i_shortcut_bonus = i_short * 10000;
+                        break;
+                    }
                 }
 
-                if( !b_trash )
+                if( i_shortcut_bonus )
                 {
-                    i_shortcut_bonus = i_short * 10000;
+                    /* We found it... remember ? */
                     break;
                 }