Message ID | 1378715396-81785-1-git-send-email-martin@martin.st |
---|---|
State | Committed |
Headers | show |
On 09/09/13 10:29, Martin Storsjö wrote: > This fixes warnings in some compiler versions, and avoids the > theoretical case where the lower 32 bits of the pointer would all > be zero where the implicit cast wouldn't give the right result. > --- > libavformat/tcp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavformat/tcp.c b/libavformat/tcp.c > index 39065aa..837d0fd 100644 > --- a/libavformat/tcp.c > +++ b/libavformat/tcp.c > @@ -100,7 +100,8 @@ 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, cur_ai->ai_next)) < 0) { > + timeout * 100, h, > + cur_ai->ai_next ? 1 : 0)) < 0) { > > if (ret == AVERROR_EXIT) > goto fail1; > ok
On 09/09/13 10:29, Martin Storsjö wrote: > This fixes warnings in some compiler versions, and avoids the > theoretical case where the lower 32 bits of the pointer would all > be zero where the implicit cast wouldn't give the right result. > --- > libavformat/tcp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavformat/tcp.c b/libavformat/tcp.c > index 39065aa..837d0fd 100644 > --- a/libavformat/tcp.c > +++ b/libavformat/tcp.c > @@ -100,7 +100,8 @@ 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, cur_ai->ai_next)) < 0) { > + timeout * 100, h, > + cur_ai->ai_next ? 1 : 0)) < 0) { > Better using !! maybe. lu
On Mon, 9 Sep 2013, Luca Barbato wrote: > On 09/09/13 10:29, Martin Storsjö wrote: >> This fixes warnings in some compiler versions, and avoids the >> theoretical case where the lower 32 bits of the pointer would all >> be zero where the implicit cast wouldn't give the right result. >> --- >> libavformat/tcp.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/libavformat/tcp.c b/libavformat/tcp.c >> index 39065aa..837d0fd 100644 >> --- a/libavformat/tcp.c >> +++ b/libavformat/tcp.c >> @@ -100,7 +100,8 @@ 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, cur_ai->ai_next)) < 0) { >> + timeout * 100, h, >> + cur_ai->ai_next ? 1 : 0)) < 0) { >> > > Better using !! maybe. What do others prefer, this or the other style? // Martin
diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 39065aa..837d0fd 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -100,7 +100,8 @@ 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, cur_ai->ai_next)) < 0) { + timeout * 100, h, + cur_ai->ai_next ? 1 : 0)) < 0) { if (ret == AVERROR_EXIT) goto fail1;