[FFmpeg-devel] [PATCH 1/6] libopenjpegenc: Replace numcomps check in libopenjpeg_copy_rgba() by assert() as it cannot be a different value.

Michael Niedermayer michaelni at gmx.at
Fri Nov 18 02:32:51 CET 2011


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/libopenjpegenc.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 737cd58..1a92d60 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -25,6 +25,7 @@
 */
 
 #include "libavutil/imgutils.h"
+#include "libavutil/avassert.h"
 #include "avcodec.h"
 #include "libavutil/intreadwrite.h"
 #define  OPJ_STATIC
@@ -186,9 +187,7 @@ static int libopenjpeg_copy_rgba(AVCodecContext *avctx, AVFrame *frame, opj_imag
     int x;
     int y;
 
-    if (numcomps != 1 && numcomps != 3 && numcomps != 4) {
-        return 0;
-    }
+    av_assert0(numcomps == 1 || numcomps == 3 || numcomps == 4);
 
     for (compno = 0; compno < numcomps; ++compno) {
         if (image->comps[compno].w > frame->linesize[0] / numcomps) {
-- 
1.7.4.1



More information about the ffmpeg-devel mailing list