[FFmpeg-devel] [PATCH] Fix pipes on OS/2

Dave Yeo daveryeo
Sun Jun 15 03:40:59 CEST 2008


On 06/07/08 04:37 pm, M?ns Rullg?rd wrote:
> Dave Yeo<daveryeo at telus.net>  writes:
>
>> On 06/05/08 12:53 am, Diego Biurrun wrote:
>>> On Tue, Jun 03, 2008 at 08:04:24PM -0700, Dave Yeo wrote:
>>>> On 06/03/08 01:18 am, M?ns Rullg?rd wrote:
>>>>> Dave Yeo<daveryeo at telus.net>    writes:
>>>>>
>>>>>> Currently pipes are broken on OS/2 due to setmode() not being declared
>>>>>> and pipes being opened in text mode. eg
>>>>>> libavformat/file.c: In function `pipe_open':
>>>>>> libavformat/file.c:106: warning: implicit declaration of function `setmode'
>>>>>> --- libavformat/file.c	(revision 13644)
>>>>>> +++ libavformat/file.c	(working copy)
>>>>>> @@ -22,6 +22,7 @@
>>>>>>     #include "avformat.h"
>>>>>>     #include<fcntl.h>
>>>>>> +#include<io.h>
>>>>>>     #include<unistd.h>
>>>>>>     #include<sys/time.h>
>>>>> Rejected: io.h is not a standard header.
>>>> Seems to be used in most DOSish systems, wonder where mingw and DOS
>>>> declare it.
>>>> Anyways updated patch attached
>>> Mans, if this conditional version of the patch is not OK, speak up,
>>> otherwise I will apply it.
>>>
>> Sorry, I seem to of screwed up between testing and submitting. Working
>> patch attached.
>> Dave
>> Index: configure
>> ===================================================================
>> --- configure	(revision 13683)
>> +++ configure	(working copy)
>> @@ -749,6 +749,7 @@
>>       imlib2
>>       inet_aton
>>       inline_asm
>> +    io_h
>>       libdc1394_1
>>       libdc1394_2
>>       llrint
>> @@ -1607,6 +1608,7 @@
>>   check_header byteswap.h
>>   check_header conio.h
>>   check_header dlfcn.h
>> +check_header io.h
>>   check_header malloc.h
>>   check_header sys/mman.h
>>   check_header sys/resource.h
>> Index: libavformat/file.c
>> ===================================================================
>> --- libavformat/file.c	(revision 13683)
>> +++ libavformat/file.c	(working copy)
>> @@ -22,6 +22,9 @@
>>   #include "libavutil/avstring.h"
>>   #include "avformat.h"
>>   #include<fcntl.h>
>> +#ifdef HAVE_IO_H
>> +#include<io.h>
>> +#endif
>>   #include<unistd.h>
>>   #include<sys/time.h>
>>   #include<stdlib.h>
>
> I am slightly sceptical to randomly including headers with such
> generic names.  We don't know what effects that might have on another
> system.  Can't we somehow get rid of the setmode() call instead.  It's
> horribly non-portable.  So badly, in fact, that the function exists on
> many systems, but does entirely different things.
>

Unluckily setmode() is used on most all DOSish compilers including all 4 
versions of GCC that FFmpeg supports. Since it is always declared in 
io.h perhaps this solution is best. This should also fix BEOS since it 
has O_BINARY and the BSD setmode().
Dave
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setmode.diff
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080614/6c7d670b/attachment.bin>



More information about the ffmpeg-devel mailing list