video-color: Add compile-time assert for ColorimetryInfo enum
authorNirbheek Chauhan <nirbheek@centricular.com>
Wed, 26 Jun 2019 11:35:04 +0000 (17:05 +0530)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 10 Aug 2019 12:35:03 +0000 (13:35 +0100)
A comment is not sufficient because this will break when
cherry-picking or backporting commits.

gst-libs/gst/video/video-color.c

index e2cac82..96461f5 100644 (file)
@@ -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)
 {