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

Paul B Mahol onemda at gmail.com
Mon Aug 26 17:16:47 CEST 2013


On 8/26/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> 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

Why it is unsigned at all.... changed locally.
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The worst form of inequality is to try to make unequal things equal.
> -- Aristotle
>


More information about the ffmpeg-devel mailing list