From db5ad06a346774a249b22797e660d55bde0d9571 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 12 Sep 2020 23:10:59 +0000 Subject: glxgears / wglgears: avoid C99 "for" without explicit -std= GCC < 5 defaults to -std=gnu89, failing to build: glxgears.c: In function 'init': glxgears.c:413: error: 'for' loop initial declaration used outside C99 mode Fixes: 8c73555b4dd5 ("glxgears / wglgears: adjust colors for sRGB") Reviewed-by: Erik Faye-Lund --- src/wgl/wglgears.c | 3 ++- src/xdemos/glxgears.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wgl/wglgears.c b/src/wgl/wglgears.c index 85391273..437bda0d 100644 --- a/src/wgl/wglgears.c +++ b/src/wgl/wglgears.c @@ -293,6 +293,7 @@ init(void) static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 }; static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 }; static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; + int i; glLightfv(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); @@ -300,7 +301,7 @@ init(void) glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); if (use_srgb) { - for (int i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { red[i] = srgb_to_linear(red[i]); green[i] = srgb_to_linear(green[i]); blue[i] = srgb_to_linear(blue[i]); diff --git a/src/xdemos/glxgears.c b/src/xdemos/glxgears.c index dc6cee72..12d31b8d 100644 --- a/src/xdemos/glxgears.c +++ b/src/xdemos/glxgears.c @@ -403,6 +403,7 @@ init(void) static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 }; static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 }; static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; + int i; glLightfv(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); @@ -410,7 +411,7 @@ init(void) glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); if (use_srgb) { - for (int i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { red[i] = srgb_to_linear(red[i]); green[i] = srgb_to_linear(green[i]); blue[i] = srgb_to_linear(blue[i]); -- cgit v1.2.3