[FFmpeg-devel] [PATCH] socklen_t definition

KO Myung-Hun komh
Tue Sep 18 14:04:05 CEST 2007


Hi/2.

Michael Niedermayer wrote:
> Hi
>
> On Tue, Sep 18, 2007 at 12:30:37PM +0200, Diego Biurrun wrote:
>   
>> On Mon, Sep 17, 2007 at 04:41:34PM -0700, Dave Yeo wrote:
>>     
>>> Reimar Doeffinger wrote:
>>>       
>>>> On Mon, Sep 17, 2007 at 12:35:46PM +0200, Diego Biurrun wrote:
>>>>         
>>>>> Even more important: Reimar came up with a header file that provides the
>>>>> correct definition.  So why can't this be used instead of adding this
>>>>> (possibly brittle as explained by Mans) check?
>>>>>           
>>>> I'm not sure that is a proper header file, at least it's not a system
>>>> one...
>>>> But it seems that _socklen_t is in some header file, maybe using that is
>>>> good enough?
>>>>         
>>> Grepping include I found in <386/ansi.h>
>>> /*
>>>   * Types which are fundamental to the implementation and must be declared
>>>   * in more than one standard header are defined here.  Standard headers
>>>   * then use:
>>>   *      #ifdef  _BSD_SIZE_T_
>>>   *      typedef _BSD_SIZE_T_    size_t;
>>>   *      #undef  _BSD_SIZE_T_
>>>   *      #endif
>>>   */
>>> ...
>>> #define _BSD_SOCKLEN_T_ __uint32_t              /* socklen_t (duh) */
>>> ...
>>>
>>> And in <sys/_type.h>
>>> ...
>>> typedef __uint32_t      __socklen_t;
>>> ...
>>> So it seems that it should be uint32_t. Also __uint32_t is typedef as
>>> unsigned int in <386/_types.h>.
>>>       
>> I get to repeat my question: Is there a way to include this header file
>> instead of adding the check from the patch?
>>     
>
> btw, an alternative solution to find the type of something is to compile
> code like:
> -----------
> #include <inttypes.h>
> #include <sys/socket.h>
>
> int (*ptr)(int SOCKET, struct sockaddr *ADDR, TYPE *LENGTHPTR);
>
> void test(void){
>     TYPE c;
>     getsockname(0, NULL, &c);
>     ptr= getsockname;
> }
> ------------
>
> with -W -Wall and all types beginning from the most likely and when it
> prints no warnings then we got the correct type
>
> this of corse depends on the compiler printing warnings if types missmatch
>
>   

I think, you should consider the case of 'ws2tcpip.h' on WIN32.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 1.1.4
Under OS/2 Warp 4 for Korean with FixPak #15
On AMD ThunderBird 750 MHz with 512 MB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr






More information about the ffmpeg-devel mailing list