X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fcache.c;h=20108472bf0e3db55bf4a380755cbf04ad9c05cc;hb=a42fe7a14d00f05748bb751dc4cd8956e29c3335;hp=bf3ce4b137a752eddd9035e0c725515f93acceb4;hpb=a94e6eb9d2f5079983a5e9293af2d40b86f50aac;p=vlc diff --git a/src/modules/cache.c b/src/modules/cache.c index bf3ce4b137..20108472bf 100644 --- a/src/modules/cache.c +++ b/src/modules/cache.c @@ -59,7 +59,7 @@ static int CacheLoadConfig ( module_t *, FILE * ); /* Sub-version number * (only used to avoid breakage in dev version when cache structure changes) */ -#define CACHE_SUBVERSION_NUM 16 +#define CACHE_SUBVERSION_NUM 18 /* Cache filename */ #define CACHE_NAME "plugins.dat" @@ -199,11 +199,9 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) uint16_t i_size; int i_submodules; - module = vlc_module_create(); + module = vlc_module_create (NULL); /* Load additional infos */ - free (module->psz_object_name); - LOAD_STRING(module->psz_object_name); LOAD_STRING(module->psz_shortname); LOAD_STRING(module->psz_longname); LOAD_STRING(module->psz_help); @@ -211,8 +209,6 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) LOAD_IMMEDIATE(module->i_shortcuts); if (module->i_shortcuts > MODULE_SHORTCUT_MAX) goto error; - else if (module->i_shortcuts == 0) - module->pp_shortcuts = NULL; else { module->pp_shortcuts = @@ -229,7 +225,6 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) if (CacheLoadConfig (module, file) != VLC_SUCCESS) goto error; - LOAD_STRING(module->psz_filename); LOAD_STRING(module->domain); if (module->domain != NULL) vlc_bindtextdomain (module->domain); @@ -238,19 +233,14 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) while( i_submodules-- ) { - module_t *submodule = vlc_submodule_create (module); - free (submodule->psz_object_name); + module_t *submodule = vlc_module_create (module); free (submodule->pp_shortcuts); - LOAD_STRING(submodule->psz_object_name); LOAD_STRING(submodule->psz_shortname); LOAD_STRING(submodule->psz_longname); - LOAD_STRING(submodule->psz_help); LOAD_IMMEDIATE(submodule->i_shortcuts); if (submodule->i_shortcuts > MODULE_SHORTCUT_MAX) goto error; - else if (submodule->i_shortcuts == 0) - submodule->pp_shortcuts = NULL; else { submodule->pp_shortcuts = @@ -261,8 +251,6 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) LOAD_STRING(submodule->psz_capability); LOAD_IMMEDIATE(submodule->i_score); - LOAD_IMMEDIATE(submodule->b_unloadable); - LOAD_STRING(submodule->domain); } char *path; @@ -326,7 +314,6 @@ static int CacheLoadConfig( module_t *p_module, FILE *file ) LOAD_STRING( p_module->p_config[i].psz_name ); LOAD_STRING( p_module->p_config[i].psz_text ); LOAD_STRING( p_module->p_config[i].psz_longtext ); - LOAD_STRING( p_module->p_config[i].psz_oldname ); if (IsConfigStringType (p_module->p_config[i].i_type)) { @@ -499,7 +486,6 @@ static int CacheSaveBank (FILE *file, const module_cache_t *cache, uint32_t i_submodule; /* Save additional infos */ - SAVE_STRING(module->psz_object_name); SAVE_STRING(module->psz_shortname); SAVE_STRING(module->psz_longname); SAVE_STRING(module->psz_help); @@ -515,7 +501,6 @@ static int CacheSaveBank (FILE *file, const module_cache_t *cache, if (CacheSaveConfig (file, module)) goto error; - SAVE_STRING(module->psz_filename); SAVE_STRING(module->domain); i_submodule = module->submodule_count; @@ -544,18 +529,14 @@ static int CacheSaveSubmodule( FILE *file, const module_t *p_module ) if( 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 ); SAVE_IMMEDIATE( p_module->i_shortcuts ); for( unsigned j = 0; j < p_module->i_shortcuts; j++ ) SAVE_STRING( p_module->pp_shortcuts[j] ); SAVE_STRING( p_module->psz_capability ); SAVE_IMMEDIATE( p_module->i_score ); - SAVE_IMMEDIATE( p_module->b_unloadable ); - SAVE_STRING( p_module->domain ); return 0; error: @@ -579,7 +560,6 @@ static int CacheSaveConfig (FILE *file, const module_t *p_module) SAVE_STRING( p_module->p_config[i].psz_name ); SAVE_STRING( p_module->p_config[i].psz_text ); SAVE_STRING( p_module->p_config[i].psz_longtext ); - SAVE_STRING( p_module->p_config[i].psz_oldname ); if (IsConfigStringType (p_module->p_config[i].i_type)) SAVE_STRING( p_module->p_config[i].orig.psz ); @@ -649,12 +629,13 @@ module_t *CacheFind (module_cache_t *cache, size_t count, { while (count > 0) { - if (!strcmp (cache->path, path) + if (cache->path != NULL + && !strcmp (cache->path, path) && cache->mtime == st->st_mtime && cache->size == st->st_size) { module_t *module = cache->p_module; - cache->p_module = NULL; /* Return NULL next time */ + cache->p_module = NULL; return module; } cache++;