diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index bae969a8474fb890edea6c010b101f282422a3a3..9faaddeef5c178a27a500ede6d788ad372f4f67b 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -265,15 +265,23 @@ void LLCharacter::dumpCharacter( LLJoint* joint ) //----------------------------------------------------------------------------- void LLCharacter::setAnimationData(const std::string& name, void *data) { - mAnimationData[name] = data; + mAnimationData.insert_or_assign(name, data); } //----------------------------------------------------------------------------- // getAnimationData() //----------------------------------------------------------------------------- -void* LLCharacter::getAnimationData(const std::string& name) +void* LLCharacter::getAnimationData(const std::string_view name) { - return get_if_there(mAnimationData, name, (void*)NULL); + auto iter = mAnimationData.find(name); + if (iter == mAnimationData.end()) + { + return nullptr; + } + else + { + return iter->second; + } } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 680f1d9328009c38c75e53fcc9b4794f4d1dba36..1fe9c90665646b8ad235c390631ee3255c226f65 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -185,7 +185,7 @@ class LLCharacter void setAnimationData(const std::string& name, void *data); - void *getAnimationData(const std::string& name); + void *getAnimationData(const std::string_view name); void removeAnimationData(const std::string& name); diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 7e69e9ec8ac47a71a4076dbc37bcb34219575150..019c5cbcd2ab60db9151a8b25d85b3dc933d25c7 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -89,23 +89,22 @@ static LLDefaultChildRegistry::Register<LLToolBar> register_toolbar("toolbar"); // Functions // -LLUUID find_ui_sound(const char * namep) +LLUUID find_ui_sound(std::string_view name) { - std::string name = ll_safe_string(namep); LLUUID uuid = LLUUID(NULL); - LLUI *ui_inst = LLUI::getInstance(); - if (!ui_inst->mSettingGroups["config"]->controlExists(name)) + LLUI& ui_inst = LLUI::instance(); + if (!ui_inst.mSettingGroups["config"]->controlExists(name)) { LL_WARNS() << "tried to make UI sound for unknown sound name: " << name << LL_ENDL; } else { - uuid = LLUUID(ui_inst->mSettingGroups["config"]->getString(name)); + uuid = LLUUID(ui_inst.mSettingGroups["config"]->getString(name)); if (uuid.isNull()) { - if (ui_inst->mSettingGroups["config"]->getString(name) == LLUUID::null.asString()) + if (ui_inst.mSettingGroups["config"]->getString(name) == LLUUID::null.asString()) { - if (ui_inst->mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle")) + if (ui_inst.mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle")) { LL_INFOS() << "UI sound name: " << name << " triggered but silent (null uuid)" << LL_ENDL; } @@ -115,9 +114,9 @@ LLUUID find_ui_sound(const char * namep) LL_WARNS() << "UI sound named: " << name << " does not translate to a valid uuid" << LL_ENDL; } } - else if (ui_inst->mAudioCallback != NULL) + else if (ui_inst.mAudioCallback != NULL) { - if (ui_inst->mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle")) + if (ui_inst.mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle")) { LL_INFOS() << "UI sound name: " << name << LL_ENDL; } @@ -127,9 +126,14 @@ LLUUID find_ui_sound(const char * namep) return uuid; } +LLUUID find_ui_sound(const char* namep) +{ + return find_ui_sound(absl::NullSafeStringView(namep)); +} + void make_ui_sound(const char* namep) { - LLUUID soundUUID = find_ui_sound(namep); + LLUUID soundUUID = find_ui_sound(absl::NullSafeStringView(namep)); if(soundUUID.notNull()) { LLUI::getInstance()->mAudioCallback(soundUUID); @@ -138,7 +142,7 @@ void make_ui_sound(const char* namep) void make_ui_sound_deferred(const char* namep) { - LLUUID soundUUID = find_ui_sound(namep); + LLUUID soundUUID = find_ui_sound(absl::NullSafeStringView(namep)); if(soundUUID.notNull()) { LLUI::getInstance()->mDeferredAudioCallback(soundUUID);