[FFmpeg-devel] r22718 in libavformat/rtsp.c uses non-portable errno

Ronald S. Bultje rsbultje
Tue Apr 6 15:31:02 CEST 2010


Hi,

On Tue, Apr 6, 2010 at 2:59 AM, Martin Storsj? <martin at martin.st> wrote:
> On Sat, 3 Apr 2010, Ronald S. Bultje wrote:
>> Does anyone mind if we make FF_NETERROR() wrap AVERROR()?
>
> There's a few occurrances in at least tcp.c (probably in udp.c and some
> other places that deal directly with networking functions) that look like
> this:
>
> ? ? ? ?if (ff_neterrno() == FF_NETERROR(EINTR))
> ? ? ? ? ? ?goto redo;
>
> These would need to be adjusted accordingly if FF_NETERROR is changed.

OK, so I propose to change ff_neterrno() to return an AVERROR(). See attached.

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/network.h
===================================================================
--- ffmpeg-svn.orig/libavformat/network.h	2010-04-06 09:30:15.000000000 -0400
+++ ffmpeg-svn/libavformat/network.h	2010-04-06 09:30:29.000000000 -0400
@@ -27,8 +27,8 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 
-#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 <sys/types.h>
@@ -36,8 +36,8 @@
 #include <netinet/in.h>
 #include <netdb.h>
 
-#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
Index: ffmpeg-svn/libavformat/rtsp.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.c	2010-04-06 09:30:15.000000000 -0400
+++ ffmpeg-svn/libavformat/rtsp.c	2010-04-06 09:30:29.000000000 -0400
@@ -1692,7 +1692,7 @@
             }
 #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);
     }



More information about the ffmpeg-devel mailing list