]> git.sesse.net Git - vlc/blobdiff - src/misc/darwin_specific.c
core: fix time-offset and position-offset callbacks
[vlc] / src / misc / darwin_specific.c
index f962c1def3f02f66900d0b2e635577173d694580..b33b3bb7419966dc7d91cf8c454e0a26eece34af 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * darwin_specific.m: Darwin specific features
  *****************************************************************************
- * Copyright (C) 2001-2007 the VideoLAN team
+ * Copyright (C) 2001-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Sam Hocevar <sam@zoy.org>
@@ -27,7 +27,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include "../libvlc.h"
 #include <dirent.h>                                                /* *dir() */
 
 # define MAXPATHLEN 1024
 #endif
 
-/* CFLocaleCopyAvailableLocaleIdentifiers is present only on post-10.4 */
-extern CFArrayRef CFLocaleCopyAvailableLocaleIdentifiers(void) __attribute__((weak_import));
-
-/* emulate CFLocaleCopyAvailableLocaleIdentifiers on pre-10.4 */
-static CFArrayRef copy_all_locale_indentifiers(void)
-{
-    CFMutableArrayRef available_locales;
-    DIR * dir;
-    struct dirent *file;
-
-    dir = opendir( "/usr/share/locale" );
-    available_locales = CFArrayCreateMutable( kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks );
-
-    while ( (file = readdir(dir)) )
-    {
-        /* we should probably filter out garbage */
-        /* we can't use CFStringCreateWithFileSystemRepresentation as it is
-         * supported only on post-10.4 (and this function is only for pre-10.4) */
-        CFStringRef locale = CFStringCreateWithCString( kCFAllocatorDefault, file->d_name, kCFStringEncodingUTF8 );
-        CFArrayAppendValue( available_locales, (void*)locale );
-        CFRelease( locale );
-    }
-
-    closedir( dir );
-    return available_locales;
-}
-
 /*****************************************************************************
  * system_Init: fill in program path & retrieve language
  *****************************************************************************/
@@ -123,7 +96,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
         p_char = strdup( ppsz_argv[ 0 ] );
     }
 
-    vlc_global()->psz_vlcpath = p_char;
+    psz_vlcpath = p_char;
 
     /* Remove trailing program name */
     for( ; *p_char ; )
@@ -149,10 +122,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
         CFArrayRef all_locales, preferred_locales;
         char psz_locale[50];
 
-        if( CFLocaleCopyAvailableLocaleIdentifiers )
-            all_locales = CFLocaleCopyAvailableLocaleIdentifiers();
-        else
-            all_locales = copy_all_locale_indentifiers();
+        all_locales = CFLocaleCopyAvailableLocaleIdentifiers();
 
         preferred_locales = CFBundleCopyLocalizationsForPreferences( all_locales, NULL );
 
@@ -168,9 +138,6 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
         }
         CFRelease( all_locales );
     }
-
-    vlc_mutex_init( p_this, &vlc_global()->iconv_lock );
-    vlc_global()->iconv_macosx = vlc_iconv_open( "UTF-8", "UTF-8-MAC" );
 }
 
 /*****************************************************************************
@@ -189,10 +156,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv
 void system_End( libvlc_int_t *p_this )
 {
     (void)p_this;
-    free( vlc_global()->psz_vlcpath );
-
-    if ( vlc_global()->iconv_macosx != (vlc_iconv_t)-1 )
-        vlc_iconv_close( vlc_global()->iconv_macosx );
-    vlc_mutex_destroy( &vlc_global()->iconv_lock );
+    free( psz_vlcpath );
+    psz_vlcpath = NULL;
 }