From 1d94fc7ce60ff37fcef4e22e6db73b4532377e9c Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 9 Oct 2019 22:32:19 +0200 Subject: [PATCH] Change function signature of getAnonym to return std::string rather than reference and do not return "nobody" in case RLVa is disabled. --- indra/integration_tests/llui_libtest/llui_libtest.cpp | 2 +- indra/llui/llurlentry.cpp | 2 +- indra/llui/tests/llurlentry_stub.cpp | 2 +- indra/newview/rlvcommon.cpp | 9 +++------ indra/newview/rlvcommon.h | 6 +++--- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/indra/integration_tests/llui_libtest/llui_libtest.cpp b/indra/integration_tests/llui_libtest/llui_libtest.cpp index acf5816f48..d8209f0931 100644 --- a/indra/integration_tests/llui_libtest/llui_libtest.cpp +++ b/indra/integration_tests/llui_libtest/llui_libtest.cpp @@ -56,7 +56,7 @@ LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warning #include "llavatarname.h" // Stub for rlvGetAnonym -const std::string& rlvGetAnonym(const LLAvatarName& avName) +std::string rlvGetAnonym(const LLAvatarName& avName) { static std::string strAnonym = "A resident"; return strAnonym; diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 82f2a74830..25afe6eee5 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -929,7 +929,7 @@ std::string LLUrlEntryAgentUserName::getName(const LLAvatarName& avatar_name) // [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Added: RLVa-1.2.2a // Defined in rlvcommon.cpp - redirects to RlvStrings::getAnonym() since we can't really get to that class from here -extern const std::string& rlvGetAnonym(const LLAvatarName& avName); +extern std::string rlvGetAnonym(const LLAvatarName& avName); // // LLUrlEntryAgentRLVAnonymizedName Describes an RLV anonymized agent name Url, e.g., diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 36aa316696..cdde80edd5 100755 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -37,7 +37,7 @@ // [RLVa:KB] - Checked: 2010-11-12 (RLVa-1.2.2a) | Added: RLVa-1.2.2a // Stub for rlvGetAnonym -const std::string& rlvGetAnonym(const LLAvatarName& avName) +std::string rlvGetAnonym(const LLAvatarName& avName) { static std::string strAnonym = "A resident"; return strAnonym; diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index 95e182bbd6..9eaea8d394 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -344,13 +344,10 @@ void RlvStrings::saveToFile(const std::string& strFilePath) } // Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a -const std::string& RlvStrings::getAnonym(const std::string& strName) +std::string RlvStrings::getAnonym(const std::string& strName) { if (!rlv_handler_t::isEnabled()) - { - static std::string strNobody = LLTrans::getString("AvatarNameNobody"); - return strNobody; - } + return strName; const char* pszName = strName.c_str(); U32 nHash = 0; @@ -912,7 +909,7 @@ BOOL rlvEnableSharedWearEnabler(void* pParam) */ // Checked: 2010-11-01 (RLVa-1.2.2a) | Added: RLVa-1.2.2a -const std::string& rlvGetAnonym(const LLAvatarName& avName) +std::string rlvGetAnonym(const LLAvatarName& avName) { return RlvStrings::getAnonym(avName); } diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index c224fcbf6c..50dc08283f 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -145,8 +145,8 @@ public: static void loadFromFile(const std::string& strFilePath, bool fDefault); static void saveToFile(const std::string& strFilePath); - static const std::string& getAnonym(const LLAvatarName& avName); // @shownames - static const std::string& getAnonym(const std::string& strName); // @shownames + static std::string getAnonym(const LLAvatarName& avName); // @shownames + static std::string getAnonym(const std::string& strName); // @shownames static const std::string& getString(const std::string& strStringName); static const char* getStringFromReturnCode(ERlvCmdRet eRet); static const std::string& getStringMapPath() { return m_StringMapPath; } @@ -307,7 +307,7 @@ template struct RlvPredValuesEqual // // Checked: 2010-10-31 (RLVa-1.2.2a) | Added: RLVa-1.2.2a -inline const std::string& RlvStrings::getAnonym(const LLAvatarName& avName) +inline std::string RlvStrings::getAnonym(const LLAvatarName& avName) { return getAnonym(avName.getLegacyName()); }