diff options
author | Sergio Martins <sergio.martins@kdab.com> | 2017-05-19 19:44:52 +0100 |
---|---|---|
committer | Sérgio Martins <sergio.martins@kdab.com> | 2017-05-19 18:57:34 +0000 |
commit | 1d024678ba16dd979a8c7023b35cdc76db357d37 (patch) | |
tree | 26ab881289eb2d65b336115b7a69a927571082e8 | |
parent | 757e26894b5b912bd03ce93b7e538e26f88c9b62 (diff) |
Fix build with QT_STRICT_ITERATORS
Which also fixes potential bugs when comparing iterators from different
containers in case a detach happens.
Change-Id: I5e91f82177d46a0f06272035af837e8a8b196f81
Reviewed-by: Mike Krus <mike.krus@kdab.com>
-rw-r--r-- | src/extras/text/qdistancefieldglyphcache.cpp | 2 | ||||
-rw-r--r-- | src/plugins/geometryloaders/default/objgeometryloader.cpp | 2 | ||||
-rw-r--r-- | src/render/materialsystem/shader.cpp | 12 | ||||
-rw-r--r-- | src/render/texture/apitexturemanager_p.h | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/extras/text/qdistancefieldglyphcache.cpp b/src/extras/text/qdistancefieldglyphcache.cpp index 9c997013e..99085f378 100644 --- a/src/extras/text/qdistancefieldglyphcache.cpp +++ b/src/extras/text/qdistancefieldglyphcache.cpp @@ -272,7 +272,7 @@ DistanceFieldFont* QDistanceFieldGlyphCache::getOrCreateDistanceFieldFont(const // return, if font already exists (make sure to only create one DistanceFieldFont for // each unique QRawFont, by building a hash on the QRawFont that ignores the font size) const QString key = fontKey(font); - const auto it = m_fonts.find(key); + const auto it = m_fonts.constFind(key); if (it != m_fonts.cend()) return it.value(); diff --git a/src/plugins/geometryloaders/default/objgeometryloader.cpp b/src/plugins/geometryloaders/default/objgeometryloader.cpp index 0f22acc66..9f31c7de6 100644 --- a/src/plugins/geometryloaders/default/objgeometryloader.cpp +++ b/src/plugins/geometryloaders/default/objgeometryloader.cpp @@ -219,7 +219,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh) if (hasNormals) m_normals.resize(vertexCount); - for (QHash<FaceIndices, unsigned int>::const_iterator it = faceIndexMap.begin(), endIt = faceIndexMap.end(); it != endIt; ++it) { + for (auto it = faceIndexMap.cbegin(), endIt = faceIndexMap.cend(); it != endIt; ++it) { m_points[it.value()] = positions[it.key().positionIndex]; if (hasTexCoords) m_texCoords[it.value()] = std::numeric_limits<unsigned int>::max() != it.key().texCoordIndex ? texCoords[it.key().texCoordIndex] : QVector2D(); diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp index 3ee00739d..915ca1d54 100644 --- a/src/render/materialsystem/shader.cpp +++ b/src/render/materialsystem/shader.cpp @@ -311,8 +311,8 @@ void Shader::updateDNA() QMutexLocker locker(&m_mutex); uint attachmentHash = 0; - QHash<QString, int>::const_iterator it = m_fragOutputs.begin(); - QHash<QString, int>::const_iterator end = m_fragOutputs.end(); + QHash<QString, int>::const_iterator it = m_fragOutputs.cbegin(); + QHash<QString, int>::const_iterator end = m_fragOutputs.cend(); while (it != end) { attachmentHash += ::qHash(it.value()) + ::qHash(it.key()); ++it; @@ -373,11 +373,11 @@ void Shader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &uniformB qCDebug(Shaders) << "Initializing Uniform Block {" << m_uniformBlockNames[i] << "}"; // Find all active uniforms for the shader block - QVector<ShaderUniform>::const_iterator uniformsIt = m_uniforms.begin(); - const QVector<ShaderUniform>::const_iterator uniformsEnd = m_uniforms.end(); + QVector<ShaderUniform>::const_iterator uniformsIt = m_uniforms.cbegin(); + const QVector<ShaderUniform>::const_iterator uniformsEnd = m_uniforms.cend(); - QVector<QString>::const_iterator uniformNamesIt = m_uniformsNames.begin(); - const QVector<QString>::const_iterator uniformNamesEnd = m_attributesNames.end(); + QVector<QString>::const_iterator uniformNamesIt = m_uniformsNames.cbegin(); + const QVector<QString>::const_iterator uniformNamesEnd = m_attributesNames.cend(); QHash<QString, ShaderUniform> activeUniformsInBlock; diff --git a/src/render/texture/apitexturemanager_p.h b/src/render/texture/apitexturemanager_p.h index c062f0971..91747b3bc 100644 --- a/src/render/texture/apitexturemanager_p.h +++ b/src/render/texture/apitexturemanager_p.h @@ -273,7 +273,7 @@ public: if (impl->isUnique()) return false; - auto it = m_sharedTextures.find(impl); + auto it = m_sharedTextures.constFind(impl); if (it == m_sharedTextures.cend()) return false; |