# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include "libvlc.h"
#include <stdlib.h> /* free(), strtol() */
#include <stdio.h> /* sprintf() */
#include <string.h> /* strdup() */
+#include <vlc_plugin.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
*****************************************************************************/
void CacheLoad( vlc_object_t *p_this )
{
- char *psz_filename, *psz_cachedir;
+ char *psz_filename, *psz_cachedir = config_GetCacheDir();
FILE *file;
int i, j, i_size, i_read;
char p_cachestring[sizeof("cache " COPYRIGHT_MESSAGE)];
int32_t i_file_size, i_marker;
libvlc_global_data_t *p_libvlc_global = vlc_global();
- psz_cachedir = p_this->p_libvlc->psz_cachedir;
if( !psz_cachedir ) /* XXX: this should never happen */
{
msg_Err( p_this, "Unable to get cache directory" );
i_size = asprintf( &psz_filename, "%s"DIR_SEP"%s",
psz_cachedir, CacheName() );
+ free( psz_cachedir );
if( i_size <= 0 )
{
- msg_Err( p_this, "out of memory" );
return;
}
LOAD_IMMEDIATE( pp_cache[i]->i_time );
LOAD_IMMEDIATE( pp_cache[i]->i_size );
LOAD_IMMEDIATE( pp_cache[i]->b_junk );
- pp_cache[i]->b_used = VLC_FALSE;
+ pp_cache[i]->b_used = false;
if( pp_cache[i]->b_junk ) continue;
pp_cache[i]->p_module = vlc_module_create( p_this );
/* Load additional infos */
+ free( pp_cache[i]->p_module->psz_object_name );
LOAD_STRING( pp_cache[i]->p_module->psz_object_name );
LOAD_STRING( pp_cache[i]->p_module->psz_shortname );
LOAD_STRING( pp_cache[i]->p_module->psz_longname );
while( i_submodules-- )
{
module_t *p_module = vlc_submodule_create( pp_cache[i]->p_module );
+ free( p_module->psz_object_name );
LOAD_STRING( p_module->psz_object_name );
LOAD_STRING( p_module->psz_shortname );
LOAD_STRING( p_module->psz_longname );
sizeof (p_module->p_config[i].saved));
}
- p_module->p_config[i].b_dirty = VLC_FALSE;
+ p_module->p_config[i].b_dirty = false;
p_module->p_config[i].p_lock = &p_module->object_lock;
"# For information about cache directory tags, see:\r\n"
"# http://www.brynosaurus.com/cachedir/\r\n";
- char *psz_cachedir;
+ char *psz_cachedir = config_GetCacheDir();
FILE *file;
int i, j, i_cache;
module_cache_t **pp_cache;
uint32_t i_file_size = 0;
libvlc_global_data_t *p_libvlc_global = vlc_global();
- psz_cachedir = p_this->p_libvlc->psz_cachedir;
if( !psz_cachedir ) /* XXX: this should never happen */
{
msg_Err( p_this, "unable to get cache directory" );
snprintf( psz_filename, sizeof( psz_filename ),
"%s"DIR_SEP"%s", psz_cachedir, CacheName() );
+ free( psz_cachedir );
msg_Dbg( p_this, "writing plugins cache %s", psz_filename );
file = utf8_fopen( psz_filename, "wb" );
SAVE_STRING( pp_cache[i]->p_module->psz_filename );
- i_submodule = pp_cache[i]->p_module->i_children;
+ i_submodule = vlc_internals( pp_cache[i]->p_module )->i_children;
SAVE_IMMEDIATE( i_submodule );
for( i_submodule = 0;
- i_submodule < (unsigned)pp_cache[i]->p_module->i_children;
+ i_submodule < (unsigned)vlc_internals( pp_cache[i]->p_module)->i_children;
i_submodule++ )
{
module_t *p_module =
- (module_t *)pp_cache[i]->p_module->pp_children[i_submodule];
+ (module_t *)vlc_internals( pp_cache[i]->p_module )->pp_children[i_submodule];
SAVE_STRING( p_module->psz_object_name );
SAVE_STRING( p_module->psz_shortname );
p_cache->pf_deactivate = p_module->pf_deactivate;
p_cache->handle = p_module->handle;
- for( i_submodule = 0; i_submodule < p_module->i_children; i_submodule++ )
+ for( i_submodule = 0; i_submodule < vlc_internals( p_module )->i_children; i_submodule++ )
{
- module_t *p_child = (module_t*)p_module->pp_children[i_submodule];
- module_t *p_cchild = (module_t*)p_cache->pp_children[i_submodule];
+ module_t *p_child = (module_t*)vlc_internals( p_module )->pp_children[i_submodule];
+ module_t *p_cchild = (module_t*)vlc_internals( p_cache )->pp_children[i_submodule];
p_cchild->pf_activate = p_child->pf_activate;
p_cchild->pf_deactivate = p_child->pf_deactivate;
}
- p_cache->b_loaded = VLC_TRUE;
- p_module->b_loaded = VLC_FALSE;
+ p_cache->b_loaded = true;
+ p_module->b_loaded = false;
}
/*****************************************************************************