Commit f3adfbd8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Save submodules in the same order as we create/load them

Buggy CacheMerge assumes this (among other wrong things)
parent 8f72c1e2
......@@ -462,6 +462,8 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
return VLC_EGENERIC;
}
static int CacheSaveSubmodule( FILE *file, module_t *p_module );
/*****************************************************************************
* SavePluginsCache: saves the plugins cache to a file
*****************************************************************************/
......@@ -588,23 +590,8 @@ void CacheSave( vlc_object_t *p_this )
i_submodule = pp_cache[i]->p_module->submodule_count;
SAVE_IMMEDIATE( i_submodule );
for( module_t *p_module = pp_cache[i]->p_module->submodule;
p_module != NULL; p_module = p_module->next )
{
SAVE_STRING( p_module->psz_object_name );
SAVE_STRING( p_module->psz_shortname );
SAVE_STRING( p_module->psz_longname );
SAVE_STRING( p_module->psz_help );
for( j = 0; j < MODULE_SHORTCUT_MAX; j++ )
{
SAVE_STRING( p_module->pp_shortcuts[j] ); // FIX
}
SAVE_STRING( p_module->psz_capability );
SAVE_IMMEDIATE( p_module->i_score );
SAVE_IMMEDIATE( p_module->i_cpu );
SAVE_IMMEDIATE( p_module->b_unloadable );
SAVE_IMMEDIATE( p_module->b_reentrant );
}
if( CacheSaveSubmodule( file, pp_cache[i]->p_module->submodule ) )
goto error;
}
/* Fill-up file size */
......@@ -627,6 +614,30 @@ error:
}
}
static int CacheSaveSubmodule( FILE *file, module_t *p_module )
{
if( p_module->next && CacheSaveSubmodule( file, p_module->next ) )
goto error;
SAVE_STRING( p_module->psz_object_name );
SAVE_STRING( p_module->psz_shortname );
SAVE_STRING( p_module->psz_longname );
SAVE_STRING( p_module->psz_help );
for( unsigned j = 0; j < MODULE_SHORTCUT_MAX; j++ )
SAVE_STRING( p_module->pp_shortcuts[j] ); // FIXME
SAVE_STRING( p_module->psz_capability );
SAVE_IMMEDIATE( p_module->i_score );
SAVE_IMMEDIATE( p_module->i_cpu );
SAVE_IMMEDIATE( p_module->b_unloadable );
SAVE_IMMEDIATE( p_module->b_reentrant );
return 0;
error:
return -1;
}
static int CacheSaveConfig( module_t *p_module, FILE *file )
{
uint32_t i_lines = p_module->confsize;
......
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