diff --git a/indra/llcommon/StackWalker.cpp b/indra/llcommon/StackWalker.cpp
index 56defc6465fa264a65787d88ad90b3df2959ea13..cf5f039ca5dc3b9169379ca640482cb2ac94c2c6 100644
--- a/indra/llcommon/StackWalker.cpp
+++ b/indra/llcommon/StackWalker.cpp
@@ -1341,6 +1341,7 @@ void StackWalker::OnDbgHelpErr(LPCSTR szFuncName, DWORD gle, DWORD64 addr)
   }
 }
 
+#pragma warning(push)
 #pragma warning (disable : 4996)
 
 void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUserName)
@@ -1382,6 +1383,7 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
   }
 #endif
 }
+#pragma warning(pop)
 
 void StackWalker::OnOutput(LPCSTR buffer)
 {
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 3094b627a2f35b7ecfa8d30661196a6fbd7b4304..c9d87466f30bb157fcd97fec0a1371f0f4daf57e 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -626,7 +626,6 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
 	if (mAutoResize)
 	{
 		// push back recordings for everything in the middle
-		S32 other_index = (other_oldest_recording_index + 1) % other_recording_slots;
 		while (other_index != other_current_recording_index)
 		{
 			mRecordingPeriods.push_back(other.mRecordingPeriods[other_index]);
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index 025dc57044d6b8edaad0c8faf343f073a96fa0bc..779127643ab14054ebe9e5a4bd164b87a802c887 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -282,14 +282,14 @@ void ThreadRecorder::pullFromChildren()
 	LL_RECORD_BLOCK_TIME(FTM_PULL_TRACE_DATA_FROM_CHILDREN);
 	if (mActiveRecordings.empty()) return;
 
-	{ LLMutexLock lock(&mChildListMutex);
+	{ LLMutexLock child_list_lock(&mChildListMutex);
 
 		AccumulatorBufferGroup& target_recording_buffers = mActiveRecordings.back()->mPartialRecording;
 		target_recording_buffers.sync();
 		for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end();
 			it != end_it;
 			++it)
-		{ LLMutexLock lock(&(*it)->mSharedRecordingMutex);
+		{ LLMutexLock shared_record_lock(&(*it)->mSharedRecordingMutex);
 
 			target_recording_buffers.merge((*it)->mSharedRecordingBuffers);
 			(*it)->mSharedRecordingBuffers.reset();
diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp
index 55eb9233c664e2d3007a478b835f82aef3dbaf63..de50aedf62d1a773867759a9460f28f97e487357 100644
--- a/indra/llfilesystem/llfilesystem.cpp
+++ b/indra/llfilesystem/llfilesystem.cpp
@@ -101,7 +101,7 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes)
         {
             fseek(mFile, mPosition, SEEK_SET);
             long rsize = fsize - mPosition;
-            size_t bytes_read = fread((void*)buffer, 1, rsize, mFile);
+            bytes_read = fread((void*)buffer, 1, rsize, mFile);
             if (bytes_read == rsize)
             {
                 mBytesRead = bytes_read;
diff --git a/indra/llinventory/llparcelflags.h b/indra/llinventory/llparcelflags.h
index 4cffa83cc1c2446bcc0d64fab432fa8cb0ff1f38..22114fe6053175f5155afd556ec717b3cce59009 100644
--- a/indra/llinventory/llparcelflags.h
+++ b/indra/llinventory/llparcelflags.h
@@ -29,55 +29,55 @@
 //---------------------------------------------------------------------------
 // Parcel Flags (PF) constants
 //---------------------------------------------------------------------------
-const U32 PF_ALLOW_FLY			= 1 << 0;// Can start flying
-const U32 PF_ALLOW_OTHER_SCRIPTS= 1 << 1;// Scripts by others can run.
-const U32 PF_FOR_SALE			= 1 << 2;// Can buy this land
-const U32 PF_FOR_SALE_OBJECTS	= 1 << 7;// Can buy all objects on this land
-const U32 PF_ALLOW_LANDMARK		= 1 << 3;// Always true/deprecated
-const U32 PF_ALLOW_TERRAFORM	= 1 << 4;
-const U32 PF_ALLOW_DAMAGE		= 1 << 5;
-const U32 PF_CREATE_OBJECTS		= 1 << 6;
+constexpr U32 PF_ALLOW_FLY			= 1U << 0U;// Can start flying
+constexpr U32 PF_ALLOW_OTHER_SCRIPTS = 1U << 1U;  // Scripts by others can run.
+constexpr U32 PF_FOR_SALE			= 1U << 2U;// Can buy this land
+constexpr U32 PF_FOR_SALE_OBJECTS	= 1U << 7U;// Can buy all objects on this land
+constexpr U32 PF_ALLOW_LANDMARK		= 1U << 3U;// Always true/deprecated
+constexpr U32 PF_ALLOW_TERRAFORM	= 1U << 4U;
+constexpr U32 PF_ALLOW_DAMAGE		= 1U << 5U;
+constexpr U32 PF_CREATE_OBJECTS		= 1U << 6U;
 // 7 is moved above
-const U32 PF_USE_ACCESS_GROUP	= 1 << 8;
-const U32 PF_USE_ACCESS_LIST	= 1 << 9;
-const U32 PF_USE_BAN_LIST		= 1 << 10;
-const U32 PF_USE_PASS_LIST		= 1 << 11;
-const U32 PF_SHOW_DIRECTORY		= 1 << 12;
-const U32 PF_ALLOW_DEED_TO_GROUP		= 1 << 13;
-const U32 PF_CONTRIBUTE_WITH_DEED		= 1 << 14;
-const U32 PF_SOUND_LOCAL				= 1 << 15;	// Hear sounds in this parcel only
-const U32 PF_SELL_PARCEL_OBJECTS		= 1 << 16;	// Objects on land are included as part of the land when the land is sold
-const U32 PF_ALLOW_PUBLISH				= 1 << 17;	// Allow publishing of parcel information on the web
-const U32 PF_MATURE_PUBLISH				= 1 << 18;	// The information on this parcel is mature
-const U32 PF_URL_WEB_PAGE				= 1 << 19;	// The "media URL" is an HTML page
-const U32 PF_URL_RAW_HTML				= 1 << 20;	// The "media URL" is a raw HTML string like <H1>Foo</H1>
-const U32 PF_RESTRICT_PUSHOBJECT		= 1 << 21;	// Restrict push object to either on agent or on scripts owned by parcel owner
-const U32 PF_DENY_ANONYMOUS				= 1 << 22;	// Deny all non identified/transacted accounts
-// const U32 PF_DENY_IDENTIFIED			= 1 << 23;	// Deny identified accounts
-// const U32 PF_DENY_TRANSACTED			= 1 << 24;	// Deny identified accounts
-const U32 PF_ALLOW_GROUP_SCRIPTS		= 1 << 25;	// Allow scripts owned by group
-const U32 PF_CREATE_GROUP_OBJECTS		= 1 << 26;	// Allow object creation by group members or objects
-const U32 PF_ALLOW_ALL_OBJECT_ENTRY		= 1 << 27;	// Allow all objects to enter a parcel
-const U32 PF_ALLOW_GROUP_OBJECT_ENTRY	= 1 << 28;	// Only allow group (and owner) objects to enter the parcel
-const U32 PF_ALLOW_VOICE_CHAT			= 1 << 29;	// Allow residents to use voice chat on this parcel
-const U32 PF_USE_ESTATE_VOICE_CHAN      = 1 << 30;
-const U32 PF_DENY_AGEUNVERIFIED         = 1 << 31;  // Prevent residents who aren't age-verified 
+constexpr U32 PF_USE_ACCESS_GROUP	= 1U << 8U;
+constexpr U32 PF_USE_ACCESS_LIST	= 1U << 9U;
+constexpr U32 PF_USE_BAN_LIST		= 1U << 10U;
+constexpr U32 PF_USE_PASS_LIST		= 1U << 11U;
+constexpr U32 PF_SHOW_DIRECTORY		= 1U << 12U;
+constexpr U32 PF_ALLOW_DEED_TO_GROUP		= 1U << 13U;
+constexpr U32 PF_CONTRIBUTE_WITH_DEED		= 1U << 14U;
+constexpr U32 PF_SOUND_LOCAL				= 1U << 15U;	// Hear sounds in this parcel only
+constexpr U32 PF_SELL_PARCEL_OBJECTS		= 1U << 16U;	// Objects on land are included as part of the land when the land is sold
+constexpr U32 PF_ALLOW_PUBLISH				= 1U << 17U;	// Allow publishing of parcel information on the web
+constexpr U32 PF_MATURE_PUBLISH				= 1U << 18U;	// The information on this parcel is mature
+constexpr U32 PF_URL_WEB_PAGE				= 1U << 19U;	// The "media URL" is an HTML page
+constexpr U32 PF_URL_RAW_HTML				= 1U << 20U;	// The "media URL" is a raw HTML string like <H1>Foo</H1>
+constexpr U32 PF_RESTRICT_PUSHOBJECT		= 1U << 21U;	// Restrict push object to either on agent or on scripts owned by parcel owner
+constexpr U32 PF_DENY_ANONYMOUS				= 1U << 22U;	// Deny all non identified/transacted accounts
+// constexpr U32 PF_DENY_IDENTIFIED			= 1U << 23U;	// Deny identified accounts
+// constexpr U32 PF_DENY_TRANSACTED			= 1U << 24U;	// Deny identified accounts
+constexpr U32 PF_ALLOW_GROUP_SCRIPTS		= 1U << 25U;	// Allow scripts owned by group
+constexpr U32 PF_CREATE_GROUP_OBJECTS		= 1U << 26U;	// Allow object creation by group members or objects
+constexpr U32 PF_ALLOW_ALL_OBJECT_ENTRY		= 1U << 27U;	// Allow all objects to enter a parcel
+constexpr U32 PF_ALLOW_GROUP_OBJECT_ENTRY	= 1U << 28U;	// Only allow group (and owner) objects to enter the parcel
+constexpr U32 PF_ALLOW_VOICE_CHAT			= 1U << 29U;	// Allow residents to use voice chat on this parcel
+constexpr U32 PF_USE_ESTATE_VOICE_CHAN      = 1U << 30U;
+constexpr U32 PF_DENY_AGEUNVERIFIED         = 1U << 31U;  // Prevent residents who aren't age-verified 
 // NOTE: At one point we have used all of the bits.
 // We have deprecated two of them in 1.19.0 which *could* be reused,
 // but only after we are certain there are no simstates using those bits.
 
-//const U32 PF_RESERVED			= 1U << 31;
+//const U32 PF_RESERVED			= 1U << 32U;
 
 // If any of these are true the parcel is restricting access in some maner.
-const U32 PF_USE_RESTRICTED_ACCESS = PF_USE_ACCESS_GROUP
+constexpr U32 PF_USE_RESTRICTED_ACCESS = PF_USE_ACCESS_GROUP
 										| PF_USE_ACCESS_LIST
 										| PF_USE_BAN_LIST
 										| PF_USE_PASS_LIST
 										| PF_DENY_ANONYMOUS
 										| PF_DENY_AGEUNVERIFIED;
-const U32 PF_NONE = 0x00000000;
-const U32 PF_ALL  = 0xFFFFFFFF;
-const U32 PF_DEFAULT =  PF_ALLOW_FLY
+constexpr U32 PF_NONE = 0x00000000U;
+constexpr U32 PF_ALL  = 0xFFFFFFFFU;
+constexpr U32 PF_DEFAULT =  PF_ALLOW_FLY
 						| PF_ALLOW_OTHER_SCRIPTS
 						| PF_ALLOW_GROUP_SCRIPTS
 						| PF_ALLOW_LANDMARK
@@ -90,25 +90,25 @@ const U32 PF_DEFAULT =  PF_ALLOW_FLY
                         | PF_USE_ESTATE_VOICE_CHAN;
 
 // Access list flags
-const U32 AL_ACCESS				= (1 << 0);
-const U32 AL_BAN					= (1 << 1);
-const U32 AL_ALLOW_EXPERIENCE	= (1 << 3);
-const U32 AL_BLOCK_EXPERIENCE	= (1 << 4);
-//const U32 AL_RENTER  = (1 << 2);
+constexpr U32 AL_ACCESS             = (1U << 0U);
+constexpr U32 AL_BAN                = (1U << 1U);
+constexpr U32 AL_ALLOW_EXPERIENCE   = (1U << 3U);
+constexpr U32 AL_BLOCK_EXPERIENCE   = (1U << 4U);
+//constexpr U32 AL_RENTER			= (1U << 2U);
 
 // Block access return values. BA_ALLOWED is the only success case
 // since some code in the simulator relies on that assumption. All
 // other BA_ values should be reasons why you are not allowed.
-const S32 BA_ALLOWED = 0;
-const S32 BA_NOT_IN_GROUP = 1;
-const S32 BA_NOT_ON_LIST = 2;
-const S32 BA_BANNED = 3;
-const S32 BA_NO_ACCESS_LEVEL = 4;
-const S32 BA_NOT_AGE_VERIFIED = 5;
+constexpr S32 BA_ALLOWED          = 0;
+constexpr S32 BA_NOT_IN_GROUP     = 1;
+constexpr S32 BA_NOT_ON_LIST      = 2;
+constexpr S32 BA_BANNED           = 3;
+constexpr S32 BA_NO_ACCESS_LEVEL  = 4;
+constexpr S32 BA_NOT_AGE_VERIFIED = 5;
 
 // ParcelRelease flags
-const U32 PR_NONE		= 0x0;
-const U32 PR_GOD_FORCE	= (1 << 0);
+constexpr U32 PR_NONE      = 0x0U;
+constexpr U32 PR_GOD_FORCE = (1U << 0U);
 
 enum EObjectCategory
 {
@@ -123,12 +123,12 @@ enum EObjectCategory
 	OC_COUNT
 };
 
-const S32 PARCEL_DETAILS_NAME = 0;
-const S32 PARCEL_DETAILS_DESC = 1;
-const S32 PARCEL_DETAILS_OWNER = 2;
-const S32 PARCEL_DETAILS_GROUP = 3;
-const S32 PARCEL_DETAILS_AREA = 4;
-const S32 PARCEL_DETAILS_ID = 5;
-const S32 PARCEL_DETAILS_SEE_AVATARS = 6;
+constexpr S32 PARCEL_DETAILS_NAME        = 0;
+constexpr S32 PARCEL_DETAILS_DESC        = 1;
+constexpr S32 PARCEL_DETAILS_OWNER       = 2;
+constexpr S32 PARCEL_DETAILS_GROUP       = 3;
+constexpr S32 PARCEL_DETAILS_AREA        = 4;
+constexpr S32 PARCEL_DETAILS_ID          = 5;
+constexpr S32 PARCEL_DETAILS_SEE_AVATARS = 6;
 
 #endif
diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp
index a9c75aede724f5584b635b1f849601b1a2228574..c609232c6ab6f8cb9e7009eaf8911d452acc058f 100644
--- a/indra/llmessage/llcoproceduremanager.cpp
+++ b/indra/llmessage/llcoproceduremanager.cpp
@@ -140,9 +140,7 @@ LLCoprocedureManager::~LLCoprocedureManager()
 
 void LLCoprocedureManager::initializePool(const std::string &poolName)
 {
-    poolMap_t::iterator it = mPoolMap.find(poolName);
-
-    if (it != mPoolMap.end())
+    if (mPoolMap.find(poolName) != mPoolMap.end())
     {
         // Pools are not supposed to be initialized twice
         // Todo: ideally restrict init to STATE_FIRST
diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp
index a23d6c9fb6b2d0989a17cf1549e11559ee1e7638..3f26842dadc910bc28c1f1538bc00165d404b9f2 100644
--- a/indra/llmessage/llpacketring.cpp
+++ b/indra/llmessage/llpacketring.cpp
@@ -290,7 +290,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
 			if (!mSendQueue.empty())
 			{
 				// Send a packet off of the queue
-				LLPacketBuffer *packetp = mSendQueue.front();
+				packetp = mSendQueue.front();
 				mSendQueue.pop();
 
 				mOutBufferLength -= packetp->getSize();
diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp
index 7c679e07d89cb20a66a5119c62d32e23ff9c3fe0..4c5a02c8593cdc410c4e1941d6b9272031355fe1 100644
--- a/indra/llmessage/llxfer_file.cpp
+++ b/indra/llmessage/llxfer_file.cpp
@@ -317,7 +317,7 @@ S32 LLXfer_File::flush()
 
 		if (mFp)
 		{
-			S32 write_size = fwrite(mBuffer,1,mBufferLength,mFp);
+			U32 write_size = fwrite(mBuffer,1,mBufferLength,mFp);
 			if (write_size != mBufferLength)
 			{
 				LL_WARNS("Xfer") << "Non-matching write size, requested " << mBufferLength
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 010aa3c9ddc3edf9a97ca0bc2bda8fb52719cac9..012641ad29a2723b2da60ef98a35c27c1c54404b 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -53,8 +53,6 @@
 #pragma warning (default : 4264)
 #endif
 
-#include <boost/lexical_cast.hpp>
-
 #include "lldaeloader.h"
 #include "llsdserialize.h"
 #include "lljoint.h"
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index b83534a26b0870f6429b0ce8248300ff5fa16af1..40ce1f73a0e895f5f2084a6ad2d88f48b45b7ebc 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -461,7 +461,7 @@ void LLControlGroup::cleanup()
 				if (access_rate >= 2)
 				{
 					msg = llformat("%13d        %7d       %s\n", iter->second, access_rate, iter->first.c_str());
-					size_t data_size = msg.size();
+					data_size = msg.size();
 					if (fwrite(msg.c_str(), 1, data_size, out) != data_size)
 					{
 						LL_WARNS("SettingsProfile") << "Failed to write settings profile" << LL_ENDL;
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 88d69b88b95a52381117c75ee338e988a309402d..595fc36659f3da8bab15facacd1e93f23b4500b7 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -26,7 +26,6 @@
  
 #include "llviewerprecompiledheaders.h"
 
-#include <boost/lexical_cast.hpp>
 #include "llaccordionctrltab.h"
 #include "llagent.h"
 #include "llagentcamera.h"
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 633a155d5fd787a527c6b7487bb1d732e6a6c4b1..60ce92d81ae7dcf0c802c54ac6a2592dd8580f7a 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -166,7 +166,6 @@
 #endif
 
 #include "llapr.h"
-#include <boost/lexical_cast.hpp>
 
 #include "llviewerinput.h"
 #include "lllfsthread.h"
diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp
index 258ffd9cffc445754f2f79c96e41d08d71508808..773abc526edfce1eaeda6f85ef08312a2c2e2a1d 100644
--- a/indra/newview/llmediadataclient.cpp
+++ b/indra/newview/llmediadataclient.cpp
@@ -30,7 +30,6 @@
 #include "llviewercontrol.h"
 
 #include <algorithm>
-#include <boost/lexical_cast.hpp>
 
 #include "llhttpconstants.h"
 #include "llsdutil.h"
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 2d958f73e4035480012c6dc7bac837c8d9baf2cf..81e94a7a46d28fc6c071d6bfa30be21b719065de 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -73,7 +73,6 @@
 #include "lluploaddialog.h"
 #include "llfloaterreg.h"
 
-#include "boost/lexical_cast.hpp"
 #include <boost/smart_ptr/make_shared.hpp>
 #include <boost/iostreams/device/array.hpp>
 #include <boost/iostreams/stream.hpp>
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 7f4022469208df112671d664b4f3aa376aec8274..7334c3bf67df99549ece4d15ac226f7e625a146f 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -54,8 +54,6 @@
 #include "llviewerwindow.h"
 #include "lllineeditor.h"
 
-#include <boost/lexical_cast.hpp>
-
 const S32 CLIENT_RECT_VPAD = 4;
 
 const F32 SECONDS_TO_SHOW_FILE_SAVED_MSG = 8.f;