diff --git a/indra/llcharacter/llanimationstates.cpp b/indra/llcharacter/llanimationstates.cpp index c16cae1bbc7237eec62fcf9aaa1fded4489e71ba..ba771c92d967b0b06cb20e1818849b4ccd12f5cb 100644 --- a/indra/llcharacter/llanimationstates.cpp +++ b/indra/llcharacter/llanimationstates.cpp @@ -355,9 +355,10 @@ const char *LLAnimationLibrary::animStateToString( const LLUUID& state ) { return NULL; } - if (mAnimMap.count(state)) + auto it = mAnimMap.find(state); + if (it != mAnimMap.end()) { - return mAnimMap[state]; + return it->second; } return NULL; diff --git a/indra/llcharacter/llanimationstates.h b/indra/llcharacter/llanimationstates.h index 79cbcabdc1da0e72ad4c4fd6544cf2ebc2f288bd..1b13a0bf54446f30ac384b7f5565aea45527e88e 100644 --- a/indra/llcharacter/llanimationstates.h +++ b/indra/llcharacter/llanimationstates.h @@ -28,6 +28,7 @@ #define LL_LLANIMATIONSTATES_H #include <map> +#include <boost/unordered_map.hpp> #include "llstringtable.h" #include "lluuid.h" @@ -203,7 +204,7 @@ class LLAnimationLibrary private: LLStringTable mAnimStringTable; - typedef std::map<LLUUID, char *> anim_map_t; + typedef boost::unordered_map<LLUUID, char *> anim_map_t; anim_map_t mAnimMap; public: diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index b764ef0c7e1f206abe615efe2f17e4c7418de877..3d2586dac887a9e4833c70922f4350930c26b6f3 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -263,7 +263,7 @@ void LLCharacter::dumpCharacter( LLJoint* joint ) //----------------------------------------------------------------------------- // setAnimationData() //----------------------------------------------------------------------------- -void LLCharacter::setAnimationData(std::string name, void *data) +void LLCharacter::setAnimationData(const std::string& name, void *data) { mAnimationData[name] = data; } @@ -271,7 +271,7 @@ void LLCharacter::setAnimationData(std::string name, void *data) //----------------------------------------------------------------------------- // getAnimationData() //----------------------------------------------------------------------------- -void* LLCharacter::getAnimationData(std::string name) +void* LLCharacter::getAnimationData(const std::string& name) { return get_if_there(mAnimationData, name, (void*)NULL); } @@ -279,7 +279,7 @@ void* LLCharacter::getAnimationData(std::string name) //----------------------------------------------------------------------------- // removeAnimationData() //----------------------------------------------------------------------------- -void LLCharacter::removeAnimationData(std::string name) +void LLCharacter::removeAnimationData(const std::string& name) { mAnimationData.erase(name); } diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 2fac5f53a6552af5aa623e9d1ceaa7e609cdd889..f30db74676d4fc174155074b41a16956a91a0c66 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -39,6 +39,8 @@ #include "llpointer.h" #include "llrefcount.h" +#include <boost/unordered_map.hpp> + class LLPolyMesh; class LLPauseRequestHandle : public LLThreadSafeRefCount @@ -181,11 +183,11 @@ class LLCharacter virtual S32 getCollisionVolumeID(std::string &name) { return -1; } - void setAnimationData(std::string name, void *data); + void setAnimationData(const std::string& name, void *data); - void *getAnimationData(std::string name); + void *getAnimationData(const std::string& name); - void removeAnimationData(std::string name); + void removeAnimationData(const std::string& name); void addVisualParam(LLVisualParam *param); void addSharedVisualParam(LLVisualParam *param); @@ -237,11 +239,10 @@ class LLCharacter } S32 getVisualParamID(LLVisualParam *id) { - visual_param_index_map_t::iterator iter; - for (iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) + for (const auto& param_pair : mVisualParamIndexMap) { - if (iter->second == id) - return iter->first; + if (param_pair.second == id) + return param_pair.first; } return 0; } @@ -267,7 +268,7 @@ class LLCharacter protected: LLMotionController mMotionController; - typedef std::map<std::string, void *> animation_data_map_t; + typedef boost::unordered_map<std::string, void *> animation_data_map_t; animation_data_map_t mAnimationData; F32 mPreferredPelvisHeight;