Browse code

Only special-case absolute DOS paths on systems that support them.

Originally committed as revision 15594 to svn://svn.ffmpeg.org/ffmpeg/trunk

Ramiro Polla authored on 2008/10/11 01:59:37
Showing 3 changed files
... ...
@@ -754,6 +754,7 @@ HAVE_LIST="
754 754
     dev_video_bktr_ioctl_bt848_h
755 755
     dlfcn_h
756 756
     dlopen
757
+    dos_paths
757 758
     ebp_available
758 759
     ebx_available
759 760
     fast_64bit
... ...
@@ -1295,6 +1296,7 @@ case $target_os in
1295 1295
         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
1296 1296
         SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
1297 1297
         objformat="win32"
1298
+        enable dos_paths
1298 1299
         ;;
1299 1300
     cygwin*)
1300 1301
         target_os=cygwin
... ...
@@ -1312,6 +1314,7 @@ case $target_os in
1312 1312
         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1313 1313
         SHFLAGS='-shared -Wl,--enable-auto-image-base'
1314 1314
         objformat="win32"
1315
+        enable dos_paths
1315 1316
         ;;
1316 1317
     *-dos|freedos|opendos)
1317 1318
         disable ffplay ffserver vhook
... ...
@@ -1319,6 +1322,7 @@ case $target_os in
1319 1319
         network_extralibs="-lsocket"
1320 1320
         EXESUF=".exe"
1321 1321
         objformat="win32"
1322
+        enable dos_paths
1322 1323
         ;;
1323 1324
     linux)
1324 1325
         enable dv1394
... ...
@@ -1350,6 +1354,7 @@ case $target_os in
1350 1350
         SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
1351 1351
         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
1352 1352
         disable vhook
1353
+        enable dos_paths
1353 1354
         ;;
1354 1355
     interix)
1355 1356
         disable vhook
... ...
@@ -21,6 +21,7 @@
21 21
 
22 22
 #include "libavutil/avstring.h"
23 23
 #include "libavcodec/opt.h"
24
+#include "os_support.h"
24 25
 #include "avformat.h"
25 26
 
26 27
 #if LIBAVFORMAT_VERSION_MAJOR >= 53
... ...
@@ -115,7 +116,7 @@ int url_open(URLContext **puc, const char *filename, int flags)
115 115
         p++;
116 116
     }
117 117
     /* if the protocol has length 1, we consider it is a dos drive */
118
-    if (*p == '\0' || (q - proto_str) <= 1) {
118
+    if (*p == '\0' || is_dos_path(filename)) {
119 119
     file_proto:
120 120
         strcpy(proto_str, "file");
121 121
     } else {
... ...
@@ -32,6 +32,15 @@
32 32
 #  define lseek(f,p,w) _lseeki64((f), (p), (w))
33 33
 #endif
34 34
 
35
+static inline int is_dos_path(const char *path)
36
+{
37
+#ifdef HAVE_DOS_PATHS
38
+    if (path[0] && path[1] == ':')
39
+        return 1;
40
+#endif
41
+    return 0;
42
+}
43
+
35 44
 #ifdef __BEOS__
36 45
 #  include <sys/socket.h>
37 46
 #  include <netinet/in.h>