[vlc-devel] [PATCH] vlc: Convert command line arguments to UTF-8 on OS/2

Rémi Denis-Courmont remi at remlab.net
Sat Oct 13 13:55:33 CEST 2012


VLC cannot call libvlccore functions, AFAIK.

Le samedi 13 octobre 2012 13:25:05, KO Myung-Hun a écrit :
> ---
>  bin/vlc.c |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/bin/vlc.c b/bin/vlc.c
> index 9151633..2015235 100644
> --- a/bin/vlc.c
> +++ b/bin/vlc.c
> @@ -42,6 +42,9 @@
>  #include <unistd.h>
> 
>  #ifdef __OS2__
> +# include <vlc_common.h>
> +# include <vlc_charset.h>
> +
>  # define pthread_t      int
>  # define pthread_self() _gettid()
>  #endif
> @@ -183,8 +186,18 @@ int main( int i_argc, const char *ppsz_argv[] )
>      if (i_argc >= 1 && !strncmp (*ppsz_argv, "-psn" , 4))
>          ppsz_argv++, i_argc--;
>  #endif
> +#ifdef __OS2__
> +    for (int i = 0; i < i_argc; i++)
> +        if ((argv[argc++] = FromLocaleDup (ppsz_argv[i])) == NULL)
> +        {
> +            fprintf (stderr, "Converting '%s' to UTF-8 failed.\n",
> +                     ppsz_argv[i]);
> +            return 1;
> +        }
> +#else
>      memcpy (argv + argc, ppsz_argv, i_argc * sizeof (*argv));
>      argc += i_argc;
> +#endif
>      argv[argc] = NULL;
> 
>      vlc_enable_override ();
> @@ -237,5 +250,10 @@ out:
>      if (vlc != NULL)
>          libvlc_release (vlc);
> 
> +#ifdef __OS2__
> +    for (int i = 2; i < argc; i++)
> +        free (argv[i]);
> +#endif
> +
>      return 0;
>  }

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list