summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Madaminov <sergey.madaminov@gmail.com>2021-08-26 10:45:57 -0500
committerIlya Maximets <i.maximets@ovn.org>2021-09-16 00:37:38 +0200
commitaae08a577ddbaed437bb10794c4aa4158fb77d8d (patch)
tree9cacfbe06a12646856fcc33fc16bbca4be67cdf4 /include
parente05e1e3c056e0c7041bef777f985469ff1552f80 (diff)
downloadopenvswitch-aae08a577ddbaed437bb10794c4aa4158fb77d8d.tar.gz
include/windows/unistd.h: Fixed type cast warning on Windows.
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@gmail.com> Acked-by: Michael Santana <msantana@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'include')
-rw-r--r--include/windows/unistd.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/windows/unistd.h b/include/windows/unistd.h
index 21cc56ff1..62ff90a3f 100644
--- a/include/windows/unistd.h
+++ b/include/windows/unistd.h
@@ -94,7 +94,7 @@ __inline long sysconf(int type)
static __inline int
rpl_isatty(int fd)
{
- HANDLE h = (HANDLE) _get_osfhandle(fd);
+ HANDLE h = (HANDLE)(INT_PTR) _get_osfhandle(fd);
DWORD st;
return (_isatty(STDOUT_FILENO)
&& h != INVALID_HANDLE_VALUE