You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avformat/os_support: check invalid socket value correctly on Windows
SOCKET defined in winsock2.h is unsigned and invalid value is defined as INVALID_SOCKET. Check this explicity to avoid compiler warnings. See: https://learn.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2 Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
@ -244,13 +244,16 @@ int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout)
|
|||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
for (i = 0; i < numfds; i++) {
|
for (i = 0; i < numfds; i++) {
|
||||||
|
#if !HAVE_WINSOCK2_H
|
||||||
if (fds[i].fd < 0)
|
if (fds[i].fd < 0)
|
||||||
continue;
|
continue;
|
||||||
#if !HAVE_WINSOCK2_H
|
|
||||||
if (fds[i].fd >= FD_SETSIZE) {
|
if (fds[i].fd >= FD_SETSIZE) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (fds[i].fd == INVALID_SOCKET)
|
||||||
|
continue;
|
||||||
#endif /* !HAVE_WINSOCK2_H */
|
#endif /* !HAVE_WINSOCK2_H */
|
||||||
|
|
||||||
if (fds[i].events & POLLIN)
|
if (fds[i].events & POLLIN)
|
||||||
|
Reference in New Issue
Block a user