[FFmpeg-devel] [PATCH] pcm: use memset()

Michael Niedermayer michaelni at gmx.at
Mon Aug 26 17:02:38 CEST 2013


On Mon, Aug 26, 2013 at 02:22:13PM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavcodec/pcx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
> index 67bc839..366489b 100644
> --- a/libavcodec/pcx.c
> +++ b/libavcodec/pcx.c
> @@ -44,8 +44,8 @@ static void pcx_rle_decode(GetByteContext *gb,
>                  run   = value & 0x3f;
>                  value = bytestream2_get_byte(gb);
>              }
> -            while (i < bytes_per_scanline && run--)
> -                dst[i++] = value;
> +            memset(&dst[i], value, FFMIN(FFMAX(bytes_per_scanline - i, 0), run));
> +            i += FFMIN(FFMAX(bytes_per_scanline - i, 0), run);

FFMAX(bytes_per_scanline - i, 0)
looks wrong, as its unsigned, it will always be >= 0

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130826/c7ab2e70/attachment.asc>


More information about the ffmpeg-devel mailing list