[FFmpeg-devel] [PATCH] do not memset for a size of 0
Reimar Döffinger
Reimar.Doeffinger
Mon Oct 12 18:26:27 CEST 2009
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.
More information about the ffmpeg-devel
mailing list