]> git.sesse.net Git - vlc/blobdiff - src/text/strings.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / src / text / strings.c
index cd110e73325ce6b56266b2d573c2818067c5e2a2..096f72df58709d9487d07524361dbf7d393b7fc9 100644 (file)
@@ -95,10 +95,6 @@ char *decode_URI( char *psz )
                 break;
             }
 
-            case '+': /* This is HTTP forms, not URI decoding... */
-                *out++ = ' ';
-                break;
-
             default:
                 /* Inserting non-ASCII or non-printable characters is unsafe,
                  * and no sane browser will send these unencoded */
@@ -1030,6 +1026,9 @@ void path_sanitize( char *str )
 }
 
 #include <vlc_url.h>
+#ifdef WIN32
+# include <io.h>
+#endif
 
 /**
  * Convert a file path to an URI.
@@ -1052,11 +1051,16 @@ char *make_URI (const char *path, const char *scheme)
 
     char *buf;
 #ifdef WIN32
+    /* Drive letter */
     if (isalpha (path[0]) && (path[1] == ':'))
     {
-        if (asprintf (&buf, "%s:///%c:", scheme, path[0]) == -1)
+        if (asprintf (&buf, "%s:///%c:", scheme ? scheme : "file",
+                      path[0]) == -1)
             buf = NULL;
         path += 2;
+# warning Drive letter-relative path not implemented!
+        if (path[0] != DIR_SEP_CHAR)
+            return NULL;
     }
     else
 #endif
@@ -1092,6 +1096,9 @@ char *make_URI (const char *path, const char *scheme)
             snprintf (buf, sizeof (SMB_SCHEME) + 3 + hostlen,
                       SMB_SCHEME"://%s", path + 2);
         path += 2 + hostlen;
+
+        if (path[0] == '\0')
+            return buf; /* Hostname without path */
     }
     else
     if (path[0] != DIR_SEP_CHAR)