[FFmpeg-devel] [PATCH 5/7] avformat/udp: dont mix integers with pointers

Michael Niedermayer michaelni at gmx.at
Sat Aug 16 15:59:57 CEST 2014


On Sat, Aug 16, 2014 at 03:00:32PM +0200, James Darnley wrote:
> On 2014-08-16 01:15, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavformat/udp.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavformat/udp.c b/libavformat/udp.c
> > index a8baa5b..8412eeb 100644
> > --- a/libavformat/udp.c
> > +++ b/libavformat/udp.c
> > @@ -313,7 +313,7 @@ static int udp_set_url(struct sockaddr_storage *addr,
> >      int addr_len;
> >  
> >      res0 = udp_resolve_host(hostname, port, SOCK_DGRAM, AF_UNSPEC, 0);
> > -    if (res0 == 0) return AVERROR(EIO);
> > +    if (!res0) return AVERROR(EIO);
> >      memcpy(addr, res0->ai_addr, res0->ai_addrlen);
> >      addr_len = res0->ai_addrlen;
> >      freeaddrinfo(res0);
> 
> fine
> 
> > @@ -332,7 +332,7 @@ static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,
> >          family = ((struct sockaddr *) &s->dest_addr)->sa_family;
> >      res0 = udp_resolve_host(localaddr[0] ? localaddr : NULL, s->local_port,
> >                              SOCK_DGRAM, family, AI_PASSIVE);
> > -    if (res0 == 0)
> > +    if (!res0)
> >          goto fail;
> >      for (res = res0; res; res=res->ai_next) {
> >          udp_fd = ff_socket(res->ai_family, SOCK_DGRAM, 0);
> > 
> 
> also fine.

applied


> 
> Plus you might be able to get rid of the assignment to NULL at the start
> of this function (I don't know what best coding practice says should be
> done here).

removed assignment

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140816/11dc4583/attachment.asc>


More information about the ffmpeg-devel mailing list