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 <thiago.macieira@intel.com>
bb10
Konstantin Ritt 2013-09-09 04:51:22 +03:00 committed by The Qt Project
parent 115da758b9
commit e15fbd5e8c
1 changed files with 4 additions and 4 deletions

View File

@ -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