/*****************************************************************************
* 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>
# 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
*****************************************************************************/
p_char = strdup( ppsz_argv[ 0 ] );
}
- vlc_global()->psz_vlcpath = p_char;
+ psz_vlcpath = p_char;
/* Remove trailing program name */
for( ; *p_char ; )
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 );
}
CFRelease( all_locales );
}
-
- vlc_mutex_init( p_this, &vlc_global()->iconv_lock );
- vlc_global()->iconv_macosx = vlc_iconv_open( "UTF-8", "UTF-8-MAC" );
}
/*****************************************************************************
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;
}