gst-plugins-base: video.c: use g_assert_not_reached() for logical error here.

Tim-Philipp Müller t.i.m at zen.co.uk
Mon May 23 04:31:10 PDT 2011


On Mon, 2011-05-23 at 04:18 -0700, Stefan Kost wrote:

Hi,

> Module: gst-plugins-base
> Branch: master
> Commit: 40273cf2d3bb9966d942f34735cf56537b5bed43
> URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=40273cf2d3bb9966d942f34735cf56537b5bed43
> 
> Author: Stefan Kost <ensonic at users.sf.net>
> Date:   Mon May 23 13:49:01 2011 +0300
> 
> video.c: use g_assert_not_reached() for logical error here.
> 
> This will help to detect them closer to the source if they ever happen.
>
> diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c
> index 1cceec5..db61f54 100644
> --- a/gst-libs/gst/video/video.c
> +++ b/gst-libs/gst/video/video.c
> @@ -658,10 +658,10 @@ gst_video_format_new_caps_raw (GstVideoFormat format)
>            blue_mask = GST_VIDEO_COMP1_MASK_15_INT;
>            break;
>          default:
> -          return NULL;
> +          g_assert_not_reached ();
>        }
>      } else if (bpp != 8) {
> -      return NULL;
> +      g_assert_not_reached ();
>      }
>  
>      caps = gst_caps_new_simple ("video/x-raw-rgb",

Before you do more of these, please keep in mind that we compile
releases with -DG_DISABLE_ASSERT now (you added that I think), which
means that replacing such returns with asserts may generate 'variable
may be used uninitialized' compiler warnings later.

 Cheers
  -Tim




More information about the gstreamer-devel mailing list