mirror of
https://github.com/brl/mutter.git
synced 2025-01-12 04:34:40 +00:00
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:
parent
f1752ff3ba
commit
cc7977988c
@ -60,8 +60,14 @@
|
|||||||
static const CoglFeatureData cogl_winsys_feature_data[] =
|
static const CoglFeatureData cogl_winsys_feature_data[] =
|
||||||
{
|
{
|
||||||
#include "cogl-winsys-feature-functions.h"
|
#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 *
|
static const char *
|
||||||
_cogl_get_winsys_extensions (void)
|
_cogl_get_winsys_extensions (void)
|
||||||
{
|
{
|
||||||
@ -81,7 +87,7 @@ _cogl_winsys_features_init (CoglContext *context)
|
|||||||
const char *extensions = _cogl_get_winsys_extensions ();
|
const char *extensions = _cogl_get_winsys_extensions ();
|
||||||
int i;
|
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,
|
if (_cogl_feature_check ("GLX", cogl_winsys_feature_data + i, 0, 0,
|
||||||
extensions))
|
extensions))
|
||||||
flags |= cogl_winsys_feature_data[i].feature_flags;
|
flags |= cogl_winsys_feature_data[i].feature_flags;
|
||||||
|
Loading…
Reference in New Issue
Block a user