On Mon, 9 Sep 2013, Diego Biurrun wrote:

On Tue, Aug 06, 2013 at 09:41:13AM +0200, Martin Storsjö  wrote:
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -238,11 +238,14 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
  * @param timeout  Polling timeout in milliseconds.
  * @param h        URLContext providing interrupt check
  *                 callback and logging context.
+ * @param will_try_next Whether the caller will try to connect to another
+ *                 address for the same host name, affecting the form of
+ *                 logged errors.
  * @return         0 on success, AVERROR on failure.
  */
 int ff_listen_connect(int fd, const struct sockaddr *addr,
                       socklen_t addrlen, int timeout,
-                      URLContext *h);
+                      URLContext *h, int will_try_next);

--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -100,7 +100,7 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
         }
     } else {
         if ((ret = ff_listen_connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
-                                     timeout * 100, h)) < 0) {
+                                     timeout * 100, h, cur_ai->ai_next)) < 0) {

libavformat/tcp.c: In function ‘tcp_open’:
libavformat/tcp.c:103:38: warning: passing argument 6 of ‘ff_listen_connect’ 
makes integer from pointer without a cast [enabled by default]

This new warning looks scary and I'm surprised this works ...

What's surprising about it? If I want to check whether a pointer is null or not, I do "if (foo)", I don't normally do "if (foo ? 1 : 0)". This is pretty much the same, but due to the different context it indeed isn't technically totally ok to do it like this.

However, if I had written it the right way originally I'm pretty sure someone would have asked me to simplify it to what we have right now. Nevertheless, fix patch coming up.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to