From 4aecee7fc34d5eb3dccf2b8ff070cd1029a14d96 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 15 Apr 2010 18:27:27 +0000 Subject: [PATCH] Fix compile error on mingw where ETIMEDOUT is missing (because it's a WSA error). This patch also changes FF_NETERROR() to be an AVERROR(), i.e. it is always negative, whereas it was previously positive. Originally committed as revision 22887 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/network.h | 8 ++++---- libavformat/rtsp.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/network.h b/libavformat/network.h index 53bb9c07c7..0fbcbbb227 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -27,8 +27,8 @@ #include #include -#define ff_neterrno() WSAGetLastError() -#define FF_NETERROR(err) WSA##err +#define ff_neterrno() (-WSAGetLastError()) +#define FF_NETERROR(err) (-WSA##err) #define WSAEAGAIN WSAEWOULDBLOCK #else #include @@ -36,8 +36,8 @@ #include #include -#define ff_neterrno() errno -#define FF_NETERROR(err) err +#define ff_neterrno() AVERROR(errno) +#define FF_NETERROR(err) AVERROR(err) #endif #if HAVE_ARPA_INET_H diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 643e4d5a1f..16397e4e90 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1692,7 +1692,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, } #endif } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) { - return AVERROR(ETIMEDOUT); + return FF_NETERROR(ETIMEDOUT); } else if (n < 0 && errno != EINTR) return AVERROR(errno); }