diff options
author | Jan Beich <jbeich@FreeBSD.org> | 2020-09-12 23:10:59 +0000 |
---|---|---|
committer | Jan Beich <jbeich@FreeBSD.org> | 2020-09-15 18:12:46 +0000 |
commit | db5ad06a346774a249b22797e660d55bde0d9571 (patch) | |
tree | a38f50c453f22b4889b9fab56ddc9b0ace2dbbb0 | |
parent | 846ec9bf933df27c2484bce550934b75830168d2 (diff) |
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 <erik.faye-lund@collabora.com>
-rw-r--r-- | src/wgl/wglgears.c | 3 | ||||
-rw-r--r-- | 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]); |