[FFmpeg-devel] [PATCH] watermark.c: void function returning value of void function

Måns Rullgård mans
Sun May 13 14:52:21 CEST 2007


Reimar Doeffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:

> Hello,
> maybe this actually is valid C, but at the least it is confusing, and
> some C compilers won't accept it (though that does not say much, it is
> the Sun C compiler and it sure does have its share of bugs...)
> Okay to apply?
>
> Index: vhook/watermark.c
> ===================================================================
> --- vhook/watermark.c	(revision 9014)
> +++ vhook/watermark.c	(working copy)
> @@ -435,9 +435,9 @@
>  {
>      ContextInfo *ci = (ContextInfo *) ctx;
>      if (1 == ci->mode) {
> -        return Process1(ctx, picture, pix_fmt, src_width, src_height, pts);
> +        Process1(ctx, picture, pix_fmt, src_width, src_height, pts);
>      } else {
> -        return Process0(ctx, picture, pix_fmt, src_width, src_height, pts);
> +        Process0(ctx, picture, pix_fmt, src_width, src_height, pts);
>      }
>  }

OK.

The C99 standard has this to say:

  A return statement with an expression shall not appear in a function
  whose return type is void. A return statement without an expression
  shall only appear in a function whose return type is void.

The return type of the Process() (which you are changing) is void, so
the return statement shall not have an expression, even if that
expression has type void.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list