From 575b4f3993e8b4aa5e0ac2788e978f07da7c388a Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sun, 20 May 2007 14:04:46 +0000 Subject: [PATCH] * Some more fixes (+ don't redefine a function that already existed, reverts part of previous commit). --- include/vlc_objects.h | 4 ---- modules/control/http/http.c | 8 ++------ modules/demux/playlist/luaplaylist.c | 10 +++------- modules/gui/skins2/win32/win32_factory.cpp | 8 ++++---- src/libvlc-common.c | 2 +- src/misc/beos_specific.cpp | 4 ++-- src/misc/darwin_specific.c | 14 +++++++------- src/misc/objects.c | 8 -------- src/misc/win32_specific.c | 8 ++++---- src/modules/configuration.c | 4 ++-- 10 files changed, 25 insertions(+), 45 deletions(-) diff --git a/include/vlc_objects.h b/include/vlc_objects.h index 6058b0b2eb..a906d517cc 100644 --- a/include/vlc_objects.h +++ b/include/vlc_objects.h @@ -110,10 +110,6 @@ VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) ); VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) ); VLC_EXPORT( libvlc_int_t *, vlc_current_object, ( int ) ); -#if defined( WIN32 ) || defined( SYS_BEOS ) || defined( __APPLE__ ) -VLC_EXPORT( const char *, vlc_path, ( vlc_object_t * ) ); -#endif - /*}@*/ #define vlc_object_create(a,b) \ diff --git a/modules/control/http/http.c b/modules/control/http/http.c index 08863cf4b1..f1b3416706 100644 --- a/modules/control/http/http.c +++ b/modules/control/http/http.c @@ -290,14 +290,10 @@ static int Open( vlc_object_t *p_this ) #if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32) if ( ( psz_src = config_GetPsz( p_intf, "http-src" )) == NULL ) { - char * psz_vlcpath = vlc_path( p_intf ); - psz_src = malloc( strlen(psz_vlcpath) + strlen("/share/http" ) + 1 ); + char * psz_vlcpath = config_GetDataDir( p_intf ); + psz_src = malloc( strlen(psz_vlcpath) + strlen("/http" ) + 1 ); if( !psz_src ) return VLC_ENOMEM; -#if defined(WIN32) sprintf( psz_src, "%s/http", psz_vlcpath ); -#else - sprintf( psz_src, "%s/share/http", psz_vlcpath ); -#endif } #else psz_src = config_GetPsz( p_intf, "http-src" ); diff --git a/modules/demux/playlist/luaplaylist.c b/modules/demux/playlist/luaplaylist.c index 2c4b0f1db9..9720fdcb95 100644 --- a/modules/demux/playlist/luaplaylist.c +++ b/modules/demux/playlist/luaplaylist.c @@ -296,14 +296,10 @@ int E_(Import_LuaPlaylist)( vlc_object_t *p_this ) # if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32) { - char *psz_vlcpath = vlc_path( p_demux ); - ppsz_dir_list[1] = malloc( strlen( psz_vlcpath ) + strlen( "/share/luaplaylist" ) + 1 ); + char *psz_vlcpath = config_GetDataDir( p_demux ); + ppsz_dir_list[1] = malloc( strlen( psz_vlcpath ) + strlen( "luaplaylist" ) + 1 ); if( !ppsz_dir_list[1] ) return VLC_ENOMEM; -# if defined( WIN32 ) - sprintf( ppsz_dir_list[1], "%s/luaplaylist", psz_vlcpath ); -# else - sprintf( ppsz_dir_list[1], "%s/share/luaplaylist", psz_vlcpath ); -# endif + sprintf( ppsz_dir_list[1], "%s/luaplaylist", psz_vlcpath ); } # else { diff --git a/modules/gui/skins2/win32/win32_factory.cpp b/modules/gui/skins2/win32/win32_factory.cpp index 603fd93ebd..6fbe0e8730 100644 --- a/modules/gui/skins2/win32/win32_factory.cpp +++ b/modules/gui/skins2/win32/win32_factory.cpp @@ -227,13 +227,13 @@ bool Win32Factory::init() // Initialize the resource path m_resourcePath.push_back( (string)getIntf()->p_libvlc->psz_homedir + "\\" + CONFIG_DIR + "\\skins" ); - m_resourcePath.push_back( (string)vlc_path( getIntf() ) + + m_resourcePath.push_back( (string)config_GetDataDir( getIntf() ) + "\\skins" ); - m_resourcePath.push_back( (string)vlc_path( getIntf() ) + + m_resourcePath.push_back( (string)config_GetDataDir( getIntf() ) + "\\skins2" ); - m_resourcePath.push_back( (string)vlc_path( getIntf() ) + + m_resourcePath.push_back( (string)config_GetDataDir( getIntf() ) + "\\share\\skins" ); - m_resourcePath.push_back( (string)vlc_path( getIntf() ) + + m_resourcePath.push_back( (string)config_GetDataDir( getIntf() ) + "\\share\\skins2" ); // All went well diff --git a/src/libvlc-common.c b/src/libvlc-common.c index d161ba0b0c..9f78e0b272 100644 --- a/src/libvlc-common.c +++ b/src/libvlc-common.c @@ -1196,7 +1196,7 @@ static inline int LoadMessages (void) #else char psz_path[1024]; if (snprintf (psz_path, sizeof (psz_path), "%s/%s", - libvlc_global.psz_vlcpath, "locale") + vlc_global( &libvlc_global )->psz_vlcpath, "locale") >= (int)sizeof (psz_path)) return -1; diff --git a/src/misc/beos_specific.cpp b/src/misc/beos_specific.cpp index 610accbc8a..34e724923f 100644 --- a/src/misc/beos_specific.cpp +++ b/src/misc/beos_specific.cpp @@ -105,7 +105,7 @@ void system_End( libvlc_int_t *p_this ) vlc_thread_join( p_this->p_libvlc_global->p_appthread ); vlc_object_destroy( p_this->p_libvlc_global->p_appthread ); - free( p_this->p_libvlc_global->psz_vlcpath ); + free( vlc_global( p_this )->psz_vlcpath ); } /* following functions are local */ @@ -172,7 +172,7 @@ void VlcApplication::ReadyToRun( ) BEntry entry( &info.ref ); entry.GetPath( &path ); path.GetParent( &path ); - p_this->p_libvlc_global->psz_vlcpath = strdup( path.Path() ); + vlc_global( p_this )->psz_vlcpath = strdup( path.Path() ); /* Tell the main thread we are finished initializing the BApplication */ vlc_thread_ready( p_this ); diff --git a/src/misc/darwin_specific.c b/src/misc/darwin_specific.c index 9a3ca5ae75..da939ac87a 100644 --- a/src/misc/darwin_specific.c +++ b/src/misc/darwin_specific.c @@ -70,7 +70,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] ) char *p_char, *p_oldchar = &i_dummy; /* Get the full program path and name */ - p_char = p_this->p_libvlc_global->psz_vlcpath = strdup( ppsz_argv[ 0 ] ); + p_char = vlc_global( p_this )->psz_vlcpath = strdup( ppsz_argv[ 0 ] ); /* Remove trailing program name */ for( ; *p_char ; ) @@ -116,8 +116,8 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] ) CFRelease( all_locales ); } - vlc_mutex_init( p_this, &p_this->p_libvlc_global->iconv_lock ); - p_this->p_libvlc_global->iconv_macosx = vlc_iconv_open( "UTF-8", "UTF-8-MAC" ); + vlc_mutex_init( p_this, &vlc_global( p_this )->iconv_lock ); + vlc_global( p_this )->iconv_macosx = vlc_iconv_open( "UTF-8", "UTF-8-MAC" ); } /***************************************************************************** @@ -133,10 +133,10 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] ) *****************************************************************************/ void system_End( libvlc_int_t *p_this ) { - free( p_this->p_libvlc_global->psz_vlcpath ); + free( vlc_global( p_this )->psz_vlcpath ); - if ( p_this->p_libvlc_global->iconv_macosx != (vlc_iconv_t)-1 ) - vlc_iconv_close( p_this->p_libvlc_global->iconv_macosx ); - vlc_mutex_destroy( &p_this->p_libvlc_global->iconv_lock ); + if ( vlc_global( p_this )->iconv_macosx != (vlc_iconv_t)-1 ) + vlc_iconv_close( vlc_global( p_this )->iconv_macosx ); + vlc_mutex_destroy( &vlc_global( p_this )->iconv_lock ); } diff --git a/src/misc/objects.c b/src/misc/objects.c index 2884fadb72..2ce0126ef4 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -1370,11 +1370,3 @@ static void ListChildren( vlc_list_t *p_list, vlc_object_t *p_this, int i_type ) } } } - - -#if defined( WIN32 ) || defined( SYS_BEOS ) || defined( __APPLE__ ) -const char *vlc_path( vlc_object_t *p_this ) -{ - return vlc_global( p_this )->psz_vlcpath; -} -#endif diff --git a/src/misc/win32_specific.c b/src/misc/win32_specific.c index c318c7d46e..1cce6aa5d9 100644 --- a/src/misc/win32_specific.c +++ b/src/misc/win32_specific.c @@ -72,7 +72,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] ) if( (psz_vlc = strrchr( psz_path, '\\' )) ) *psz_vlc = '\0'; - p_this->p_libvlc_global->psz_vlcpath = strdup( psz_path ); + vlc_global( p_this )->psz_vlcpath = strdup( psz_path ); /* Set the default file-translation mode */ #if !defined( UNDER_CE ) @@ -351,10 +351,10 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam, *****************************************************************************/ void system_End( libvlc_int_t *p_this ) { - if( p_this && p_this->p_libvlc_global && p_this->p_libvlc_global->psz_vlcpath ) + if( p_this && p_this->p_libvlc_global && vlc_global( p_this )->psz_vlcpath ) { - free( p_this->p_libvlc_global->psz_vlcpath ); - p_this->p_libvlc_global->psz_vlcpath = NULL; + free( vlc_global( p_this )->psz_vlcpath ); + vlc_global( p_this )->psz_vlcpath = NULL; } WSACleanup(); diff --git a/src/modules/configuration.c b/src/modules/configuration.c index 86e0571bf4..fb5fcc6208 100644 --- a/src/modules/configuration.c +++ b/src/modules/configuration.c @@ -1715,14 +1715,14 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], const char *config_GetDataDir( const vlc_object_t *p_this ) { #if defined (WIN32) || defined (UNDER_CE) - return p_this->p_libvlc_global->psz_vlcpath; + return vlc_global( p_this )->psz_vlcpath; #elif defined(__APPLE__) || defined (SYS_BEOS) static char path[PATH_MAX] = ""; if( *path == '\0' ) { snprintf( path, sizeof( path ), "%s/share", - p_this->p_libvlc_global->psz_vlcpath ); + vlc_global( p_this )->psz_vlcpath ); path[sizeof( path ) - 1] = '\0'; } return path; -- 2.39.2