[FFmpeg-devel] Non-void function without return value
Mashiat Sarker Shakkhar
shahriman_ams at yahoo.com
Fri Dec 2 07:36:08 CET 2011
----- Original Message -----
> From: Dominique Leuenberger <dominique at leuenberger.net>
> To: ffmpeg-devel at ffmpeg.org
> Cc:
> Sent: Wednesday, November 30, 2011 8:07 PM
> Subject: [FFmpeg-devel] Non-void function without return value
>
> Hi everybody,
>
> While building current git master of ffmpeg, brp (Build Root policy)
> checker raises an error about a non-void function not returning a value.
>
> I: Program returns random data in a function
> E: ffmpeg no-return-in-nonvoid-function libavcodec/wmalosslessdec.c:322
>
> The function in question is:
>
> static int dump_int_buffer(int *buffer, int length, int delimiter)
> {
> int i;
>
> for (i=0 ; i<length ; i++) {
> if (!(i%delimiter))
> av_log(0, 0, "\n[%d] ", i);
> av_log(0, 0, "%d, ", buffer[i]);
> }
> av_log(0, 0, "\n");
>
> }
>
> So, yes, the bro check is right (and the compiler spits a warning).
> Unfortunately, from this code snip, I'm not even sure if it needs to
> return a value at all, likely not:
>
> The usage of the function happens (in the same source file) in the
> function
> static int decode_channel_residues(WmallDecodeCtx *s, int ch, int
> tile_size) and it is simply called as
>
> static int decode_channel_residues(WmallDecodeCtx *s, int ch, int
> tile_size
>
> => Thus, implying that void would be a perfect valid prototype for this
> function. But maybe there are plans for the future.
>
That is a work-in-progress which I earlier resisted merging into FFmpeg
codebase. That function is only useful for debugging purpose and has no
place in the finished working decoder.
And yes, the function is not intended to return a value. It simply takes
an integer buffer and dumps it to stdout.
> Best regards,
> Dominique
>
More information about the ffmpeg-devel
mailing list