From e15fbd5e8c13afb0cb9b70bf1270786672083d15 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 9 Sep 2013 04:51:22 +0300 Subject: Fix QtOpenGL module build with -Werror Build failed with error "array subscript is above array bounds [-Werror=array-bounds]" because GCC optimizes three inline calls and sees A[4][4] != A[16]. According to Thiago this may lead to an undefined behavior after all. Change-Id: I31ec01377d856890f6072369b3acd1f37e4118ab Reviewed-by: Thiago Macieira --- src/opengl/qgl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/opengl') diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3f496a4ffc..f1ce2cfae3 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4467,13 +4467,13 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con int width = d->glcx->device()->width(); int height = d->glcx->device()->height(); - GLdouble model[4][4], proj[4][4]; + GLdouble model[4 * 4], proj[4 * 4]; GLint view[4]; - glGetDoublev(GL_MODELVIEW_MATRIX, &model[0][0]); - glGetDoublev(GL_PROJECTION_MATRIX, &proj[0][0]); + glGetDoublev(GL_MODELVIEW_MATRIX, &model[0]); + glGetDoublev(GL_PROJECTION_MATRIX, &proj[0]); glGetIntegerv(GL_VIEWPORT, &view[0]); GLdouble win_x = 0, win_y = 0, win_z = 0; - qgluProject(x, y, z, &model[0][0], &proj[0][0], &view[0], + qgluProject(x, y, z, &model[0], &proj[0], &view[0], &win_x, &win_y, &win_z); win_y = height - win_y; // y is inverted -- cgit v1.2.3