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

Paul B Mahol onemda at gmail.com
Mon Aug 26 16:22:13 CEST 2013


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);
         }
     } else {
         bytestream2_get_buffer(gb, dst, bytes_per_scanline);
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list