Commit f716766a authored by Olivier Teulière's avatar Olivier Teulière

* src/misc/objects.c: vlc_list_find now returns a (vlc_list_t *)

   instead of a (vlc_list_t); this modification was needed because BCB
   doesn't like at all when a function (compiled with mingw32) returns
   a struct...
 * ALL: modified the files to take this change into account
 * modules/gui/win32/menu.cpp: enabled the "Add interface" command
parent 5b84049b
......@@ -2,7 +2,7 @@
* vlc_objects.h: vlc_object_t definition.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlc_objects.h,v 1.14 2002/12/13 01:56:29 gbazin Exp $
* $Id: vlc_objects.h,v 1.15 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -61,7 +61,7 @@ VLC_EXPORT( void *, __vlc_object_get, ( vlc_object_t *, int ) );
VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
VLC_EXPORT( vlc_list_t, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
#define vlc_object_create(a,b) \
......
......@@ -2,7 +2,7 @@
* familiar.c : familiar plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: familiar.c,v 1.27 2003/01/17 18:19:11 jpsaman Exp $
* $Id: familiar.c,v 1.28 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -261,11 +261,12 @@ void GtkAutoPlayFile( vlc_object_t *p_this )
GtkWidget *cbautoplay;
intf_thread_t *p_intf;
int i_index;
vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF, FIND_ANYWHERE );
vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_intf = (intf_thread_t *)list.p_values[i_index].p_object ;
p_intf = (intf_thread_t *)p_list->p_values[i_index].p_object ;
if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
......@@ -286,7 +287,7 @@ void GtkAutoPlayFile( vlc_object_t *p_this )
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( cbautoplay ),
p_intf->p_sys->b_autoplayfile );
}
vlc_list_release( &list );
vlc_list_release( p_list );
}
/* following functions are local */
......
......@@ -2,7 +2,7 @@
* display.c: Gtk+ tools for main interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: display.c,v 1.7 2003/01/20 20:07:06 fenrir Exp $
* $Id: display.c,v 1.8 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -242,14 +242,14 @@ void E_(GtkHideTooltips)( vlc_object_t *p_this )
{
intf_thread_t *p_intf;
int i_index;
vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF,
vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
vlc_bool_t b_enable = config_GetInt( p_this, "gnome-tooltips" );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_intf = (intf_thread_t *)list.p_values[i_index].p_object ;
p_intf = (intf_thread_t *)p_list->p_values[i_index].p_object ;
if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
......@@ -266,7 +266,7 @@ void E_(GtkHideTooltips)( vlc_object_t *p_this )
}
}
vlc_list_release( &list );
vlc_list_release( p_list );
}
#ifdef MODULE_NAME_IS_gnome
......@@ -282,16 +282,16 @@ void GtkHideToolbarText( vlc_object_t *p_this )
GtkToolbar * p_toolbar;
intf_thread_t *p_intf;
int i_index;
vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF,
vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
style = config_GetInt( p_this, "gnome-toolbartext" )
? GTK_TOOLBAR_BOTH
: GTK_TOOLBAR_ICONS;
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_intf = (intf_thread_t *)list.p_values[i_index].p_object ;
p_intf = (intf_thread_t *)p_list->p_values[i_index].p_object ;
if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
......@@ -303,6 +303,6 @@ void GtkHideToolbarText( vlc_object_t *p_this )
gtk_toolbar_set_style( p_toolbar, style );
}
vlc_list_release( &list );
vlc_list_release( p_list );
}
#endif
......@@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: preferences.c,v 1.7 2003/01/06 00:37:30 garf Exp $
* $Id: preferences.c,v 1.8 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loc Minier <lool@via.ecp.fr>
......@@ -121,7 +121,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
intf_thread_t *p_intf )
{
module_t *p_parser = NULL;
vlc_list_t list;
vlc_list_t *p_list;
module_config_t *p_item;
int i_index;
......@@ -179,11 +179,11 @@ static void GtkCreateConfigDialog( char *psz_module_name,
/* Look for the selected module */
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( psz_module_name
&& !strcmp( psz_module_name, p_parser->psz_object_name ) )
......@@ -192,9 +192,9 @@ static void GtkCreateConfigDialog( char *psz_module_name,
}
}
if( !p_parser || i_index == list.i_count )
if( !p_parser || i_index == p_list->i_count )
{
vlc_list_release( &list );
vlc_list_release( p_list );
return;
}
......@@ -334,9 +334,9 @@ static void GtkCreateConfigDialog( char *psz_module_name,
{
gchar * entry[2];
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability,
p_item->psz_type ) )
......@@ -560,7 +560,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
vlc_list_release( &list );
vlc_list_release( p_list );
#ifndef MODULE_NAME_IS_gnome
/* Now let's add the action buttons at the bottom of the page */
......@@ -704,7 +704,7 @@ static void GtkModuleHighlighted( GtkCList *module_clist, int row, int column,
intf_thread_t *p_intf;
GtkWidget *config_button;
module_t *p_parser;
vlc_list_t list;
vlc_list_t *p_list;
char *psz_name;
int i_index;
......@@ -717,11 +717,11 @@ static void GtkModuleHighlighted( GtkCList *module_clist, int row, int column,
}
/* look for module 'psz_name' */
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_object_name, psz_name ) )
{
......@@ -738,7 +738,7 @@ static void GtkModuleHighlighted( GtkCList *module_clist, int row, int column,
}
}
vlc_list_release( &list );
vlc_list_release( p_list );
}
/****************************************************************************
......
......@@ -2,7 +2,7 @@
* preferences.cpp: preferences window for the kde gui
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: preferences.cpp,v 1.10 2002/12/17 09:54:32 sam Exp $
* $Id: preferences.cpp,v 1.11 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*
......@@ -53,7 +53,7 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
"vlc preferences", true, false, "Save")
{
module_t *p_parser = NULL;
vlc_list_t list;
vlc_list_t *p_list;
module_config_t *p_item;
int i_index;
QVBox *category_table = NULL;
......@@ -62,12 +62,12 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
this->p_intf = p_intf;
/* List all modules */
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Look for the selected module */
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( psz_module_name
&& !strcmp( psz_module_name, p_parser->psz_object_name ) )
......@@ -76,9 +76,9 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
}
}
if( !p_parser || i_index == list.i_count )
if( !p_parser || i_index == p_list->i_count )
{
vlc_list_release( &list );
vlc_list_release( p_list );
return;
}
......@@ -130,9 +130,9 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
/* build a list of available plugins */
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability,
p_item->psz_type ) )
......@@ -251,7 +251,7 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
}
while( p_item->i_type != CONFIG_HINT_END );
vlc_list_release( &list );
vlc_list_release( p_list );
exec();
}
......@@ -269,24 +269,24 @@ KPreferences::~KPreferences()
bool KPreferences::isConfigureable(QString module)
{
module_t *p_parser;
vlc_list_t list;
vlc_list_t *p_list;
int i_index;
list = vlc_list_find( this->p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( this->p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !module.compare( p_parser->psz_object_name ) )
{
bool ret = p_parser->i_config_items != 0;
vlc_list_release( &list );
vlc_list_release( p_list );
return ret;
}
}
vlc_list_release( &list );
vlc_list_release( p_list );
return false;
}
......
......@@ -2,7 +2,7 @@
* prefs.m: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: prefs.m,v 1.8 2003/01/27 00:08:31 jlj Exp $
* $Id: prefs.m,v 1.9 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -101,28 +101,28 @@
- (BOOL)hasPrefs:(NSString *)o_module_name
{
module_t *p_parser;
vlc_list_t list;
vlc_list_t *p_list;
char *psz_module_name;
int i_index;
psz_module_name = (char *)[o_module_name lossyCString];
/* look for module */
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_object_name, psz_module_name ) )
{
BOOL b_has_prefs = p_parser->i_config_items != 0;
vlc_list_release( &list );
vlc_list_release( p_list );
return( b_has_prefs );
}
}
vlc_list_release( &list );
vlc_list_release( p_list );
return( NO );
}
......@@ -133,7 +133,7 @@
int i_module_tag;
module_t *p_parser = NULL;
vlc_list_t list;
vlc_list_t *p_list;
module_config_t *p_item;
char *psz_module_name;
int i_index;
......@@ -165,11 +165,11 @@
psz_module_name = (char *)[o_module_name lossyCString];
/* Look for the selected module */
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( psz_module_name
&& !strcmp( psz_module_name, p_parser->psz_object_name ) )
......@@ -178,9 +178,9 @@
}
}
if( !p_parser || i_index == list.i_count )
if( !p_parser || i_index == p_list->i_count )
{
vlc_list_release( &list );
vlc_list_release( p_list );
return;
}
......@@ -385,9 +385,9 @@
/* build a list of available modules */
{
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability,
p_item->psz_type ) )
......@@ -526,7 +526,7 @@
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
vlc_list_release( &list );
vlc_list_release( p_list );
[o_toolbars setObject: o_tb_items forKey: o_module_name];
[o_toolbar setDelegate: self];
......
......@@ -517,7 +517,6 @@ object MainFrameDlg: TMainFrameDlg
object MenuAddInterface: TMenuItem
Tag = 3
Caption = '&Add interface'
Enabled = False
Hint = 'Spawn a new interface'
end
end
......
......@@ -2,7 +2,7 @@
* menu.cpp: functions to handle menu items
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: menu.cpp,v 1.10 2003/01/26 00:51:43 sam Exp $
* $Id: menu.cpp,v 1.11 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
......@@ -295,9 +295,7 @@ __fastcall TMenusGen::TMenusGen( intf_thread_t *_p_intf ) : TObject()
MenuAddInterface = p_window->MenuAddInterface;
/* Create the "Add interface" menu */
#if 0
SetupModuleMenu( "inerface", MenuAddInterface, InterfaceModuleClick );
#endif
SetupModuleMenu( "interface", MenuAddInterface, InterfaceModuleClick );
}
......@@ -679,17 +677,17 @@ void __fastcall TMenusGen::SetupModuleMenu( const char *psz_capability,
TMenuItem *Root, TNotifyEvent MenuItemClick )
{
module_t * p_parser;
vlc_list_t list;
vlc_list_t *p_list;
int i_index;
/* remove previous menu */
Root->Clear();
Root->Enabled = false;
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability, psz_capability ) )
{
......@@ -701,7 +699,7 @@ void __fastcall TMenusGen::SetupModuleMenu( const char *psz_capability,
}
}
vlc_list_release( &list );
vlc_list_release( p_list );
/* be sure that menu is enabled, if there is at least one item */
if( i_index > 0 )
......
......@@ -282,7 +282,7 @@ __fastcall TPanelPlugin::TPanelPlugin( TComponent* Owner,
void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )
{
module_t *p_parser;
vlc_list_t list;
vlc_list_t *p_list;
int i_index;
/* check that the click is valid (we are on an item, and the click
......@@ -310,11 +310,11 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )
}
/* look for module 'Name' */
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( strcmp( p_parser->psz_object_name, Name.c_str() ) == 0 )
{
......@@ -325,6 +325,7 @@ void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )
break;
}
}
vlc_list_release( p_list );
}
//---------------------------------------------------------------------------
void __fastcall TPanelPlugin::CheckListBoxClickCheck( TObject *Sender )
......@@ -642,7 +643,7 @@ void __fastcall TPreferencesDlg::FormClose( TObject *Sender,
void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
{
module_t *p_parser;
vlc_list_t list;
vlc_list_t *p_list;
int i_index;
module_config_t *p_item;
......@@ -658,11 +659,11 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
TPanelBool *PanelBool;
/* Look for the selected module */
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( psz_module_name
&& !strcmp( psz_module_name, p_parser->psz_object_name ) )
......@@ -670,9 +671,9 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
break;
}
}
if( !p_parser || i_index == list.i_count )
if( !p_parser || i_index == p_list->i_count )
{
vlc_list_release( &list );
vlc_list_release( p_list );
return;
}
......@@ -714,9 +715,9 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
PanelPlugin->Parent = ScrollBox;
/* Look for valid modules */
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability, p_item->psz_type ) )
{
......@@ -797,7 +798,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
}
}
vlc_list_release( &list );
vlc_list_release( p_list );
/* set active tabsheet
* FIXME: i don't know why, but both lines are necessary */
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.58 2003/01/22 22:19:29 sigmunau Exp $
* $Id: libvlc.c,v 1.59 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -1067,7 +1067,7 @@ static void Usage( vlc_t *p_this, char const *psz_module_name )
*/
#define LINE_START 8
#define PADDING_SPACES 25
vlc_list_t list;
vlc_list_t *p_list;
module_t *p_parser;
module_config_t *p_item;
char psz_spaces[PADDING_SPACES+LINE_START+1];
......@@ -1084,14 +1084,14 @@ static void Usage( vlc_t *p_this, char const *psz_module_name )
#endif
/* List all modules */
list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Enumerate the config for each module */
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
vlc_bool_t b_help_module;
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( psz_module_name && strcmp( psz_module_name,
p_parser->psz_object_name ) )
......@@ -1243,7 +1243,7 @@ static void Usage( vlc_t *p_this, char const *psz_module_name )
}
/* Release the module list */
vlc_list_release( &list );
vlc_list_release( p_list );
#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
fprintf( stdout, _("\nPress the RETURN key to continue...\n") );
......@@ -1259,7 +1259,7 @@ static void Usage( vlc_t *p_this, char const *psz_module_name )
*****************************************************************************/
static void ListModules( vlc_t *p_this )
{
vlc_list_t list;
vlc_list_t *p_list;
module_t *p_parser;
char psz_spaces[22];
int i_index;
......@@ -1277,14 +1277,14 @@ static void ListModules( vlc_t *p_this )
fprintf( stdout, _("[module] [description]\n") );
/* List all modules */
list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Enumerate each module */
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
int i;
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
/* Nasty hack, but right now I'm too tired to think about a nice
* solution */
......@@ -1298,7 +1298,7 @@ static void ListModules( vlc_t *p_this )
psz_spaces[i] = ' ';
}
vlc_list_release( &list );
vlc_list_release( p_list );
#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
fprintf( stdout, _("\nPress the RETURN key to continue...\n") );
......
......@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.48 2003/01/06 00:37:30 garf Exp $
* $Id: configuration.c,v 1.49 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -303,18 +303,18 @@ void __config_PutFloat( vlc_object_t *p_this,
*****************************************************************************/
module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name )
{
vlc_list_t list;
vlc_list_t *p_list;
module_t *p_parser;
module_config_t *p_item;
int i_index;
if( !psz_name ) return NULL;
list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !p_parser->i_config_items )
continue;
......@@ -328,13 +328,13 @@ module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name )
continue;
if( !strcmp( psz_name, p_item->psz_name ) )
{
vlc_list_release( &list );
vlc_list_release( p_list );
return p_item;
}
}
}
vlc_list_release( &list );
vlc_list_release( p_list );
return NULL;
}
......@@ -507,7 +507,7 @@ void config_UnsetCallbacks( module_config_t *p_new )
*****************************************************************************/
int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
{
vlc_list_t list;
vlc_list_t *p_list;
module_t *p_parser;
module_config_t *p_item;
FILE *file;
......@@ -546,11 +546,11 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
}
/* Look for the selected module, if NULL then save everything */
list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( psz_module_name
&& strcmp( psz_module_name, p_parser->psz_object_name ) )
......@@ -667,7 +667,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
}
vlc_list_release( &list );
vlc_list_release( p_list );
fclose( file );
free( psz_filename );
......@@ -699,7 +699,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
{
module_t *p_parser;
vlc_list_t list;
vlc_list_t *p_list;
module_config_t *p_item;
FILE *file;
char p_line[1024], *p_index2;
......@@ -788,7 +788,7 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
p_bigbuffer[0] = 0;
/* List all available modules */
list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* backup file into memory, we only need to backup the sections we won't
* save later on */
......@@ -799,9 +799,9 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
{
/* we found a section, check if we need to do a backup */
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( ((p_index2 - &p_line[1])
== (int)strlen(p_parser->psz_object_name) )
......@@ -816,7 +816,7 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
}
}
if( i_index == list.i_count )
if( i_index == p_list->i_count )
{
/* we don't have this section in our list so we need to back
* it up */
......@@ -855,7 +855,7 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
msg_Warn( p_this, "could not open config file %s for writing",
psz_filename );
free( psz_filename );
vlc_list_release( &list );
vlc_list_release( p_list );
vlc_mutex_unlock( &p_this->p_vlc->config_lock );
return -1;
}
......@@ -863,9 +863,9 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
fprintf( file, "###\n### " COPYRIGHT_MESSAGE "\n###\n\n" );
/* Look for the selected module, if NULL then save everything */
for( i_index = 0; i_index < list.i_count; i_index++ )
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( psz_module_name && strcmp( psz_module_name,
p_parser->psz_object_name ) )
......@@ -922,7 +922,7 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
fprintf( file, "\n" );
}
vlc_list_release( &list );
vlc_list_release( p_list );
/*
* Restore old settings from the config in file
......@@ -951,7 +951,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
{
int i_cmd, i_index, i_opts, i_shortopts, flag, i_verbose = 0;
module_t *p_parser;
vlc_list_t list;
vlc_list_t *p_list;
module_config_t *p_item;
struct option *p_longopts;
int i_modules_index;
......@@ -987,17 +987,17 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
#endif
/* List all modules */
list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/*
* Generate the longopts and shortopts structures used by getopt_long
*/
i_opts = 0;
for( i_modules_index = 0; i_modules_index < list.i_count;
for( i_modules_index = 0; i_modules_index < p_list->i_count;
i_modules_index++ )
{
p_parser = (module_t *)list.p_values[i_modules_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_modules_index].p_object ;
/* count the number of exported configuration options (to allocate
* longopts). We also need to allocate space for too options when
......@@ -1010,7 +1010,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
if( p_longopts == NULL )
{
msg_Err( p_this, "out of memory" );
vlc_list_release( &list );
vlc_list_release( p_list );
return -1;
}
......@@ -1019,7 +1019,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
{
msg_Err( p_this, "out of memory" );
free( p_longopts );
vlc_list_release( &list );
vlc_list_release( p_list );
return -1;
}
......@@ -1034,7 +1034,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
msg_Err( p_this, "out of memory" );
free( psz_shortopts );
free( p_longopts );
vlc_list_release( &list );
vlc_list_release( p_list );
return -1;
}
memcpy( ppsz_argv, p_this->p_vlc->ppsz_argv,
......@@ -1049,10 +1049,10 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
/* Fill the p_longopts and psz_shortopts structures */
i_index = 0;
for( i_modules_index = 0; i_modules_index < list.i_count;
for( i_modules_index = 0; i_modules_index < p_list->i_count;
i_modules_index++ )
{
p_parser = (module_t *)list.p_values[i_modules_index].p_object ;
p_parser = (module_t *)p_list->p_values[i_modules_index].p_object ;
if( !p_parser->i_config_items )
continue;
......@@ -1124,7 +1124,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
}
/* We don't need the module list anymore */
vlc_list_release( &list );
vlc_list_release( p_list );
/* Close the longopts and shortopts structures */
memset( &p_longopts[i_index], 0, sizeof(struct option) );
......
......@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.110 2003/01/19 03:16:24 sam Exp $
* $Id: modules.c,v 1.111 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -250,7 +250,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
};
module_list_t *p_list, *p_first, *p_tmp;
vlc_list_t all;
vlc_list_t *p_all;
int i_which_module, i_index = 0;
vlc_bool_t b_intf = VLC_FALSE;
......@@ -295,17 +295,17 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
}
/* Sort the modules and test them */
all = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = malloc( all.i_count * sizeof( module_list_t ) );
p_all = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_list = malloc( p_all->i_count * sizeof( module_list_t ) );
p_first = NULL;
/* Parse the module list for capabilities and probe each of them */
for( i_which_module = 0; i_which_module < all.i_count; i_which_module++ )
for( i_which_module = 0; i_which_module < p_all->i_count; i_which_module++ )
{
module_t * p_submodule = NULL;
int i_shortcut_bonus = 0, i_submodule;
p_module = (module_t *)all.p_values[i_which_module].p_object;
p_module = (module_t *)p_all->p_values[i_which_module].p_object;
/* Test that this module can do what we need */
if( strcmp( p_module->psz_capability, psz_capability ) )
......@@ -448,7 +448,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
}
/* We can release the list, interesting modules were yielded */
vlc_list_release( &all );
vlc_list_release( p_all );
/* Parse the linked list and use the first successful module */
p_tmp = p_first;
......
......@@ -2,7 +2,7 @@
* objects.c: vlc_object_t handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: objects.c,v 1.33 2002/12/14 19:34:06 gbazin Exp $
* $Id: objects.c,v 1.34 2003/01/27 17:41:01 ipkiss Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -57,7 +57,7 @@ static void DumpStructure ( vlc_object_t *, int, char * );
static int FindIndex ( vlc_object_t *, vlc_object_t **, int );
static void SetAttachment ( vlc_object_t *, vlc_bool_t );
static vlc_list_t NewList ( int );
static vlc_list_t * NewList ( int );
static void ListReplace ( vlc_list_t *, vlc_object_t *, int );
static void ListAppend ( vlc_list_t *, vlc_object_t * );
static int CountChildren ( vlc_object_t *, int );
......@@ -491,9 +491,9 @@ void __vlc_object_detach( vlc_object_t *p_this )
* This function recursively looks for a given object type. i_mode can be one
* of FIND_PARENT, FIND_CHILD or FIND_ANYWHERE.
*****************************************************************************/
vlc_list_t __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
{
vlc_list_t list;
vlc_list_t *p_list;
vlc_object_t **pp_current, **pp_end;
int i_count = 0, i_index = 0;
......@@ -515,7 +515,7 @@ vlc_list_t __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
}
}
list = NewList( i_count );
p_list = NewList( i_count );
pp_current = p_this->p_libvlc->pp_objects;
for( ; pp_current < pp_end ; pp_current++ )
......@@ -523,7 +523,7 @@ vlc_list_t __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
if( (*pp_current)->b_attached
&& (*pp_current)->i_object_type == i_type )
{
ListReplace( &list, *pp_current, i_index );
ListReplace( p_list, *pp_current, i_index );
if( i_index < i_count ) i_index++;
}
}
......@@ -531,29 +531,29 @@ vlc_list_t __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
case FIND_CHILD:
i_count = CountChildren( p_this, i_type );
list = NewList( i_count );
p_list = NewList( i_count );
/* Check allocation was successful */
if( list.i_count != i_count )
if( p_list->i_count != i_count )
{
msg_Err( p_this, "list allocation failed!" );
list.i_count = 0;
p_list->i_count = 0;
break;
}
list.i_count = 0;
ListChildren( &list, p_this, i_type );
p_list->i_count = 0;
ListChildren( p_list, p_this, i_type );
break;
default:
msg_Err( p_this, "unimplemented!" );
list = NewList( 0 );
p_list = NewList( 0 );
break;
}
vlc_mutex_unlock( &structure_lock );
return list;
return p_list;
}
/*****************************************************************************
......@@ -646,6 +646,7 @@ void vlc_list_release( vlc_list_t *p_list )
}
free( p_list->p_values );
free( p_list );
}
/* Following functions are local */
......@@ -882,26 +883,30 @@ static void DumpStructure( vlc_object_t *p_this, int i_level, char *psz_foo )
}
}
static vlc_list_t NewList( int i_count )
static vlc_list_t * NewList( int i_count )
{
vlc_list_t list;
vlc_list_t * p_list = (vlc_list_t *)malloc( sizeof( vlc_list_t ) );
if( p_list == NULL )
{
return NULL;
}
list.i_count = i_count;
p_list->i_count = i_count;
if( i_count == 0 )
{
list.p_values = NULL;
return list;
p_list->p_values = NULL;
return p_list;
}
list.p_values = malloc( i_count * sizeof( vlc_value_t ) );
if( list.p_values == NULL )
p_list->p_values = malloc( i_count * sizeof( vlc_value_t ) );
if( p_list->p_values == NULL )
{
list.i_count = 0;
return list;
p_list->i_count = 0;
return p_list;
}
return list;
return p_list;
}
static void ListReplace( vlc_list_t *p_list, vlc_object_t *p_object,
......
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