cogl-context-winsys: Avoid zero-length arrays

When compiling for non-glx platforms the winsys feature data array
ends up empty. Empty arrays cause problems for MSVC so this patch adds
a stub entry so that the array always has at least one entry.

Based on a patch by Ole André Vadla Ravnås
This commit is contained in:
Neil Roberts 2010-10-25 13:15:01 +01:00
parent f1752ff3ba
commit cc7977988c

View File

@ -60,8 +60,14 @@
static const CoglFeatureData cogl_winsys_feature_data[] =
{
#include "cogl-winsys-feature-functions.h"
/* This stub is just here so that if the header is empty then we
won't end up declaring an empty array */
{ 0, }
};
#define COGL_WINSYS_N_FEATURES (G_N_ELEMENTS (cogl_winsys_feature_data) - 1)
static const char *
_cogl_get_winsys_extensions (void)
{
@ -81,7 +87,7 @@ _cogl_winsys_features_init (CoglContext *context)
const char *extensions = _cogl_get_winsys_extensions ();
int i;
for (i = 0; i < G_N_ELEMENTS (cogl_winsys_feature_data); i++)
for (i = 0; i < COGL_WINSYS_N_FEATURES; i++)
if (_cogl_feature_check ("GLX", cogl_winsys_feature_data + i, 0, 0,
extensions))
flags |= cogl_winsys_feature_data[i].feature_flags;