[vlc-devel] [PATCH 16/41] Convert '/' to '\' on OS/2
Rémi Denis-Courmont
remi at remlab.net
Mon Oct 10 15:25:56 CEST 2011
On Mon, 10 Oct 2011 20:43:55 +0900, KO Myung-Hun <komh at chollian.net>
wrote:
> This allows a mixed usage of '\' and '/'.
> ---
> src/text/strings.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/src/text/strings.c b/src/text/strings.c
> index d5cae97..93ae149 100644
> --- a/src/text/strings.c
> +++ b/src/text/strings.c
> @@ -1074,6 +1074,16 @@ char *make_URI (const char *path, const char
> *scheme)
> /* Note: VLC cannot handle URI schemes without double slash after
the
> * scheme name (such as mailto: or news:). */
>
> +#ifdef __OS2__
> + char *p = alloca (strlen (path) + 1);
Since VLC uses C99, you could avoid the non-standard alloca():
char p[strlen (path) + 1];
> + strcpy (p, path);
> + path = p;
> +
> + for (; *p; p++)
> + if (*p == '/')
> + *p = DIR_SEP_CHAR;
You could probably fold the copy into the loop. Alternatively, you could
use strchr(p, '/').
> +#endif
> +
> char *buf;
> #if defined( WIN32 ) || defined( __OS2__ )
> /* Drive letter */
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list