Avoid mixing declarations and code

Mixing declarations and code causes problems for MSVC as it is a C99
feature so we should try to avoid it.
This commit is contained in:
Neil Roberts 2010-10-25 13:08:52 +01:00
parent 66680d22f8
commit 371e6bd47c
2 changed files with 11 additions and 2 deletions

View File

@ -290,12 +290,14 @@ void
_cogl_gl_use_program_wrapper (CoglHandle program_handle) _cogl_gl_use_program_wrapper (CoglHandle program_handle)
{ {
#ifdef COGL_MATERIAL_BACKEND_GLSL #ifdef COGL_MATERIAL_BACKEND_GLSL
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
#ifndef HAVE_COGL_GLES2 #ifndef HAVE_COGL_GLES2
CoglProgram *program = (CoglProgram *)program_handle; CoglProgram *program = (CoglProgram *)program_handle;
GLuint gl_program; GLuint gl_program;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (program_handle != COGL_INVALID_HANDLE) if (program_handle != COGL_INVALID_HANDLE)
gl_program = program->gl_handle; gl_program = program->gl_handle;
else else
@ -322,9 +324,14 @@ _cogl_gl_use_program_wrapper (CoglHandle program_handle)
GE (glUseProgram (0)); GE (glUseProgram (0));
ctx->current_gl_program = gl_program; ctx->current_gl_program = gl_program;
#else /* HAVE_COGL_GLES2 */ #else /* HAVE_COGL_GLES2 */
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
ctx->drv.gles2.settings.user_program = program_handle; ctx->drv.gles2.settings.user_program = program_handle;
ctx->drv.gles2.settings_dirty = TRUE; ctx->drv.gles2.settings_dirty = TRUE;
#endif /* HAVE_COGL_GLES2 */ #endif /* HAVE_COGL_GLES2 */
#endif #endif

View File

@ -5578,8 +5578,10 @@ dump_material_cb (CoglMaterialNode *node, void *user_data)
if (material->differences & COGL_MATERIAL_STATE_BLEND) if (material->differences & COGL_MATERIAL_STATE_BLEND)
{ {
changes = TRUE;
const char *blend_enable_name; const char *blend_enable_name;
changes = TRUE;
switch (material->blend_enable) switch (material->blend_enable)
{ {
case COGL_MATERIAL_BLEND_ENABLE_AUTOMATIC: case COGL_MATERIAL_BLEND_ENABLE_AUTOMATIC: