changeset 3994:4d5d9ac28e21 libavformat

Only special-case absolute DOS paths on systems that support them.
author ramiro
date Fri, 10 Oct 2008 16:59:37 +0000
parents 8c5a32f0d479
children fcff303d5c8c
files avio.c os_support.h
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/avio.c	Wed Oct 08 20:55:22 2008 +0000
+++ b/avio.c	Fri Oct 10 16:59:37 2008 +0000
@@ -21,6 +21,7 @@
 
 #include "libavutil/avstring.h"
 #include "libavcodec/opt.h"
+#include "os_support.h"
 #include "avformat.h"
 
 #if LIBAVFORMAT_VERSION_MAJOR >= 53
@@ -115,7 +116,7 @@
         p++;
     }
     /* if the protocol has length 1, we consider it is a dos drive */
-    if (*p == '\0' || (q - proto_str) <= 1) {
+    if (*p == '\0' || is_dos_path(filename)) {
     file_proto:
         strcpy(proto_str, "file");
     } else {
--- a/os_support.h	Wed Oct 08 20:55:22 2008 +0000
+++ b/os_support.h	Fri Oct 10 16:59:37 2008 +0000
@@ -32,6 +32,15 @@
 #  define lseek(f,p,w) _lseeki64((f), (p), (w))
 #endif
 
+static inline int is_dos_path(const char *path)
+{
+#ifdef HAVE_DOS_PATHS
+    if (path[0] && path[1] == ':')
+        return 1;
+#endif
+    return 0;
+}
+
 #ifdef __BEOS__
 #  include <sys/socket.h>
 #  include <netinet/in.h>