From 12396d0ce3786f7cc9f1289a674a37c7f0158a5d Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 30 Jan 2018 19:42:58 +0200 Subject: [PATCH] Ogre: Change OgreXmlSerializer::HasAttribute parameter from std::string to pointer It's immediately passed via string pointer and in most places it's already a raw string constant. --- code/OgreXmlSerializer.cpp | 16 ++++++++-------- code/OgreXmlSerializer.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/code/OgreXmlSerializer.cpp b/code/OgreXmlSerializer.cpp index a7e6b5a09..bcfe2d185 100644 --- a/code/OgreXmlSerializer.cpp +++ b/code/OgreXmlSerializer.cpp @@ -171,9 +171,9 @@ bool OgreXmlSerializer::ReadAttribute(const std::string &name) const } } -bool OgreXmlSerializer::HasAttribute(const std::string &name) const +bool OgreXmlSerializer::HasAttribute(const char *name) const { - return (m_reader->getAttributeValue(name.c_str()) != 0); + return (m_reader->getAttributeValue(name) != 0); } std::string &OgreXmlSerializer::NextNode() @@ -548,10 +548,10 @@ void OgreXmlSerializer::ReadSubMesh(MeshXml *mesh) SubMeshXml* submesh = new SubMeshXml(); - if (HasAttribute(anMaterial)) { + if (HasAttribute(anMaterial.c_str())) { submesh->materialRef = ReadAttribute(anMaterial); } - if (HasAttribute(anUseSharedVertices)) { + if (HasAttribute(anUseSharedVertices.c_str())) { 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)) { + if (!quadWarned && HasAttribute(anV4.c_str())) { DefaultLogger::get()->warn("Submesh has quads with , only triangles are supported at the moment!"); quadWarned = true; } @@ -968,11 +968,11 @@ void OgreXmlSerializer::ReadBones(Skeleton *skeleton) } else { - if (HasAttribute(anX)) + if (HasAttribute(anX.c_str())) bone->scale.x = ReadAttribute(anX); - if (HasAttribute(anY)) + if (HasAttribute(anY.c_str())) bone->scale.y = ReadAttribute(anY); - if (HasAttribute(anZ)) + if (HasAttribute(anZ.c_str())) bone->scale.z = ReadAttribute(anZ); } } diff --git a/code/OgreXmlSerializer.h b/code/OgreXmlSerializer.h index 1ad46f95f..487bb65fa 100644 --- a/code/OgreXmlSerializer.h +++ b/code/OgreXmlSerializer.h @@ -99,7 +99,7 @@ private: template T ReadAttribute(const std::string &name) const; - bool HasAttribute(const std::string &name) const; + bool HasAttribute(const char *name) const; std::string &NextNode(); std::string &SkipCurrentNode();