[FFmpeg-devel] [PATCH 2/6] Improve error reporting.
Stefano Sabatini
stefano.sabatini-lala
Sun Jun 13 00:38:12 CEST 2010
---
libavutil/eval.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/libavutil/eval.c b/libavutil/eval.c
index cfe71e1..5506822 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -182,7 +182,7 @@ void av_free_expr(AVExpr *e)
static int parse_primary(AVExpr **e, Parser *p)
{
AVExpr *d = av_mallocz(sizeof(AVExpr));
- char *next= p->s;
+ char *s0, *s1, *next= p->s;
int ret, i;
if (!d)
@@ -209,9 +209,10 @@ static int parse_primary(AVExpr **e, Parser *p)
}
}
- p->s= strchr(p->s, '(');
+ s0 = p->s;
+ p->s = strchr(p->s, '(');
if (p->s==NULL) {
- av_log(p, AV_LOG_ERROR, "undefined constant or missing (\n");
+ av_log(p, AV_LOG_ERROR, "Undefined constant or missing '(' in '%s'\n", s0);
p->s= next;
av_free_expr(d);
return AVERROR(EINVAL);
@@ -219,10 +220,11 @@ static int parse_primary(AVExpr **e, Parser *p)
p->s++; // "("
if (*next == '(') { // special case do-nothing
av_freep(&d);
+ s1 = p->s;
if ((ret = parse_expr(&d, p)) < 0)
return ret;
if (p->s[0] != ')') {
- av_log(p, AV_LOG_ERROR, "missing )\n");
+ av_log(p, AV_LOG_ERROR, "Missing ')' in '%s'\n", s0);
av_free_expr(d);
return AVERROR(EINVAL);
}
@@ -230,6 +232,7 @@ static int parse_primary(AVExpr **e, Parser *p)
*e = d;
return 0;
}
+ s1 = p->s;
if ((ret = parse_expr(&(d->param[0]), p)) < 0) {
av_free_expr(d);
return ret;
@@ -239,7 +242,7 @@ static int parse_primary(AVExpr **e, Parser *p)
parse_expr(&d->param[1], p);
}
if (p->s[0] != ')') {
- av_log(p, AV_LOG_ERROR, "missing )\n");
+ av_log(p, AV_LOG_ERROR, "Missing ')' or too many args in '%s'\n", s0);
av_free_expr(d);
return AVERROR(EINVAL);
}
@@ -290,7 +293,7 @@ static int parse_primary(AVExpr **e, Parser *p)
}
}
- av_log(p, AV_LOG_ERROR, "unknown function\n");
+ av_log(p, AV_LOG_ERROR, "Unknown function in '%s'\n", s0);
av_free_expr(d);
return AVERROR(EINVAL);
}
--
1.7.1
More information about the ffmpeg-devel
mailing list