提交 4b1b1449 编写于 作者: R Ronald S. Bultje 提交者: Martin Storsjö

network: Don't redefine error codes if they already exist in errno.h

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: NMartin Storsjö <martin@martin.st>
上级 e64bceea
......@@ -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;
}
......
......@@ -35,10 +35,19 @@
#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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册