[FFmpeg-devel] new warning in libavcodec/dv.c
Roman V. Shaposhnik
rvs
Thu Feb 19 23:26:46 CET 2009
On Thu, 2009-02-19 at 13:20 +0200, Dominique Leuenberger wrote:
> Hi,
>
> this code snipet produces a new warning (especially on newer compilers):
>
> static av_always_inline int dv_guess_dct_mode(DVVideoContext *s,
> uint8_t *data, int linesize) {
> if (s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) {
> int ps = s->ildct_cmp(NULL, data, NULL, linesize, 8) - 400;
> if (ps > 0) {
> int is = s->ildct_cmp(NULL, data , NULL,
> linesize<<1, 4) +
> s->ildct_cmp(NULL, data + linesize, NULL,
> linesize<<1, 4);
> return (ps > is);
> }
> } else
> return 0;
> }
> The 'issue' is reaching a non-void function without returning a value.
> At first sight, of course you would say this is nonsense and a wrong
> warning by the compiler, but by looking closer you can see that the
> compiler is right:
>
> in case of the nested if (ps > 0) not being evaluated to true, no
> return value is specified. the 'final' else is never reached. and thus
> no return value given at all.
>
> I think the 'simplest' solution would be to just drop the else and
> have return 0; unconditional happening at the end. On the other hand
> I'm not sure if this is what it is supposed to do.
It is. I'll fix it in a moment. Sorry for the trouble.
Thanks,
Roman.
More information about the ffmpeg-devel
mailing list