changeset 6911:0e2576b1e753 libavcodec

Do not read from prior the array, fix CID 127.
author michael
date Tue, 27 May 2008 19:44:56 +0000
parents 67c615c7e19c
children 941a4e753961
files imgconvert.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/imgconvert.c	Tue May 27 16:50:48 2008 +0000
+++ b/imgconvert.c	Tue May 27 19:44:56 2008 +0000
@@ -407,16 +407,16 @@
 
 void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt)
 {
-    PixFmtInfo info= pix_fmt_info[pix_fmt];
-
-    char is_alpha_char= info.is_alpha ? 'y' : 'n';
-
     /* print header */
     if (pix_fmt < 0)
         snprintf (buf, buf_size,
                   "name      " " nb_channels" " depth" " is_alpha"
             );
-    else
+    else{
+        PixFmtInfo info= pix_fmt_info[pix_fmt];
+
+        char is_alpha_char= info.is_alpha ? 'y' : 'n';
+
         snprintf (buf, buf_size,
                   "%-10s" "      %1d     " "   %2d " "     %c   ",
                   info.name,
@@ -424,6 +424,7 @@
                   info.depth,
                   is_alpha_char
             );
+    }
 }
 
 int ff_fill_linesize(AVPicture *picture, int pix_fmt, int width)