summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/planets-qml/meshes
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-06-05 22:17:35 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-06-08 14:49:01 +0000
commite3cf1127ff1559fee159ebc2389f7449c07bc1be (patch)
treef4f9b971056b0baafe8e60c4e3dc34554a9d7417 /examples/qt3d/planets-qml/meshes
parentfeb8d2673c99df8a913b98e74027ab3cae5de8d5 (diff)
Graphics Helpers: fix use of fromUtf8(QByteArray)
Since Qt 5.5, the QByteArray overloads of QString::fromXXX() do no longer call strlen(arg.constData()), but use arg.size() as the length to use. This breaks brittle code like the one fixed there, which rely on the old behavior by creating QByteArrays with content where size() is larger than the actual contents. As a drive-by also fix the premature pessimization where a new temporary buffer was allocated on the heap each time through the loop. A buffer of automatic storage duration is the better choice. I note that the api docs for glGetActiveAttrib() do not suggest a fixed-size buffer, but calling glGetProgramiv with the value GL_ACTIVE_ATTRIBUTE_MAX_LENGTH to determine the required buffer size, but this is outside the scope of this patch. Also, instead of initializing the buffer with all-NULs, only force the last character in the array to NUL, and only because the following call to glGetAttribLocation() requires a NUL- terminated string. QString::fromUtf8() wouldn't care, because we pass the length explicitly. Change-Id: I17e746455fd5a2131728ce876b93efbbf2df53d9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/planets-qml/meshes')
0 files changed, 0 insertions, 0 deletions