[FFmpeg-devel] [patch] libswscale: fix warning regarding "no return in non void function"

Michael Niedermayer michaelni
Fri Apr 23 02:26:48 CEST 2010


On Thu, Apr 22, 2010 at 08:48:52PM +0300, Dominique Leuenberger wrote:
> In libswscale, in case HAVE_7REGS is not defined to true, there are two 
> functions that result in empty code blocks.
>
> And as a consequence, the compiler warns about no return value in a non 
> void function.
>
> The attached patch fixes this by:
> - Moving the #if HAVE_7REGS out of the function declaraion (meaning the 
> function does not exist at all if we do not HAVE_7REGS.
> - Change some logic to not call the functions if they would not return 
> useful result anyway.
>
> I would be grateful if somebody could review this patch and apply it, if 
> considered useful.
>
> Best regards,
> Dominique, aka DimStar

>  yuv2rgb_mmx.c      |   16 ++++++++++++----
>  yuv2rgb_template.c |    8 ++++----
>  2 files changed, 16 insertions(+), 8 deletions(-)
> 01d13f420cda9526ad09602f4234d923f1152fec  ffmpeg-libswscale.patch
> diff -ur ffmpeg-0.5/libswscale/x86/yuv2rgb_mmx.c ffmpeg-0.5.dev/libswscale/x86/yuv2rgb_mmx.c
> --- ffmpeg-0.5/libswscale/x86/yuv2rgb_mmx.c	2010-04-21 09:40:20.000000000 +0200
> +++ ffmpeg-0.5.dev/libswscale/x86/yuv2rgb_mmx.c	2010-04-22 08:13:46.000000000 +0200
> @@ -64,12 +64,16 @@
>          switch (c->dstFormat) {
>          case PIX_FMT_RGB32:
>              if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
> -                if (HAVE_7REGS) return yuva420_rgb32_MMX2;
> +#if HAVE_7REGS
> +                return yuva420_rgb32_MMX2;
> +#endif
>                  break;

i dont like #ifdefery, the code before was cleaner

besides iam seeing "ffmpeg-0.5" in your directory path, you arent
submitting a patch against 0.5 are you?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100423/17ea3904/attachment.pgp>



More information about the ffmpeg-devel mailing list