ws2_32: Add support and tests for WSARecvMsg and IP_PKTINFO.

Rolf Kalbermatter r.kalbermatter at hccnet.nl
Thu Oct 14 04:16:02 CDT 2010


On Tue, Oct 13, 2010 at 16:30 PM, Erich Hoover <ehoover at mines.edu> wrote:
>> ...
>> +    int newsize = (int)*maxsize;
>> +
>> +    /* Make sure there is at least enough room for this entry */
>> +    newsize -= sizeof(WSACMSGHDR) + CMSG_ALIGN(len);
>> +    if (newsize < 0)
>> +        return 0;
>> +    *maxsize = (ULONG)newsize;
>> Just declare it as a ULONG/size_t so you don't have to cast.
>
>I can obviously change this around a little bit, but the reason for this
conversion is that as a >ULONG the "if (newsize < 0)" comparison is not
going to work.

Then following code would work better:

    ULONG newsize = sizeof(WSACMSGHDR) + CMSG_ALIGN(len);

    /* Make sure there is at least enough room for this entry */
    if (newsize > *maxsize)
        return 0;
    /* else */
       *maxsize -= newsize;



Rolf Kalbermatter





More information about the wine-devel mailing list