[FFmpeg-cvslog] avformat/os_support: check invalid socket value correctly on Windows
Kacper Michajłow
git at videolan.org
Fri Jul 25 22:49:17 EEST 2025
ffmpeg | branch: master | Kacper Michajłow <kasper93 at gmail.com> | Tue Jul 22 20:49:29 2025 +0200| [c6ea6ac39bd1a1610971daca542d82b4ff0aa4c1] | committer: Kacper Michajłow
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 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6ea6ac39bd1a1610971daca542d82b4ff0aa4c1
---
libavformat/os_support.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 4d6eb8a74c..17d77a01d5 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -244,13 +244,16 @@ int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout)
n = 0;
for (i = 0; i < numfds; i++) {
+#if !HAVE_WINSOCK2_H
if (fds[i].fd < 0)
continue;
-#if !HAVE_WINSOCK2_H
if (fds[i].fd >= FD_SETSIZE) {
errno = EINVAL;
return -1;
}
+#else
+ if (fds[i].fd == INVALID_SOCKET)
+ continue;
#endif /* !HAVE_WINSOCK2_H */
if (fds[i].events & POLLIN)
More information about the ffmpeg-cvslog
mailing list