[FFmpeg-devel] [PATCH] avio: Check for FF_NETERROR(EAGAIN) in retry_transfer_wrapper
Martin Storsjö
martin
Tue Feb 22 14:42:04 CET 2011
On Tue, 22 Feb 2011, Martin Storsj? wrote:
> On Tue, 22 Feb 2011, M?ns Rullg?rd wrote:
>
> > > diff --git a/libavformat/network.h b/libavformat/network.h
> > > index d6aee93..c575975 100644
> > > --- a/libavformat/network.h
> > > +++ b/libavformat/network.h
> > > @@ -27,9 +27,21 @@
> > > #include <winsock2.h>
> > > #include <ws2tcpip.h>
> > >
> > > -#define ff_neterrno() (-WSAGetLastError())
> > > -#define FF_NETERROR(err) (-WSA##err)
> > > -#define WSAEAGAIN WSAEWOULDBLOCK
> > > +static inline int ff_neterrno() {
> > > + int err = WSAGetLastError();
> > > + switch (err) {
> > > + case WSAEWOULDBLOCK:
> > > + return AVERROR(EAGAIN);
> > > + case WSAEINTR:
> > > + return AVERROR(EINTR);
> > > + }
> > > + return -err;
> > > +}
> > > +
> > > +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
> > > +#define ETIMEDOUT WSAETIMEDOUT
> > > +#define ECONNREFUSED WSAECONNREFUSED
> > > +#define EINPROGRESS WSAEINPROGRESS
> >
> > Are we certain these are never defined on Windows, or should they have
> > some ifdefs? Also, a little vertical alignment wouldn't hurt.
>
> I guess you never can be certain, but they don't exist in neither mingw32
> nor in Visual Studio. (mingw64 seems to have them defined, mapping to the
> WSAE* codes just as we do, but within #if 0.) If they later turn out to be
> defined in some platform update, we can always add ifdefs around them and
> add mapping in ff_neterrno() for them.
>
> Aligned them vertically at least, and moved them up above ff_neterrno(),
> which would be needed if we later will have to remap them.
And this time featuring the actual attachment...
// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libavformat-Remove-FF_NETERRNO.patch
Type: text/x-diff
Size: 13054 bytes
Desc:
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110222/a5a8582b/attachment.patch>
More information about the ffmpeg-devel
mailing list