From 12d534bada0a5e091e2b1c3cc4046cea62540595 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 26 Jun 2019 17:05:04 +0530 Subject: [PATCH] video-color: Add compile-time assert for ColorimetryInfo enum A comment is not sufficient because this will break when cherry-picking or backporting commits. --- gst-libs/gst/video/video-color.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst-libs/gst/video/video-color.c b/gst-libs/gst/video/video-color.c index e49a412c01..a25f3ffe1c 100644 --- a/gst-libs/gst/video/video-color.c +++ b/gst-libs/gst/video/video-color.c @@ -80,6 +80,10 @@ static const ColorimetryInfo colorimetry[] = { MAKE_COLORIMETRY (NONAME, _UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN), }; +/* Ensure that DEFAULT_UNKNOWN is indeed updated */ +G_STATIC_ASSERT (sizeof (colorimetry) == + (sizeof (gchar *) + sizeof (GstVideoColorimetry)) * (DEFAULT_UNKNOWN + 1)); + static const ColorimetryInfo * gst_video_get_colorimetry (const gchar * s) {