[FFmpeg-soc] [soc]: r4056 - libavfilter/vf_format.c

stefano subversion at mplayerhq.hu
Mon Feb 16 21:53:50 CET 2009


Author: stefano
Date: Mon Feb 16 21:53:50 2009
New Revision: 4056

Log:
Introduce a len variable, improve readability and help the following
refactoring.

Modified:
   libavfilter/vf_format.c

Modified: libavfilter/vf_format.c
==============================================================================
--- libavfilter/vf_format.c	Mon Feb 16 21:50:29 2009	(r4055)
+++ libavfilter/vf_format.c	Mon Feb 16 21:53:50 2009	(r4056)
@@ -35,19 +35,20 @@ static av_cold int init(AVFilterContext 
     FormatContext *format = ctx->priv;
     const char *cur, *sep;
     char name[32];
-    int fmt;
+    int fmt, len;
 
     /* parse the list of formats */
     for(cur = args; cur; cur = sep) {
         if(!(sep = strchr(cur, ':')))
             fmt = avcodec_get_pix_fmt(cur);
         else {
-            if(sep-cur > 32) {
+            len = sep - cur;
+            if(len > 32) {
                 av_log(ctx, AV_LOG_ERROR, "format name too long\n");
                 return -1;
             }
-            memcpy(name, cur, sep-cur);
-            name[sep-cur] = 0;
+            memcpy(name, cur, len);
+            name[len] = 0;
             fmt = avcodec_get_pix_fmt(name);
             sep ++;
         }



More information about the FFmpeg-soc mailing list