[FFmpeg-devel] [PATCH] do not memset for a size of 0

Reimar Döffinger Reimar.Doeffinger
Tue Oct 27 15:07:35 CET 2009


On Mon, Oct 12, 2009 at 06:34:33PM +0200, Benoit Fouet wrote:
> On 2009-10-12 18:26, Reimar D?ffinger wrote:
> > On Mon, Oct 12, 2009 at 05:20:15PM +0200, Benoit Fouet wrote:
> >> Hi,
> >>
> >> the following patch fixes the linker warning:
> >> /home/hack/ffmpeg/ffmpeg_x86/libavcodec/libavcodec.a(pcx.o): In function
> >> `memset':
> >>
> >>
> >> /usr/include/bits/string3.h:82: warning: memset used with constant zero
> >> length parameter; this could be due to transposed parameters
> >>
> >> Index: libavcodec/pcx.c
> >> ===================================================================
> >> --- libavcodec/pcx.c    (revision 20209)
> >> +++ libavcodec/pcx.c    (working copy)
> >> @@ -71,6 +71,7 @@ static void pcx_palette(const uint8_t **
> >>
> >>      for (i=0; i<pallen; i++)
> >>          *dst++ = bytestream_get_be24(src);
> >> +    if (256 - pallen)
> >>      memset(dst, 0, (256 - pallen) * sizeof(*dst));
> >>  }
> > 
> > I think it is a good idea, but
> > if (pallen < 256)
> > IMO is more readable.
> 
> indeed :)
> 
> Index: pcx.c
> ===================================================================
> --- pcx.c	(revision 20209)
> +++ pcx.c	(working copy)
> @@ -71,6 +71,7 @@ static void pcx_palette(const uint8_t **
> 
>      for (i=0; i<pallen; i++)
>          *dst++ = bytestream_get_be24(src);
> +    if (pallen < 256)
>      memset(dst, 0, (256 - pallen) * sizeof(*dst));
>  }

Please apply, this has been around long enough.



More information about the ffmpeg-devel mailing list