diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-06-01 12:07:07 +0400 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-06-01 12:07:07 +0400 |
commit | 9ace13b416c77f15464fd8e1a024db8b00ce76f9 (patch) | |
tree | 0f2a306d39f556bd203b4381141f52ef35fa5d17 /libavcodec/opt.c | |
parent | 27241cbffe180fc92f9f519c6ea7957fc4b3b0c9 (diff) |
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.
Originally committed as revision 23402 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/opt.c')
-rw-r--r-- | libavcodec/opt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/opt.c b/libavcodec/opt.c index 24696e1280..8473d908bf 100644 --- a/libavcodec/opt.c +++ b/libavcodec/opt.c @@ -165,10 +165,10 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons 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; } } } |