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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Tim-Philipp Müller-2
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 <[hidden email]>
> 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


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Stefan Kost-2
Am 23.05.2011 14:31, schrieb Tim-Philipp Müller:

> 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 <[hidden email]>
>> 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.

I think I have carefully checked this case. Which variable do you think can be
left uninitialized?

Stefan

>
>  Cheers
>   -Tim
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel