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
This commit is contained in:
Ronald S. Bultje 2010-04-15 18:27:27 +00:00
parent e58c05bb3c
commit 4aecee7fc3
2 changed files with 5 additions and 5 deletions

View File

@ -27,8 +27,8 @@
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#define ff_neterrno() WSAGetLastError() #define ff_neterrno() (-WSAGetLastError())
#define FF_NETERROR(err) WSA##err #define FF_NETERROR(err) (-WSA##err)
#define WSAEAGAIN WSAEWOULDBLOCK #define WSAEAGAIN WSAEWOULDBLOCK
#else #else
#include <sys/types.h> #include <sys/types.h>
@ -36,8 +36,8 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#define ff_neterrno() errno #define ff_neterrno() AVERROR(errno)
#define FF_NETERROR(err) err #define FF_NETERROR(err) AVERROR(err)
#endif #endif
#if HAVE_ARPA_INET_H #if HAVE_ARPA_INET_H

View File

@ -1692,7 +1692,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
} }
#endif #endif
} else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) { } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) {
return AVERROR(ETIMEDOUT); return FF_NETERROR(ETIMEDOUT);
} else if (n < 0 && errno != EINTR) } else if (n < 0 && errno != EINTR)
return AVERROR(errno); return AVERROR(errno);
} }