[vlc-commits] Win32: fix file://localhost/... to path conversion
Rémi Denis-Courmont
git at videolan.org
Fri Aug 26 17:07:34 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Aug 26 18:03:26 2011 +0300| [6a69f95cc9f5222c2e92d928816dfa700b573959] | committer: Rémi Denis-Courmont
Win32: fix file://localhost/... to path conversion
Pointed-out-by: Michael A. Puls II
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a69f95cc9f5222c2e92d928816dfa700b573959
---
src/text/strings.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/text/strings.c b/src/text/strings.c
index 0666cfd..0b5d828 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -1206,23 +1206,24 @@ char *make_path (const char *url)
if (schemelen == 4 && !strncasecmp (url, "file", 4))
{
-#if (DIR_SEP_CHAR != '/')
- for (char *p = strchr (path, '/'); p; p = strchr (p + 1, '/'))
- *p = DIR_SEP_CHAR;
-#endif
- /* Leading slash => local path */
- if (*path == DIR_SEP_CHAR)
#if (!defined (WIN32) && !defined (__OS2__)) || defined (UNDER_CE)
+ /* Leading slash => local path */
+ if (*path == '/')
return path;
-#else
- return memmove (path, path + 1, strlen (path + 1) + 1);
-#endif
-
- /* Local path disguised as a remote one (MacOS X) */
- if (!strncasecmp (path, "localhost"DIR_SEP, 10))
+ /* Local path disguised as a remote one */
+ if (!strncasecmp (path, "localhost/", 10))
return memmove (path, path + 9, strlen (path + 9) + 1);
+#else
+ for (char *p = strchr (path, '/'); p; p = strchr (p + 1, '/'))
+ *p = '\\';
-#if defined( WIN32 ) || defined( __OS2__ )
+ /* Leading backslash => local path */
+ if (*path == '\\')
+ return memmove (path, path + 1, strlen (path + 1) + 1);
+ /* Local path disguised as a remote one */
+ if (!strncasecmp (path, "localhost\\", 10))
+ return memmove (path, path + 10, strlen (path + 10) + 1);
+ /* UNC path */
if (*path && asprintf (&ret, "\\\\%s", path) == -1)
ret = NULL;
#endif
More information about the vlc-commits
mailing list