[ovs-dev] [PATCH] include/windows/unistd.h: fixed type cast warning on Windows

Ilya Maximets i.maximets at ovn.org
Wed Sep 15 23:07:34 UTC 2021


On 9/3/21 18:01, Michael Santana wrote:
> 
> 
> On 8/26/21 11:45 AM, Sergey Madaminov wrote:
>> Currently, the function call type cast for getting file handle
>> produces a warning during OvS compilation on Windows with the following
>> message:
>>
>> ```
>> ..\include\windows\unistd.h:97:25: warning: cast from function call of type
>> 'intptr_t' (aka 'int') to non-matching type 'HANDLE' (aka 'void *')
>> [-Wbad-function-cast]
>>      HANDLE h = (HANDLE) _get_osfhandle(fd);
>> ```
>>
>> There is a function `LongToHandle()` to perform such cast [1].
>> But as `intptr_t` can be either `long long` for 64-bit or `int` for
>> 32-bit, instead of clogging the code with `#ifdef` macros to use
>> different cast functions, we can perform this cast directly.
>>
>> Signed-off-by: Sergey Madaminov <sergey.madaminov at gmail.com>
> Acked-by: Michael Santana <msantana at redhat.com>

Thanks!  Applied.

Best regards, Ilya Maximets.


More information about the dev mailing list