[FFmpeg-devel] [PATCH] Set systems that should support DOS paths in configure

Måns Rullgård mans
Tue Oct 7 00:52:09 CEST 2008


"Ramiro Polla" <ramiro.polla at gmail.com> writes:

> On Mon, Oct 6, 2008 at 1:42 PM, Ramiro Polla <ramiro.polla at gmail.com> wrote:
>> Hi,
>>
>> On Fri, Oct 3, 2008 at 7:58 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
>>> "Ramiro Polla" <ramiro.polla at gmail.com> writes:
>>>> $subj
>> [...]
>>>> Index: libavformat/os_support.h
>>>> ===================================================================
>>>> --- libavformat/os_support.h  (revision 15464)
>>>> +++ libavformat/os_support.h  (working copy)
>>>> @@ -35,6 +35,12 @@
>>>>  #  define lseek(f,p,w) _lseeki64((f), (p), (w))
>>>>  #endif
>>>>
>>>> +#ifdef HAVE_DOS_PATHS
>>>> +    #define is_dos_path(path) (path[1]==':')
>>>
>>> This allows anything as the "drive letter", though maybe that's
>>> considered OK.
>>
>> According to [0], only letters are allowed for the drive letter
>> (altough I've seen some program, fsdext2 IIRC, using numbers). Added
>> isalpha() for path[0].
>>
>>>> +#else
>>>> +    #define is_dos_path(path) (0)
>>>
>>> Useless ().
>>
>> Removed.
>>
>> Also changed from #define to static inline int like ff_network_init().
>>
>> Ramiro Polla
>> [0] http://msdn.microsoft.com/en-us/library/cc232152.aspx
>>
>
> And now without the tabs in os_support.h
>
> Index: configure
> ===================================================================
> --- configure	(revision 15572)
> +++ configure	(working copy)
> @@ -750,6 +750,7 @@
>      dev_video_bktr_ioctl_bt848_h
>      dlfcn_h
>      dlopen
> +    dos_paths
>      ebp_available
>      ebx_available
>      fast_64bit
> @@ -1291,6 +1292,7 @@
>          SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
>          SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
>          objformat="win32"
> +        enable dos_paths
>          ;;
>      cygwin*)
>          target_os=cygwin
> @@ -1308,6 +1310,7 @@
>          SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
>          SHFLAGS='-shared -Wl,--enable-auto-image-base'
>          objformat="win32"
> +        enable dos_paths
>          ;;
>      *-dos|freedos|opendos)
>          disable ffplay ffserver vhook
> @@ -1315,6 +1318,7 @@
>          network_extralibs="-lsocket"
>          EXESUF=".exe"
>          objformat="win32"
> +        enable dos_paths
>          ;;
>      linux)
>          enable dv1394
> @@ -1346,6 +1350,7 @@
>          SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
>          SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
>          disable vhook
> +        enable dos_paths
>          ;;
>      interix)
>          disable vhook

OK

> Index: libavformat/os_support.h
> ===================================================================
> --- libavformat/os_support.h	(revision 15572)
> +++ libavformat/os_support.h	(working copy)
> @@ -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 (isalpha(path[0]) && path[1] == ':')
> +        return 1;
> +#endif
> +    return 0;
> +}
> +
>  #ifdef __BEOS__
>  #  include <sys/socket.h>
>  #  include <netinet/in.h>

isalpha() needs #include <ctype.h>.  I don't see it anywhere in the file.

> Index: libavformat/avio.c
> ===================================================================
> --- libavformat/avio.c	(revision 15572)
> +++ libavformat/avio.c	(working copy)
> @@ -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 {

Looks OK, but not my code.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list