Message ID | 1510736658-31312-1-git-send-email-zhong.li@intel.com |
---|---|
State | New |
Headers | show |
2017-11-15 10:04 GMT+01:00 Zhong Li <zhong.li@intel.com>: > fix the compiling warning of "ignoring return value" > - ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); > - ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); > + if ((ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats)) < 0) > + return ret; > + if ((ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats)) < 0) Two additional lines are cheap. Carl Eugen
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf > Of Carl Eugen Hoyos > Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavf/qsv_vpp: fix compiling warning > > 2017-11-15 10:04 GMT+01:00 Zhong Li <zhong.li@intel.com>: > > fix the compiling warning of "ignoring return value" > > > - ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); > > - ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); > > + if ((ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats)) < 0) > > + return ret; > > + if ((ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats)) < > 0) > > Two additional lines are cheap. Just don't like any compiling warnings which may have potential issues just like this one. Personally speaking, I prefer to clear most of FFmpeg compiling warnings. > > Carl Eugen > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavf/qsv_vpp: fix compiling warning > > > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On > Behalf > > Of Carl Eugen Hoyos > > Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavf/qsv_vpp: fix compiling > > warning > > > > 2017-11-15 10:04 GMT+01:00 Zhong Li <zhong.li@intel.com>: > > > fix the compiling warning of "ignoring return value" > > > > > - ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); > > > - ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); > > > + if ((ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats)) < > 0) > > > + return ret; > > > + if ((ret = ff_formats_ref(out_fmts, > > > + &ctx->outputs[0]->in_formats)) < > > 0) > > > > Two additional lines are cheap. > > Just don't like any compiling warnings which may have potential issues just > like this one. > Personally speaking, I prefer to clear most of FFmpeg compiling warnings. Sorry, I may misunderstood due to miss some history discussion, here you mean should be coding style making code clearer, right? Just like this: "ret = ff_formats_ref(); if (ret < 0) return ret;" Please correct me if I am wrong.
2017-11-17 6:52 GMT+01:00 Li, Zhong <zhong.li@intel.com>: >> > 2017-11-15 10:04 GMT+01:00 Zhong Li <zhong.li@intel.com>: >> > > fix the compiling warning of "ignoring return value" >> > >> > > - ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); >> > > - ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); >> > > + if ((ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats)) >> > > < 0) >> > > + return ret; >> > > + if ((ret = ff_formats_ref(out_fmts, >> > > + &ctx->outputs[0]->in_formats)) < >> > 0) >> > >> > Two additional lines are cheap. >> >> Just don't like any compiling warnings which may have potential issues >> just like this one. >> Personally speaking, I prefer to clear most of FFmpeg compiling warnings. > > Sorry, I may misunderstood due to miss some history discussion, here you > mean should be coding style making code clearer, right? Just like this: > "ret = ff_formats_ref(); > if (ret < 0) return ret;" Yes, this is more readable. Thank you, Carl Eugen
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf > Of Carl Eugen Hoyos > Sent: Friday, November 17, 2017 6:06 PM > To: FFmpeg development discussions and patches > <ffmpeg-devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavf/qsv_vpp: fix compiling warning > > 2017-11-17 6:52 GMT+01:00 Li, Zhong <zhong.li@intel.com>: > > >> > 2017-11-15 10:04 GMT+01:00 Zhong Li <zhong.li@intel.com>: > >> > > fix the compiling warning of "ignoring return value" > >> > > >> > > - ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); > >> > > - ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); > >> > > + if ((ret = ff_formats_ref(in_fmts, > >> > > + &ctx->inputs[0]->out_formats)) > >> > > < 0) > >> > > + return ret; > >> > > + if ((ret = ff_formats_ref(out_fmts, > >> > > + &ctx->outputs[0]->in_formats)) < > >> > 0) > >> > > >> > Two additional lines are cheap. > >> > >> Just don't like any compiling warnings which may have potential > >> issues just like this one. > >> Personally speaking, I prefer to clear most of FFmpeg compiling warnings. > > > > Sorry, I may misunderstood due to miss some history discussion, here > > you mean should be coding style making code clearer, right? Just like this: > > "ret = ff_formats_ref(); > > if (ret < 0) return ret;" > > Yes, this is more readable. > > Thank you, Carl Eugen Got it, thanks. Patches will be updated.
diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index eb2f1cc..bc059cc 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -332,6 +332,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) static int query_formats(AVFilterContext *ctx) { + int ret; AVFilterFormats *in_fmts, *out_fmts; static const enum AVPixelFormat in_pix_fmts[] = { AV_PIX_FMT_YUV420P, @@ -349,8 +350,10 @@ static int query_formats(AVFilterContext *ctx) in_fmts = ff_make_format_list(in_pix_fmts); out_fmts = ff_make_format_list(out_pix_fmts); - ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); - ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); + if ((ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats)) < 0) + return ret; + if ((ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats)) < 0) + return ret; return 0; }
fix the compiling warning of "ignoring return value" Signed-off-by: Zhong Li <zhong.li@intel.com> --- libavfilter/vf_vpp_qsv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)