Avoid C99 to fix compilation with compilers like MSVC.

This commit is contained in:
Ole André Vadla Ravnås 2009-06-16 22:29:21 +02:00 committed by Neil Roberts
parent ab5a10768c
commit f61f66c6fe
3 changed files with 19 additions and 13 deletions

View File

@ -68,9 +68,9 @@ typedef enum _ParserArgState
#define DEFINE_COLOR_SOURCE(NAME, NAME_LEN) \ #define DEFINE_COLOR_SOURCE(NAME, NAME_LEN) \
{.type = COGL_BLEND_STRING_COLOR_SOURCE_ ## NAME, \ {/*.type = */COGL_BLEND_STRING_COLOR_SOURCE_ ## NAME, \
.name = #NAME, \ /*.name = */#NAME, \
.name_len = NAME_LEN} /*.name_len = */NAME_LEN}
static CoglBlendStringColorSourceInfo blending_color_sources[] = { static CoglBlendStringColorSourceInfo blending_color_sources[] = {
DEFINE_COLOR_SOURCE (SRC_COLOR, 9), DEFINE_COLOR_SOURCE (SRC_COLOR, 9),
@ -87,18 +87,18 @@ static CoglBlendStringColorSourceInfo tex_combine_color_sources[] = {
}; };
static CoglBlendStringColorSourceInfo tex_combine_texture_n_color_source = { static CoglBlendStringColorSourceInfo tex_combine_texture_n_color_source = {
.type = COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE_N, /*.type = */COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE_N,
.name = "TEXTURE_N", /*.name = */"TEXTURE_N",
.name_len = 0 /*.name_len = */0
}; };
#undef DEFINE_COLOR_SOURCE #undef DEFINE_COLOR_SOURCE
#define DEFINE_FUNCTION(NAME, NAME_LEN, ARGC) \ #define DEFINE_FUNCTION(NAME, NAME_LEN, ARGC) \
{ .type = COGL_BLEND_STRING_FUNCTION_ ## NAME, \ { /*.type = */COGL_BLEND_STRING_FUNCTION_ ## NAME, \
.name = #NAME, \ /*.name = */#NAME, \
.name_len = NAME_LEN, \ /*.name_len = */NAME_LEN, \
.argc = ARGC } /*.argc = */ARGC }
/* NB: These must be sorted so any name that's a subset of another /* NB: These must be sorted so any name that's a subset of another
* comes later than the longer name. */ * comes later than the longer name. */

View File

@ -1269,9 +1269,11 @@ void
cogl_rectangles (const float *verts, cogl_rectangles (const float *verts,
guint n_rects) guint n_rects)
{ {
struct _CoglMutiTexturedRect rects[n_rects]; struct _CoglMutiTexturedRect *rects;
int i; int i;
rects = g_alloca (n_rects * sizeof (struct _CoglMutiTexturedRect));
for (i = 0; i < n_rects; i++) for (i = 0; i < n_rects; i++)
{ {
rects[i].x_1 = verts[i * 4]; rects[i].x_1 = verts[i * 4];
@ -1289,9 +1291,11 @@ void
cogl_rectangles_with_texture_coords (const float *verts, cogl_rectangles_with_texture_coords (const float *verts,
guint n_rects) guint n_rects)
{ {
struct _CoglMutiTexturedRect rects[n_rects]; struct _CoglMutiTexturedRect *rects;
int i; int i;
rects = g_alloca (n_rects * sizeof (struct _CoglMutiTexturedRect));
for (i = 0; i < n_rects; i++) for (i = 0; i < n_rects; i++)
{ {
rects[i].x_1 = verts[i * 8]; rects[i].x_1 = verts[i * 8];

View File

@ -729,11 +729,13 @@ cogl_read_pixels (int x,
GLint viewport[4]; GLint viewport[4];
GLint viewport_height; GLint viewport_height;
int rowstride = width * 4; int rowstride = width * 4;
guint8 temprow[rowstride]; guint8 *temprow;
g_return_if_fail (format == COGL_PIXEL_FORMAT_RGBA_8888); g_return_if_fail (format == COGL_PIXEL_FORMAT_RGBA_8888);
g_return_if_fail (source == COGL_READ_PIXELS_COLOR_BUFFER); g_return_if_fail (source == COGL_READ_PIXELS_COLOR_BUFFER);
temprow = g_alloca (rowstride * sizeof (guint8));
glGetIntegerv (GL_VIEWPORT, viewport); glGetIntegerv (GL_VIEWPORT, viewport);
viewport_height = viewport[3]; viewport_height = viewport[3];