[FFmpeg-devel] [PATCHv2 1/4] avfilter/all: check and propagate the return code of av_expr_parse_and_eval
Michael Niedermayer
michael at niedermayer.cc
Sun Nov 1 23:20:30 CET 2015
On Sun, Nov 01, 2015 at 04:16:18PM -0500, Ganesh Ajjanagadde wrote:
> On Sun, Nov 1, 2015 at 3:45 PM, Nicolas George <george at nsup.org> wrote:
> > Le primidi 11 brumaire, an CCXXIV, Ganesh Ajjanagadde a écrit :
> >> This function can return ENOMEM that needs to be propagated.
> >>
> >> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> >> ---
> >> libavfilter/vf_pad.c | 12 +++++++-----
> >> libavfilter/vf_rotate.c | 5 +++--
> >> libavfilter/vf_scale.c | 5 +++--
> >> libavfilter/vf_zscale.c | 5 +++--
> >> 4 files changed, 16 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
> >> index 63dc6a8..a40f5fa 100644
> >> --- a/libavfilter/vf_pad.c
> >> +++ b/libavfilter/vf_pad.c
> >> @@ -114,9 +114,10 @@ static int config_input(AVFilterLink *inlink)
> >> var_values[VAR_VSUB] = 1 << s->draw.vsub_max;
> >>
> >> /* evaluate width and height */
> >> - av_expr_parse_and_eval(&res, (expr = s->w_expr),
> >> + if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr),
> >> var_names, var_values,
> >> - NULL, NULL, NULL, NULL, NULL, 0, ctx);
> >> + NULL, NULL, NULL, NULL, NULL, 0, ctx)) == AVERROR(ENOMEM))
> >> + goto eval_fail;
> >
> > I am quite unhappy about this, it is cluttering the code for no good reason
> > and makes the test fragile.
>
> The fragility is something I don't like either, suggestions?
less fragile could be ret < 0 && ret != the error code generated by NaN
i dont know what to do about the clutter or if this approuch makes
sense or if just droping the return warning for av_expr_parse_and_eval
would be better ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151101/5d3ba956/attachment.sig>
More information about the ffmpeg-devel
mailing list