diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 0c5642f8d900e1800cc6393f0d53a65b6b536b89..98a4f4e6d8fe7ef96a5cf113c538582ee6362b09 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 8968187531042e56280c692ab0eff171455b6980..f7e93c5696b805d4c8bd66fcd84a771eb78e244e 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 edf82f494e7f525b4f8424e6486fa0b655e883ab..8579e6b0f63f4273b0b3382ae2d847ad1eaa9d15 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 1965a85902b99fc6bdc98fca197f165c2efa36a6..993716f14640ef8f3afed67e1402bdfd79ecf647 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 93a26f31ccf5706b3050b87aea09480fb9b64f1f..cdacc1b731751bbba98bdee359788f19c6d9d84c 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 0f20392495f54857b1e5c77c3ba334645e8e9b6a..df177adb7b28fc1128e4b3ecafd915d4f4c8a686 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 99fba4706301e0dfd1d11a12fb4eb7d03c1087eb..d3a01c99bcf0e44d5310bf465491db7776abe62b 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 a0630b2f7489a724f3e46e0ff0a1a59be08a9a72..32538a14743bd752eaf7111a520258bf6d4b213e 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 b785f9a63869278e8a8dd17834cf1b8dd042d703..878041fb67ed691a8b66e5439b3ed3fd035393de 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);