diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2013-09-09 04:51:22 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-09 04:03:57 +0200 |
commit | e15fbd5e8c13afb0cb9b70bf1270786672083d15 (patch) | |
tree | eeec9e1696c38288e5e02ac8350ea7e6dbd7c490 /src/opengl | |
parent | 115da758b9ea3195dfd35c672caee05e9cc90038 (diff) |
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>
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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 |