From f57638f87e4b37d6b087e07c2094b8c8d710d5cd Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Tue, 2 Feb 2021 17:50:47 -0500
Subject: [PATCH] Fix merge issues and build failures after import of LL
 6.4.12-release

---
 indra/llappearance/llavatarappearance.cpp      |  4 ++--
 indra/llappearance/llavatarappearancedefines.h |  2 +-
 indra/llmessage/llavatarnamecache.cpp          |  2 +-
 indra/newview/llappviewer.cpp                  |  2 +-
 indra/newview/llfloaterjoystick.cpp            |  2 +-
 indra/newview/llviewerjoystick.cpp             | 15 ++++++++-------
 indra/newview/llviewerstats.cpp                |  3 ++-
 indra/newview/llvoavatar.cpp                   |  7 +++----
 indra/newview/llvoavatarself.cpp               |  2 --
 9 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 0c5642f8d90..98a4f4e6d8f 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -1267,7 +1267,7 @@ BOOL LLAvatarAppearance::loadLayersets()
 
 			// scan baked textures and associate the layerset with the appropriate one
 			EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
-			for (const auto& baked_tex_pair : sAvatarDictionary->getMeshEntries())
+			for (const auto& baked_tex_pair : sAvatarDictionary->getBakedTextures())
 			{
 				const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_tex_pair.second;
 				if (layer_set->isBodyRegion(baked_dict->mName))
@@ -1971,7 +1971,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
 			{
 				delete morphinfo;
 				delete info;
-				return -1;
+				return FALSE;
 			}
 			BOOL shared = FALSE;
 			static LLStdStringHandle shared_string = LLXmlTree::addAttributeString("shared");
diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h
index 89681875310..f7e93c5696b 100644
--- a/indra/llappearance/llavatarappearancedefines.h
+++ b/indra/llappearance/llavatarappearancedefines.h
@@ -150,7 +150,7 @@ class LLAvatarAppearanceDictionary
 	//--------------------------------------------------------------------
 public:
 	LLAvatarAppearanceDictionary();
-	~LLAvatarAppearanceDictionary();
+	~LLAvatarAppearanceDictionary() = default;
 private:
 	void createAssociations();
 	
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index edf82f494e7..8579e6b0f63 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -287,7 +287,7 @@ void LLAvatarNameCache::processName(const LLUUID& agent_id, const LLAvatarName&
 
     bool updated_account = true; // assume obsolete value for new arrivals by default
 
-    std::map<LLUUID, LLAvatarName>::iterator it = mCache.find(agent_id);
+    auto it = mCache.find(agent_id);
     if (it != mCache.end()
         && (*it).second.getAccountName() == av_name.getAccountName())
     {
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 1965a85902b..993716f1464 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1542,7 +1542,7 @@ bool LLAppViewer::doFrame()
 						LL_RECORD_BLOCK_TIME(FTM_SLEEP);
 						// llclamp for when time function gets funky
 						U64 sleep_time = llclamp(mMinMicroSecPerFrame - elapsed_time, (U64)1, (U64)1e6);
-						micro_sleep(sleep_time, 0);
+						micro_sleep(sleep_time);
 					}
 				}
 				last_call = LLTimer::getTotalTime();
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index 93a26f31ccf..cdacc1b7317 100644
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -78,7 +78,7 @@ BOOL CALLBACK di8_list_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr,
     // Capable of detecting devices like Oculus Rift
     if (device_instance_ptr && pvRef)
     {
-        std::string product_name = utf16str_to_utf8str(llutf16string(device_instance_ptr->tszProductName));
+        std::string product_name = ll_convert_wide_to_string(std::wstring(device_instance_ptr->tszProductName));
         S32 size = sizeof(GUID);
         LLSD::Binary data; //just an std::vector
         data.resize(size);
diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp
index 0f20392495f..df177adb7b2 100644
--- a/indra/newview/llviewerjoystick.cpp
+++ b/indra/newview/llviewerjoystick.cpp
@@ -144,7 +144,7 @@ BOOL CALLBACK di8_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, LPVO
     // Capable of detecting devices like Oculus Rift
     if (device_instance_ptr)
     {
-        std::string product_name = utf16str_to_utf8str(llutf16string(device_instance_ptr->tszProductName));
+        std::string product_name = ll_convert_wide_to_string(std::wstring(device_instance_ptr->tszProductName));
 
         LLSD guid = LLViewerJoystick::getInstance()->getDeviceUUID();
 
@@ -192,10 +192,11 @@ BOOL CALLBACK di8_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, LPVO
                 LL_DEBUGS("Joystick") << "Properties updated" << LL_ENDL;
 
                 S32 size = sizeof(GUID);
-                LLSD::Binary data; //just an std::vector
-                data.resize(size);
-                memcpy(&data[0], &device_instance_ptr->guidInstance /*POD _GUID*/, size);
-                LLViewerJoystick::getInstance()->initDevice(&device, product_name, LLSD(data));
+                LLSD::Binary binary_data; //just an std::vector
+				binary_data.resize(size);
+                memcpy(&binary_data[0], &device_instance_ptr->guidInstance /*POD _GUID*/, size);
+				LLSD data(binary_data);
+                LLViewerJoystick::getInstance()->initDevice(&device, product_name, data);
                 return DIENUM_STOP;
             }
         }
@@ -211,7 +212,7 @@ BOOL CALLBACK di8_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, LPVO
 // This is GUID2 so teoretically it can be memcpy copied into LLUUID
 void guid_from_string(GUID &guid, const std::string &input)
 {
-    CLSIDFromString(utf8str_to_utf16str(input).c_str(), &guid);
+    CLSIDFromString(ll_convert_string_to_wide(input).c_str(), &guid);
 }
 
 std::string string_from_guid(const GUID &guid)
@@ -221,7 +222,7 @@ std::string string_from_guid(const GUID &guid)
 
     // use guidString...
 
-    std::string res = utf16str_to_utf8str(llutf16string(guidString));
+    std::string res = ll_convert_wide_to_string(std::wstring(guidString));
     // ensure memory is freed
     ::CoTaskMemFree(guidString);
 
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 99fba470630..d3a01c99bcf 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -636,7 +636,8 @@ void send_viewer_stats(bool include_preferences)
 
 
 	LL_INFOS("LogViewerStatsPacket") << "Sending viewer statistics: " << body << LL_ENDL;
-	if (debugLoggingEnabled("LogViewerStatsPacket"))
+	static bool enable_debug_log = debugLoggingEnabled("LogViewerStatsPacket");
+	if (enable_debug_log)
 	{
 		std::string filename("viewer_stats_packet.xml");
 		llofstream of(filename.c_str());
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index a0630b2f748..32538a14743 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7672,7 +7672,7 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
 			if (texture_dict->mIsUsedByBakedTexture)
 			{
 				const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
-				return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex);
+				return isTextureDefined(LLAvatarAppearance::getDictionary()->getBakedTexture(baked_index)->mTextureIndex);
 			}
 			return FALSE;
 		}
@@ -8425,7 +8425,7 @@ void LLVOAvatar::updateMeshTextures()
 	} 
 	
 	
-	for (const auto& baked_pair : LLAvatarAppearanceDictionary::getInstance()->getBakedTextures())
+	for (const auto& baked_pair : LLAvatarAppearance::getDictionary()->getBakedTextures())
 	{
 		const EBakedTextureIndex baked_index = baked_pair.first;
 		const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_pair.second;
@@ -10746,8 +10746,7 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const
 {
 	std::string line;
 
-	for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
-		 iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
+	for (const auto& tex_pair : LLAvatarAppearance::getDictionary()->getTextures())
 	{
 		const ETextureIndex index = tex_pair.first;
 		const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_pair.second;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index b785f9a6386..878041fb67e 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1512,7 +1512,6 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset
 	static const LLCachedControl<U32> desired_tex_discard_level(gSavedSettings, "TextureDiscardLevel");
 	// const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels.
 
-	auto& avApprDict = LLAvatarAppearanceDictionary::instance();
 	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
 		if (layerset == mBakedTextureDatas[i].mTexLayerSet)
@@ -1545,7 +1544,6 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
 	static const LLCachedControl<U32> desired_tex_discard_level(gSavedSettings, "TextureDiscardLevel");
 	// const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels
 
-	auto& avApprDict = LLAvatarAppearanceDictionary::instance();
 	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
 		const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = sAvatarDictionary->getBakedTexture((EBakedTextureIndex)i);
-- 
GitLab