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,
FIND_ANYWHERE );
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,
FIND_ANYWHERE );
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;
}
......
This diff is collapsed.
......@@ -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,29 +677,29 @@ void __fastcall TMenusGen::SetupModuleMenu( const char *psz_capability,
TMenuItem *Root, TNotifyEvent MenuItemClick )
{
module_t * p_parser;
vlc_list_t list;
int i_index;
/* remove previous menu */
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_parser = (module_t *)list.p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability, psz_capability ) )
{
TMenuItem *Item = new TMenuItem( Root );
Item->Caption = p_parser->psz_object_name;
Item->Hint = Item->Caption;
Item->OnClick = MenuItemClick;
Root->Add( Item );
}
}
vlc_list_release( &list );
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 *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability, psz_capability ) )
{
TMenuItem *Item = new TMenuItem( Root );
Item->Caption = p_parser->psz_object_name;
Item->Hint = Item->Caption;
Item->OnClick = MenuItemClick;
Root->Add( Item );
}
}
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>
......@@ -509,7 +509,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
{
free( psz_modules );
}
/*
* Get input filenames given as commandline arguments
*/
......@@ -605,7 +605,7 @@ int VLC_Destroy( int i_object )
{
network_ChannelJoin( p_vlc, COMMON_CHANNEL );
}
/*
* Free allocated memory
*/
......@@ -625,12 +625,12 @@ int VLC_Destroy( int i_object )
* XXX: Free module bank !
*/
//module_EndBank( p_vlc );
/*
* System specific cleaning code
*/
system_End( p_vlc );
/* Destroy mutexes */
vlc_mutex_destroy( &p_vlc->config_lock );
......@@ -805,7 +805,7 @@ int VLC_Play( int i_object )
{
return VLC_ENOOBJ;
}
vlc_thread_set_priority( p_vlc, VLC_THREAD_PRIORITY_LOW );
p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_CHILD );
......@@ -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>
*
......@@ -159,7 +159,7 @@ char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name )
* represented by a string (CONFIG_ITEM_STRING, CONFIG_ITEM_FILE,
* and CONFIG_ITEM_MODULE).
*****************************************************************************/
void __config_PutPsz( vlc_object_t *p_this,
void __config_PutPsz( vlc_object_t *p_this,
const char *psz_name, const char *psz_value )
{
module_config_t *p_config;
......@@ -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 ) )
......@@ -666,8 +666,8 @@ 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 );
......@@ -687,7 +687,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
*
* When we save we mustn't delete the config options of the modules that
* haven't been loaded. So we cannot just create a new config file with the
* config structures we've got in memory.
* config structures we've got in memory.
* I don't really know how to deal with this nicely, so I will use a completly
* dumb method ;-)
* I will load the config file in memory, but skipping all the sections of the
......@@ -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 ) )
......@@ -385,7 +385,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
&& !strcmp( p_module->psz_program,
p_this->p_vlc->psz_object_name ) )
{
if( !b_intf )
if( !b_intf )
{
/* Remove previous non-matching plugins */
i_index = 0;
......@@ -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;
......@@ -671,7 +671,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const MYCHAR *psz_dir,
AllocatePluginFile( p_this, psz_path );
}
}
while( FindNextFile( handle, &finddata ) );
while( FindNextFile( handle, &finddata ) );
/* Close the directory */
FindClose( handle );
......@@ -754,7 +754,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file )
}
/* Now that we have successfully loaded the module, we can
* allocate a structure for it */
* allocate a structure for it */
p_module = vlc_object_create( p_this, VLC_OBJECT_MODULE );
if( p_module == NULL )
{
......@@ -868,7 +868,7 @@ static int AllocateBuiltinModule( vlc_object_t * p_this,
module_t * p_module;
/* Now that we have successfully loaded the module, we can
* allocate a structure for it */
* allocate a structure for it */
p_module = vlc_object_create( p_this, VLC_OBJECT_MODULE );
if( p_module == NULL )
{
......@@ -948,7 +948,7 @@ static int CallEntry( module_t * p_module )
int (* pf_symbol) ( module_t * p_module );
/* Try to resolve the symbol */
pf_symbol = (int (*)(module_t *)) module_getsymbol( p_module->handle,
pf_symbol = (int (*)(module_t *)) module_getsymbol( p_module->handle,
psz_name );
if( pf_symbol == NULL )
......
......@@ -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>
*
......@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -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;
}
/*****************************************************************************
......@@ -595,7 +595,7 @@ static int DumpCommand( vlc_object_t *p_this, char const *psz_cmd,
if( *newval.psz_string )
{
vlc_object_release( p_this );
}
}
}
else if( *psz_cmd == 'l' )
{
......@@ -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