Skip to content
Snippets Groups Projects
Commit 69b8dde8 authored by Johannes Kauffmann's avatar Johannes Kauffmann Committed by Steve Lhomme
Browse files

win32: spawn: avoid Wbad-function-cast

Instead of casting the return value of _get_osfhandle() immediately to
HANDLE, check for the error cases first, and only cast to HANDLE when
used in DuplicateHandle().
parent 01162c3f
No related branches found
No related tags found
1 merge request!4035win32: spawn: avoid Wbad-function-cast
Pipeline #371074 passed with stage
in 17 minutes and 2 seconds
......@@ -73,15 +73,15 @@ error:
static HANDLE dup_handle_from_fd(const int fd)
{
HANDLE vlc_handle = (HANDLE)_get_osfhandle(fd);
if (vlc_handle == INVALID_HANDLE_VALUE)
return vlc_handle;
intptr_t vlc_handle = _get_osfhandle(fd);
if (vlc_handle == (intptr_t)INVALID_HANDLE_VALUE)
return INVALID_HANDLE_VALUE;
if (vlc_handle == (HANDLE)-2)
if (vlc_handle == -2)
return INVALID_HANDLE_VALUE;
HANDLE dup_inheritable_handle;
BOOL result = DuplicateHandle(GetCurrentProcess(), vlc_handle, GetCurrentProcess(),
BOOL result = DuplicateHandle(GetCurrentProcess(), (HANDLE)vlc_handle, GetCurrentProcess(),
&dup_inheritable_handle, 0, TRUE, DUPLICATE_SAME_ACCESS);
if (!result)
return INVALID_HANDLE_VALUE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment