From 0c66b3902eaf165daf92ab29dd408deb2240356a Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 30 Jan 2018 19:47:15 +0200 Subject: [PATCH] Ogre: Avoid creating static std::strings They're causing false positive race condition messages from Helgrind --- code/OgreXmlSerializer.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/code/OgreXmlSerializer.cpp b/code/OgreXmlSerializer.cpp index bcfe2d185..bf2680dcb 100644 --- a/code/OgreXmlSerializer.cpp +++ b/code/OgreXmlSerializer.cpp @@ -538,20 +538,20 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest) void OgreXmlSerializer::ReadSubMesh(MeshXml *mesh) { - static const std::string anMaterial = "material"; - static const std::string anUseSharedVertices = "usesharedvertices"; - static const std::string anCount = "count"; - static const std::string anV1 = "v1"; - static const std::string anV2 = "v2"; - static const std::string anV3 = "v3"; - static const std::string anV4 = "v4"; + static const char *anMaterial = "material"; + static const char *anUseSharedVertices = "usesharedvertices"; + static const char *anCount = "count"; + static const char *anV1 = "v1"; + static const char *anV2 = "v2"; + static const char *anV3 = "v3"; + static const char *anV4 = "v4"; SubMeshXml* submesh = new SubMeshXml(); - if (HasAttribute(anMaterial.c_str())) { + if (HasAttribute(anMaterial)) { submesh->materialRef = ReadAttribute(anMaterial); } - if (HasAttribute(anUseSharedVertices.c_str())) { + if (HasAttribute(anUseSharedVertices)) { submesh->usesSharedVertexData = ReadAttribute(anUseSharedVertices); } @@ -587,7 +587,7 @@ void OgreXmlSerializer::ReadSubMesh(MeshXml *mesh) face.mIndices[2] = ReadAttribute(anV3); /// @todo Support quads if Ogre even supports them in XML (I'm not sure but I doubt it) - if (!quadWarned && HasAttribute(anV4.c_str())) { + if (!quadWarned && HasAttribute(anV4)) { DefaultLogger::get()->warn("Submesh has quads with , only triangles are supported at the moment!"); quadWarned = true; } @@ -635,9 +635,9 @@ void OgreXmlSerializer::ReadBoneAssignments(VertexDataXml *dest) throw DeadlyImportError("Cannot read bone assignments, vertex data is null."); } - static const std::string anVertexIndex = "vertexindex"; - static const std::string anBoneIndex = "boneindex"; - static const std::string anWeight = "weight"; + static const char *anVertexIndex = "vertexindex"; + static const char *anBoneIndex = "boneindex"; + static const char *anWeight = "weight"; std::set influencedVertices;