Commit 2d87367f authored by Laurent Aimar's avatar Laurent Aimar

* modules.c: fixed module_Need. (but I'm not sure of what to do with

 shortcuts,any and 0 scored modules).
parent e3455523
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions * modules.c : Builtin and plugin modules management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2004 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: modules.c,v 1.146 2004/03/03 20:39:53 gbazin Exp $ * $Id: modules.c,v 1.147 2004/03/04 23:59:16 fenrir Exp $
* *
* Authors: Sam Hocevar <sam@zoy.org> * Authors: Sam Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com> * Ethan C. Baldridge <BaldridgeE@cadmus.com>
...@@ -324,8 +324,16 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability, ...@@ -324,8 +324,16 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
/* Check if the user wants to override the "strict" mode */ /* Check if the user wants to override the "strict" mode */
if( psz_last_shortcut ) if( psz_last_shortcut )
{ {
if( !strcmp(psz_last_shortcut, "none") ) b_strict = VLC_TRUE; if( !strcmp(psz_last_shortcut, "none") )
else if( !strcmp(psz_last_shortcut, "any") ) b_strict = VLC_FALSE; {
b_strict = VLC_TRUE;
i_shortcuts--;
}
else if( !strcmp(psz_last_shortcut, "any") )
{
b_strict = VLC_FALSE;
i_shortcuts--;
}
} }
} }
...@@ -373,7 +381,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability, ...@@ -373,7 +381,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
} }
/* If we required a shortcut, check this plugin provides it. */ /* If we required a shortcut, check this plugin provides it. */
if( i_shortcuts ) if( i_shortcuts > 0 )
{ {
vlc_bool_t b_trash; vlc_bool_t b_trash;
int i_dummy, i_short = i_shortcuts; int i_dummy, i_short = i_shortcuts;
...@@ -383,17 +391,8 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability, ...@@ -383,17 +391,8 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
* explicitly requested) */ * explicitly requested) */
b_trash = !p_module->i_score; b_trash = !p_module->i_score;
while( i_short ) while( i_short > 0 )
{
/* If we are in "strict" mode and we couldn't
* find the module in the list of provided shortcuts,
* then kick the bastard out of here!!! */
if( i_short == 1 && b_strict )
{ {
b_trash = VLC_TRUE;
break;
}
for( i_dummy = 0; p_module->pp_shortcuts[i_dummy]; i_dummy++ ) for( i_dummy = 0; p_module->pp_shortcuts[i_dummy]; i_dummy++ )
{ {
if( !strcasecmp( psz_name, if( !strcasecmp( psz_name,
...@@ -421,6 +420,14 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability, ...@@ -421,6 +420,14 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
i_short--; i_short--;
} }
/* If we are in "strict" mode and we couldn't
* find the module in the list of provided shortcuts,
* then kick the bastard out of here!!! */
if( i_short == 0 && b_strict )
{
b_trash = VLC_TRUE;
}
if( b_trash ) if( b_trash )
{ {
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment