Commit d7892111 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Convert from locale before passing to LibVLC - closes #838

parent ab8bf7fc
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#include <stdlib.h> /* putenv(), strtol(), */ #include <stdlib.h> /* putenv(), strtol(), */
#include <locale.h> #include <locale.h>
/* Explicit HACK */
extern void LocaleFree (const char *);
extern char *FromLocale (const char *);
/***************************************************************************** /*****************************************************************************
* Local prototypes. * Local prototypes.
...@@ -89,7 +93,7 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -89,7 +93,7 @@ int main( int i_argc, char *ppsz_argv[] )
i_ret = VLC_Create(); i_ret = VLC_Create();
if( i_ret < 0 ) if( i_ret < 0 )
{ {
return i_ret; return -i_ret;
} }
#if !defined(WIN32) && !defined(UNDER_CE) #if !defined(WIN32) && !defined(UNDER_CE)
...@@ -143,7 +147,7 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -143,7 +147,7 @@ int main( int i_argc, char *ppsz_argv[] )
else else
{ {
/* failed!, quit */ /* failed!, quit */
return -1; return 1;
} }
} }
else else
...@@ -154,18 +158,24 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -154,18 +158,24 @@ int main( int i_argc, char *ppsz_argv[] )
else else
{ {
/* failed!, quit */ /* failed!, quit */
return -1; return 1;
} }
} }
} }
else
#endif #endif
{
for (int i = 0; i < i_argc; i++)
if ((ppsz_argv[i] = FromLocale (ppsz_argv[i])) == NULL)
return 1; // BOOM!
}
/* Initialize libvlc */ /* Initialize libvlc */
i_ret = VLC_Init( 0, i_argc, ppsz_argv ); i_ret = VLC_Init( 0, i_argc, ppsz_argv );
if( i_ret < 0 ) if( i_ret < 0 )
{ {
VLC_Destroy( 0 ); VLC_Destroy( 0 );
return i_ret == VLC_EEXITSUCCESS ? 0 : i_ret; return i_ret == VLC_EEXITSUCCESS ? 0 : -i_ret;
} }
i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE ); i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE );
...@@ -178,6 +188,9 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -178,6 +188,9 @@ int main( int i_argc, char *ppsz_argv[] )
/* Destroy the libvlc structure */ /* Destroy the libvlc structure */
VLC_Destroy( 0 ); VLC_Destroy( 0 );
for (int i = 0; i < i_argc; i++)
LocaleFree (ppsz_argv[i]);
#if !defined(WIN32) && !defined(UNDER_CE) #if !defined(WIN32) && !defined(UNDER_CE)
pthread_cancel (sigth); pthread_cancel (sigth);
# ifdef __APPLE__ # ifdef __APPLE__
...@@ -189,7 +202,7 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -189,7 +202,7 @@ int main( int i_argc, char *ppsz_argv[] )
pthread_join (sigth, NULL); pthread_join (sigth, NULL);
#endif #endif
return i_ret; return -i_ret;
} }
#if !defined(WIN32) && !defined(UNDER_CE) #if !defined(WIN32) && !defined(UNDER_CE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment