]> git.sesse.net Git - ffmpeg/commitdiff
network: Don't redefine error codes if they already exist in errno.h
authorRonald S. Bultje <rsbultje@gmail.com>
Sat, 23 Jun 2012 12:00:17 +0000 (15:00 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 26 Jun 2012 14:22:21 +0000 (17:22 +0300)
Since the errno.h values don't match the error codes that winsock
returns, map the winsock error codes to the errno ones, to make
sure explicit checks against AVERROR(x) match.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/network.c
libavformat/network.h

index 432084faa406cb91eeeae0f5e46bffc32ce1c583..c2f7a9b0de6745fb9d402e8b82e164d074b8c914 100644 (file)
@@ -164,6 +164,14 @@ int ff_neterrno(void)
         return AVERROR(EAGAIN);
     case WSAEINTR:
         return AVERROR(EINTR);
+    case WSAEPROTONOSUPPORT:
+        return AVERROR(EPROTONOSUPPORT);
+    case WSAETIMEDOUT:
+        return AVERROR(ETIMEDOUT);
+    case WSAECONNREFUSED:
+        return AVERROR(ECONNREFUSED);
+    case WSAEINPROGRESS:
+        return AVERROR(EINPROGRESS);
     }
     return -err;
 }
index 3e4422e4c2ecf44f0c6e185c133a845c99ade773..793cfee9a9ec310a743fda46cfde409bc078356b 100644 (file)
 #include <winsock2.h>
 #include <ws2tcpip.h>
 
+#ifndef EPROTONOSUPPORT
 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
+#endif
+#ifndef ETIMEDOUT
 #define ETIMEDOUT       WSAETIMEDOUT
+#endif
+#ifndef ECONNREFUSED
 #define ECONNREFUSED    WSAECONNREFUSED
+#endif
+#ifndef EINPROGRESS
 #define EINPROGRESS     WSAEINPROGRESS
+#endif
+
 #define getsockopt(a, b, c, d, e) getsockopt(a, b, c, (char*) d, e)
 #define setsockopt(a, b, c, d, e) setsockopt(a, b, c, (const char*) d, e)