[vlc-commits] [Git][videolan/vlc][master] win32: spawn: avoid Wbad-function-cast
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Aug 6 08:06:47 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
69b8dde8 by Johannes Kauffmann at 2023-08-06T07:48:07+00:00
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().
- - - - -
1 changed file:
- src/win32/spawn.c
Changes:
=====================================
src/win32/spawn.c
=====================================
@@ -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;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/69b8dde81b2cdbc4306c1e3f20f03bf8876adcaa
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/69b8dde81b2cdbc4306c1e3f20f03bf8876adcaa
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list