[FFmpeg-devel] [PATCH] deals with code that has no effect when executed

Reimar Döffinger Reimar.Doeffinger
Thu May 29 20:20:27 CEST 2008


On Thu, May 29, 2008 at 10:57:22AM -0700, Erik Hovland wrote:
> All of the memset calls rely on the compiler to sizeof the array. If
> a compiler does this then it is outside of the C standard.

I'd really like a citation of the C standard for that claim...

> --- a/ffserver.c
> +++ b/ffserver.c
> @@ -1611,7 +1611,7 @@ static void compute_stats(HTTPContext *c)
>      url_fprintf(pb, "\r\n");
>  
>      url_fprintf(pb, "<HEAD><TITLE>FFServer Status</TITLE>\n");
> -    if (c->stream->feed_filename)
> +    if (strlen(c->stream->feed_filename) > 0)

if (c->stream->feed_filename[0])

> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index effe699..740afec 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -290,15 +290,16 @@ int udp_set_remote_url(URLContext *h, const char *uri)
>  {
>      UDPContext *s = h->priv_data;
>      char hostname[256];
> -    int port;
> +    int port, addr_len = 0;
>  
>      url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
>  
>      /* set the destination address */
> -    s->dest_addr_len = udp_set_url(&s->dest_addr, hostname, port);
> -    if (s->dest_addr_len < 0) {
> +    addr_len = udp_set_url(&s->dest_addr, hostname, port);
> +    if (addr_len < 0) {
>          return AVERROR(EIO);
>      }
> +    s->dest_addr_len = addr_len;

Useless initialization of addr_len.




More information about the ffmpeg-devel mailing list