[vlc-devel] commit: Win32: fix #2592 (stdin file input). It may impact other platforms, so please test, and fix/revert if you see a bug. (Geoffroy Couprie )

git version control git at videolan.org
Sat Dec 26 16:24:31 CET 2009


vlc | branch: master | Geoffroy Couprie <geal at videolan.org> | Fri Dec 25 13:57:57 2009 +0100| [e33a82dbd7ef005de310f67f7cc83a1bf0c71269] | committer: Geoffroy Couprie 

Win32: fix #2592 (stdin file input). It may impact other platforms, so please test, and fix/revert if you see a bug.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e33a82dbd7ef005de310f67f7cc83a1bf0c71269
---

 src/text/strings.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/src/text/strings.c b/src/text/strings.c
index 09c4ed1..b69c9e5 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -1100,16 +1100,28 @@ char *make_URI (const char *path)
     }
     else
     if (path[0] != DIR_SEP_CHAR)
-    {   /* Relative path: prepend the current working directory */
-        char cwd[PATH_MAX];
+    {
+        if(path[0] == '-')
+        {
+            /*reading from stdin*/
+            if (asprintf (&buf, "-") == -1)
+                return NULL;
 
-        if (getcwd (cwd, sizeof (cwd)) == NULL) /* FIXME: UTF8? */
-            return NULL;
-        if (asprintf (&buf, "%s/%s", cwd, path) == -1)
-            return NULL;
-        char *ret = make_URI (buf);
-        free (buf);
-        return ret;
+            return buf;
+        }
+        else
+        {
+            /* Relative path: prepend the current working directory */
+            char cwd[PATH_MAX];
+
+            if (getcwd (cwd, sizeof (cwd)) == NULL) /* FIXME: UTF8? */
+                return NULL;
+            if (asprintf (&buf, "%s/%s", cwd, path) == -1)
+                return NULL;
+            char *ret = make_URI (buf);
+            free (buf);
+            return ret;
+        }
     }
     else
         buf = strdup ("file://");




More information about the vlc-devel mailing list