From: Gildas Bazin Date: Tue, 25 Mar 2003 15:38:14 +0000 (+0000) Subject: * src/misc/modules.c: module_Need() now only raises the scores of the X-Git-Tag: 0.5.3~93 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8bc4747451a0b32d1b780a22877431a804136c8a;p=vlc * src/misc/modules.c: module_Need() now only raises the scores of the 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 :)) --- diff --git a/src/misc/modules.c b/src/misc/modules.c index d5e1c070b5..b2e6f0abb3 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -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 * Ethan C. Baldridge @@ -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; }