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

Ramiro Polla ramiro.polla
Tue Oct 7 03:23:17 CEST 2008


On Mon, Oct 6, 2008 at 7:52 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
> "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.

Added under a #ifdef HAVE_DOS_PATHS.

>> 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.

Ok, then if there are no objections I'll apply attached patch on Wednesday.

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dospaths_8.diff
Type: text/x-diff
Size: 2640 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081006/f8463c5b/attachment.diff>



More information about the ffmpeg-devel mailing list