diff opt.c @ 11801:026edf66e3a9 libavcodec

Make ff_parse_expr() and ff_parse_and_eval_expr() return an int containing an error code. Allow these functions to convey the reason of the failure to the calling function, failure which is not always due to a parsing error but it may depend for example on a memory problem. Also fix several potential memleaks.
author stefano
date Tue, 01 Jun 2010 08:07:07 +0000
parents c6368258b694
children e522dbf60abd
line wrap: on
line diff
--- a/opt.c	Mon May 31 22:01:31 2010 +0000
+++ b/opt.c	Tue Jun 01 08:07:07 2010 +0000
@@ -165,10 +165,10 @@
                 else if(!strcmp(buf, "none"   )) d= 0;
                 else if(!strcmp(buf, "all"    )) d= ~0;
                 else {
-                    d = ff_parse_and_eval_expr(buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
-                    if (isnan(d)){
+                    int res = ff_parse_and_eval_expr(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
+                    if (res < 0) {
                         av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
-                    return AVERROR(EINVAL);
+                        return res;
                     }
                 }
             }