[FFmpeg-devel] [PATCH v3 1/3] avformat/network: add ff_neterrno2() for cases where we already have an errno

Andrew Sayers ffmpeg-devel at pileofstuff.org
Fri Apr 19 22:07:59 EEST 2024


For example, WSAStartup()'s documentation says:

    "A call to the WSAGetLastError function is not needed and should not be used"
---
 libavformat/network.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index f752efc411..fb70f9cafc 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -121,9 +121,14 @@ void ff_network_close(void)
 }
 
 #if HAVE_WINSOCK2_H
+
+}
 int ff_neterrno(void)
 {
-    int err = WSAGetLastError();
+    return ff_neterrno2(WSAGetLastError());
+}
+int ff_neterrno2(int err)
+{
     switch (err) {
     case WSAEWOULDBLOCK:
         return AVERROR(EAGAIN);
-- 
2.43.0



More information about the ffmpeg-devel mailing list