* Some more fixes (+ don't redefine a function that already existed, reverts part...
authorAntoine Cellerier <dionoea@videolan.org>
Sun, 20 May 2007 14:04:46 +0000 (14:04 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 20 May 2007 14:04:46 +0000 (14:04 +0000)
include/vlc_objects.h
modules/control/http/http.c
modules/demux/playlist/luaplaylist.c
modules/gui/skins2/win32/win32_factory.cpp
src/libvlc-common.c
src/misc/beos_specific.cpp
src/misc/darwin_specific.c
src/misc/objects.c
src/misc/win32_specific.c
src/modules/configuration.c

index 6058b0b..a906d51 100644 (file)
@@ -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) \
index 08863cf..f1b3416 100644 (file)
@@ -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" );
index 2c4b0f1..9720fdc 100644 (file)
@@ -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
     {
index 603fd93..6fbe0e8 100644 (file)
@@ -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
index d161ba0..9f78e0b 100644 (file)
@@ -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;
 
index 610accb..34e7249 100644 (file)
@@ -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 );
index 9a3ca5a..da939ac 100644 (file)
@@ -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 );
 }
 
index 2884fad..2ce0126 100644 (file)
@@ -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
index c318c7d..1cce6aa 100644 (file)
@@ -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();
index 86e0571..fb5fcc6 100644 (file)
@@ -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;