diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 0e91cd3185096ce77177ac955e5948a579d1ec62..8126d620ec17a861d5b53a0049bc412d936de9a0 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -35,8 +35,7 @@
 #include "llavatarappearance.h"
 #include "llavatarappearancedefines.h"
 #include "llavatarjointmesh.h"
-#include "imageids.h"
-#include "lldeleteutils.h"
+#include "llstl.h"
 #include "lldir.h"
 #include "llpolymorph.h"
 #include "llpolymesh.h"
@@ -135,9 +134,9 @@ LLAvatarAppearance::LLAvatarXmlInfo::~LLAvatarXmlInfo()
 	std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer());
 	std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer());		
 	std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer());
-	deleteAndClear(mTexSkinColorInfo);
-	deleteAndClear(mTexHairColorInfo);
-	deleteAndClear(mTexEyeColorInfo);
+	delete_and_clear(mTexSkinColorInfo);
+	delete_and_clear(mTexHairColorInfo);
+	delete_and_clear(mTexEyeColorInfo);
 	std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());		
 	std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer());
 	std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer());
@@ -222,7 +221,7 @@ void LLAvatarAppearance::initInstance()
 			mesh->setMeshID(mesh_index);
 			mesh->setPickName(mesh_dict->mPickName);
 			mesh->setIsTransparent(FALSE);
-			switch((int)mesh_index)
+			switch((S32)mesh_index)
 			{
 				case MESH_ID_HAIR:
 					mesh->setIsTransparent(TRUE);
@@ -258,7 +257,7 @@ void LLAvatarAppearance::initInstance()
 			 ++iter)
 		{
 			LLAvatarJointMesh* mesh = (*iter);
-			mBakedTextureDatas[(int)baked_texture_index].mJointMeshes.push_back(mesh);
+			mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh);
 		}
 	}
 
@@ -269,13 +268,13 @@ void LLAvatarAppearance::initInstance()
 // virtual
 LLAvatarAppearance::~LLAvatarAppearance()
 {
-	deleteAndClear(mTexSkinColor);
-	deleteAndClear(mTexHairColor);
-	deleteAndClear(mTexEyeColor);
+	delete_and_clear(mTexSkinColor);
+	delete_and_clear(mTexHairColor);
+	delete_and_clear(mTexEyeColor);
 
 	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
-		deleteAndClear(mBakedTextureDatas[i].mTexLayerSet);
+		delete_and_clear(mBakedTextureDatas[i].mTexLayerSet);
 		mBakedTextureDatas[i].mJointMeshes.clear();
 
 		for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin();
@@ -290,11 +289,11 @@ LLAvatarAppearance::~LLAvatarAppearance()
 	mJointMap.clear();
 
 	clearSkeleton();
-	deleteAndClearArray(mCollisionVolumes);
+	delete_and_clear_array(mCollisionVolumes);
 
-	deleteAndClear(mTexSkinColor);
-	deleteAndClear(mTexHairColor);
-	deleteAndClear(mTexEyeColor);
+	delete_and_clear(mTexSkinColor);
+	delete_and_clear(mTexHairColor);
+	delete_and_clear(mTexEyeColor);
 
 	std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer());
 	mPolyMeshes.clear();
@@ -320,14 +319,14 @@ void LLAvatarAppearance::initClass()
 	BOOL success = sXMLTree.parseFile( xmlFile, FALSE );
 	if (!success)
 	{
-		llerrs << "Problem reading avatar configuration file:" << xmlFile << llendl;
+		llerrs << "Problem reading avatar configuration file:" << xmlFile << LL_ENDL;
 	}
 
 	// now sanity check xml file
 	LLXmlTreeNode* root = sXMLTree.getRoot();
 	if (!root) 
 	{
-		llerrs << "No root node found in avatar configuration file: " << xmlFile << llendl;
+		llerrs << "No root node found in avatar configuration file: " << xmlFile << LL_ENDL;
 		return;
 	}
 
@@ -336,14 +335,14 @@ void LLAvatarAppearance::initClass()
 	//-------------------------------------------------------------------------
 	if( !root->hasName( "linden_avatar" ) )
 	{
-		llerrs << "Invalid avatar file header: " << xmlFile << llendl;
+		llerrs << "Invalid avatar file header: " << xmlFile << LL_ENDL;
 	}
 	
 	std::string version;
 	static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
 	if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") )
 	{
-		llerrs << "Invalid avatar file version: " << version << " in file: " << xmlFile << llendl;
+		llerrs << "Invalid avatar file version: " << version << " in file: " << xmlFile << LL_ENDL;
 	}
 
 	S32 wearable_def_version = 1;
@@ -356,7 +355,7 @@ void LLAvatarAppearance::initClass()
 	LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" );
 	if (!skeleton_node)
 	{
-		llerrs << "No skeleton in avatar configuration file: " << xmlFile << llendl;
+		llerrs << "No skeleton in avatar configuration file: " << xmlFile << LL_ENDL;
 		return;
 	}
 	
@@ -364,14 +363,14 @@ void LLAvatarAppearance::initClass()
 	static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name");
 	if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name))
 	{
-		llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << llendl;
+		llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << LL_ENDL;
 	}
 	
 	std::string skeleton_path;
 	skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name);
 	if (!parseSkeletonFile(skeleton_path))
 	{
-		llerrs << "Error parsing skeleton file: " << skeleton_path << llendl;
+		llerrs << "Error parsing skeleton file: " << skeleton_path << LL_ENDL;
 	}
 
 	// Process XML data
@@ -384,43 +383,43 @@ void LLAvatarAppearance::initClass()
 	sAvatarSkeletonInfo = new LLAvatarSkeletonInfo;
 	if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot()))
 	{
-		llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl;
+		llerrs << "Error parsing skeleton XML file: " << skeleton_path << LL_ENDL;
 	}
 	// parse avatar_lad.xml
 	if (sAvatarXmlInfo)
 	{ //this can happen if a login attempt failed
-		deleteAndClear(sAvatarXmlInfo);
+		delete_and_clear(sAvatarXmlInfo);
 	}
 	sAvatarXmlInfo = new LLAvatarXmlInfo;
 	if (!sAvatarXmlInfo->parseXmlSkeletonNode(root))
 	{
-		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
+		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
 	}
 	if (!sAvatarXmlInfo->parseXmlMeshNodes(root))
 	{
-		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
+		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
 	}
 	if (!sAvatarXmlInfo->parseXmlColorNodes(root))
 	{
-		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
+		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
 	}
 	if (!sAvatarXmlInfo->parseXmlLayerNodes(root))
 	{
-		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
+		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
 	}
 	if (!sAvatarXmlInfo->parseXmlDriverNodes(root))
 	{
-		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
+		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
 	}
 	if (!sAvatarXmlInfo->parseXmlMorphNodes(root))
 	{
-		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
+		llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
 	}
 }
 
 void LLAvatarAppearance::cleanupClass()
 {
-	deleteAndClear(sAvatarXmlInfo);
+	delete_and_clear(sAvatarXmlInfo);
 	// *TODO: What about sAvatarSkeletonInfo ???
 	sSkeletonXMLTree.cleanup();
 	sXMLTree.cleanup();
@@ -527,7 +526,7 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename)
 
 	if (!parsesuccess)
 	{
-		llerrs << "Can't parse skeleton file: " << filename << llendl;
+		llerrs << "Can't parse skeleton file: " << filename << LL_ENDL;
 		return FALSE;
 	}
 
@@ -535,13 +534,13 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename)
 	LLXmlTreeNode* root = sSkeletonXMLTree.getRoot();
 	if (!root) 
 	{
-		llerrs << "No root node found in avatar skeleton file: " << filename << llendl;
+		llerrs << "No root node found in avatar skeleton file: " << filename << LL_ENDL;
 		return FALSE;
 	}
 
 	if( !root->hasName( "linden_skeleton" ) )
 	{
-		llerrs << "Invalid avatar skeleton file header: " << filename << llendl;
+		llerrs << "Invalid avatar skeleton file header: " << filename << LL_ENDL;
 		return FALSE;
 	}
 
@@ -549,7 +548,7 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename)
 	static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
 	if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") )
 	{
-		llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << llendl;
+		llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << LL_ENDL;
 		return FALSE;
 	}
 
@@ -568,7 +567,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
 		joint = getCharacterJoint(joint_num);
 		if (!joint)
 		{
-			llwarns << "Too many bones" << llendl;
+			llwarns << "Too many bones" << LL_ENDL;
 			return FALSE;
 		}
 		joint->setName( info->mName );
@@ -577,7 +576,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
 	{
 		if (volume_num >= (S32)mNumCollisionVolumes)
 		{
-			llwarns << "Too many bones" << llendl;
+			llwarns << "Too many bones" << LL_ENDL;
 			return FALSE;
 		}
 		joint = (&mCollisionVolumes[volume_num]);
@@ -647,7 +646,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
 	//-------------------------------------------------------------------------
 	if (!allocateCharacterJoints(info->mNumBones))
 	{
-		llerrs << "Can't allocate " << info->mNumBones << " joints" << llendl;
+		llerrs << "Can't allocate " << info->mNumBones << " joints" << LL_ENDL;
 		return FALSE;
 	}
 	
@@ -658,7 +657,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
 	{
 		if (!allocateCollisionVolumes(info->mNumCollisionVolumes))
 		{
-			llerrs << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << llendl;
+			llerrs << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << LL_ENDL;
 			return FALSE;
 		}
 	}
@@ -671,7 +670,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
 		LLAvatarBoneInfo *info = *iter;
 		if (!setupBone(info, NULL, current_volume_num, current_joint_num))
 		{
-			llerrs << "Error parsing bone in skeleton file" << llendl;
+			llerrs << "Error parsing bone in skeleton file" << LL_ENDL;
 			return FALSE;
 		}
 	}
@@ -731,17 +730,17 @@ void LLAvatarAppearance::buildCharacter()
 	stop_glerror();
 
 // 	gPrintMessagesThisFrame = TRUE;
-	lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << llendl;
+	lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << LL_ENDL;
 
 	if (!status)
 	{
 		if (isSelf())
 		{
-			llerrs << "Unable to load user's avatar" << llendl;
+			llerrs << "Unable to load user's avatar" << LL_ENDL;
 		}
 		else
 		{
-			llwarns << "Unable to load other's avatar" << llendl;
+			llwarns << "Unable to load other's avatar" << LL_ENDL;
 		}
 		return;
 	}
@@ -790,7 +789,7 @@ void LLAvatarAppearance::buildCharacter()
 		  mEyeLeftp &&
 		  mEyeRightp))
 	{
-		llerrs << "Failed to create avatar." << llendl;
+		llerrs << "Failed to create avatar." << LL_ENDL;
 		return;
 	}
 
@@ -811,21 +810,21 @@ BOOL LLAvatarAppearance::loadAvatar()
 	// avatar_skeleton.xml
 	if( !buildSkeleton(sAvatarSkeletonInfo) )
 	{
-		llwarns << "avatar file: buildSkeleton() failed" << llendl;
+		llwarns << "avatar file: buildSkeleton() failed" << LL_ENDL;
 		return FALSE;
 	}
 
 	// avatar_lad.xml : <skeleton>
 	if( !loadSkeletonNode() )
 	{
-		llwarns << "avatar file: loadNodeSkeleton() failed" << llendl;
+		llwarns << "avatar file: loadNodeSkeleton() failed" << LL_ENDL;
 		return FALSE;
 	}
 	
 	// avatar_lad.xml : <mesh>
 	if( !loadMeshNodes() )
 	{
-		llwarns << "avatar file: loadNodeMesh() failed" << llendl;
+		llwarns << "avatar file: loadNodeMesh() failed" << LL_ENDL;
 		return FALSE;
 	}
 	
@@ -835,13 +834,13 @@ BOOL LLAvatarAppearance::loadAvatar()
 		mTexSkinColor = new LLTexGlobalColor( this );
 		if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) )
 		{
-			llwarns << "avatar file: mTexSkinColor->setInfo() failed" << llendl;
+			llwarns << "avatar file: mTexSkinColor->setInfo() failed" << LL_ENDL;
 			return FALSE;
 		}
 	}
 	else
 	{
-		llwarns << "<global_color> name=\"skin_color\" not found" << llendl;
+		llwarns << "<global_color> name=\"skin_color\" not found" << LL_ENDL;
 		return FALSE;
 	}
 	if( sAvatarXmlInfo->mTexHairColorInfo )
@@ -849,13 +848,13 @@ BOOL LLAvatarAppearance::loadAvatar()
 		mTexHairColor = new LLTexGlobalColor( this );
 		if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) )
 		{
-			llwarns << "avatar file: mTexHairColor->setInfo() failed" << llendl;
+			llwarns << "avatar file: mTexHairColor->setInfo() failed" << LL_ENDL;
 			return FALSE;
 		}
 	}
 	else
 	{
-		llwarns << "<global_color> name=\"hair_color\" not found" << llendl;
+		llwarns << "<global_color> name=\"hair_color\" not found" << LL_ENDL;
 		return FALSE;
 	}
 	if( sAvatarXmlInfo->mTexEyeColorInfo )
@@ -863,26 +862,26 @@ BOOL LLAvatarAppearance::loadAvatar()
 		mTexEyeColor = new LLTexGlobalColor( this );
 		if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) )
 		{
-			llwarns << "avatar file: mTexEyeColor->setInfo() failed" << llendl;
+			llwarns << "avatar file: mTexEyeColor->setInfo() failed" << LL_ENDL;
 			return FALSE;
 		}
 	}
 	else
 	{
-		llwarns << "<global_color> name=\"eye_color\" not found" << llendl;
+		llwarns << "<global_color> name=\"eye_color\" not found" << LL_ENDL;
 		return FALSE;
 	}
 	
 	// avatar_lad.xml : <layer_set>
 	if (sAvatarXmlInfo->mLayerInfoList.empty())
 	{
-		llwarns << "avatar file: missing <layer_set> node" << llendl;
+		llwarns << "avatar file: missing <layer_set> node" << LL_ENDL;
 		return FALSE;
 	}
 
 	if (sAvatarXmlInfo->mMorphMaskInfoList.empty())
 	{
-		llwarns << "avatar file: missing <morph_masks> node" << llendl;
+		llwarns << "avatar file: missing <morph_masks> node" << LL_ENDL;
 		return FALSE;
 	}
 
@@ -924,14 +923,14 @@ BOOL LLAvatarAppearance::loadAvatar()
 			LLVisualParam*(LLAvatarAppearance::*avatar_function)(S32)const = &LLAvatarAppearance::getVisualParam; 
 			if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLAvatarAppearance*)this,_1 ), false))
 			{
-				llwarns << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << llendl;
+				llwarns << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << LL_ENDL;
 				continue;
 			}
 		}
 		else
 		{
 			delete driver_param;
-			llwarns << "avatar file: driver_param->parseData() failed" << llendl;
+			llwarns << "avatar file: driver_param->parseData() failed" << LL_ENDL;
 			return FALSE;
 		}
 	}
@@ -1051,17 +1050,17 @@ BOOL LLAvatarAppearance::loadMeshNodes()
 			}
 			else
 			{
-				llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl;
+				llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << LL_ENDL;
 				return FALSE;
 			}
 		}
 		else 
 		{
-			llwarns << "Ignoring unrecognized mesh type: " << type << llendl;
+			llwarns << "Ignoring unrecognized mesh type: " << type << LL_ENDL;
 			return FALSE;
 		}
 
-		//	llinfos << "Parsing mesh data for " << type << "..." << llendl;
+		//	llinfos << "Parsing mesh data for " << type << "..." << LL_ENDL;
 
 		// If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings.
 		// Do not touch!!!
@@ -1091,7 +1090,7 @@ BOOL LLAvatarAppearance::loadMeshNodes()
 
 		if( !poly_mesh )
 		{
-			llwarns << "Failed to load mesh of type " << type << llendl;
+			llwarns << "Failed to load mesh of type " << type << LL_ENDL;
 			return FALSE;
 		}
 
@@ -1151,7 +1150,7 @@ BOOL LLAvatarAppearance::loadLayersets()
 			{
 				stop_glerror();
 				delete layer_set;
-				llwarns << "avatar file: layer_set->setInfo() failed" << llendl;
+				llwarns << "avatar file: layer_set->setInfo() failed" << LL_ENDL;
 				return FALSE;
 			}
 
@@ -1174,7 +1173,7 @@ BOOL LLAvatarAppearance::loadLayersets()
 			// if no baked texture was found, warn and cleanup
 			if (baked_index == BAKED_NUM_INDICES)
 			{
-				llwarns << "<layer_set> has invalid body_region attribute" << llendl;
+				llwarns << "<layer_set> has invalid body_region attribute" << LL_ENDL;
 				delete layer_set;
 				return FALSE;
 			}
@@ -1192,7 +1191,7 @@ BOOL LLAvatarAppearance::loadLayersets()
 				}
 				else
 				{
-					llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << llendl;
+					llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << LL_ENDL;
 					success = FALSE;
 				}
 			}
@@ -1288,7 +1287,7 @@ BOOL LLAvatarAppearance::isValid() const
 	// This should only be called on ourself.
 	if (!isSelf())
 	{
-		llerrs << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << llendl;
+		llerrs << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << LL_ENDL;
 	}
 	return TRUE;
 }
@@ -1453,7 +1452,7 @@ LLTexLayerSet* LLAvatarAppearance::getAvatarLayerSet(EBakedTextureIndex baked_in
 //-----------------------------------------------------------------------------
 BOOL LLAvatarAppearance::allocateCollisionVolumes( U32 num )
 {
-	deleteAndClearArray(mCollisionVolumes);
+	delete_and_clear_array(mCollisionVolumes);
 	mNumCollisionVolumes = 0;
 
 	mCollisionVolumes = new LLAvatarJointCollisionVolume[num];
@@ -1477,7 +1476,7 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
 		static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
 		if (!node->getFastAttributeString(name_string, mName))
 		{
-			llwarns << "Bone without name" << llendl;
+			llwarns << "Bone without name" << LL_ENDL;
 			return FALSE;
 		}
 	}
@@ -1492,28 +1491,28 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
 	}
 	else
 	{
-		llwarns << "Invalid node " << node->getName() << llendl;
+		llwarns << "Invalid node " << node->getName() << LL_ENDL;
 		return FALSE;
 	}
 
 	static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos");
 	if (!node->getFastAttributeVector3(pos_string, mPos))
 	{
-		llwarns << "Bone without position" << llendl;
+		llwarns << "Bone without position" << LL_ENDL;
 		return FALSE;
 	}
 
 	static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot");
 	if (!node->getFastAttributeVector3(rot_string, mRot))
 	{
-		llwarns << "Bone without rotation" << llendl;
+		llwarns << "Bone without rotation" << LL_ENDL;
 		return FALSE;
 	}
 	
 	static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
 	if (!node->getFastAttributeVector3(scale_string, mScale))
 	{
-		llwarns << "Bone without scale" << llendl;
+		llwarns << "Bone without scale" << LL_ENDL;
 		return FALSE;
 	}
 
@@ -1522,7 +1521,7 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
 		static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot");
 		if (!node->getFastAttributeVector3(pivot_string, mPivot))
 		{
-			llwarns << "Bone without pivot" << llendl;
+			llwarns << "Bone without pivot" << LL_ENDL;
 			return FALSE;
 		}
 	}
@@ -1550,7 +1549,7 @@ BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node)
 	static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones");
 	if (!node->getFastAttributeS32(num_bones_string, mNumBones))
 	{
-		llwarns << "Couldn't find number of bones." << llendl;
+		llwarns << "Couldn't find number of bones." << LL_ENDL;
 		return FALSE;
 	}
 
@@ -1564,7 +1563,7 @@ BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node)
 		if (!info->parseXml(child))
 		{
 			delete info;
-			llwarns << "Error parsing bone in skeleton file" << llendl;
+			llwarns << "Error parsing bone in skeleton file" << LL_ENDL;
 			return FALSE;
 		}
 		mBoneInfoList.push_back(info);
@@ -1581,7 +1580,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
 	LLXmlTreeNode* node = root->getChildByName( "skeleton" );
 	if( !node )
 	{
-		llwarns << "avatar file: missing <skeleton>" << llendl;
+		llwarns << "avatar file: missing <skeleton>" << LL_ENDL;
 		return FALSE;
 	}
 
@@ -1596,11 +1595,11 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
 		{
 			if (child->getChildByName("param_morph"))
 			{
-				llwarns << "Can't specify morph param in skeleton definition." << llendl;
+				llwarns << "Can't specify morph param in skeleton definition." << LL_ENDL;
 			}
 			else
 			{
-				llwarns << "Unknown param type." << llendl;
+				llwarns << "Unknown param type." << LL_ENDL;
 			}
 			continue;
 		}
@@ -1625,7 +1624,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
 		static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
 		if (!child->getFastAttributeString(name_string, info->mName))
 		{
-			llwarns << "No name supplied for attachment point." << llendl;
+			llwarns << "No name supplied for attachment point." << LL_ENDL;
 			delete info;
 			continue;
 		}
@@ -1633,7 +1632,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
 		static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint");
 		if (!child->getFastAttributeString(joint_string, info->mJointName))
 		{
-			llwarns << "No bone declared in attachment point " << info->mName << llendl;
+			llwarns << "No bone declared in attachment point " << info->mName << LL_ENDL;
 			delete info;
 			continue;
 		}
@@ -1659,7 +1658,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
 		static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id");
 		if (!child->getFastAttributeS32(id_string, info->mAttachmentID))
 		{
-			llwarns << "No id supplied for attachment point " << info->mName << llendl;
+			llwarns << "No id supplied for attachment point " << info->mName << LL_ENDL;
 			delete info;
 			continue;
 		}
@@ -1694,7 +1693,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
 		static LLStdStringHandle type_string = LLXmlTree::addAttributeString("type");
 		if( !node->getFastAttributeString( type_string, info->mType ) )
 		{
-			llwarns << "Avatar file: <mesh> is missing type attribute.  Ignoring element. " << llendl;
+			llwarns << "Avatar file: <mesh> is missing type attribute.  Ignoring element. " << LL_ENDL;
 			delete info;
 			return FALSE;  // Ignore this element
 		}
@@ -1702,7 +1701,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
 		static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod");
 		if (!node->getFastAttributeS32( lod_string, info->mLOD ))
 		{
-			llwarns << "Avatar file: <mesh> is missing lod attribute.  Ignoring element. " << llendl;
+			llwarns << "Avatar file: <mesh> is missing lod attribute.  Ignoring element. " << LL_ENDL;
 			delete info;
 			return FALSE;  // Ignore this element
 		}
@@ -1710,7 +1709,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
 		static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name");
 		if( !node->getFastAttributeString( file_name_string, info->mMeshFileName ) )
 		{
-			llwarns << "Avatar file: <mesh> is missing file_name attribute.  Ignoring: " << info->mType << llendl;
+			llwarns << "Avatar file: <mesh> is missing file_name attribute.  Ignoring: " << info->mType << LL_ENDL;
 			delete info;
 			return FALSE;  // Ignore this element
 		}
@@ -1741,11 +1740,11 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
 			{
 				if (child->getChildByName("param_skeleton"))
 				{
-					llwarns << "Can't specify skeleton param in a mesh definition." << llendl;
+					llwarns << "Can't specify skeleton param in a mesh definition." << LL_ENDL;
 				}
 				else
 				{
-					llwarns << "Unknown param type." << llendl;
+					llwarns << "Unknown param type." << LL_ENDL;
 				}
 				continue;
 			}
@@ -1786,14 +1785,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root
 			{
 				if (mTexSkinColorInfo)
 				{
-					llwarns << "avatar file: multiple instances of skin_color" << llendl;
+					llwarns << "avatar file: multiple instances of skin_color" << LL_ENDL;
 					return FALSE;
 				}
 				mTexSkinColorInfo = new LLTexGlobalColorInfo;
 				if( !mTexSkinColorInfo->parseXml( color_node ) )
 				{
-					deleteAndClear(mTexSkinColorInfo);
-					llwarns << "avatar file: mTexSkinColor->parseXml() failed" << llendl;
+					delete_and_clear(mTexSkinColorInfo);
+					llwarns << "avatar file: mTexSkinColor->parseXml() failed" << LL_ENDL;
 					return FALSE;
 				}
 			}
@@ -1801,14 +1800,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root
 			{
 				if (mTexHairColorInfo)
 				{
-					llwarns << "avatar file: multiple instances of hair_color" << llendl;
+					llwarns << "avatar file: multiple instances of hair_color" << LL_ENDL;
 					return FALSE;
 				}
 				mTexHairColorInfo = new LLTexGlobalColorInfo;
 				if( !mTexHairColorInfo->parseXml( color_node ) )
 				{
-					deleteAndClear(mTexHairColorInfo);
-					llwarns << "avatar file: mTexHairColor->parseXml() failed" << llendl;
+					delete_and_clear(mTexHairColorInfo);
+					llwarns << "avatar file: mTexHairColor->parseXml() failed" << LL_ENDL;
 					return FALSE;
 				}
 			}
@@ -1816,13 +1815,13 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root
 			{
 				if (mTexEyeColorInfo)
 				{
-					llwarns << "avatar file: multiple instances of eye_color" << llendl;
+					llwarns << "avatar file: multiple instances of eye_color" << LL_ENDL;
 					return FALSE;
 				}
 				mTexEyeColorInfo = new LLTexGlobalColorInfo;
 				if( !mTexEyeColorInfo->parseXml( color_node ) )
 				{
-					llwarns << "avatar file: mTexEyeColor->parseXml() failed" << llendl;
+					llwarns << "avatar file: mTexEyeColor->parseXml() failed" << LL_ENDL;
 					return FALSE;
 				}
 			}
@@ -1848,7 +1847,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root
 		else
 		{
 			delete layer_info;
-			llwarns << "avatar file: layer_set->parseXml() failed" << llendl;
+			llwarns << "avatar file: layer_set->parseXml() failed" << LL_ENDL;
 			return FALSE;
 		}
 	}
@@ -1877,7 +1876,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* roo
 				else
 				{
 					delete driver_info;
-					llwarns << "avatar file: driver_param->parseXml() failed" << llendl;
+					llwarns << "avatar file: driver_param->parseXml() failed" << LL_ENDL;
 					return FALSE;
 				}
 			}
@@ -1906,7 +1905,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root
 		static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name");
 		if (!grand_child->getFastAttributeString(name_string, info->mName))
 		{
-			llwarns << "No name supplied for morph mask." << llendl;
+			llwarns << "No name supplied for morph mask." << LL_ENDL;
 			delete info;
 			continue;
 		}
@@ -1914,7 +1913,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root
 		static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region");
 		if (!grand_child->getFastAttributeString(region_string, info->mRegion))
 		{
-			llwarns << "No region supplied for morph mask." << llendl;
+			llwarns << "No region supplied for morph mask." << LL_ENDL;
 			delete info;
 			continue;
 		}
@@ -1922,7 +1921,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root
 		static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer");
 		if (!grand_child->getFastAttributeString(layer_string, info->mLayer))
 		{
-			llwarns << "No layer supplied for morph mask." << llendl;
+			llwarns << "No layer supplied for morph mask." << LL_ENDL;
 			delete info;
 			continue;
 		}
diff --git a/indra/llappearance/llavatarjointmesh.cpp b/indra/llappearance/llavatarjointmesh.cpp
index 753805b314da5d529c9d8ba4458ea31415d97b0d..e50ef8d48521837af5f36d01a9aaed168cc4689c 100644
--- a/indra/llappearance/llavatarjointmesh.cpp
+++ b/indra/llappearance/llavatarjointmesh.cpp
@@ -28,7 +28,6 @@
 // Header Files
 //-----------------------------------------------------------------------------
 #include "linden_common.h"
-#include "imageids.h"
 #include "llfasttimer.h"
 #include "llrender.h"
 
@@ -317,7 +316,7 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
 		setupJoint((LLAvatarJoint*)getRoot());
 	}
 
-//	llinfos << "joint render entries: " << mMesh->mJointRenderData.count() << llendl;
+	LL_DEBUGS() << "joint render entries: " << mMesh->mJointRenderData.size() << LL_ENDL;
 }
 
 //-----------------------------------------------------------------------------
@@ -325,10 +324,11 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
 //-----------------------------------------------------------------------------
 void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
 {
-//	llinfos << "Mesh: " << getName() << llendl;
+	LL_DEBUGS() << "Mesh: " << getName() << LL_ENDL;
 
-//	S32 joint_count = 0;
+	S32 joint_count = 0;
 	U32 sj;
+
 	for (sj=0; sj<mNumSkinJoints; sj++)
 	{
 		LLSkinJoint &js = mSkinJoints[sj];
@@ -341,23 +341,20 @@ void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
 		// we've found a skinjoint for this joint..
 
 		// is the last joint in the array our parent?
-		if(mMesh->mJointRenderData.count() && mMesh->mJointRenderData[mMesh->mJointRenderData.count() - 1]->mWorldMatrix == &current_joint->getParent()->getWorldMatrix())
+		if(mMesh->mJointRenderData.size() && mMesh->mJointRenderData[mMesh->mJointRenderData.size() - 1]->mWorldMatrix == &current_joint->getParent()->getWorldMatrix())
 		{
 			// ...then just add ourselves
 			LLAvatarJoint* jointp = js.mJoint;
-			mMesh->mJointRenderData.put(new LLJointRenderData(&jointp->getWorldMatrix(), &js));
-//			llinfos << "joint " << joint_count << js.mJoint->getName() << llendl;
-//			joint_count++;
+			mMesh->mJointRenderData.push_back(new LLJointRenderData(&jointp->getWorldMatrix(), &js));
+			LL_DEBUGS() << "joint " << joint_count++ << js.mJoint->getName() << LL_ENDL;
 		}
 		// otherwise add our parent and ourselves
 		else
 		{
-			mMesh->mJointRenderData.put(new LLJointRenderData(&current_joint->getParent()->getWorldMatrix(), NULL));
-//			llinfos << "joint " << joint_count << current_joint->getParent()->getName() << llendl;
-//			joint_count++;
-			mMesh->mJointRenderData.put(new LLJointRenderData(&current_joint->getWorldMatrix(), &js));
-//			llinfos << "joint " << joint_count << current_joint->getName() << llendl;
-//			joint_count++;
+			mMesh->mJointRenderData.push_back(new LLJointRenderData(&current_joint->getParent()->getWorldMatrix(), NULL));
+			LL_DEBUGS() << "joint " << joint_count++ << current_joint->getParent()->getName() << LL_ENDL;
+			mMesh->mJointRenderData.push_back(new LLJointRenderData(&current_joint->getWorldMatrix(), &js));
+			LL_DEBUGS() << "joint " << joint_count++ << current_joint->getName() << LL_ENDL;
 		}
 	}
 
diff --git a/indra/llappearance/lldriverparam.h b/indra/llappearance/lldriverparam.h
index 040c9cf5be1dce89df81b2b31b49b27f3be3fb92..2420db76e7fdc59cc153ccffff0574f4e37c2082 100644
--- a/indra/llappearance/lldriverparam.h
+++ b/indra/llappearance/lldriverparam.h
@@ -29,6 +29,7 @@
 
 #include "llviewervisualparam.h"
 #include "llwearabletype.h"
+#include <deque>
 
 class LLAvatarAppearance;
 class LLDriverParam;
diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp
index a01457246e19de1ff115e9e16bfa08d4f6ed6d27..1e87dae4850be98c7fb3b9368a8c386c51b483b4 100644
--- a/indra/llappearance/llpolymesh.cpp
+++ b/indra/llappearance/llpolymesh.cpp
@@ -161,8 +161,8 @@ void LLPolyMeshSharedData::freeMeshData()
 //      mVertFaceMap.deleteAllData();
 }
 
-// compate_int is used by the qsort function to sort the index array
-int compare_int(const void *a, const void *b);
+// compare_int is used by the qsort function to sort the index array
+S32 compare_int(const void *a, const void *b);
 
 //-----------------------------------------------------------------------------
 // genIndices()
@@ -547,10 +547,10 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
 //                      S32 j;
 //                      for(j = 0; j < 3; j++)
 //                      {
-//                              LLDynamicArray<S32> *face_list = mVertFaceMap.getIfThere(face[j]);
+//                              std::vector<S32> *face_list = mVertFaceMap.getIfThere(face[j]);
 //                              if (!face_list)
 //                              {
-//                                      face_list = new LLDynamicArray<S32>;
+//                                      face_list = new std::vector<S32>;
 //                                      mVertFaceMap.addData(face[j], face_list);
 //                              }
 //                              face_list->put(i);
@@ -808,15 +808,8 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_
 //-----------------------------------------------------------------------------
 LLPolyMesh::~LLPolyMesh()
 {
-        S32 i;
-        for (i = 0; i < mJointRenderData.count(); i++)
-        {
-                delete mJointRenderData[i];
-                mJointRenderData[i] = NULL;
-        }
-
-		ll_aligned_free_16(mVertexData);
-
+	delete_and_clear(mJointRenderData);
+	ll_aligned_free_16(mVertexData);
 }
 
 
diff --git a/indra/llappearance/llpolymesh.h b/indra/llappearance/llpolymesh.h
index ef1dfb1adb25feb94f105bde280589ae588a0511..83659d9514c30ac9c895ad98e8e708253b8194d8 100644
--- a/indra/llappearance/llpolymesh.h
+++ b/indra/llappearance/llpolymesh.h
@@ -36,7 +36,6 @@
 #include "llquaternion.h"
 #include "llpolymorph.h"
 #include "lljoint.h"
-//#include "lldarray.h"
 
 class LLSkinJoint;
 class LLAvatarAppearance;
@@ -322,7 +321,7 @@ class LLPolyMesh
 	void setAvatar(LLAvatarAppearance* avatarp) { mAvatarp = avatarp; }
 	LLAvatarAppearance* getAvatar() { return mAvatarp; }
 
-	LLDynamicArray<LLJointRenderData*>	mJointRenderData;
+	std::vector<LLJointRenderData*>	mJointRenderData;
 
 	U32				mFaceVertexOffset;
 	U32				mFaceVertexCount;
diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp
index a98a11b357e37d8ee09a655a5125a074b7244031..8f1f413e02b6597f946e7ed810df71f9fa83843d 100644
--- a/indra/llappearance/llpolyskeletaldistortion.cpp
+++ b/indra/llappearance/llpolyskeletaldistortion.cpp
@@ -28,7 +28,7 @@
 // Header Files
 //-----------------------------------------------------------------------------
 #include "llpreprocessor.h"
-#include "llerrorlegacy.h"
+#include "llerror.h"
 #include "llavatarappearance.h"
 #include "llavatarjoint.h"
 #include "llpolymorph.h"
diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h
index 774bc7dfa2a8071ad89ae8c680e4326a17f0c033..24c9e9ae48aa5b06e4b50bf218a9094f29a1c773 100644
--- a/indra/llappearance/llpolyskeletaldistortion.h
+++ b/indra/llappearance/llpolyskeletaldistortion.h
@@ -39,7 +39,6 @@
 //#include "llpolymorph.h"
 #include "lljoint.h"
 #include "llviewervisualparam.h"
-//#include "lldarray.h"
 
 //class LLSkinJoint;
 class LLAvatarAppearance;
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index f65829febe488a6ee2f7490ff7a75cdb235b627e..6c584c239cdee8811dd61251e35d3c51111bb95a 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -30,7 +30,6 @@
 
 #include "llavatarappearance.h"
 #include "llcrc.h"
-#include "imageids.h"
 #include "llimagej2c.h"
 #include "llimagetga.h"
 #include "lldir.h"
diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h
index 6e4d2b22428d17c60cddc04fd24940157de65bb2..132c153bcdb5c1515648391d9476b4b17b26043c 100644
--- a/indra/llappearance/llwearable.h
+++ b/indra/llappearance/llwearable.h
@@ -28,7 +28,6 @@
 #define LL_LLWEARABLE_H
 
 #include "llavatarappearancedefines.h"
-#include "llextendedstatus.h"
 #include "llpermissions.h"
 #include "llsaleinfo.h"
 #include "llwearabletype.h"
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index bcff03ceaa094c164c2c0f1ad320fd8fd7a66f62..e7b9fa6b18f9559c8247bc1da782eea9b050facb 100755
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -41,6 +41,7 @@
 #include "vorbis/codec.h"
 #include "vorbis/vorbisfile.h"
 #include <iterator>
+#include <deque>
 
 extern LLAudioEngine *gAudiop;
 
@@ -114,7 +115,7 @@ size_t vfs_read(void *ptr, size_t size, size_t nmemb, void *datasource)
 	}
 }
 
-int vfs_seek(void *datasource, ogg_int64_t offset, int whence)
+S32 vfs_seek(void *datasource, ogg_int64_t offset, S32 whence)
 {
 	LLVFile *file = (LLVFile *)datasource;
 
@@ -150,7 +151,7 @@ int vfs_seek(void *datasource, ogg_int64_t offset, int whence)
 	}
 }
 
-int vfs_close (void *datasource)
+S32 vfs_close (void *datasource)
 {
 	LLVFile *file = (LLVFile *)datasource;
 	delete file;
@@ -209,7 +210,7 @@ BOOL LLVorbisDecodeState::initDecode()
 		return FALSE;
 	}
 
-	int r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, vfs_callbacks);
+	S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, vfs_callbacks);
 	if(r < 0) 
 	{
 		llwarns << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << llendl;
@@ -542,7 +543,7 @@ class LLAudioDecodeMgr::Impl
 	void processQueue(const F32 num_secs = 0.005);
 
 protected:
-	LLLinkedQueue<LLUUID> mDecodeQueue;
+	std::deque<LLUUID> mDecodeQueue;
 	LLPointer<LLVorbisDecodeState> mCurrentDecodep;
 };
 
@@ -617,7 +618,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
 
 		if (!done)
 		{
-			if (!mDecodeQueue.getLength())
+			if (mDecodeQueue.empty())
 			{
 				// Nothing else on the queue.
 				done = TRUE;
@@ -625,7 +626,8 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
 			else
 			{
 				LLUUID uuid;
-				mDecodeQueue.pop(uuid);
+				uuid = mDecodeQueue.front();
+				mDecodeQueue.pop_front();
 				if (gAudiop->hasDecodedFile(uuid))
 				{
 					// This file has already been decoded, don't decode it again.
@@ -683,7 +685,7 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
 	{
 		// Just put it on the decode queue.
 		//llinfos << "addDecodeRequest for " << uuid << " has local asset file already" << llendl;
-		mImpl->mDecodeQueue.push(uuid);
+		mImpl->mDecodeQueue.push_back(uuid);
 		return TRUE;
 	}
 
diff --git a/indra/llaudio/llaudiodecodemgr.h b/indra/llaudio/llaudiodecodemgr.h
index e42fe8a40d3855670004bbe666b817ceb3b4f910..7a9b807d04db0ccc7247e443b319f928e3165e09 100755
--- a/indra/llaudio/llaudiodecodemgr.h
+++ b/indra/llaudio/llaudiodecodemgr.h
@@ -28,7 +28,6 @@
 
 #include "stdtypes.h"
 
-#include "lllinkedqueue.h"
 #include "lluuid.h"
 
 #include "llassettype.h"
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 06e752cf340494ad5c490b5b9ce61bbf5c6edc2b..9c72515a0f6c2f7fba8f128beb2b52bcb84291d9 100755
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -187,7 +187,7 @@ void LLAudioEngine::stopInternetStream()
 }
 
 // virtual
-void LLAudioEngine::pauseInternetStream(int pause)
+void LLAudioEngine::pauseInternetStream(S32 pause)
 {
 	if (mStreamingAudioImpl)
 		mStreamingAudioImpl->pause(pause);
diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h
index da1629a1db57a7c1fda86305a06e6ced52e90898..f1e1b4e308c79a440115011ed64a53c2dfe0343e 100755
--- a/indra/llaudio/llaudioengine.h
+++ b/indra/llaudio/llaudioengine.h
@@ -88,7 +88,7 @@ class LLAudioEngine
 	
 	enum LLAudioPlayState
 	{
-		// isInternetStreamPlaying() returns an *int*, with
+		// isInternetStreamPlaying() returns an *S32*, with
 		// 0 = stopped, 1 = playing, 2 = paused.
 		AUDIO_STOPPED = 0,
 		AUDIO_PLAYING = 1,
@@ -160,7 +160,7 @@ class LLAudioEngine
 	// Internet stream methods - these will call down into the *mStreamingAudioImpl if it exists
 	void startInternetStream(const std::string& url);
 	void stopInternetStream();
-	void pauseInternetStream(int pause);
+	void pauseInternetStream(S32 pause);
 	void updateInternetStream(); // expected to be called often
 	LLAudioPlayState isInternetStreamPlaying();
 	// use a value from 0.0 to 1.0, inclusive
diff --git a/indra/llaudio/llstreamingaudio_fmodex.h b/indra/llaudio/llstreamingaudio_fmodex.h
index 1dee18ae7dab520cea4295bdd254dc14a4da21d2..2787840ba1a8581bba725f3574c0620fa9c7ea3e 100644
--- a/indra/llaudio/llstreamingaudio_fmodex.h
+++ b/indra/llaudio/llstreamingaudio_fmodex.h
@@ -49,9 +49,9 @@ class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface
 
 	/*virtual*/ void start(const std::string& url);
 	/*virtual*/ void stop();
-	/*virtual*/ void pause(int pause);
+	/*virtual*/ void pause(S32 pause);
 	/*virtual*/ void update();
-	/*virtual*/ int isPlaying();
+	/*virtual*/ S32 isPlaying();
 	/*virtual*/ void setGain(F32 vol);
 	/*virtual*/ F32 getGain();
 	/*virtual*/ std::string getURL();
diff --git a/indra/llcharacter/llanimationstates.h b/indra/llcharacter/llanimationstates.h
index 84185c3f92c8b27a17ac411afb18a874b3050b2f..79cbcabdc1da0e72ad4c4fd6544cf2ebc2f288bd 100755
--- a/indra/llcharacter/llanimationstates.h
+++ b/indra/llcharacter/llanimationstates.h
@@ -29,7 +29,7 @@
 
 #include <map>
 
-#include "string_table.h"
+#include "llstringtable.h"
 #include "lluuid.h"
 
 //-----------------------------------------------------------------------------
diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h
index 5740dbce77274089b2a4a0d60ea9c6b8c57c50bd..43fb68bb5ccdfe61f4bb190a9c335208085d29f2 100755
--- a/indra/llcharacter/llcharacter.h
+++ b/indra/llcharacter/llcharacter.h
@@ -35,7 +35,7 @@
 #include "lljoint.h"
 #include "llmotioncontroller.h"
 #include "llvisualparam.h"
-#include "string_table.h"
+#include "llstringtable.h"
 #include "llpointer.h"
 #include "llthread.h"
 
diff --git a/indra/llcharacter/llgesture.cpp b/indra/llcharacter/llgesture.cpp
index c23694639e1e98ab6778b2e9ac481e8bbe81e1bd..aeb65eb10fd87f4c7bdcfe4cefc268074b425e8d 100755
--- a/indra/llcharacter/llgesture.cpp
+++ b/indra/llcharacter/llgesture.cpp
@@ -173,27 +173,7 @@ S32 LLGesture::getMaxSerialSize()
 
 LLGestureList::LLGestureList()
 :	mList(0)
-{
-	// add some gestures for debugging
-//	LLGesture *gesture = NULL;
-/*
-	gesture = new LLGesture(KEY_F2, MASK_NONE, ":-)", 
-		SND_CHIRP, "dance2", ":-)" );
-	mList.put(gesture);
-
-	gesture = new LLGesture(KEY_F3, MASK_NONE, "/dance", 
-		SND_OBJECT_CREATE, "dance3", "(dances)" );
-	mList.put(gesture);
-
-	gesture = new LLGesture(KEY_F4, MASK_NONE, "/boogie", 
-		LLUUID::null, "dance4", LLStringUtil::null );
-	mList.put(gesture);
-
-	gesture = new LLGesture(KEY_F5, MASK_SHIFT, "/tongue", 
-		LLUUID::null, "Express_Tongue_Out", LLStringUtil::null );
-	mList.put(gesture);
-	*/
-}
+{}
 
 LLGestureList::~LLGestureList()
 {
@@ -203,12 +183,7 @@ LLGestureList::~LLGestureList()
 
 void LLGestureList::deleteAll()
 {
-	S32 count = mList.count();
-	for (S32 i = 0; i < count; i++)
-	{
-		delete mList.get(i);
-	}
-	mList.reset();
+	delete_and_clear(mList);
 }
 
 // Iterates through space delimited tokens in string, triggering any gestures found.
@@ -235,9 +210,9 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
 			std::string cur_token_lower = *token_iter;
 			LLStringUtil::toLower(cur_token_lower);
 
-			for (S32 i = 0; i < mList.count(); i++)
+			for (U32 i = 0; i < mList.size(); i++)
 			{
-				gesture = mList.get(i);
+				gesture = mList.at(i);
 				if (gesture->trigger(cur_token_lower))
 				{
 					if( !gesture->getOutputString().empty() )
@@ -286,9 +261,9 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
 
 BOOL LLGestureList::trigger(KEY key, MASK mask)
 {
-	for (S32 i = 0; i < mList.count(); i++)
+	for (U32 i = 0; i < mList.size(); i++)
 	{
-		LLGesture* gesture = mList.get(i);
+		LLGesture* gesture = mList.at(i);
 		if( gesture )
 		{
 			if (gesture->trigger(key, mask))
@@ -308,7 +283,7 @@ BOOL LLGestureList::trigger(KEY key, MASK mask)
 U8 *LLGestureList::serialize(U8 *buffer) const
 {
 	// a single S32 serves as the header that tells us how many to read
-	S32 count = mList.count();
+	U32 count = mList.size();
 	htonmemcpy(buffer, &count, MVT_S32, 4);
 	buffer += sizeof(count);
 
@@ -345,7 +320,7 @@ U8 *LLGestureList::deserialize(U8 *buffer, S32 max_size)
 
 	tmp += sizeof(count);
 
-	mList.reserve_block(count);
+	mList.resize(count);
 
 	for (S32 i = 0; i < count; i++)
 	{
diff --git a/indra/llcharacter/llgesture.h b/indra/llcharacter/llgesture.h
index 66b618c473e061ca3ca5b344d4c7631cb2d9c7a1..cfb489f72766a051cd5512bb5d9dfe659c68b299 100755
--- a/indra/llcharacter/llgesture.h
+++ b/indra/llcharacter/llgesture.h
@@ -31,7 +31,6 @@
 #include "llanimationstates.h"
 #include "lluuid.h"
 #include "llstring.h"
-#include "lldarray.h"
 
 class LLGesture
 {
@@ -67,12 +66,12 @@ class LLGesture
 	static S32 getMaxSerialSize();
 
 protected:
-	KEY					mKey;			// usually a function key
-	MASK				mMask;			// usually MASK_NONE, or MASK_SHIFT
+	KEY				mKey;			// usually a function key
+	MASK			mMask;			// usually MASK_NONE, or MASK_SHIFT
 	std::string		mTrigger;		// string, no whitespace allowed
 	std::string		mTriggerLower;	// lowercase version of mTrigger
-	LLUUID				mSoundItemID;	// ItemID of sound to play, LLUUID::null if none
-	std::string			mAnimation;		// canonical name of animation or face animation
+	LLUUID			mSoundItemID;	// ItemID of sound to play, LLUUID::null if none
+	std::string		mAnimation;		// canonical name of animation or face animation
 	std::string		mOutputString;	// string to say
 
 	static const S32	MAX_SERIAL_SIZE;
@@ -91,9 +90,9 @@ class LLGestureList
 	BOOL triggerAndReviseString(const std::string &string, std::string* revised_string);
 
 	// Used for construction from UI
-	S32 count() const						{ return mList.count(); }
-	virtual LLGesture* get(S32 i) const		{ return mList.get(i); }
-	virtual void put(LLGesture* gesture)	{ mList.put( gesture ); }
+	S32 count() const						{ return mList.size(); }
+	virtual LLGesture* get(S32 i) const		{ return mList.at(i); }
+	virtual void put(LLGesture* gesture)	{ mList.push_back( gesture ); }
 	void deleteAll();
 
 	// non-endian-neutral serialization
@@ -106,7 +105,7 @@ class LLGestureList
 	virtual LLGesture *create_gesture(U8 **buffer, S32 max_size);
 
 protected:
-	LLDynamicArray<LLGesture*>	mList;
+	std::vector<LLGesture*>	mList;
 
 	static const S32	SERIAL_HEADER_SIZE;
 };
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index 09a7c11a22d972a007c22407aac3a2802463a3eb..83bd62e8fae0aca892be56069ab246ab1a3d9d7b 100755
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -560,7 +560,7 @@ void LLJoint::clampRotation(LLQuaternion old_rot, LLQuaternion new_rot)
 //	LLVector3 old_axis = main_axis * old_rot;
 //	LLVector3 new_axis = main_axis * new_rot;
 
-//	for (S32 i = 0; i < mConstraintSilhouette.count() - 1; i++)
+//	for (S32 i = 0; i < mConstraintSilhouette.size() - 1; i++)
 //	{
 //		LLVector3 vert1 = mConstraintSilhouette[i];
 //		LLVector3 vert2 = mConstraintSilhouette[i + 1];
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index 07374b7814986ca0343939d5b085038a36928d18..6efa13aeb55592e6986332355514c259a7e2fed5 100755
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -33,13 +33,11 @@
 #include <string>
 #include <list>
 
-#include "linked_lists.h"
 #include "v3math.h"
 #include "v4math.h"
 #include "m4math.h"
 #include "llquaternion.h"
 #include "xform.h"
-#include "lldarray.h"
 
 const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15;
 const U32 LL_CHARACTER_MAX_JOINTS = 32; // must be divisible by 4!
diff --git a/indra/llcharacter/lljointsolverrp3.cpp b/indra/llcharacter/lljointsolverrp3.cpp
index 133190079115fde5b438a4e79beeeecc036148b4..69a7e3dc6e7593c314ab30a2e94960a0ef6f17cc 100755
--- a/indra/llcharacter/lljointsolverrp3.cpp
+++ b/indra/llcharacter/lljointsolverrp3.cpp
@@ -135,8 +135,6 @@ void LLJointSolverRP3::setTwist( F32 twist )
 //-----------------------------------------------------------------------------
 void LLJointSolverRP3::solve()
 {
-//	llinfos << llendl;
-//	llinfos << "LLJointSolverRP3::solve()" << llendl;
 
 	//-------------------------------------------------------------------------
 	// setup joints in their base rotations
@@ -152,15 +150,15 @@ void LLJointSolverRP3::solve()
 	LLVector3 cPos = mJointC->getWorldPosition();
 	LLVector3 gPos = mJointGoal->getWorldPosition();
 
-//	llinfos << "bPosLocal = " << mJointB->getPosition() << llendl;
-//	llinfos << "cPosLocal = " << mJointC->getPosition() << llendl;
-//	llinfos << "bRotLocal = " << mJointB->getRotation() << llendl;
-//	llinfos << "cRotLocal = " << mJointC->getRotation() << llendl;
-
-//	llinfos << "aPos : " << aPos << llendl;
-//	llinfos << "bPos : " << bPos << llendl;
-//	llinfos << "cPos : " << cPos << llendl;
-//	llinfos << "gPos : " << gPos << llendl;
+	LL_DEBUGS("JointSolver") << "LLJointSolverRP3::solve()" << LL_NEWLINE
+							<< "bPosLocal = " << mJointB->getPosition() << LL_NEWLINE
+							<< "cPosLocal = " << mJointC->getPosition() << LL_NEWLINE
+							<< "bRotLocal = " << mJointB->getRotation() << LL_NEWLINE
+							<< "cRotLocal = " << mJointC->getRotation() << LL_NEWLINE
+							<< "aPos : " << aPos << LL_NEWLINE
+							<< "bPos : " << bPos << LL_NEWLINE
+							<< "cPos : " << cPos << LL_NEWLINE
+							<< "gPos : " << gPos << LL_ENDL;
 
 	//-------------------------------------------------------------------------
 	// get the poleVector in world space
@@ -184,11 +182,6 @@ void LLJointSolverRP3::solve()
 	LLVector3 acVec = cPos - aPos;
 	LLVector3 agVec = gPos - aPos;
 
-//	llinfos << "abVec : " << abVec << llendl;
-//	llinfos << "bcVec : " << bcVec << llendl;
-//	llinfos << "acVec : " << acVec << llendl;
-//	llinfos << "agVec : " << agVec << llendl;
-
 	//-------------------------------------------------------------------------
 	// compute needed lengths of those vectors
 	//-------------------------------------------------------------------------
@@ -196,16 +189,19 @@ void LLJointSolverRP3::solve()
 	F32 bcLen = bcVec.magVec();
 	F32 agLen = agVec.magVec();
 
-//	llinfos << "abLen : " << abLen << llendl;
-//	llinfos << "bcLen : " << bcLen << llendl;
-//	llinfos << "agLen : " << agLen << llendl;
-
 	//-------------------------------------------------------------------------
 	// compute component vector of (A->B) orthogonal to (A->C)
 	//-------------------------------------------------------------------------
 	LLVector3 abacCompOrthoVec = abVec - acVec * ((abVec * acVec)/(acVec * acVec));
 
-//	llinfos << "abacCompOrthoVec : " << abacCompOrthoVec << llendl;
+	LL_DEBUGS("JointSolver") << "abVec : " << abVec << LL_NEWLINE
+		<< "bcVec : " << bcVec << LL_NEWLINE
+		<< "acVec : " << acVec << LL_NEWLINE
+		<< "agVec : " << agVec << LL_NEWLINE
+		<< "abLen : " << abLen << LL_NEWLINE
+		<< "bcLen : " << bcLen << LL_NEWLINE
+		<< "agLen : " << agLen << LL_NEWLINE
+		<< "abacCompOrthoVec : " << abacCompOrthoVec << LL_ENDL;
 
 	//-------------------------------------------------------------------------
 	// compute the normal of the original ABC plane (and store for later)
@@ -273,13 +269,17 @@ void LLJointSolverRP3::solve()
 
 	LLQuaternion bRot(theta - abbcAng, abbcOrthoVec);
 
-//	llinfos << "abbcAng      : " << abbcAng << llendl;
-//	llinfos << "abbcOrthoVec : " << abbcOrthoVec << llendl;
-//	llinfos << "agLenSq      : " << agLenSq << llendl;
-//	llinfos << "cosTheta     : " << cosTheta << llendl;
-//	llinfos << "theta        : " << theta << llendl;
-//	llinfos << "bRot         : " << bRot << llendl;
-//	llinfos << "theta abbcAng theta-abbcAng: " << theta*180.0/F_PI << " " << abbcAng*180.0f/F_PI << " " << (theta - abbcAng)*180.0f/F_PI << llendl;
+	LL_DEBUGS("JointSolver") << "abbcAng      : " << abbcAng << LL_NEWLINE
+							<< "abbcOrthoVec : " << abbcOrthoVec << LL_NEWLINE
+							<< "agLenSq      : " << agLenSq << LL_NEWLINE
+							<< "cosTheta     : " << cosTheta << LL_NEWLINE
+							<< "theta        : " << theta << LL_NEWLINE
+							<< "bRot         : " << bRot << LL_NEWLINE
+							<< "theta abbcAng theta-abbcAng: " 
+								<< theta*180.0/F_PI << " " 
+								<< abbcAng*180.0f/F_PI << " " 
+								<< (theta - abbcAng)*180.0f/F_PI 
+	<< LL_ENDL;
 
 	//-------------------------------------------------------------------------
 	// compute rotation that rotates new A->C to A->G
@@ -293,9 +293,9 @@ void LLJointSolverRP3::solve()
 	LLQuaternion cgRot;
 	cgRot.shortestArc( acVec, agVec );
 
-//	llinfos << "bcVec : " << bcVec << llendl;
-//	llinfos << "acVec : " << acVec << llendl;
-//	llinfos << "cgRot : " << cgRot << llendl;
+	LL_DEBUGS("JointSolver") << "bcVec : " << bcVec << LL_NEWLINE
+							<< "acVec : " << acVec << LL_NEWLINE
+							<< "cgRot : " << cgRot << LL_ENDL;
 
 	// update A->B and B->C with rotation from C to G
 	abVec = abVec * cgRot;
@@ -353,18 +353,16 @@ void LLJointSolverRP3::solve()
 		pRot.shortestArc( abcNorm, apgNorm );
 	}
 
-//	llinfos << "abcNorm = " << abcNorm << llendl;
-//	llinfos << "apgNorm = " << apgNorm << llendl;
-//	llinfos << "pRot = " << pRot << llendl;
-
 	//-------------------------------------------------------------------------
 	// compute twist rotation
 	//-------------------------------------------------------------------------
 	LLQuaternion twistRot( mTwist, agVec );
 
-//	llinfos	<< "twist    : " << mTwist*180.0/F_PI << llendl;
-//	llinfos << "agNormVec: " << agNormVec << llendl;
-//	llinfos << "twistRot : " << twistRot << llendl;
+	LL_DEBUGS("JointSolver") << "abcNorm = " << abcNorm << LL_NEWLINE
+							<< "apgNorm = " << apgNorm << LL_NEWLINE
+							<< "pRot = " << pRot << LL_NEWLINE
+							<< "twist    : " << mTwist*180.0/F_PI << LL_NEWLINE
+							<< "twistRot : " << twistRot << LL_ENDL;
 
 	//-------------------------------------------------------------------------
 	// compute rotation of A
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index 831a0a6719286e1c1879549d899e5ca2e34955cb..1352c9d592e3bc8b60462d1d0183a19130421d50 100755
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -1263,7 +1263,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
 
 	if (mJointMotionList->mBasePriority >= LLJoint::ADDITIVE_PRIORITY)
 	{
-		mJointMotionList->mBasePriority = (LLJoint::JointPriority)((int)LLJoint::ADDITIVE_PRIORITY-1);
+		mJointMotionList->mBasePriority = (LLJoint::JointPriority)((S32)LLJoint::ADDITIVE_PRIORITY-1);
 		mJointMotionList->mMaxPriority = mJointMotionList->mBasePriority;
 	}
 	else if (mJointMotionList->mBasePriority < LLJoint::USE_MOTION_PRIORITY)
@@ -2288,8 +2288,7 @@ LLKeyframeMotion::JointConstraint::JointConstraint(JointConstraintSharedData* sh
 	mTargetVolume = NULL;
 	mFixupDistanceRMS = 0.f;
 
-	int i;
-	for (i=0; i<MAX_CHAIN_LENGTH; ++i)
+	for (S32 i=0; i<MAX_CHAIN_LENGTH; ++i)
 	{
 		mJointLengths[i] = 0.f;
 		mJointLengthFractions[i] = 0.f;
diff --git a/indra/llcharacter/llkeyframemotionparam.h b/indra/llcharacter/llkeyframemotionparam.h
index 24e81417539d920f560be2255a7693ed42e180e7..0fac3724d14dac9392c0d7571595c40da532bc30 100755
--- a/indra/llcharacter/llkeyframemotionparam.h
+++ b/indra/llcharacter/llkeyframemotionparam.h
@@ -37,7 +37,6 @@
 #include "lljointstate.h"
 #include "v3math.h"
 #include "llquaternion.h"
-#include "linked_lists.h"
 #include "llkeyframemotion.h"
 
 //-----------------------------------------------------------------------------
diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp
index af2e10220abfec23fc494c1993195be61d40ed8a..094cf87167cb46020c29b9245ba4a58af212f1c0 100755
--- a/indra/llcharacter/llmotion.cpp
+++ b/indra/llcharacter/llmotion.cpp
@@ -54,7 +54,7 @@ LLMotion::LLMotion( const LLUUID &id ) :
 	mDeactivateCallback(NULL),
 	mDeactivateCallbackUserData(NULL)
 {
-	for (int i=0; i<3; ++i)
+	for (S32 i=0; i<3; ++i)
 		memset(&mJointSignature[i][0], 0, sizeof(U8) * LL_CHARACTER_MAX_JOINTS);
 }
 
diff --git a/indra/llcharacter/llpose.h b/indra/llcharacter/llpose.h
index b486852605db04d815a1e9dec54f03b03ad33253..c004a0f3b74388b3ceb7999eca33b2dff6a59fb9 100755
--- a/indra/llcharacter/llpose.h
+++ b/indra/llcharacter/llpose.h
@@ -33,7 +33,6 @@
 
 #include "lljointstate.h"
 #include "lljoint.h"
-#include "llmap.h"
 #include "llpointer.h"
 
 #include <map>
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 0c76fd46c0fcc1abc231c97cd2660cc06e50e60e..4336550d07141ec774af6d1a0d63234e20ab260d 100755
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -26,22 +26,20 @@ include_directories(
 #     ${LLCOMMON_LIBRARIES})
 
 set(llcommon_SOURCE_FILES
-    imageids.cpp
     indra_constants.cpp
     llallocator.cpp
     llallocator_heap_profile.cpp
     llapp.cpp
     llapr.cpp
     llassettype.cpp
-    llavatarname.cpp
     llbase32.cpp
     llbase64.cpp
+	llbitpack.cpp
     llcommon.cpp
     llcommonutils.cpp
     llcoros.cpp
     llcrc.cpp
     llcriticaldamp.cpp
-    llcursortypes.cpp
     lldate.cpp
     lldependencies.cpp
     lldictionary.cpp
@@ -58,7 +56,6 @@ set(llcommon_SOURCE_FILES
     llfile.cpp
     llfindlocale.cpp
     llfixedbuffer.cpp
-    llfoldertype.cpp
     llformat.cpp
     llframetimer.cpp
     llheartbeat.cpp
@@ -68,7 +65,6 @@ set(llcommon_SOURCE_FILES
     llleaplistener.cpp
     llliveappconfig.cpp
     lllivefile.cpp
-    lllog.cpp
     llmd5.cpp
     llmemory.cpp
     llmemorystream.cpp
@@ -76,7 +72,6 @@ set(llcommon_SOURCE_FILES
     llmetricperformancetester.cpp
     llmortician.cpp
     llmutex.cpp
-    lloptioninterface.cpp
     llptrto.cpp 
     llpredicate.cpp
     llprocess.cpp
@@ -90,7 +85,6 @@ set(llcommon_SOURCE_FILES
     llsdserialize.cpp
     llsdserialize_xml.cpp
     llsdutil.cpp
-    llsecondlifeurls.cpp
     llsingleton.cpp
     llstacktrace.cpp
     llstreamqueue.cpp
@@ -116,45 +110,33 @@ set(llcommon_SOURCE_FILES
 set(llcommon_HEADER_FILES
     CMakeLists.txt
 
-    bitpack.h
     ctype_workaround.h
     fix_macros.h
-    imageids.h
     indra_constants.h
     linden_common.h
-    linked_lists.h
-    llaccountingcost.h
     llallocator.h
     llallocator_heap_profile.h
-    llagentconstants.h
-    llavatarname.h
     llapp.h
     llapr.h
     llassettype.h
-    llavatarconstants.h
     llbase32.h
     llbase64.h
+    llbitpack.h
     llboost.h
-    llchat.h
-    llclickaction.h
     llcommon.h
     llcommonutils.h
     llcoros.h
     llcrc.h
     llcriticaldamp.h
-    llcursortypes.h
-    lldarray.h
     lldate.h
     lldefs.h
     lldependencies.h
-    lldeleteutils.h
     lldepthstack.h
     lldictionary.h
     lldoubledispatch.h
     llendianswizzle.h
     llerror.h
     llerrorcontrol.h
-    llerrorlegacy.h
     llerrorthread.h
     llevent.h
     lleventapi.h
@@ -163,30 +145,25 @@ set(llcommon_HEADER_FILES
     lleventfilter.h
     llevents.h
     lleventemitter.h
-    llextendedstatus.h
     llfasttimer.h
     llfile.h
     llfindlocale.h
     llfixedbuffer.h
-    llfoldertype.h
     llformat.h
     llframetimer.h
     llhandle.h
     llhash.h
     llheartbeat.h
     llhttpstatuscodes.h
+    llindexedvector.h
     llinitparam.h
     llinstancetracker.h
     llkeythrottle.h
     llleap.h
     llleaplistener.h
     lllistenerwrapper.h
-    lllinkedqueue.h
     llliveappconfig.h
     lllivefile.h
-    lllog.h
-    lllslconstants.h
-    llmap.h
     llmd5.h
     llmemory.h
     llmemorystream.h
@@ -194,8 +171,6 @@ set(llcommon_HEADER_FILES
     llmetricperformancetester.h
     llmortician.h
     llmutex.h
-    llnametable.h
-    lloptioninterface.h
     llpointer.h
     llpredicate.h
     llpreprocessor.h
@@ -215,11 +190,9 @@ set(llcommon_HEADER_FILES
     llsdserialize.h
     llsdserialize_xml.h
     llsdutil.h
-    llsecondlifeurls.h
     llsimplehash.h
     llsingleton.h
     llstacktrace.h
-    llstatenums.h
     llstl.h
     llstreamqueue.h
     llstreamtools.h
@@ -239,18 +212,12 @@ set(llcommon_HEADER_FILES
     llunit.h
     lluri.h
     lluuid.h
-    llversionserver.h
 	llwin32headers.h
     llwin32headerslean.h
     llworkerthread.h
-    ll_template_cast.h
-    roles_constants.h
-    stdenums.h
     stdtypes.h
-    string_table.h
     stringize.h
     timer.h
-    timing.h
     u64.h
     )
 
diff --git a/indra/llcommon/imageids.cpp b/indra/llcommon/imageids.cpp
deleted file mode 100755
index 7d647e5c364f4dae5a76bc817c50e2f1c48d699c..0000000000000000000000000000000000000000
--- a/indra/llcommon/imageids.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/** 
- * @file imageids.cpp
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#include "imageids.h"
-
-#include "lluuid.h"
-
-//
-// USE OF THIS FILE IS DEPRECATED
-//
-// Please use viewerart.ini and the standard
-// art import path.																			// indicates if file is only
-			 															// on dataserver, or also
-																			// pre-cached on viewer
-
-// Grass Images
-const LLUUID IMG_SMOKE			("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d");  // VIEWER
-
-const LLUUID IMG_DEFAULT		("d2114404-dd59-4a4d-8e6c-49359e91bbf0");  // VIEWER
-
-const LLUUID IMG_SUN			("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver
-const LLUUID IMG_MOON			("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
-const LLUUID IMG_CLOUD_POOF		("fc4b9f0b-d008-45c6-96a4-01dd947ac621"); // dataserver
-const LLUUID IMG_SHOT			("35f217a3-f618-49cf-bbca-c86d486551a9"); // dataserver
-const LLUUID IMG_SPARK			("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver
-const LLUUID IMG_FIRE			("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver
-const LLUUID IMG_FACE_SELECT    ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector
-const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver
-const LLUUID IMG_INVISIBLE		("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver
-
-const LLUUID IMG_EXPLOSION				("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver
-const LLUUID IMG_EXPLOSION_2			("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver
-const LLUUID IMG_EXPLOSION_3			("fedea30a-1be8-47a6-bc06-337a04a39c4b"); // On dataserver
-const LLUUID IMG_EXPLOSION_4			("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); // On dataserver
-const LLUUID IMG_SMOKE_POOF				("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On dataserver
-
-const LLUUID IMG_BIG_EXPLOSION_1		("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver
-const LLUUID IMG_BIG_EXPLOSION_2		("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver
-
-const LLUUID IMG_BLOOM1	  			    ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER
-const LLUUID TERRAIN_DIRT_DETAIL		("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER
-const LLUUID TERRAIN_GRASS_DETAIL		("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER
-const LLUUID TERRAIN_MOUNTAIN_DETAIL	("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER
-const LLUUID TERRAIN_ROCK_DETAIL		("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER
-
-const LLUUID DEFAULT_WATER_NORMAL		("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
-
-const LLUUID IMG_CHECKERBOARD_RGBA     ("2585a0f3-4163-6dd1-0f34-ad48cb909e25"); // dataserver
-
diff --git a/indra/llcommon/imageids.h b/indra/llcommon/imageids.h
deleted file mode 100755
index 18c8ecb0743765b06857558504cdd1bb16722376..0000000000000000000000000000000000000000
--- a/indra/llcommon/imageids.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/** 
- * @file imageids.h
- * @brief Temporary holder for image IDs
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_IMAGEIDS_H
-#define LL_IMAGEIDS_H
-
-//
-// USE OF THIS FILE IS DEPRECATED
-//
-// Please use viewerart.ini and the standard
-// art import path.
-
-class LLUUID;
-
-LL_COMMON_API extern const LLUUID IMG_SMOKE;
-
-LL_COMMON_API extern const LLUUID IMG_DEFAULT;
-
-LL_COMMON_API extern const LLUUID IMG_SUN;
-LL_COMMON_API extern const LLUUID IMG_MOON;
-LL_COMMON_API extern const LLUUID IMG_CLOUD_POOF;
-LL_COMMON_API extern const LLUUID IMG_SHOT;
-LL_COMMON_API extern const LLUUID IMG_SPARK;
-LL_COMMON_API extern const LLUUID IMG_FIRE;
-LL_COMMON_API extern const LLUUID IMG_FACE_SELECT;
-LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR;
-LL_COMMON_API extern const LLUUID IMG_INVISIBLE;
-
-LL_COMMON_API extern const LLUUID IMG_EXPLOSION;
-LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2;
-LL_COMMON_API extern const LLUUID IMG_EXPLOSION_3;
-LL_COMMON_API extern const LLUUID IMG_EXPLOSION_4;
-LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF;
-
-LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1;
-LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2;
-
-LL_COMMON_API extern const LLUUID IMG_BLOOM1;
-LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL;
-LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL;
-LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL;
-LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL;
-
-LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL;
-
-LL_COMMON_API extern const LLUUID IMG_CHECKERBOARD_RGBA;
-#endif
diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp
index d32ae6c04184bf42f365e36a32ee9f960ecd0ea2..b61dca32434bd2e0adf65063cb78bf29470fdc57 100755
--- a/indra/llcommon/indra_constants.cpp
+++ b/indra/llcommon/indra_constants.cpp
@@ -35,6 +35,35 @@ const LLUUID LL_UUID_ALL_AGENTS("44e87126-e794-4ded-05b3-7c42da3d5cdb");
 // Governor Linden's agent id.
 const LLUUID ALEXANDRIA_LINDEN_ID("ba2a564a-f0f1-4b82-9c61-b7520bfcd09f");
 const LLUUID GOVERNOR_LINDEN_ID("3d6181b0-6a4b-97ef-18d8-722652995cf1");
-const LLUUID REALESTATE_LINDEN_ID("3d6181b0-6a4b-97ef-18d8-722652995cf1");
 // Maintenance's group id.
 const LLUUID MAINTENANCE_GROUP_ID("dc7b21cd-3c89-fcaa-31c8-25f9ffd224cd");
+// Grass Images
+const LLUUID IMG_SMOKE			("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d");  // VIEWER
+
+const LLUUID IMG_DEFAULT		("d2114404-dd59-4a4d-8e6c-49359e91bbf0");  // VIEWER
+
+const LLUUID IMG_SUN			("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver
+const LLUUID IMG_MOON			("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
+const LLUUID IMG_SHOT			("35f217a3-f618-49cf-bbca-c86d486551a9"); // dataserver
+const LLUUID IMG_SPARK			("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver
+const LLUUID IMG_FIRE			("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver
+const LLUUID IMG_FACE_SELECT    ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector
+const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver
+const LLUUID IMG_INVISIBLE		("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver
+
+const LLUUID IMG_EXPLOSION				("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver
+const LLUUID IMG_EXPLOSION_2			("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver
+const LLUUID IMG_EXPLOSION_3			("fedea30a-1be8-47a6-bc06-337a04a39c4b"); // On dataserver
+const LLUUID IMG_EXPLOSION_4			("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); // On dataserver
+const LLUUID IMG_SMOKE_POOF				("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On dataserver
+
+const LLUUID IMG_BIG_EXPLOSION_1		("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver
+const LLUUID IMG_BIG_EXPLOSION_2		("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver
+
+const LLUUID IMG_BLOOM1	  			    ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER
+const LLUUID TERRAIN_DIRT_DETAIL		("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER
+const LLUUID TERRAIN_GRASS_DETAIL		("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER
+const LLUUID TERRAIN_MOUNTAIN_DETAIL	("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER
+const LLUUID TERRAIN_ROCK_DETAIL		("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER
+
+const LLUUID DEFAULT_WATER_NORMAL		("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
\ No newline at end of file
diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h
index 0da83720bd57d8f3bd15c75a066aab291a70e223..02f063f5e843cf2105440983e85e05d6f7e2ec98 100755
--- a/indra/llcommon/indra_constants.h
+++ b/indra/llcommon/indra_constants.h
@@ -31,122 +31,28 @@
 
 class LLUUID;
 
-// At 45 Hz collisions seem stable and objects seem
-// to settle down at a reasonable rate.
-// JC 3/18/2003
-
-// const F32 PHYSICS_TIMESTEP = 1.f / 45.f;
-// This must be a #define due to anal retentive restrictions on const expressions
-// CG 2008-06-05
-#define PHYSICS_TIMESTEP (1.f / 45.f)
-
-const F32 COLLISION_TOLERANCE = 0.1f;
-const F32 HALF_COLLISION_TOLERANCE = 0.05f;
-
-// Time constants
-const U32 HOURS_PER_LINDEN_DAY		= 4;	
-const U32 DAYS_PER_LINDEN_YEAR		= 11;
-
-const U32 SEC_PER_LINDEN_DAY		= HOURS_PER_LINDEN_DAY * 60 * 60;
-const U32 SEC_PER_LINDEN_YEAR		= DAYS_PER_LINDEN_YEAR * SEC_PER_LINDEN_DAY;
-
 static const F32 REGION_WIDTH_METERS = 256.f;
 static const S32 REGION_WIDTH_UNITS = 256;
 static const U32 REGION_WIDTH_U32 = 256;
 
 const F32 REGION_HEIGHT_METERS = 4096.f;
 
-// Bits for simulator performance query flags
-enum LAND_STAT_FLAGS
-{
-	STAT_FILTER_BY_PARCEL	= 0x00000001,
-	STAT_FILTER_BY_OWNER	= 0x00000002,
-	STAT_FILTER_BY_OBJECT	= 0x00000004,
-	STAT_FILTER_BY_PARCEL_NAME	= 0x00000008,
-	STAT_REQUEST_LAST_ENTRY	= 0x80000000,
-};
-
-enum LAND_STAT_REPORT_TYPE
-{
-	STAT_REPORT_TOP_SCRIPTS = 0,
-	STAT_REPORT_TOP_COLLIDERS
-};
-
-const U32 STAT_FILTER_MASK	= 0x1FFFFFFF;
-
-// Region absolute limits
-static const S32		REGION_AGENT_COUNT_MIN = 1;
-static const S32		REGION_AGENT_COUNT_MAX = 200;			// Must fit in U8 for the moment (RegionInfo msg)
-static const S32		REGION_PRIM_COUNT_MIN = 0;
-static const S32		REGION_PRIM_COUNT_MAX = 40000;
-static const F32		REGION_PRIM_BONUS_MIN = 1.0;
-static const F32		REGION_PRIM_BONUS_MAX = 10.0;
-
-// Default maximum number of tasks/prims per region.
-const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000;
-
-const 	F32 	MIN_AGENT_DEPTH			= 0.30f;
 const 	F32 	DEFAULT_AGENT_DEPTH 	= 0.45f;
-const 	F32 	MAX_AGENT_DEPTH			= 0.60f;
-
-const 	F32 	MIN_AGENT_WIDTH 		= 0.40f;
 const 	F32 	DEFAULT_AGENT_WIDTH 	= 0.60f;
-const 	F32 	MAX_AGENT_WIDTH 		= 0.80f;
-
-const 	F32 	MIN_AGENT_HEIGHT		= 1.1f;
 const 	F32 	DEFAULT_AGENT_HEIGHT	= 1.9f;
-const 	F32 	MAX_AGENT_HEIGHT		= 2.45f;
-
-// For linked sets
-const S32 MAX_CHILDREN_PER_TASK = 255;
-const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 32;
-
-const S32 MAX_JOINTS_PER_OBJECT = 1;	// limiting to 1 until Havok 2.x
-
-const	char* const	DEFAULT_DMZ_SPACE_SERVER	= "192.168.0.140";
-const	char* const	DEFAULT_DMZ_USER_SERVER		= "192.168.0.140";
-const	char* const	DEFAULT_DMZ_DATA_SERVER		= "192.168.0.140";
-const	char* const	DEFAULT_DMZ_ASSET_SERVER	= "http://asset.dmz.lindenlab.com:80";
-
-const	char* const	DEFAULT_AGNI_SPACE_SERVER	= "63.211.139.100";
-const	char* const	DEFAULT_AGNI_USER_SERVER	= "63.211.139.100";
-const	char* const	DEFAULT_AGNI_DATA_SERVER	= "63.211.139.100";
-const	char* const	DEFAULT_AGNI_ASSET_SERVER	= "http://asset.agni.lindenlab.com:80";
-
-// Information about what ports are for what services is in the wiki Name Space Ports page
-// https://wiki.lindenlab.com/wiki/Name_Space_Ports
-const	char* const DEFAULT_LOCAL_ASSET_SERVER	= "http://localhost:12041/asset/tmp";
-const	char* const	LOCAL_ASSET_URL_FORMAT		= "http://%s:12041/asset";
-
-const	U32		DEFAULT_LAUNCHER_PORT			= 12029;
-//const	U32		DEFAULT_BIGBOARD_PORT			= 12030; // Deprecated
-//const	U32		DEFAULT_QUERYSIM_PORT			= 12031; // Deprecated
-const	U32		DEFAULT_DATA_SERVER_PORT		= 12032;
-const	U32		DEFAULT_SPACE_SERVER_PORT		= 12033;
-const	U32		DEFAULT_VIEWER_PORT				= 12034;
-const	U32		DEFAULT_SIMULATOR_PORT			= 12035;
-const	U32		DEFAULT_USER_SERVER_PORT		= 12036;
-const	U32		DEFAULT_RPC_SERVER_PORT			= 12037;
-const	U32		DEFAULT_LOG_DATA_SERVER_PORT	= 12039;
-const	U32		DEFAULT_BACKBONE_PORT			= 12040;
-const   U32		DEFAULT_LOCAL_ASSET_PORT		= 12041;
-//const   U32		DEFAULT_BACKBONE_CAP_PORT		= 12042; // Deprecated
-const   U32		DEFAULT_CAP_PROXY_PORT			= 12043;
-const   U32		DEFAULT_INV_DATA_SERVER_PORT	= 12044;
-const	U32		DEFAULT_CGI_SERVICES_PORT		= 12045;
-
-// Mapserver uses ports 12124 - 12139 to allow multiple mapservers to run
-// on a single host for map tile generation. JC
-const	U32		DEFAULT_MAPSERVER_PORT			= 12124;
-
-// For automatic port discovery when running multiple viewers on one host
-const	U32		PORT_DISCOVERY_RANGE_MIN		= 13000;
-const	U32		PORT_DISCOVERY_RANGE_MAX		= PORT_DISCOVERY_RANGE_MIN + 50;
-
-const	char	LAND_LAYER_CODE					= 'L';
-const	char	WATER_LAYER_CODE				= 'W';
-const	char	WIND_LAYER_CODE					= '7';
-const	char	CLOUD_LAYER_CODE				= '8';
+
+enum ETerrainBrushType
+{
+	// the valid brush numbers cannot be reordered, because they 
+	// are used in the binary LSL format as arguments to llModifyLand()
+	E_LANDBRUSH_LEVEL	= 0,
+	E_LANDBRUSH_RAISE	= 1,
+	E_LANDBRUSH_LOWER	= 2,
+	E_LANDBRUSH_SMOOTH 	= 3,
+	E_LANDBRUSH_NOISE	= 4,
+	E_LANDBRUSH_REVERT 	= 5,
+	E_LANDBRUSH_INVALID = 6
+};
 
 // keys
 // Bit masks for various keyboard modifier keys.
@@ -265,89 +171,43 @@ LL_COMMON_API extern const LLUUID LL_UUID_ALL_AGENTS;
 LL_COMMON_API extern const LLUUID ALEXANDRIA_LINDEN_ID;
 
 LL_COMMON_API extern const LLUUID GOVERNOR_LINDEN_ID;
-LL_COMMON_API extern const LLUUID REALESTATE_LINDEN_ID;
 // Maintenance's group id.
 LL_COMMON_API extern const LLUUID MAINTENANCE_GROUP_ID;
 
-// Flags for kick message
-const U32 KICK_FLAGS_DEFAULT	= 0x0;
-const U32 KICK_FLAGS_FREEZE		= 1 << 0;
-const U32 KICK_FLAGS_UNFREEZE	= 1 << 1;
-
-const U8 UPD_NONE      		= 0x00;
-const U8 UPD_POSITION  		= 0x01;
-const U8 UPD_ROTATION  		= 0x02;
-const U8 UPD_SCALE     		= 0x04;
-const U8 UPD_LINKED_SETS 	= 0x08;
-const U8 UPD_UNIFORM 		= 0x10;	// used with UPD_SCALE
-
-// Agent Update Flags (U8)
-const U8 AU_FLAGS_NONE      		= 0x00;
-const U8 AU_FLAGS_HIDETITLE      	= 0x01;
-const U8 AU_FLAGS_CLIENT_AUTOPILOT	= 0x02;
-
-// start location constants
-const U32 START_LOCATION_ID_LAST 		= 0;
-const U32 START_LOCATION_ID_HOME 		= 1;
-const U32 START_LOCATION_ID_DIRECT	 	= 2;	// for direct teleport
-const U32 START_LOCATION_ID_PARCEL	 	= 3;	// for teleports to a parcel
-const U32 START_LOCATION_ID_TELEHUB 	= 4;	// for teleports to a spawnpoint
-const U32 START_LOCATION_ID_URL			= 5;
-const U32 START_LOCATION_ID_COUNT 		= 6;
-
-// group constants
-const U32 GROUP_MIN_SIZE = 2;
-
-// gMaxAgentGroups is now sent by login.cgi, which
-// looks it up from globals.xml.
-//
-// For now we need an old default value however,
-// so the viewer can be deployed ahead of login.cgi.
-//
-const S32 DEFAULT_MAX_AGENT_GROUPS = 25;
+// image ids
+LL_COMMON_API extern const LLUUID IMG_SMOKE;
 
-// radius within which a chat message is fully audible
-const F32 CHAT_WHISPER_RADIUS = 10.f;
-const F32 CHAT_NORMAL_RADIUS = 20.f;
-const F32 CHAT_SHOUT_RADIUS = 100.f;
-const F32 CHAT_MAX_RADIUS = CHAT_SHOUT_RADIUS;
-const F32 CHAT_MAX_RADIUS_BY_TWO = CHAT_MAX_RADIUS / 2.f;
+LL_COMMON_API extern const LLUUID IMG_DEFAULT;
 
-// squared editions of the above for distance checks
-const F32 CHAT_WHISPER_RADIUS_SQUARED = CHAT_WHISPER_RADIUS * CHAT_WHISPER_RADIUS;
-const F32 CHAT_NORMAL_RADIUS_SQUARED = CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS;
-const F32 CHAT_SHOUT_RADIUS_SQUARED = CHAT_SHOUT_RADIUS * CHAT_SHOUT_RADIUS;
-const F32 CHAT_MAX_RADIUS_SQUARED = CHAT_SHOUT_RADIUS_SQUARED;
-const F32 CHAT_MAX_RADIUS_BY_TWO_SQUARED = CHAT_MAX_RADIUS_BY_TWO * CHAT_MAX_RADIUS_BY_TWO;
+LL_COMMON_API extern const LLUUID IMG_SUN;
+LL_COMMON_API extern const LLUUID IMG_MOON;
+LL_COMMON_API extern const LLUUID IMG_SHOT;
+LL_COMMON_API extern const LLUUID IMG_SPARK;
+LL_COMMON_API extern const LLUUID IMG_FIRE;
+LL_COMMON_API extern const LLUUID IMG_FACE_SELECT;
+LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR;
+LL_COMMON_API extern const LLUUID IMG_INVISIBLE;
 
+LL_COMMON_API extern const LLUUID IMG_EXPLOSION;
+LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2;
+LL_COMMON_API extern const LLUUID IMG_EXPLOSION_3;
+LL_COMMON_API extern const LLUUID IMG_EXPLOSION_4;
+LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF;
 
-// this times above gives barely audible radius
-const F32 CHAT_BARELY_AUDIBLE_FACTOR = 2.0f;
+LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1;
+LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2;
 
-// distance in front of speaking agent the sphere is centered
-const F32 CHAT_WHISPER_OFFSET = 5.f;
-const F32 CHAT_NORMAL_OFFSET = 10.f;
-const F32 CHAT_SHOUT_OFFSET = 50.f;
+LL_COMMON_API extern const LLUUID IMG_BLOOM1;
+LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL;
+LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL;
+LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL;
+LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL;
 
-// first clean starts at 3 AM
-const S32 SANDBOX_FIRST_CLEAN_HOUR = 3;
-// clean every <n> hours
-const S32 SANDBOX_CLEAN_FREQ = 12;
+LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL;
 
-const F32 WIND_SCALE_HACK		= 2.0f;	// hack to make wind speeds more realistic
 
-enum ETerrainBrushType
-{
-	// the valid brush numbers cannot be reordered, because they 
-	// are used in the binary LSL format as arguments to llModifyLand()
-	E_LANDBRUSH_LEVEL	= 0,
-	E_LANDBRUSH_RAISE	= 1,
-	E_LANDBRUSH_LOWER	= 2,
-	E_LANDBRUSH_SMOOTH 	= 3,
-	E_LANDBRUSH_NOISE	= 4,
-	E_LANDBRUSH_REVERT 	= 5,
-	E_LANDBRUSH_INVALID = 6
-};
+// radius within which a chat message is fully audible
+const F32 CHAT_NORMAL_RADIUS = 20.f;
 
 // media commands
 const U32 PARCEL_MEDIA_COMMAND_STOP  = 0;
@@ -365,51 +225,101 @@ const U32 PARCEL_MEDIA_COMMAND_SIZE = 11;
 const U32 PARCEL_MEDIA_COMMAND_DESC = 12;
 const U32 PARCEL_MEDIA_COMMAND_LOOP_SET = 13;
 
-// map item types
-const U32 MAP_ITEM_TELEHUB = 0x01;
-const U32 MAP_ITEM_PG_EVENT = 0x02;
-const U32 MAP_ITEM_MATURE_EVENT = 0x03;
-//const U32 MAP_ITEM_POPULAR = 0x04;		// No longer supported, 2009-03-02 KLW
-//const U32 MAP_ITEM_AGENT_COUNT = 0x05;
-const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06;
-const U32 MAP_ITEM_LAND_FOR_SALE = 0x07;
-const U32 MAP_ITEM_CLASSIFIED = 0x08;
-const U32 MAP_ITEM_ADULT_EVENT = 0x09;
-const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a;
-
-// Region map layer numbers
-const S32 MAP_SIM_OBJECTS = 0;	
-const S32 MAP_SIM_TERRAIN = 1;
-const S32 MAP_SIM_LAND_FOR_SALE = 2;			// Transparent alpha overlay of land for sale
-const S32 MAP_SIM_IMAGE_TYPES = 3;				// Number of map layers
-const S32 MAP_SIM_INFO_MASK  		= 0x00FFFFFF;		// Agent access may be stuffed into upper byte
-const S32 MAP_SIM_LAYER_MASK 		= 0x0000FFFF;		// Layer info is in lower 16 bits
-const S32 MAP_SIM_RETURN_NULL_SIMS 	= 0x00010000;
-const S32 MAP_SIM_PRELUDE 			= 0x00020000;
-
-// Crash reporter behavior
-const S32 CRASH_BEHAVIOR_ASK = 0;
-const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1;
-const S32 CRASH_BEHAVIOR_NEVER_SEND = 2;
-
-// Export/Import return values
-const S32 EXPORT_SUCCESS = 0;
-const S32 EXPORT_ERROR_PERMISSIONS = -1;
-const S32 EXPORT_ERROR_UNKNOWN = -2;
-
-// This is how long the sim will try to teleport you before giving up.
-const F32 TELEPORT_EXPIRY = 15.0f;
-// Additional time (in seconds) to wait per attachment
-const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f;
-
-// The maximum size of an object extra parameters binary (packed) block
-#define MAX_OBJECT_PARAMS_SIZE 1024
-
 const S32 CHAT_CHANNEL_DEBUG = S32_MAX;
 
-// PLEASE don't add constants here.  Every dev will have to do
-// a complete rebuild.  Try to find another shared header file,
-// like llregionflags.h, lllslconstants.h, llagentconstants.h,
-// or create a new one.  JC
+// agent constants
+const U32 CONTROL_AT_POS_INDEX				= 0;
+const U32 CONTROL_AT_NEG_INDEX				= 1;
+const U32 CONTROL_LEFT_POS_INDEX			= 2;
+const U32 CONTROL_LEFT_NEG_INDEX			= 3;
+const U32 CONTROL_UP_POS_INDEX				= 4;
+const U32 CONTROL_UP_NEG_INDEX				= 5;
+const U32 CONTROL_PITCH_POS_INDEX			= 6;
+const U32 CONTROL_PITCH_NEG_INDEX			= 7;
+const U32 CONTROL_YAW_POS_INDEX				= 8;
+const U32 CONTROL_YAW_NEG_INDEX				= 9;
+const U32 CONTROL_FAST_AT_INDEX				= 10;
+const U32 CONTROL_FAST_LEFT_INDEX			= 11;
+const U32 CONTROL_FAST_UP_INDEX				= 12;
+const U32 CONTROL_FLY_INDEX					= 13;
+const U32 CONTROL_STOP_INDEX				= 14;
+const U32 CONTROL_FINISH_ANIM_INDEX			= 15;
+const U32 CONTROL_STAND_UP_INDEX			= 16;
+const U32 CONTROL_SIT_ON_GROUND_INDEX		= 17;
+const U32 CONTROL_MOUSELOOK_INDEX			= 18;
+const U32 CONTROL_NUDGE_AT_POS_INDEX		= 19;
+const U32 CONTROL_NUDGE_AT_NEG_INDEX		= 20;
+const U32 CONTROL_NUDGE_LEFT_POS_INDEX		= 21;
+const U32 CONTROL_NUDGE_LEFT_NEG_INDEX		= 22;
+const U32 CONTROL_NUDGE_UP_POS_INDEX		= 23;
+const U32 CONTROL_NUDGE_UP_NEG_INDEX		= 24;
+const U32 CONTROL_TURN_LEFT_INDEX			= 25;
+const U32 CONTROL_TURN_RIGHT_INDEX			= 26;
+const U32 CONTROL_AWAY_INDEX				= 27;
+const U32 CONTROL_LBUTTON_DOWN_INDEX		= 28;
+const U32 CONTROL_LBUTTON_UP_INDEX			= 29;
+const U32 CONTROL_ML_LBUTTON_DOWN_INDEX		= 30;
+const U32 CONTROL_ML_LBUTTON_UP_INDEX		= 31;
+const U32 TOTAL_CONTROLS					= 32;
+
+const U32 AGENT_CONTROL_AT_POS              = 0x1 << CONTROL_AT_POS_INDEX;			// 0x00000001
+const U32 AGENT_CONTROL_AT_NEG              = 0x1 << CONTROL_AT_NEG_INDEX;			// 0x00000002
+const U32 AGENT_CONTROL_LEFT_POS            = 0x1 << CONTROL_LEFT_POS_INDEX;		// 0x00000004
+const U32 AGENT_CONTROL_LEFT_NEG            = 0x1 << CONTROL_LEFT_NEG_INDEX;		// 0x00000008
+const U32 AGENT_CONTROL_UP_POS              = 0x1 << CONTROL_UP_POS_INDEX;			// 0x00000010
+const U32 AGENT_CONTROL_UP_NEG              = 0x1 << CONTROL_UP_NEG_INDEX;			// 0x00000020
+const U32 AGENT_CONTROL_PITCH_POS           = 0x1 << CONTROL_PITCH_POS_INDEX;		// 0x00000040
+const U32 AGENT_CONTROL_PITCH_NEG           = 0x1 << CONTROL_PITCH_NEG_INDEX;		// 0x00000080
+const U32 AGENT_CONTROL_YAW_POS             = 0x1 << CONTROL_YAW_POS_INDEX;			// 0x00000100
+const U32 AGENT_CONTROL_YAW_NEG             = 0x1 << CONTROL_YAW_NEG_INDEX;			// 0x00000200
+
+const U32 AGENT_CONTROL_FAST_AT             = 0x1 << CONTROL_FAST_AT_INDEX;			// 0x00000400
+const U32 AGENT_CONTROL_FAST_LEFT           = 0x1 << CONTROL_FAST_LEFT_INDEX;		// 0x00000800
+const U32 AGENT_CONTROL_FAST_UP             = 0x1 << CONTROL_FAST_UP_INDEX;			// 0x00001000
+
+const U32 AGENT_CONTROL_FLY					= 0x1 << CONTROL_FLY_INDEX;				// 0x00002000
+const U32 AGENT_CONTROL_STOP				= 0x1 << CONTROL_STOP_INDEX;			// 0x00004000
+const U32 AGENT_CONTROL_FINISH_ANIM			= 0x1 << CONTROL_FINISH_ANIM_INDEX;		// 0x00008000
+const U32 AGENT_CONTROL_STAND_UP			= 0x1 << CONTROL_STAND_UP_INDEX;		// 0x00010000
+const U32 AGENT_CONTROL_SIT_ON_GROUND		= 0x1 << CONTROL_SIT_ON_GROUND_INDEX;	// 0x00020000
+const U32 AGENT_CONTROL_MOUSELOOK			= 0x1 << CONTROL_MOUSELOOK_INDEX;		// 0x00040000
+
+const U32 AGENT_CONTROL_NUDGE_AT_POS        = 0x1 << CONTROL_NUDGE_AT_POS_INDEX;	// 0x00080000
+const U32 AGENT_CONTROL_NUDGE_AT_NEG        = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX;	// 0x00100000
+const U32 AGENT_CONTROL_NUDGE_LEFT_POS      = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX;	// 0x00200000
+const U32 AGENT_CONTROL_NUDGE_LEFT_NEG      = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX;	// 0x00400000
+const U32 AGENT_CONTROL_NUDGE_UP_POS        = 0x1 << CONTROL_NUDGE_UP_POS_INDEX;	// 0x00800000
+const U32 AGENT_CONTROL_NUDGE_UP_NEG        = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX;	// 0x01000000
+const U32 AGENT_CONTROL_TURN_LEFT	        = 0x1 << CONTROL_TURN_LEFT_INDEX;		// 0x02000000
+const U32 AGENT_CONTROL_TURN_RIGHT	        = 0x1 << CONTROL_TURN_RIGHT_INDEX;		// 0x04000000
+
+const U32 AGENT_CONTROL_AWAY				= 0x1 << CONTROL_AWAY_INDEX;			// 0x08000000
+
+const U32 AGENT_CONTROL_LBUTTON_DOWN		= 0x1 << CONTROL_LBUTTON_DOWN_INDEX;	// 0x10000000
+const U32 AGENT_CONTROL_LBUTTON_UP			= 0x1 << CONTROL_LBUTTON_UP_INDEX;		// 0x20000000
+const U32 AGENT_CONTROL_ML_LBUTTON_DOWN		= 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX;	// 0x40000000
+const U32 AGENT_CONTROL_ML_LBUTTON_UP		= ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX;	// 0x80000000
+
+// move these up so that we can hide them in "State" for object updates 
+// (for now)
+const U32 AGENT_ATTACH_OFFSET				= 4;
+const U32 AGENT_ATTACH_MASK					= 0xf << AGENT_ATTACH_OFFSET;
+
+// RN: this method swaps the upper and lower nibbles to maintain backward 
+// compatibility with old objects that only used the upper nibble
+#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4)))
+
+// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
+const U8 CLICK_ACTION_NONE = 0;
+const U8 CLICK_ACTION_TOUCH = 0;
+const U8 CLICK_ACTION_SIT = 1;
+const U8 CLICK_ACTION_BUY = 2;
+const U8 CLICK_ACTION_PAY = 3;
+const U8 CLICK_ACTION_OPEN = 4;
+const U8 CLICK_ACTION_PLAY = 5;
+const U8 CLICK_ACTION_OPEN_MEDIA = 6;
+const U8 CLICK_ACTION_ZOOM = 7;
+// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
+
 
 #endif
diff --git a/indra/llcommon/linked_lists.h b/indra/llcommon/linked_lists.h
deleted file mode 100755
index 6b25295b7b51c6840f7b4c307ebbcad4231a5acc..0000000000000000000000000000000000000000
--- a/indra/llcommon/linked_lists.h
+++ /dev/null
@@ -1,937 +0,0 @@
-/** 
- * @file linked_lists.h
- * @brief LLLinkedList class header amd implementation file.
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LINKED_LISTS_H
-#define LL_LINKED_LISTS_H
-
-/** 
- * Provides a standard doubly linked list for fun and profit
- * Utilizes a neat trick off of Flipcode where the back pointer is a
- * pointer to a pointer, allowing easier transfer of nodes between lists, &c
- * And a template class, of course
- */
-
-#include "llerror.h"
-
-
-template <class DATA_TYPE> class LLLinkedList
-{
-public:
-	friend class LLLinkNode;
-	// External interface
-
-	// basic constructor
-	LLLinkedList() : mHead(NULL), mCurrentp(NULL), mInsertBefore(NULL)
-	{
-		mCurrentp = mHead.mNextp;
-		mCurrentOperatingp = mHead.mNextp;
-		mCount = 0;
-	}
-
-	// basic constructor
-	LLLinkedList(BOOL	(*insert_before)(DATA_TYPE *data_new, DATA_TYPE *data_tested)) : mHead(NULL), mCurrentp(NULL), mInsertBefore(insert_before)
-	{
-		mCurrentp = mHead.mNextp;
-		mCurrentOperatingp = mHead.mNextp;
-		mCount = 0;
-	}
-
-	// destructor destroys list and nodes, but not data in nodes
-	~LLLinkedList()
-	{
-		removeAllNodes();
-	}
-
-	// set mInsertBefore
-	void setInsertBefore(BOOL (*insert_before)(DATA_TYPE *data_new, DATA_TYPE *data_tested))
-	{
-		mInsertBefore = insert_before;
-	}
-
-	//
-	// WARNING!!!!!!!
-	// addData and addDataSorted are NOT O(1) operations, but O(n) because they check
-	// for existence of the data in the linked list first.  Why, I don't know - djs
-	// If you don't care about dupes, use addDataNoCheck
-	//
-
-	// put data into a node and stick it at the front of the list
-	inline BOOL addData(DATA_TYPE *data);
-
-	// put data into a node and sort into list by mInsertBefore()
-	// calls normal add if mInsertBefore isn't set
-	inline BOOL addDataSorted(DATA_TYPE *data);
-
-	inline BOOL addDataNoCheck(DATA_TYPE *data);
-
-	// bubbleSortList
-	// does an improved bubble sort of the list . . . works best with almost sorted data
-	// does nothing if mInsertBefore isn't set
-	// Nota Bene: Swaps are accomplished by swapping data pointers
-	inline void bubbleSortList();
-
-	// put data into a node and stick it at the end of the list
-	inline BOOL addDataAtEnd(DATA_TYPE *data);
-
-	// returns number of items in the list
-	inline S32 getLength() const;
-
-	inline BOOL isEmpty();
-
-	// search the list starting at mHead.mNextp and remove the link with mDatap == data
-	// leave mCurrentp and mCurrentOperatingp on the next entry
-	// return TRUE if found, FALSE if not found
-	inline BOOL removeData(DATA_TYPE *data);
-
-		// search the list starting at mHead.mNextp and delete the link with mDatap == data
-	// leave mCurrentp and mCurrentOperatingp on the next entry
-	// return TRUE if found, FALSE if not found
-	inline BOOL deleteData(DATA_TYPE *data);
-
-	// remove all nodes from the list and delete the associated data
-	inline void deleteAllData();
-
-	// remove all nodes from the list but do not delete data
-	inline void removeAllNodes();
-
-	// check to see if data is in list
-	// if TRUE then mCurrentp and mCurrentOperatingp point to data
-	inline BOOL	checkData(DATA_TYPE *data);
-
-	// place mCurrentp on first node
-	inline void resetList();
-
-	// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp
-	inline DATA_TYPE	*getCurrentData();
-
-	// same as getCurrentData() but a more intuitive name for the operation
-	inline DATA_TYPE	*getNextData();
-
-	// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp
-	inline DATA_TYPE	*getFirstData();
-
-	// reset the list and return the data at position n, set mCurentOperatingp to that node and bump mCurrentp
-	// Note: n is zero-based
-	inline DATA_TYPE	*getNthData( U32 n);
-
-	// reset the list and return the last data in it, set mCurentOperatingp to that node and bump mCurrentp
-	inline DATA_TYPE	*getLastData();
-
-	// remove the Node at mCurentOperatingp
-	// leave mCurrentp and mCurentOperatingp on the next entry
-	inline void removeCurrentData();
-
-	// remove the Node at mCurentOperatingp and add it to newlist
-	// leave mCurrentp and mCurentOperatingp on the next entry
-	void moveCurrentData(LLLinkedList *newlist, BOOL b_sort);
-
-	BOOL moveData(DATA_TYPE *data, LLLinkedList *newlist, BOOL b_sort);
-
-	// delete the Node at mCurentOperatingp
-	// leave mCurrentp anf mCurentOperatingp on the next entry
-	void deleteCurrentData();
-
-private:
-	// node that actually contains the data
-	class LLLinkNode
-	{
-	public:
-		// assign the mDatap pointer
-		LLLinkNode(DATA_TYPE *data) : mDatap(data), mNextp(NULL), mPrevpp(NULL)
-		{
-		}
-
-		// destructor does not, by default, destroy associated data
-		// however, the mDatap must be NULL to ensure that we aren't causing memory leaks
-		~LLLinkNode()
-		{
-			if (mDatap)
-			{
-				llerror("Attempting to call LLLinkNode destructor with a non-null mDatap!", 1);
-			}
-		}
-
-		// delete associated data and NULL out pointer
-		void deleteData()
-		{
-			delete mDatap;
-			mDatap = NULL;
-		}
-
-		// NULL out pointer
-		void removeData()
-		{
-			mDatap = NULL;
-		}
-
-		DATA_TYPE	*mDatap;
-		LLLinkNode	*mNextp;
-		LLLinkNode	**mPrevpp;
-	};
-
-	// add a node at the front of the list
-	void addData(LLLinkNode *node)
-	{
-		// don't allow NULL to be passed to addData
-		if (!node)
-		{
-			llerror("NULL pointer passed to LLLinkedList::addData", 0);
-		}
-
-		// add the node to the front of the list
-		node->mPrevpp = &mHead.mNextp;
-		node->mNextp = mHead.mNextp;
-
-		// if there's something in the list, fix its back pointer
-		if (node->mNextp)
-		{
-			node->mNextp->mPrevpp = &node->mNextp;
-		}
-
-		mHead.mNextp = node;
-	}
-
-	LLLinkNode			mHead;															// fake head node. . . makes pointer operations faster and easier
-	LLLinkNode			*mCurrentp;														// mCurrentp is the Node that getCurrentData returns
-	LLLinkNode			*mCurrentOperatingp;											// this is the node that the various mumbleCurrentData functions act on
-	BOOL				(*mInsertBefore)(DATA_TYPE *data_new, DATA_TYPE *data_tested);	// user function set to allow sorted lists
-	U32					mCount;
-};
-
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::addData(DATA_TYPE *data)
-{
-	// don't allow NULL to be passed to addData
-	if (!data)
-	{
-		llerror("NULL pointer passed to LLLinkedList::addData", 0);
-	}
-
-	LLLinkNode *tcurr = mCurrentp;
-	LLLinkNode *tcurrop = mCurrentOperatingp;
-
-	if ( checkData(data))
-	{
-		mCurrentp = tcurr;
-		mCurrentOperatingp = tcurrop;
-		return FALSE;
-	}
-
-	// make the new node
-	LLLinkNode *temp = new LLLinkNode(data);
-
-	// add the node to the front of the list
-	temp->mPrevpp = &mHead.mNextp;
-	temp->mNextp = mHead.mNextp;
-
-	// if there's something in the list, fix its back pointer
-	if (temp->mNextp)
-	{
-		temp->mNextp->mPrevpp = &temp->mNextp;
-	}
-
-	mHead.mNextp = temp;
-	mCurrentp = tcurr;
-	mCurrentOperatingp = tcurrop;
-	mCount++;
-	return TRUE;
-}
-
-
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::addDataNoCheck(DATA_TYPE *data)
-{
-	// don't allow NULL to be passed to addData
-	if (!data)
-	{
-		llerror("NULL pointer passed to LLLinkedList::addData", 0);
-	}
-
-	LLLinkNode *tcurr = mCurrentp;
-	LLLinkNode *tcurrop = mCurrentOperatingp;
-
-	// make the new node
-	LLLinkNode *temp = new LLLinkNode(data);
-
-	// add the node to the front of the list
-	temp->mPrevpp = &mHead.mNextp;
-	temp->mNextp = mHead.mNextp;
-
-	// if there's something in the list, fix its back pointer
-	if (temp->mNextp)
-	{
-		temp->mNextp->mPrevpp = &temp->mNextp;
-	}
-
-	mHead.mNextp = temp;
-	mCurrentp = tcurr;
-	mCurrentOperatingp = tcurrop;
-	mCount++;
-	return TRUE;
-}
-
-
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::addDataSorted(DATA_TYPE *data)
-{
-	LLLinkNode *tcurr = mCurrentp;
-	LLLinkNode *tcurrop = mCurrentOperatingp;
-	// don't allow NULL to be passed to addData
-	if (!data)
-	{
-		llerror("NULL pointer passed to LLLinkedList::addDataSorted", 0);
-	}
-
-	if (checkData(data))
-	{
-		// restore
-		mCurrentp = tcurr;
-		mCurrentOperatingp = tcurrop;
-		return FALSE;
-	}
-
-	// mInsertBefore not set?
-	if (!mInsertBefore)
-	{
-		addData(data);
-		// restore
-		mCurrentp = tcurr;
-		mCurrentOperatingp = tcurrop;
-		return FALSE;
-	}
-
-	// empty list?
-	if (!mHead.mNextp)
-	{
-		addData(data);
-		// restore
-		mCurrentp = tcurr;
-		mCurrentOperatingp = tcurrop;
-		return TRUE;
-	}
-
-	// make the new node
-	LLLinkNode *temp = new LLLinkNode(data);
-
-	// walk the list until mInsertBefore returns true 
-	mCurrentp = mHead.mNextp;
-	while (mCurrentp->mNextp)
-	{
-		if (mInsertBefore(data, mCurrentp->mDatap))
-		{
-			// insert before the current one
-			temp->mPrevpp = mCurrentp->mPrevpp;
-			temp->mNextp = mCurrentp;
-			*(temp->mPrevpp) = temp;
-			mCurrentp->mPrevpp = &temp->mNextp;
-			// restore
-			mCurrentp = tcurr;
-			mCurrentOperatingp = tcurrop;
-			mCount++;
-			return TRUE;
-		}
-		else
-		{
-			mCurrentp = mCurrentp->mNextp;
-		}
-	}
-
-	// on the last element, add before?
-	if (mInsertBefore(data, mCurrentp->mDatap))
-	{
-		// insert before the current one
-		temp->mPrevpp = mCurrentp->mPrevpp;
-		temp->mNextp = mCurrentp;
-		*(temp->mPrevpp) = temp;
-		mCurrentp->mPrevpp = &temp->mNextp;
-		// restore
-		mCurrentp = tcurr;
-		mCurrentOperatingp = tcurrop;
-	}
-	else // insert after
-	{
-		temp->mPrevpp = &mCurrentp->mNextp;
-		temp->mNextp = NULL;
-		mCurrentp->mNextp = temp;
-
-		// restore
-		mCurrentp = tcurr;
-		mCurrentOperatingp = tcurrop;
-	}
-	mCount++;
-	return TRUE;
-}
-
-template <class DATA_TYPE>
-void LLLinkedList<DATA_TYPE>::bubbleSortList()
-{
-	// mInsertBefore not set
-	if (!mInsertBefore)
-	{
-		return;
-	}
-
-	LLLinkNode *tcurr = mCurrentp;
-	LLLinkNode *tcurrop = mCurrentOperatingp;
-
-	BOOL		b_swapped = FALSE;
-	DATA_TYPE	*temp;
-
-	// Nota Bene: This will break if more than 0x7FFFFFFF members in list!
-	S32			length = 0x7FFFFFFF;
-	S32			count = 0;
-	do
-	{
-		b_swapped = FALSE;
-		mCurrentp = mHead.mNextp;
-		count = 0;
-		while (  (count + 1 < length)
-			   &&(mCurrentp))
-		{
-			if (mCurrentp->mNextp)
-			{
-				if (!mInsertBefore(mCurrentp->mDatap, mCurrentp->mNextp->mDatap))
-				{
-					// swap data pointers!
-					temp = mCurrentp->mDatap;
-					mCurrentp->mDatap = mCurrentp->mNextp->mDatap;
-					mCurrentp->mNextp->mDatap = temp;
-					b_swapped = TRUE;
-				}
-			}
-			else
-			{
-				break;
-			}
-			count++;
-			mCurrentp = mCurrentp->mNextp;
-		}
-		length = count;
-	} while (b_swapped);
-
-	// restore
-	mCurrentp = tcurr;
-	mCurrentOperatingp = tcurrop;
-}
-
-
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::addDataAtEnd(DATA_TYPE *data)
-{
-	LLLinkNode *tcurr = mCurrentp;
-	LLLinkNode *tcurrop = mCurrentOperatingp;
-
-	// don't allow NULL to be passed to addData
-	if (!data)
-	{
-		llerror("NULL pointer passed to LLLinkedList::addData", 0);
-	}
-
-	if (checkData(data))
-	{
-		mCurrentp = tcurr;
-		mCurrentOperatingp = tcurrop;
-		return FALSE;
-	}
-
-	// make the new node
-	LLLinkNode *temp = new LLLinkNode(data);
-
-	// add the node to the end of the list
-
-	// if empty, add to the front and be done with it
-	if (!mHead.mNextp)
-	{
-		temp->mPrevpp = &mHead.mNextp;
-		temp->mNextp = NULL;
-		mHead.mNextp = temp;
-	}
-	else
-	{
-		// otherwise, walk to the end of the list
-		mCurrentp = mHead.mNextp;
-		while (mCurrentp->mNextp)
-		{
-			mCurrentp = mCurrentp->mNextp;
-		}
-		temp->mPrevpp = &mCurrentp->mNextp;
-		temp->mNextp = NULL;
-		mCurrentp->mNextp = temp;
-	}
-
-	// restore
-	mCurrentp = tcurr;
-	mCurrentOperatingp = tcurrop;
-	mCount++;
-	return TRUE;
-}
-
-
-// returns number of items in the list
-template <class DATA_TYPE>
-S32 LLLinkedList<DATA_TYPE>::getLength() const
-{
-//	S32	length = 0;
-//	for (LLLinkNode* temp = mHead.mNextp; temp != NULL; temp = temp->mNextp)
-//	{
-//		length++;
-//	}
-	return mCount;
-}
-
-
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::isEmpty()
-{
-	return (mCount == 0);
-}
-
-
-// search the list starting at mHead.mNextp and remove the link with mDatap == data
-// leave mCurrentp and mCurrentOperatingp on the next entry
-// return TRUE if found, FALSE if not found
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::removeData(DATA_TYPE *data)
-{
-	BOOL b_found = FALSE;
-	// don't allow NULL to be passed to addData
-	if (!data)
-	{
-		llerror("NULL pointer passed to LLLinkedList::removeData", 0);
-	}
-
-	LLLinkNode *tcurr = mCurrentp;
-	LLLinkNode *tcurrop = mCurrentOperatingp;
-
-	mCurrentp = mHead.mNextp;
-	mCurrentOperatingp = mHead.mNextp;
-
-	while (mCurrentOperatingp)
-	{
-		if (mCurrentOperatingp->mDatap == data)
-		{
-			b_found = TRUE;
-
-			// remove the node
-
-			// if there is a next one, fix it
-			if (mCurrentOperatingp->mNextp)
-			{
-				mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
-			}
-			*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
-
-			// remove the LLLinkNode
-
-			// if we were on the one we want to delete, bump the cached copies
-			if (mCurrentOperatingp == tcurrop)
-			{
-				tcurrop = tcurr = mCurrentOperatingp->mNextp;
-			}
-			else if (mCurrentOperatingp == tcurr)
-			{
-				tcurrop = tcurr = mCurrentOperatingp->mNextp;
-			}
-
-			mCurrentp = mCurrentOperatingp->mNextp;
-
-			mCurrentOperatingp->removeData();
-			delete mCurrentOperatingp;
-			mCurrentOperatingp = mCurrentp;
-			mCount--;
-			break;
-		}
-		mCurrentOperatingp = mCurrentOperatingp->mNextp;
-	}
-	// restore
-	mCurrentp = tcurr;
-	mCurrentOperatingp = tcurrop;
-	return b_found;
-}
-
-// search the list starting at mHead.mNextp and delete the link with mDatap == data
-// leave mCurrentp and mCurrentOperatingp on the next entry
-// return TRUE if found, FALSE if not found
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::deleteData(DATA_TYPE *data)
-{
-	BOOL b_found = FALSE;
-	// don't allow NULL to be passed to addData
-	if (!data)
-	{
-		llerror("NULL pointer passed to LLLinkedList::removeData", 0);
-	}
-
-	LLLinkNode *tcurr = mCurrentp;
-	LLLinkNode *tcurrop = mCurrentOperatingp;
-
-	mCurrentp = mHead.mNextp;
-	mCurrentOperatingp = mHead.mNextp;
-
-	while (mCurrentOperatingp)
-	{
-		if (mCurrentOperatingp->mDatap == data)
-		{
-			b_found = TRUE;
-
-			// remove the node
-			// if there is a next one, fix it
-			if (mCurrentOperatingp->mNextp)
-			{
-				mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
-			}
-			*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
-
-			// delete the LLLinkNode
-			// if we were on the one we want to delete, bump the cached copies
-			if (mCurrentOperatingp == tcurrop)
-			{
-				tcurrop = tcurr = mCurrentOperatingp->mNextp;
-			}
-
-			// and delete the associated data
-			llassert(mCurrentOperatingp);
-			mCurrentp = mCurrentOperatingp->mNextp;
-			mCurrentOperatingp->deleteData();
-			delete mCurrentOperatingp;
-			mCurrentOperatingp = mCurrentp;
-			mCount--;
-			break;
-		}
-		mCurrentOperatingp = mCurrentOperatingp->mNextp;
-	}
-	// restore
-	mCurrentp = tcurr;
-	mCurrentOperatingp = tcurrop;
-	return b_found;
-}
-
-	// remove all nodes from the list and delete the associated data
-template <class DATA_TYPE>
-void LLLinkedList<DATA_TYPE>::deleteAllData()
-{
-	LLLinkNode *temp;
-	// reset mCurrentp
-	mCurrentp = mHead.mNextp;
-
-	while (mCurrentp)
-	{
-		temp = mCurrentp->mNextp;
-		mCurrentp->deleteData();
-		delete mCurrentp;
-		mCurrentp = temp;
-	}
-
-	// reset mHead and mCurrentp
-	mHead.mNextp = NULL;
-	mCurrentp = mHead.mNextp;
-	mCurrentOperatingp = mHead.mNextp;
-	mCount = 0;
-}
-
-// remove all nodes from the list but do not delete data
-template <class DATA_TYPE>
-void LLLinkedList<DATA_TYPE>::removeAllNodes()
-{
-	LLLinkNode *temp;
-	// reset mCurrentp
-	mCurrentp = mHead.mNextp;
-
-	while (mCurrentp)
-	{
-		temp = mCurrentp->mNextp;
-		mCurrentp->removeData();
-		delete mCurrentp;
-		mCurrentp = temp;
-	}
-
-	// reset mHead and mCurrentp
-	mHead.mNextp = NULL;
-	mCurrentp = mHead.mNextp;
-	mCurrentOperatingp = mHead.mNextp;
-	mCount = 0;
-}
-
-// check to see if data is in list
-// if TRUE then mCurrentp and mCurrentOperatingp point to data
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::checkData(DATA_TYPE *data)
-{
-	// reset mCurrentp
-	mCurrentp = mHead.mNextp;
-
-	while (mCurrentp)
-	{
-		if (mCurrentp->mDatap == data)
-		{
-			mCurrentOperatingp = mCurrentp;
-			return TRUE;
-		}
-		mCurrentp = mCurrentp->mNextp;
-	}
-	mCurrentOperatingp = mCurrentp;
-	return FALSE;
-}
-
-// place mCurrentp on first node
-template <class DATA_TYPE>
-void LLLinkedList<DATA_TYPE>::resetList()
-{
-	mCurrentp = mHead.mNextp;
-	mCurrentOperatingp = mHead.mNextp;
-}
-
-// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp
-template <class DATA_TYPE>
-DATA_TYPE *LLLinkedList<DATA_TYPE>::getCurrentData()
-{
-	if (mCurrentp)
-	{
-		mCurrentOperatingp = mCurrentp;
-		mCurrentp = mCurrentp->mNextp;
-		return mCurrentOperatingp->mDatap;
-	}
-	else
-	{
-		return NULL;
-	}
-}
-
-// same as getCurrentData() but a more intuitive name for the operation
-template <class DATA_TYPE>
-DATA_TYPE *LLLinkedList<DATA_TYPE>::getNextData()
-{
-	if (mCurrentp)
-	{
-		mCurrentOperatingp = mCurrentp;
-		mCurrentp = mCurrentp->mNextp;
-		return mCurrentOperatingp->mDatap;
-	}
-	else
-	{
-		return NULL;
-	}
-}
-
-// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp
-template <class DATA_TYPE>
-DATA_TYPE *LLLinkedList<DATA_TYPE>::getFirstData()
-{
-	mCurrentp = mHead.mNextp;
-	mCurrentOperatingp = mHead.mNextp;
-	if (mCurrentp)
-	{
-		mCurrentOperatingp = mCurrentp;
-		mCurrentp = mCurrentp->mNextp;
-		return mCurrentOperatingp->mDatap;
-	}
-	else
-	{
-		return NULL;
-	}
-}
-
-// Note: n is zero-based
-template <class DATA_TYPE>
-DATA_TYPE	*LLLinkedList<DATA_TYPE>::getNthData( U32 n )
-{
-	mCurrentOperatingp = mHead.mNextp;
-
-	// if empty, return NULL
-	if (!mCurrentOperatingp)
-	{
-		return NULL;
-	}
-
-	for( U32 i = 0; i < n; i++ )
-	{
-		mCurrentOperatingp = mCurrentOperatingp->mNextp;
-		if( !mCurrentOperatingp )
-		{
-			return NULL;
-		}
-	}
-
-	mCurrentp = mCurrentOperatingp->mNextp;
-	return mCurrentOperatingp->mDatap;
-}
-
-
-// reset the list and return the last data in it, set mCurentOperatingp to that node and bump mCurrentp
-template <class DATA_TYPE>
-DATA_TYPE *LLLinkedList<DATA_TYPE>::getLastData()
-{
-	mCurrentOperatingp = mHead.mNextp;
-
-	// if empty, return NULL
-	if (!mCurrentOperatingp)
-		return NULL;
-
-	// walk until we're pointing at the last entry
-	while (mCurrentOperatingp->mNextp)
-	{
-		mCurrentOperatingp = mCurrentOperatingp->mNextp;
-	}
-	mCurrentp = mCurrentOperatingp->mNextp;
-	return mCurrentOperatingp->mDatap;
-}
-
-// remove the Node at mCurentOperatingp
-// leave mCurrentp and mCurentOperatingp on the next entry
-// return TRUE if found, FALSE if not found
-template <class DATA_TYPE>
-void LLLinkedList<DATA_TYPE>::removeCurrentData()
-{
-	if (mCurrentOperatingp)
-	{
-		// remove the node
-		// if there is a next one, fix it
-		if (mCurrentOperatingp->mNextp)
-		{
-			mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
-		}
-		*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
-
-		// remove the LLLinkNode
-		mCurrentp = mCurrentOperatingp->mNextp;
-
-		mCurrentOperatingp->removeData();
-		delete mCurrentOperatingp;
-		mCount--;
-		mCurrentOperatingp = mCurrentp;
-	}
-}
-
-// remove the Node at mCurentOperatingp and add it to newlist
-// leave mCurrentp and mCurentOperatingp on the next entry
-// return TRUE if found, FALSE if not found
-template <class DATA_TYPE>
-void LLLinkedList<DATA_TYPE>::moveCurrentData(LLLinkedList *newlist, BOOL b_sort)
-{
-	if (mCurrentOperatingp)
-	{
-		// remove the node
-		// if there is a next one, fix it
-		if (mCurrentOperatingp->mNextp)
-		{
-			mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
-		}
-		*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
-
-		// remove the LLLinkNode
-		mCurrentp = mCurrentOperatingp->mNextp;
-		// move the node to the new list
-		newlist->addData(mCurrentOperatingp);
-		if (b_sort)
-			bubbleSortList();
-		mCurrentOperatingp = mCurrentp;
-	}
-}
-
-template <class DATA_TYPE>
-BOOL LLLinkedList<DATA_TYPE>::moveData(DATA_TYPE *data, LLLinkedList *newlist, BOOL b_sort)
-{
-	BOOL b_found = FALSE;
-	// don't allow NULL to be passed to addData
-	if (!data)
-	{
-		llerror("NULL pointer passed to LLLinkedList::removeData", 0);
-	}
-
-	LLLinkNode *tcurr = mCurrentp;
-	LLLinkNode *tcurrop = mCurrentOperatingp;
-
-	mCurrentp = mHead.mNextp;
-	mCurrentOperatingp = mHead.mNextp;
-
-	while (mCurrentOperatingp)
-	{
-		if (mCurrentOperatingp->mDatap == data)
-		{
-			b_found = TRUE;
-
-			// remove the node
-
-			// if there is a next one, fix it
-			if (mCurrentOperatingp->mNextp)
-			{
-				mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
-			}
-			*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
-
-			// if we were on the one we want to delete, bump the cached copies
-			if (  (mCurrentOperatingp == tcurrop)
-				||(mCurrentOperatingp == tcurr))
-			{
-				tcurrop = tcurr = mCurrentOperatingp->mNextp;
-			}
-
-			// remove the LLLinkNode
-			mCurrentp = mCurrentOperatingp->mNextp;
-			// move the node to the new list
-			newlist->addData(mCurrentOperatingp);
-			if (b_sort)
-				newlist->bubbleSortList();
-			mCurrentOperatingp = mCurrentp;
-			break;
-		}
-		mCurrentOperatingp = mCurrentOperatingp->mNextp;
-	}
-	// restore
-	mCurrentp = tcurr;
-	mCurrentOperatingp = tcurrop;
-	return b_found;
-}
-
-// delete the Node at mCurentOperatingp
-// leave mCurrentp anf mCurentOperatingp on the next entry
-// return TRUE if found, FALSE if not found
-template <class DATA_TYPE>
-void LLLinkedList<DATA_TYPE>::deleteCurrentData()
-{
-	if (mCurrentOperatingp)
-	{
-		// remove the node
-		// if there is a next one, fix it
-		if (mCurrentOperatingp->mNextp)
-		{
-			mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
-		}
-		*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
-
-		// remove the LLLinkNode
-		mCurrentp = mCurrentOperatingp->mNextp;
-
-		mCurrentOperatingp->deleteData();
-		if (mCurrentOperatingp->mDatap)
-			llerror("This is impossible!", 0);
-		delete mCurrentOperatingp;
-		mCurrentOperatingp = mCurrentp;
-		mCount--;
-	}
-}
-
-#endif
diff --git a/indra/llcommon/ll_template_cast.h b/indra/llcommon/ll_template_cast.h
deleted file mode 100755
index c8f9a2f7eb382752844364a98841a7924aae852a..0000000000000000000000000000000000000000
--- a/indra/llcommon/ll_template_cast.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * @file   ll_template_cast.h
- * @author Nat Goodspeed
- * @date   2009-11-21
- * @brief  Define ll_template_cast function
- * 
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#if ! defined(LL_LL_TEMPLATE_CAST_H)
-#define LL_LL_TEMPLATE_CAST_H
-
-/**
- * Implementation for ll_template_cast() (q.v.).
- *
- * Default implementation: trying to cast two completely unrelated types
- * returns 0. Typically you'd specify T and U as pointer types, but in fact T
- * can be any type that can be initialized with 0.
- */
-template <typename T, typename U>
-struct ll_template_cast_impl
-{
-    T operator()(U)
-    {
-        return 0;
-    }
-};
-
-/**
- * ll_template_cast<T>(some_value) is for use in a template function when
- * some_value might be of arbitrary type, but you want to recognize type T
- * specially.
- *
- * It's designed for use with pointer types. Example:
- * @code
- * struct SpecialClass
- * {
- *     void someMethod(const std::string&) const;
- * };
- *
- * template <class REALCLASS>
- * void somefunc(const REALCLASS& instance)
- * {
- *     const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance);
- *     if (ptr)
- *     {
- *         ptr->someMethod("Call method only available on SpecialClass");
- *     }
- * }
- * @endcode
- *
- * Why is this better than dynamic_cast<>? Because unless OtherClass is
- * polymorphic, the following won't even compile (gcc 4.0.1):
- * @code
- * OtherClass other;
- * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other);
- * @endcode
- * to say nothing of this:
- * @code
- * void function(int);
- * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function);
- * @endcode
- * ll_template_cast handles these kinds of cases by returning 0.
- */
-template <typename T, typename U>
-T ll_template_cast(U value)
-{
-    return ll_template_cast_impl<T, U>()(value);
-}
-
-/**
- * Implementation for ll_template_cast() (q.v.).
- *
- * Implementation for identical types: return same value.
- */
-template <typename T>
-struct ll_template_cast_impl<T, T>
-{
-    T operator()(T value)
-    {
-        return value;
-    }
-};
-
-/**
- * LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of
- * type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s --
- * presuming that @c source can be converted to @c dest by the normal rules of
- * C++.
- *
- * By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's
- * type is literally identical to @c dest. (This is because of the
- * straightforward application of template specialization rules.) That can
- * lead to surprising results, e.g.:
- *
- * @code
- * Foo myFoo;
- * const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo);
- * @endcode
- *
- * Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt>
- * -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would
- * force the compiler to do the right thing.)
- *
- * More disappointingly:
- * @code
- * struct Base {};
- * struct Subclass: public Base {};
- * Subclass object;
- * Base* ptr = ll_template_cast<Base*>(&object);
- * @endcode
- *
- * Here @c ptr will be 0 because <tt>&object</tt> is of type
- * <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to
- * succeed, but without our help ll_template_cast can't recognize it.
- *
- * The following would suffice:
- * @code
- * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
- * ...
- * Base* ptr = ll_template_cast<Base*>(&object);
- * @endcode
- *
- * However, as noted earlier, this is easily fooled:
- * @code
- * const Base* ptr = ll_template_cast<const Base*>(&object);
- * @endcode
- * would still produce 0 because we haven't yet seen:
- * @code
- * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
- * @endcode
- *
- * @TODO
- * This macro should use Boost type_traits facilities for stripping and
- * re-adding @c const and @c volatile qualifiers so that invoking
- * LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all
- * permitted permutations. It's really not fair to the coder to require
- * separate:
- * @code
- * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
- * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
- * LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*);
- * @endcode
- *
- * (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt>
- * because that's not permitted by normal C++ assignment anyway.)
- */
-#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE)   \
-template <>                                     \
-struct ll_template_cast_impl<DEST, SOURCE>      \
-{                                               \
-    DEST operator()(SOURCE wrapper)             \
-    {                                           \
-        return wrapper;                         \
-    }                                           \
-}
-
-#endif /* ! defined(LL_LL_TEMPLATE_CAST_H) */
diff --git a/indra/llcommon/llaccountingcost.h b/indra/llcommon/llaccountingcost.h
deleted file mode 100755
index 0ef3b50c6dfa513bfd1b8357e4325f8e1959bad5..0000000000000000000000000000000000000000
--- a/indra/llcommon/llaccountingcost.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/** 
- * @file llaccountingcost.h
- * @
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_ACCOUNTINGQUOTA_H
-#define LL_ACCOUNTINGQUOTA_H
-
-struct ParcelQuota
-{
-	ParcelQuota( F32 ownerRenderCost,	 F32 ownerPhysicsCost,	  F32 ownerNetworkCost,	   F32 ownerSimulationCost,
-				 F32 groupRenderCost,	 F32 groupPhysicsCost,	  F32 groupNetworkCost,	   F32 groupSimulationCost,
-				 F32 otherRenderCost,	 F32 otherPhysicsCost,	  F32 otherNetworkCost,	   F32 otherSimulationCost,
-				 F32 tempRenderCost,	 F32 tempPhysicsCost,	  F32 tempNetworkCost,	   F32 tempSimulationCost,
-				 F32 selectedRenderCost, F32 selectedPhysicsCost, F32 selectedNetworkCost, F32 selectedSimulationCost,
-				 F32 parcelCapacity )
-	: mOwnerRenderCost( ownerRenderCost ), mOwnerPhysicsCost( ownerPhysicsCost ) 
-	, mOwnerNetworkCost( ownerNetworkCost ), mOwnerSimulationCost( ownerSimulationCost )
-	, mGroupRenderCost( groupRenderCost ), mGroupPhysicsCost( groupPhysicsCost )
-	, mGroupNetworkCost( groupNetworkCost ), mGroupSimulationCost( groupSimulationCost )
-	, mOtherRenderCost( otherRenderCost ), mOtherPhysicsCost( otherPhysicsCost )
-	, mOtherNetworkCost( otherNetworkCost ), mOtherSimulationCost( otherSimulationCost )
-	, mTempRenderCost( tempRenderCost ), mTempPhysicsCost( tempPhysicsCost ) 
-	, mTempNetworkCost( tempNetworkCost ), mTempSimulationCost( tempSimulationCost )
-	, mSelectedRenderCost( tempRenderCost ), mSelectedPhysicsCost( tempPhysicsCost ) 
-	, mSelectedNetworkCost( tempNetworkCost ), mSelectedSimulationCost( selectedSimulationCost )
-	, mParcelCapacity( parcelCapacity )
-	{
-	}
-
-	ParcelQuota(){}			
-	F32 mOwnerRenderCost, mOwnerPhysicsCost, mOwnerNetworkCost, mOwnerSimulationCost;
-	F32 mGroupRenderCost, mGroupPhysicsCost, mGroupNetworkCost, mGroupSimulationCost;
-	F32 mOtherRenderCost, mOtherPhysicsCost, mOtherNetworkCost, mOtherSimulationCost;
-	F32 mTempRenderCost,  mTempPhysicsCost,  mTempNetworkCost,  mTempSimulationCost;
-	F32 mSelectedRenderCost, mSelectedPhysicsCost, mSelectedNetworkCost, mSelectedSimulationCost;
-	F32 mParcelCapacity;
-};
-
-//SelectionQuota atm does not require a id
-struct SelectionCost
-{
-	SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost )
-	//: mTransactionId( transactionId)
-	: mPhysicsCost( physicsCost )
-	, mNetworkCost( networkCost )
-	, mSimulationCost( simulationCost )
-	{
-	}
-	SelectionCost()
-	: mPhysicsCost( 0.0f )
-	, mNetworkCost( 0.0f )
-	, mSimulationCost( 0.0f )
-	{}
-	
-	F32 mPhysicsCost, mNetworkCost, mSimulationCost;	
-	//LLTransactionID mTransactionId;
-};
-
-typedef enum { Roots = 0 , Prims } eSelectionType;
-
-#endif
-
-
-
diff --git a/indra/llcommon/llagentconstants.h b/indra/llcommon/llagentconstants.h
deleted file mode 100755
index cd237da4eb909ae733a7275b3158ad87fd550d14..0000000000000000000000000000000000000000
--- a/indra/llcommon/llagentconstants.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/** 
- * @file llagentconstants.h
- * @author James Cook, Andrew Meadows, Richard Nelson
- * @brief Shared constants through the system for agents.
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLAGENTCONSTANTS_H
-#define LL_LLAGENTCONSTANTS_H
-
-const U32 CONTROL_AT_POS_INDEX				= 0;
-const U32 CONTROL_AT_NEG_INDEX				= 1;
-const U32 CONTROL_LEFT_POS_INDEX			= 2;
-const U32 CONTROL_LEFT_NEG_INDEX			= 3;
-const U32 CONTROL_UP_POS_INDEX				= 4;
-const U32 CONTROL_UP_NEG_INDEX				= 5;
-const U32 CONTROL_PITCH_POS_INDEX			= 6;
-const U32 CONTROL_PITCH_NEG_INDEX			= 7;
-const U32 CONTROL_YAW_POS_INDEX				= 8;
-const U32 CONTROL_YAW_NEG_INDEX				= 9;
-const U32 CONTROL_FAST_AT_INDEX				= 10;
-const U32 CONTROL_FAST_LEFT_INDEX			= 11;
-const U32 CONTROL_FAST_UP_INDEX				= 12;
-const U32 CONTROL_FLY_INDEX					= 13;
-const U32 CONTROL_STOP_INDEX				= 14;
-const U32 CONTROL_FINISH_ANIM_INDEX			= 15;
-const U32 CONTROL_STAND_UP_INDEX			= 16;
-const U32 CONTROL_SIT_ON_GROUND_INDEX		= 17;
-const U32 CONTROL_MOUSELOOK_INDEX			= 18;
-const U32 CONTROL_NUDGE_AT_POS_INDEX		= 19;
-const U32 CONTROL_NUDGE_AT_NEG_INDEX		= 20;
-const U32 CONTROL_NUDGE_LEFT_POS_INDEX		= 21;
-const U32 CONTROL_NUDGE_LEFT_NEG_INDEX		= 22;
-const U32 CONTROL_NUDGE_UP_POS_INDEX		= 23;
-const U32 CONTROL_NUDGE_UP_NEG_INDEX		= 24;
-const U32 CONTROL_TURN_LEFT_INDEX			= 25;
-const U32 CONTROL_TURN_RIGHT_INDEX			= 26;
-const U32 CONTROL_AWAY_INDEX				= 27;
-const U32 CONTROL_LBUTTON_DOWN_INDEX		= 28;
-const U32 CONTROL_LBUTTON_UP_INDEX			= 29;
-const U32 CONTROL_ML_LBUTTON_DOWN_INDEX		= 30;
-const U32 CONTROL_ML_LBUTTON_UP_INDEX		= 31;
-const U32 TOTAL_CONTROLS					= 32;
-
-const U32 AGENT_CONTROL_AT_POS              = 0x1 << CONTROL_AT_POS_INDEX;			// 0x00000001
-const U32 AGENT_CONTROL_AT_NEG              = 0x1 << CONTROL_AT_NEG_INDEX;			// 0x00000002
-const U32 AGENT_CONTROL_LEFT_POS            = 0x1 << CONTROL_LEFT_POS_INDEX;		// 0x00000004
-const U32 AGENT_CONTROL_LEFT_NEG            = 0x1 << CONTROL_LEFT_NEG_INDEX;		// 0x00000008
-const U32 AGENT_CONTROL_UP_POS              = 0x1 << CONTROL_UP_POS_INDEX;			// 0x00000010
-const U32 AGENT_CONTROL_UP_NEG              = 0x1 << CONTROL_UP_NEG_INDEX;			// 0x00000020
-const U32 AGENT_CONTROL_PITCH_POS           = 0x1 << CONTROL_PITCH_POS_INDEX;		// 0x00000040
-const U32 AGENT_CONTROL_PITCH_NEG           = 0x1 << CONTROL_PITCH_NEG_INDEX;		// 0x00000080
-const U32 AGENT_CONTROL_YAW_POS             = 0x1 << CONTROL_YAW_POS_INDEX;			// 0x00000100
-const U32 AGENT_CONTROL_YAW_NEG             = 0x1 << CONTROL_YAW_NEG_INDEX;			// 0x00000200
-
-const U32 AGENT_CONTROL_FAST_AT             = 0x1 << CONTROL_FAST_AT_INDEX;			// 0x00000400
-const U32 AGENT_CONTROL_FAST_LEFT           = 0x1 << CONTROL_FAST_LEFT_INDEX;		// 0x00000800
-const U32 AGENT_CONTROL_FAST_UP             = 0x1 << CONTROL_FAST_UP_INDEX;			// 0x00001000
-
-const U32 AGENT_CONTROL_FLY					= 0x1 << CONTROL_FLY_INDEX;				// 0x00002000
-const U32 AGENT_CONTROL_STOP				= 0x1 << CONTROL_STOP_INDEX;			// 0x00004000
-const U32 AGENT_CONTROL_FINISH_ANIM			= 0x1 << CONTROL_FINISH_ANIM_INDEX;		// 0x00008000
-const U32 AGENT_CONTROL_STAND_UP			= 0x1 << CONTROL_STAND_UP_INDEX;		// 0x00010000
-const U32 AGENT_CONTROL_SIT_ON_GROUND		= 0x1 << CONTROL_SIT_ON_GROUND_INDEX;	// 0x00020000
-const U32 AGENT_CONTROL_MOUSELOOK			= 0x1 << CONTROL_MOUSELOOK_INDEX;		// 0x00040000
-
-const U32 AGENT_CONTROL_NUDGE_AT_POS        = 0x1 << CONTROL_NUDGE_AT_POS_INDEX;	// 0x00080000
-const U32 AGENT_CONTROL_NUDGE_AT_NEG        = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX;	// 0x00100000
-const U32 AGENT_CONTROL_NUDGE_LEFT_POS      = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX;	// 0x00200000
-const U32 AGENT_CONTROL_NUDGE_LEFT_NEG      = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX;	// 0x00400000
-const U32 AGENT_CONTROL_NUDGE_UP_POS        = 0x1 << CONTROL_NUDGE_UP_POS_INDEX;	// 0x00800000
-const U32 AGENT_CONTROL_NUDGE_UP_NEG        = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX;	// 0x01000000
-const U32 AGENT_CONTROL_TURN_LEFT	        = 0x1 << CONTROL_TURN_LEFT_INDEX;		// 0x02000000
-const U32 AGENT_CONTROL_TURN_RIGHT	        = 0x1 << CONTROL_TURN_RIGHT_INDEX;		// 0x04000000
-
-const U32 AGENT_CONTROL_AWAY				= 0x1 << CONTROL_AWAY_INDEX;			// 0x08000000
-
-const U32 AGENT_CONTROL_LBUTTON_DOWN		= 0x1 << CONTROL_LBUTTON_DOWN_INDEX;	// 0x10000000
-const U32 AGENT_CONTROL_LBUTTON_UP			= 0x1 << CONTROL_LBUTTON_UP_INDEX;		// 0x20000000
-const U32 AGENT_CONTROL_ML_LBUTTON_DOWN		= 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX;	// 0x40000000
-const U32 AGENT_CONTROL_ML_LBUTTON_UP		= ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX;	// 0x80000000
-
-const U32 AGENT_CONTROL_AT 		= AGENT_CONTROL_AT_POS 
-								  | AGENT_CONTROL_AT_NEG 
-								  | AGENT_CONTROL_NUDGE_AT_POS 
-								  | AGENT_CONTROL_NUDGE_AT_NEG;
-
-const U32 AGENT_CONTROL_LEFT 	= AGENT_CONTROL_LEFT_POS 
-								  | AGENT_CONTROL_LEFT_NEG 
-								  | AGENT_CONTROL_NUDGE_LEFT_POS 
-								  | AGENT_CONTROL_NUDGE_LEFT_NEG;
-
-const U32 AGENT_CONTROL_UP 		= AGENT_CONTROL_UP_POS 
-								  | AGENT_CONTROL_UP_NEG 
-								  | AGENT_CONTROL_NUDGE_UP_POS 
-								  | AGENT_CONTROL_NUDGE_UP_NEG;
-
-const U32 AGENT_CONTROL_HORIZONTAL = AGENT_CONTROL_AT 
-									 | AGENT_CONTROL_LEFT;
-
-const U32 AGENT_CONTROL_NOT_USED_BY_LSL = AGENT_CONTROL_FLY 
-										  | AGENT_CONTROL_STOP 
-										  | AGENT_CONTROL_FINISH_ANIM 
-										  | AGENT_CONTROL_STAND_UP 
-										  | AGENT_CONTROL_SIT_ON_GROUND 
-										  | AGENT_CONTROL_MOUSELOOK 
-										  | AGENT_CONTROL_AWAY;
-
-const U32 AGENT_CONTROL_MOVEMENT = AGENT_CONTROL_AT 
-								   | AGENT_CONTROL_LEFT 
-								   | AGENT_CONTROL_UP;
-
-const U32 AGENT_CONTROL_ROTATION = AGENT_CONTROL_PITCH_POS 
-								   | AGENT_CONTROL_PITCH_NEG 
-								   | AGENT_CONTROL_YAW_POS 
-								   | AGENT_CONTROL_YAW_NEG;
-
-const U32 AGENT_CONTROL_NUDGE = AGENT_CONTROL_NUDGE_AT_POS
-								| AGENT_CONTROL_NUDGE_AT_NEG
-								| AGENT_CONTROL_NUDGE_LEFT_POS
-								| AGENT_CONTROL_NUDGE_LEFT_NEG;
-
-
-// move these up so that we can hide them in "State" for object updates 
-// (for now)
-const U32 AGENT_ATTACH_OFFSET				= 4;
-const U32 AGENT_ATTACH_MASK					= 0xf << AGENT_ATTACH_OFFSET;
-const U32 AGENT_ATTACH_CLEAR				= 0x00;
-
-// RN: this method swaps the upper and lower nibbles to maintain backward 
-// compatibility with old objects that only used the upper nibble
-#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4)))
-
-// test state for use in testing grabbing the camera
-const U32 AGENT_CAMERA_OBJECT				= 0x1 << 3;
-
-const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters?
-
-#endif
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index afa06df23e1e680b394d7b83b84c94cf52ddea8b..82df78a33525c4f9b6995b4e9befbc7797b367c3 100755
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -30,7 +30,6 @@
 #include <map>
 #include "llrun.h"
 #include "llsd.h"
-#include "lloptioninterface.h"
 
 // Forward declarations
 template <typename Type> class LLAtomic32;
@@ -64,7 +63,7 @@ namespace google_breakpad {
 	class ExceptionHandler; // See exception_handler.h
 }
 
-class LL_COMMON_API LLApp : public LLOptionInterface
+class LL_COMMON_API LLApp
 {
 	friend class LLErrorThread;
 public:
@@ -113,7 +112,7 @@ class LL_COMMON_API LLApp : public LLOptionInterface
 	 * @param name The name of the option.
 	 * @return Returns the option data.
 	 */
-	virtual LLSD getOption(const std::string& name) const;
+	LLSD getOption(const std::string& name) const;
 
 	/** 
 	 * @brief Parse command line options and insert them into
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index 69b01731e5dc2ed76d764a441764b0ec38448a11..5a95a58d93db4f43054e507e2020c8ae2e7569e4 100755
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -29,8 +29,6 @@
 
 #include <string>
 
-#include "stdenums.h" 	// for EDragAndDropType
-
 class LL_COMMON_API LLAssetType
 {
 public:
diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h
deleted file mode 100755
index f47f447b454b9ca13df7cbf5575f8a98e86c4aa0..0000000000000000000000000000000000000000
--- a/indra/llcommon/llavatarconstants.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/** 
- * @file llavatarconstants.h
- * @brief some useful short term constants for Indra
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_AVATAR_CONSTANTS_H
-#define LL_AVATAR_CONSTANTS_H
-
-// If this string is passed to dataserver in AvatarPropertiesUpdate 
-// then no change is made to user.profile_web
-const char* const BLACKLIST_PROFILE_WEB_STR = "featureWebProfilesDisabled";
-
-// If profile web pages are feature blacklisted then this URL is 
-// shown in the profile instead of the user's set URL
-const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisabled";
-
-// Maximum number of avatar picks
-const S32 MAX_AVATAR_PICKS = 10;
-
-// For Flags in AvatarPropertiesReply
-const U32 AVATAR_ALLOW_PUBLISH			= 0x1 << 0;	// whether profile is externally visible or not
-const U32 AVATAR_MATURE_PUBLISH			= 0x1 << 1;	// profile is "mature"
-const U32 AVATAR_IDENTIFIED				= 0x1 << 2;	// whether avatar has provided payment info
-const U32 AVATAR_TRANSACTED				= 0x1 << 3;	// whether avatar has actively used payment info
-const U32 AVATAR_ONLINE					= 0x1 << 4; // the online status of this avatar, if known.
-const U32 AVATAR_AGEVERIFIED			= 0x1 << 5;	// whether avatar has been age-verified
-
-char const* const VISIBILITY_DEFAULT = "default";
-char const* const VISIBILITY_HIDDEN = "hidden";
-char const* const VISIBILITY_VISIBLE = "visible";
-char const* const VISIBILITY_INVISIBLE = "invisible";
-
-#endif
-
diff --git a/indra/llcommon/bitpack.cpp b/indra/llcommon/llbitpack.cpp
similarity index 98%
rename from indra/llcommon/bitpack.cpp
rename to indra/llcommon/llbitpack.cpp
index cdcaba076577edf2cfdbd62a1a2883b5d243b8c1..622a099945c6100ba959f3e6e28b9f1469338c47 100755
--- a/indra/llcommon/bitpack.cpp
+++ b/indra/llcommon/llbitpack.cpp
@@ -27,4 +27,4 @@
 #include "linden_common.h"
 
 // implementation is all in the header, this include dep ensures the unit test is rerun if the implementation changes.
-#include "bitpack.h"
+#include "llbitpack.h"
diff --git a/indra/llcommon/bitpack.h b/indra/llcommon/llbitpack.h
similarity index 94%
rename from indra/llcommon/bitpack.h
rename to indra/llcommon/llbitpack.h
index 037300dd144a5ffccbd1119a4912f442d8afb124..fea56a4f1fb6e625ee671ed753b432056fcea398 100755
--- a/indra/llcommon/bitpack.h
+++ b/indra/llcommon/llbitpack.h
@@ -1,5 +1,5 @@
 /** 
- * @file bitpack.h
+ * @file llbitpack.h
  * @brief Convert data to packed bit stream
  *
  * $LicenseInfo:firstyear=2000&license=viewerlgpl$
@@ -79,7 +79,7 @@ class LLBitPack
 					*(mBuffer + mBufferSize++) = mLoad;
 					if (mBufferSize > mMaxSize)
 					{
-						llerror("mBufferSize exceeding mMaxSize!", 0);
+						LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL;
 					}
 					mLoadSize = 0;
 					mLoad = 0x00;
@@ -122,7 +122,7 @@ class LLBitPack
 					*(mBuffer + mBufferSize++) = mLoad;
 					if (mBufferSize > mMaxSize)
 					{
-						llerror("mBufferSize exceeding mMaxSize!", 0);
+						LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL;
 					}
 					mLoadSize = 0;
 					mLoad = 0x00;
@@ -190,7 +190,7 @@ class LLBitPack
 			*(mBuffer + mBufferSize++) = mLoad;
 			if (mBufferSize > mMaxSize)
 			{
-				llerror("mBufferSize exceeding mMaxSize!", 0);
+				LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL;
 			}
 			mLoadSize = 0;
 		}
diff --git a/indra/llcommon/llclickaction.h b/indra/llcommon/llclickaction.h
deleted file mode 100755
index 1f87d8eec3a87d8e52eb7cd9a02ca06e3daed2cf..0000000000000000000000000000000000000000
--- a/indra/llcommon/llclickaction.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/** 
- * @file llclickaction.h
- * @author James Cook
- * @brief Constants for single-click actions on objects
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLCLICKACTION_H
-#define LL_LLCLICKACTION_H
-// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
-const U8 CLICK_ACTION_NONE = 0;
-const U8 CLICK_ACTION_TOUCH = 0;
-const U8 CLICK_ACTION_SIT = 1;
-const U8 CLICK_ACTION_BUY = 2;
-const U8 CLICK_ACTION_PAY = 3;
-const U8 CLICK_ACTION_OPEN = 4;
-const U8 CLICK_ACTION_PLAY = 5;
-const U8 CLICK_ACTION_OPEN_MEDIA = 6;
-const U8 CLICK_ACTION_ZOOM = 7;
-// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
-#endif
diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h
deleted file mode 100755
index 131b819c99148f29c136c77012450ffe6a02de10..0000000000000000000000000000000000000000
--- a/indra/llcommon/lldarray.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/** 
- * @file lldarray.h
- * @brief Wrapped std::vector for backward compatibility.
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLDARRAY_H
-#define LL_LLDARRAY_H
-
-#include "llerror.h"
-
-#include <vector>
-#include <map>
-
-// class LLDynamicArray<>; // = std::vector + reserves <BlockSize> elements
-// class LLDynamicArrayIndexed<>; // = std::vector + std::map if indices, only supports operator[] and begin(),end()
-
-//--------------------------------------------------------
-// LLDynamicArray declaration
-//--------------------------------------------------------
-// NOTE: BlockSize is used to reserve a minimal initial amount
-template <typename Type, int BlockSize = 32> 
-class LLDynamicArray : public std::vector<Type>
-{
-public:
-	enum
-	{
-		OKAY = 0,
-		FAIL = -1
-	};
-	
-	LLDynamicArray(S32 size=0) : std::vector<Type>(size) { if (size < BlockSize) std::vector<Type>::reserve(BlockSize); }
-
-	void reset() { std::vector<Type>::clear(); }
-
-	// ACCESSORS
-	const Type& get(S32 index) const	 			{ return std::vector<Type>::operator[](index); }
-	Type&       get(S32 index)						{ return std::vector<Type>::operator[](index); }
-	S32			find(const Type &obj) const;
-
-	S32			count() const						{ return std::vector<Type>::size(); }
-	S32			getLength() const					{ return std::vector<Type>::size(); }
-	S32			getMax() const						{ return std::vector<Type>::capacity(); }
-
-	// MANIPULATE
-	S32         put(const Type &obj);					// add to end of array, returns index
-// 	Type*		reserve(S32 num);					// reserve a block of indices in advance
-	Type*		reserve_block(U32 num);			// reserve a block of indices in advance
-
-	S32			remove(S32 index);				// remove by index, no bounds checking
-	S32			removeObj(const Type &obj);				// remove by object
-	S32			removeLast();
-
-	void		operator+=(const LLDynamicArray<Type,BlockSize> &other);
-};
-
-//--------------------------------------------------------
-// LLDynamicArray implementation
-//--------------------------------------------------------
-
-template <typename Type,int BlockSize>
-inline S32 LLDynamicArray<Type,BlockSize>::find(const Type &obj) const
-{
-	typename std::vector<Type>::const_iterator iter = std::find(this->begin(), this->end(), obj);
-	if (iter != this->end())
-	{
-		return iter - this->begin();
-	}
-	return FAIL;
-}
-
-
-template <typename Type,int BlockSize>
-inline S32 LLDynamicArray<Type,BlockSize>::remove(S32 i)
-{
-	// This is a fast removal by swapping with the last element
-	S32 sz = this->size();
-	if (i < 0 || i >= sz)
-	{
-		return FAIL;
-	}
-	if (i < sz-1)
-	{
-		this->operator[](i) = this->back();
-	}
-	this->pop_back();
-	return i;
-}
-
-template <typename Type,int BlockSize>
-inline S32 LLDynamicArray<Type,BlockSize>::removeObj(const Type& obj)
-{
-	typename std::vector<Type>::iterator iter = std::find(this->begin(), this->end(), obj);
-	if (iter != this->end())
-	{
-		S32 res = iter - this->begin();
-		typename std::vector<Type>::iterator last = this->end(); 
-		--last;
-		*iter = *last;
-		this->pop_back();
-		return res;
-	}
-	return FAIL;
-}
-
-template <typename Type,int BlockSize>
-inline S32	LLDynamicArray<Type,BlockSize>::removeLast()
-{
-	if (!this->empty())
-	{
-		this->pop_back();
-		return OKAY;
-	}
-	return FAIL;
-}
-
-template <typename Type,int BlockSize>
-inline Type* LLDynamicArray<Type,BlockSize>::reserve_block(U32 num)
-{
-	U32 sz = this->size();
-	this->resize(sz+num);
-	return &(this->operator[](sz));
-}
-
-template <typename Type,int BlockSize>
-inline S32	LLDynamicArray<Type,BlockSize>::put(const Type &obj) 
-{
-	this->push_back(obj);
-	return this->size() - 1;
-}
-
-template <typename Type,int BlockSize>
-inline void LLDynamicArray<Type,BlockSize>::operator+=(const LLDynamicArray<Type,BlockSize> &other)
-{
-	insert(this->end(), other.begin(), other.end());
-}
-
-//--------------------------------------------------------
-// LLDynamicArrayIndexed declaration
-//--------------------------------------------------------
-
-template <typename Type, typename Key, int BlockSize = 32> 
-class LLDynamicArrayIndexed
-{
-public:
-	typedef typename std::vector<Type>::iterator iterator;
-	typedef typename std::vector<Type>::const_iterator const_iterator;
-	typedef typename std::vector<Type>::reverse_iterator reverse_iterator;
-	typedef typename std::vector<Type>::const_reverse_iterator const_reverse_iterator;
-	typedef typename std::vector<Type>::size_type size_type;
-protected:
-	std::vector<Type> mVector;
-	std::map<Key, U32> mIndexMap;
-	
-public:
-	LLDynamicArrayIndexed() { mVector.reserve(BlockSize); }
-	
-	iterator begin() { return mVector.begin(); }
-	const_iterator begin() const { return mVector.begin(); }
-	iterator end() { return mVector.end(); }
-	const_iterator end() const { return mVector.end(); }
-
-	reverse_iterator rbegin() { return mVector.rbegin(); }
-	const_reverse_iterator rbegin() const { return mVector.rbegin(); }
-	reverse_iterator rend() { return mVector.rend(); }
-	const_reverse_iterator rend() const { return mVector.rend(); }
-
-	void reset() { mVector.resize(0); mIndexMap.resize(0); }
-	bool empty() const { return mVector.empty(); }
-	size_type size() const { return mVector.size(); }
-	
-	Type& operator[](const Key& k)
-	{
-		typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k);
-		if (iter == mIndexMap.end())
-		{
-			U32 n = mVector.size();
-			mIndexMap[k] = n;
-			mVector.push_back(Type());
-			llassert(mVector.size() == mIndexMap.size());
-			return mVector[n];
-		}
-		else
-		{
-			return mVector[iter->second];
-		}
-	}
-
-	const_iterator find(const Key& k) const
-	{
-		typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k);
-		if(iter == mIndexMap.end())
-		{
-			return mVector.end();
-		}
-		else
-		{
-			return mVector.begin() + iter->second;
-		}
-	}
-};
-
-#endif
diff --git a/indra/llcommon/lldeleteutils.h b/indra/llcommon/lldeleteutils.h
deleted file mode 100644
index f250dc3028ee36d19b0e648591b6a4ab94db54f2..0000000000000000000000000000000000000000
--- a/indra/llcommon/lldeleteutils.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/** 
- * @file lldeleteutils.h
- * @brief Utility functions to simplify some common pointer-munging idioms.
- *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-#ifndef LL_DELETE_UTILS_H
-#define LL_DELETE_UTILS_H
-
-// Simple utility functions to eventually replace the common 2-line
-// idiom scattered throughout the viewer codebase.  Note that where
-// possible we would rather be using smart pointers of some sort.
-
-template <class T>
-inline void deleteAndClear(T*& ptr)
-{
-	delete ptr;
-	ptr = NULL;
-}
-
-template <class T>
-inline void deleteAndClearArray(T*& array_ptr)
-{
-	delete[] array_ptr;
-	array_ptr = NULL;
-}
-
-#endif
diff --git a/indra/llcommon/lldepthstack.h b/indra/llcommon/lldepthstack.h
index ac435a30faf0296752fb827df9864e98d033df3f..b65840d342cc7176a383f22aa421b7d2bf3f0fd7 100755
--- a/indra/llcommon/lldepthstack.h
+++ b/indra/llcommon/lldepthstack.h
@@ -41,8 +41,6 @@ template <class DATA_TYPE> class LLDepthStack
 	:	mCurrentDepth(0), mMaxDepth(0) 
 	{}
 
-	~LLDepthStack()	{}
-
 	void setDepth(U32 depth)
 	{
 		mMaxDepth = depth;
@@ -87,14 +85,7 @@ template <class DATA_TYPE> class LLDepthStack
 	{ 
 		return mStack.empty() ? NULL : mStack.back();
 	}
-	
-	void deleteAllData()
-	{ 
-		mCurrentDepth = 0;
-		std::for_each(mStack.begin(), mStack.end(), DeletePointer());
-		mStack.clear(); 
-	}
-	
+
 	void removeAllNodes()
 	{ 
 		mCurrentDepth = 0;
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 5b4be1ac80e042e682888492b42dce28a26737bf..6da9df4dce34e4f8f01e665464d8961fdcc191e8 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -96,7 +96,7 @@ namespace {
 			mFile.open(filename, llofstream::out | llofstream::app);
 			if (!mFile)
 			{
-				llinfos << "Error setting log file to " << filename << llendl;
+				LL_INFOS() << "Error setting log file to " << filename << LL_ENDL;
 			}
 		}
 		
@@ -331,7 +331,7 @@ namespace
 		}
 		
 		LLError::configure(configuration);
-		llinfos << "logging reconfigured from " << filename() << llendl;
+		LL_INFOS() << "logging reconfigured from " << filename() << LL_ENDL;
 		return true;
 	}
 
@@ -495,14 +495,44 @@ namespace LLError
 					int line,
 					const std::type_info& class_info, 
 					const char* function, 
+					bool printOnce,
 					const char* broadTag, 
-					const char* narrowTag,
-					bool printOnce)
-		: mLevel(level), mFile(file), mLine(line),
-		  mClassInfo(class_info), mFunction(function),
-		  mCached(false), mShouldLog(false), 
-		  mBroadTag(broadTag), mNarrowTag(narrowTag), mPrintOnce(printOnce)
-		{ }
+					const char* narrowTag)
+	:	mLevel(level), 
+		mFile(file), 
+		mLine(line),
+		mClassInfo(class_info), 
+		mFunction(function),
+		mCached(false), 
+		mShouldLog(false), 
+		mPrintOnce(printOnce),
+		mBroadTag(broadTag), 
+		mNarrowTag(narrowTag)
+	{}
+
+	CallSite::CallSite(ELevel level,
+		const char* file,
+		int line,
+		const std::type_info& class_info, 
+		const char* function, 
+		bool printOnce,
+		const char* broadTag, 
+		const char* narrowTag,
+		const char*,
+		...)
+	:	mLevel(level), 
+		mFile(file), 
+		mLine(line),
+		mClassInfo(class_info), 
+		mFunction(function),
+		mCached(false), 
+		mShouldLog(false), 
+		mPrintOnce(printOnce),
+		mBroadTag(broadTag), 
+		mNarrowTag(narrowTag)
+	{
+		LL_ERRS() << "No support for more than 2 logging tags" << LL_ENDL;
+	}
 
 
 	void CallSite::invalidate()
@@ -677,7 +707,7 @@ namespace LLError
 		LevelMap::const_iterator i = level_names.find(name);
 		if (i == level_names.end())
 		{
-			llwarns << "unrecognized logging level: '" << name << "'" << llendl;
+			LL_WARNS() << "unrecognized logging level: '" << name << "'" << LL_ENDL;
 			return LLError::LEVEL_INFO;
 		}
 		
@@ -741,6 +771,12 @@ namespace LLError
 		return false; 
 	}
 
+	// virtual
+	bool Recorder::wantsTags()
+	{
+		return false;
+	}
+
 	void addRecorder(Recorder* recorder)
 	{
 		if (recorder == NULL)
@@ -817,11 +853,14 @@ namespace LLError
 
 namespace
 {
-	void writeToRecorders(LLError::ELevel level, const std::string& message)
+	void writeToRecorders(const LLError::CallSite& site, const std::string& message)
 	{
+		LLError::ELevel level = site.mLevel;
 		LLError::Settings& s = LLError::Settings::get();
 	
 		std::string messageWithTime;
+		std::string messageWithTags;
+		std::string messageWithTagsAndTime;
 		
 		for (Recorders::const_iterator i = s.recorders.begin();
 			i != s.recorders.end();
@@ -829,18 +868,47 @@ namespace
 		{
 			LLError::Recorder* r = *i;
 			
-			if (r->wantsTime()  &&  s.timeFunction != NULL)
+			if (r->wantsTime() && s.timeFunction != NULL)
 			{
-				if (messageWithTime.empty())
+				if (r->wantsTags())
 				{
-					messageWithTime = s.timeFunction() + " " + message;
+					if (messageWithTagsAndTime.empty())
+					{
+						messageWithTagsAndTime = s.timeFunction() + " " 
+												+ (site.mBroadTag ? (std::string("#") + std::string(site.mBroadTag) + " ") : std::string())  
+												+ (site.mNarrowTag ? (std::string("#") + std::string(site.mNarrowTag) + " ") : std::string()) 
+												+ message;
+					}
+
+					r->recordMessage(level, messageWithTagsAndTime);
+				}
+				else
+				{
+					if (messageWithTime.empty())
+					{
+						messageWithTime = s.timeFunction() + " " + message;
+					}
+
+					r->recordMessage(level, messageWithTime);
 				}
-				
-				r->recordMessage(level, messageWithTime);
 			}
 			else
 			{
-				r->recordMessage(level, message);
+				if (r->wantsTags())
+				{
+					if (messageWithTags.empty())
+					{
+						messageWithTags = (site.mBroadTag ? (std::string("#") + std::string(site.mBroadTag) + " ") : std::string())  
+										+ (site.mNarrowTag ? (std::string("#") + std::string(site.mNarrowTag) + " ") : std::string()) 
+										+ message;
+					}
+
+					r->recordMessage(level, messageWithTags);
+				}
+				else
+				{
+					r->recordMessage(level, message);				
+				}
 			}
 		}
 	}
@@ -1017,10 +1085,11 @@ namespace LLError
 	   else
 	   {
 		   strncpy(message, out->str().c_str(), 127);
-		   message[127] = '\0' ;
+		   message[127] = '\0';
 	   }
 	   
 	   Globals& g = Globals::get();
+
        if (out == &g.messageStream)
        {
            g.messageStream.clear();
@@ -1031,7 +1100,7 @@ namespace LLError
        {
            delete out;
        }
-	   return ;
+	   return;
     }
 
 	void Log::flush(std::ostringstream* out, const CallSite& site)
@@ -1063,7 +1132,7 @@ namespace LLError
 			fatalMessage << abbreviateFile(site.mFile)
 						<< "(" << site.mLine << ") : error";
 			
-			writeToRecorders(site.mLevel, fatalMessage.str());
+			writeToRecorders(site, fatalMessage.str());
 		}
 		
 		
@@ -1125,7 +1194,7 @@ namespace LLError
 		prefix << message;
 		message = prefix.str();
 		
-		writeToRecorders(site.mLevel, message);
+		writeToRecorders(site, message);
 		
 		if (site.mLevel == LEVEL_ERROR  &&  s.crashFunction)
 		{
@@ -1164,7 +1233,7 @@ namespace LLError
 	{
 		std::string::size_type i = 0;
 		std::string::size_type len = s.length();
-		for ( ; i < len; i++ )
+		for (; i < len; i++ )
 		{
 			if (s[i] == old)
 			{
@@ -1235,8 +1304,8 @@ namespace LLError
 
 namespace LLError
 {     
-	char** LLCallStacks::sBuffer = NULL ;
-	S32    LLCallStacks::sIndex  = 0 ;
+	char** LLCallStacks::sBuffer = NULL;
+	S32    LLCallStacks::sIndex  = 0;
 
 #define SINGLE_THREADED 1
 
@@ -1312,34 +1381,34 @@ namespace LLError
 
 	   if(!sBuffer)
 	   {
-		   sBuffer = new char*[512] ;
-		   sBuffer[0] = new char[512 * 128] ;
-		   for(S32 i = 1 ; i < 512 ; i++)
+		   sBuffer = new char*[512];
+		   sBuffer[0] = new char[512 * 128];
+		   for(S32 i = 1; i < 512; i++)
 		   {
-			   sBuffer[i] = sBuffer[i-1] + 128 ;
+			   sBuffer[i] = sBuffer[i-1] + 128;
 		   }
-		   sIndex = 0 ;
+		   sIndex = 0;
 	   }
 
 	   if(sIndex > 511)
 	   {
-		   clear() ;
+		   clear();
 	   }
 
-	   strcpy(sBuffer[sIndex], function) ;
-	   sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line) ;
-	   sIndex++ ;
+	   strcpy(sBuffer[sIndex], function);
+	   sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line);
+	   sIndex++;
 
-	   return ;
+	   return;
    }
 
 	//static
    std::ostringstream* LLCallStacks::insert(const char* function, const int line)
    {
        std::ostringstream* _out = LLError::Log::out();
-	   *_out << function << " line " << line << " " ;
+	   *_out << function << " line " << line << " ";
              
-	   return _out ;
+	   return _out;
    }
 
    //static
@@ -1353,21 +1422,21 @@ namespace LLError
 
 	   if(!sBuffer)
 	   {
-		   sBuffer = new char*[512] ;
-		   sBuffer[0] = new char[512 * 128] ;
-		   for(S32 i = 1 ; i < 512 ; i++)
+		   sBuffer = new char*[512];
+		   sBuffer[0] = new char[512 * 128];
+		   for(S32 i = 1; i < 512; i++)
 		   {
-			   sBuffer[i] = sBuffer[i-1] + 128 ;
+			   sBuffer[i] = sBuffer[i-1] + 128;
 		   }
-		   sIndex = 0 ;
+		   sIndex = 0;
 	   }
 
 	   if(sIndex > 511)
 	   {
-		   clear() ;
+		   clear();
 	   }
 
-	   LLError::Log::flush(_out, sBuffer[sIndex++]) ;	   
+	   LLError::Log::flush(_out, sBuffer[sIndex++]);
    }
 
    //static
@@ -1381,27 +1450,27 @@ namespace LLError
 
        if(sIndex > 0)
        {
-           llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ;
+           LL_INFOS() << " ************* PRINT OUT LL CALL STACKS ************* " << LL_ENDL;
            while(sIndex > 0)
            {                  
-			   sIndex-- ;
-               llinfos << sBuffer[sIndex] << llendl ;
+			   sIndex--;
+               LL_INFOS() << sBuffer[sIndex] << LL_ENDL;
            }
-           llinfos << " *************** END OF LL CALL STACKS *************** " << llendl ;
+           LL_INFOS() << " *************** END OF LL CALL STACKS *************** " << LL_ENDL;
        }
 
 	   if(sBuffer)
 	   {
-		   delete[] sBuffer[0] ;
-		   delete[] sBuffer ;
-		   sBuffer = NULL ;
+		   delete[] sBuffer[0];
+		   delete[] sBuffer;
+		   sBuffer = NULL;
 	   }
    }
 
    //static
    void LLCallStacks::clear()
    {
-       sIndex = 0 ;
+       sIndex = 0;
    }
 
 #if LL_WINDOWS
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index ceff40e9006c223765f4867b692f903044b5e5df..d7dc38a4c6a5d0fba831d1f4150f797804bfabe8 100755
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -31,9 +31,66 @@
 #include <sstream>
 #include <typeinfo>
 
-#include "llerrorlegacy.h"
 #include "stdtypes.h"
 
+#include "llpreprocessor.h"
+#include <boost/static_assert.hpp>
+
+const int LL_ERR_NOERR = 0;
+
+// Define one of these for different error levels in release...
+// #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output.
+#define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output
+#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output.
+
+#ifdef _DEBUG
+#define SHOW_DEBUG
+#define SHOW_WARN
+#define SHOW_INFO
+#define SHOW_ASSERT
+#else // _DEBUG
+
+#ifdef LL_RELEASE_WITH_DEBUG_INFO
+#define SHOW_ASSERT
+#endif // LL_RELEASE_WITH_DEBUG_INFO
+
+#ifdef RELEASE_SHOW_DEBUG
+#define SHOW_DEBUG
+#endif
+
+#ifdef RELEASE_SHOW_WARN
+#define SHOW_WARN
+#endif
+
+#ifdef RELEASE_SHOW_INFO
+#define SHOW_INFO
+#endif
+
+#ifdef RELEASE_SHOW_ASSERT
+#define SHOW_ASSERT
+#endif
+
+#endif // !_DEBUG
+
+#define llassert_always(func)	if (LL_UNLIKELY(!(func))) LL_ERRS() << "ASSERT (" << #func << ")" << LL_ENDL;
+
+#ifdef SHOW_ASSERT
+#define llassert(func)			llassert_always(func)
+#define llverify(func)			llassert_always(func)
+#else
+#define llassert(func)
+#define llverify(func)			do {if (func) {}} while(0)
+#endif
+
+#ifdef LL_WINDOWS
+#define LL_STATIC_ASSERT(func, msg) static_assert(func, msg)
+#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) static_assert(false, msg)
+#else
+#define LL_STATIC_ASSERT(func, msg) BOOST_STATIC_ASSERT(func)
+#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) BOOST_STATIC_ASSERT(sizeof(type) != 0 && false);
+#endif
+
+
 /** Error Logging Facility
 
 	Information for most users:
@@ -121,26 +178,25 @@ namespace LLError
 		They are not intended for general use.
 	*/
 	
-	class CallSite;
+	struct CallSite;
 	
 	class LL_COMMON_API Log
 	{
 	public:
 		static bool shouldLog(CallSite&);
 		static std::ostringstream* out();
-		static void flush(std::ostringstream* out, char* message)  ;
+		static void flush(std::ostringstream* out, char* message);
 		static void flush(std::ostringstream*, const CallSite&);
 	};
 	
-	class LL_COMMON_API CallSite
+	struct LL_COMMON_API CallSite
 	{
 		// Represents a specific place in the code where a message is logged
 		// This is public because it is used by the macros below.  It is not
 		// intended for public use.
-	public:
 		CallSite(ELevel, const char* file, int line,
-				const std::type_info& class_info, const char* function, const char* broadTag, const char* narrowTag, bool printOnce);
-						
+				const std::type_info& class_info, const char* function, bool printOnce, const char* broadTag = NULL, const char* narrowTag = NULL );
+
 #ifdef LL_LIBRARY_INCLUDE
 		bool shouldLog();
 #else // LL_LIBRARY_INCLUDE
@@ -151,7 +207,6 @@ namespace LLError
 		
 		void invalidate();
 		
-	private:
 		// these describe the call site and never change
 		const ELevel			mLevel;
 		const char* const		mFile;
@@ -167,6 +222,11 @@ namespace LLError
 		bool mShouldLog;
 		
 		friend class Log;
+
+	private:
+		// 3 or more tags not currently supported
+		CallSite(ELevel, const char* file, int line,
+			const std::type_info& class_info, const char* function, bool printOnce, const char* broadTag, const char* narrowTag, const char*, ...);
 	};
 	
 	
@@ -237,78 +297,64 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
 	// Outside a class declaration, or in class without LOG_CLASS(), this
 	// typedef causes the messages to not be associated with any class.
 
+/////////////////////////////////
+// Error Logging Macros
+// See top of file for common usage.	
+/////////////////////////////////
 
+#define lllog(level, once, ...)																	   \
+	do {                                                                                           \
+		static LLError::CallSite _site(                                                            \
+			level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, once, __VA_ARGS__ );\
+		if (LL_UNLIKELY(_site.shouldLog()))			                                               \
+		{                                                                                          \
+			std::ostringstream* _out = LLError::Log::out();                                        \
+			(*_out)
 
+//Use this construct if you need to do computation in the middle of a
+//message:
+//	
+//	LL_INFOS("AgentGesture") << "the agent " << agend_id;
+//	switch (f)
+//	{
+//		case FOP_SHRUGS:	LL_CONT << "shrugs";				break;
+//		case FOP_TAPS:		LL_CONT << "points at " << who;	break;
+//		case FOP_SAYS:		LL_CONT << "says " << message;	break;
+//	}
+//	LL_CONT << " for " << t << " seconds" << LL_ENDL;
+//	
+//Such computation is done iff the message will be logged.
+#define LL_CONT	(*_out)
 
+#define LL_NEWLINE '\n'
 
-/*
-	Error Logging Macros
-	See top of file for common usage.	
-*/
-
-#define lllog(level, broadTag, narrowTag, once) \
-	do { \
-		static LLError::CallSite _site( \
-			level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, broadTag, narrowTag, once);\
-		if (LL_UNLIKELY(_site.shouldLog()))			\
-		{ \
-			std::ostringstream* _out = LLError::Log::out(); \
-			(*_out)
-
-// DEPRECATED: Don't call directly, use LL_ENDL instead, which actually looks like a macro
-#define llendl \
-			LLError::End(); \
+#define LL_ENDL                               \
+			LLError::End();                   \
 			LLError::Log::flush(_out, _site); \
-		} \
+		}                                     \
 	} while(0)
 
-// DEPRECATED: Use the new macros that allow tags and *look* like macros.
-#define lldebugs	lllog(LLError::LEVEL_DEBUG, NULL, NULL, false)
-#define llinfos		lllog(LLError::LEVEL_INFO, NULL, NULL, false)
-#define llwarns		lllog(LLError::LEVEL_WARN, NULL, NULL, false)
-#define llerrs		lllog(LLError::LEVEL_ERROR, NULL, NULL, false)
-#define llcont		(*_out)
-
 // NEW Macros for debugging, allow the passing of a string tag
 
-// One Tag
-#define LL_DEBUGS(broadTag)	lllog(LLError::LEVEL_DEBUG, broadTag, NULL, false)
-#define LL_INFOS(broadTag)	lllog(LLError::LEVEL_INFO, broadTag, NULL, false)
-#define LL_WARNS(broadTag)	lllog(LLError::LEVEL_WARN, broadTag, NULL, false)
-#define LL_ERRS(broadTag)	lllog(LLError::LEVEL_ERROR, broadTag, NULL, false)
-// Two Tags
-#define LL_DEBUGS2(broadTag, narrowTag)	lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, false)
-#define LL_INFOS2(broadTag, narrowTag)	lllog(LLError::LEVEL_INFO, broadTag, narrowTag, false)
-#define LL_WARNS2(broadTag, narrowTag)	lllog(LLError::LEVEL_WARN, broadTag, narrowTag, false)
-#define LL_ERRS2(broadTag, narrowTag)	lllog(LLError::LEVEL_ERROR, broadTag, narrowTag, false)
+// Pass comma separated list of tags (currently only supports up to 0, 1, or 2)
+#define LL_DEBUGS(...)	lllog(LLError::LEVEL_DEBUG, false, __VA_ARGS__)
+#define LL_INFOS(...)	lllog(LLError::LEVEL_INFO, false, __VA_ARGS__)
+#define LL_WARNS(...)	lllog(LLError::LEVEL_WARN, false, __VA_ARGS__)
+#define LL_ERRS(...)	lllog(LLError::LEVEL_ERROR, false, __VA_ARGS__)
 
 // Only print the log message once (good for warnings or infos that would otherwise
 // spam the log file over and over, such as tighter loops).
-#define LL_DEBUGS_ONCE(broadTag)	lllog(LLError::LEVEL_DEBUG, broadTag, NULL, true)
-#define LL_INFOS_ONCE(broadTag)	lllog(LLError::LEVEL_INFO, broadTag, NULL, true)
-#define LL_WARNS_ONCE(broadTag)	lllog(LLError::LEVEL_WARN, broadTag, NULL, true)
-#define LL_DEBUGS2_ONCE(broadTag, narrowTag)	lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, true)
-#define LL_INFOS2_ONCE(broadTag, narrowTag)	lllog(LLError::LEVEL_INFO, broadTag, narrowTag, true)
-#define LL_WARNS2_ONCE(broadTag, narrowTag)	lllog(LLError::LEVEL_WARN, broadTag, narrowTag, true)
-
-#define LL_ENDL llendl
-#define LL_CONT	(*_out)
+#define LL_DEBUGS_ONCE(...)	lllog(LLError::LEVEL_DEBUG, true, __VA_ARGS__)
+#define LL_INFOS_ONCE(...)	lllog(LLError::LEVEL_INFO, true, __VA_ARGS__)
+#define LL_WARNS_ONCE(...)	lllog(LLError::LEVEL_WARN, true, __VA_ARGS__)
 
-	/*
-		Use this construct if you need to do computation in the middle of a
-		message:
-		
-			LL_INFOS("AgentGesture") << "the agent " << agend_id;
-			switch (f)
-			{
-				case FOP_SHRUGS:	LL_CONT << "shrugs";				break;
-				case FOP_TAPS:		LL_CONT << "points at " << who;	break;
-				case FOP_SAYS:		LL_CONT << "says " << message;	break;
-			}
-			LL_CONT << " for " << t << " seconds" << LL_ENDL;
-		
-		Such computation is done iff the message will be logged.
-	*/
 
+// DEPRECATED: Use the new macros that allow tags and *look* like macros.
+#define lldebugs	LL_DEBUGS()
+#define llinfos		LL_INFOS()
+#define llwarns		LL_WARNS()
+#define llerrs		LL_ERRS()
+#define llcont		LL_CONT
+#define llendl		LL_ENDL 
 
 #endif // LL_LLERROR_H
diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h
index 480654b1a2b433d1ec07bce8c82a50d9155da901..7c9df57115dd4ee1f32a0ece3b275585301289b2 100755
--- a/indra/llcommon/llerrorcontrol.h
+++ b/indra/llcommon/llerrorcontrol.h
@@ -144,6 +144,10 @@ namespace LLError
 		virtual bool wantsTime(); // default returns false
 			// override and return true if the recorder wants the time string
 			// included in the text of the message
+
+		virtual bool wantsTags(); // default returns false
+			// override ands return true if the recorder wants the tags included
+			// in the text of the message
 	};
 
 	/**
diff --git a/indra/llcommon/llerrorlegacy.h b/indra/llcommon/llerrorlegacy.h
index 50c95339e4ee44c79cc02ec1426a71b6b627527b..31dd20700824d3eb3bb5fd708ba5c6376501c219 100755
--- a/indra/llcommon/llerrorlegacy.h
+++ b/indra/llcommon/llerrorlegacy.h
@@ -28,100 +28,5 @@
 #ifndef LL_LLERRORLEGACY_H
 #define LL_LLERRORLEGACY_H
 
-#include "llpreprocessor.h"
-#include <boost/static_assert.hpp>
-
-/*
-	LEGACY -- DO NOT USE THIS STUFF ANYMORE
-*/
-
-// Specific error codes
-const int LL_ERR_NOERR = 0;
-const int LL_ERR_ASSET_REQUEST_FAILED = -1;
-//const int LL_ERR_ASSET_REQUEST_INVALID = -2;
-const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3;
-const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4;
-const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5;
-const int LL_ERR_EOF = -39;
-const int LL_ERR_CANNOT_OPEN_FILE = -42;
-const int LL_ERR_FILE_NOT_FOUND = -43;
-const int LL_ERR_FILE_EMPTY     = -44;
-const int LL_ERR_TCP_TIMEOUT    = -23016;
-const int LL_ERR_CIRCUIT_GONE   = -23017;
-const int LL_ERR_PRICE_MISMATCH = -23018;
-
-
-
-// Define one of these for different error levels in release...
-// #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output.
-#define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output
-#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output.
-
-
-//////////////////////////////////////////
-//
-//  Implementation - ignore
-//
-//
-#ifdef _DEBUG
-#define SHOW_DEBUG
-#define SHOW_WARN
-#define SHOW_INFO
-#define SHOW_ASSERT
-#else // _DEBUG
-
-#ifdef LL_RELEASE_WITH_DEBUG_INFO
-#define SHOW_ASSERT
-#endif // LL_RELEASE_WITH_DEBUG_INFO
-
-#ifdef RELEASE_SHOW_DEBUG
-#define SHOW_DEBUG
-#endif
-
-#ifdef RELEASE_SHOW_WARN
-#define SHOW_WARN
-#endif
-
-#ifdef RELEASE_SHOW_INFO
-#define SHOW_INFO
-#endif
-
-#ifdef RELEASE_SHOW_ASSERT
-#define SHOW_ASSERT
-#endif
-
-#endif // _DEBUG
-
-
-
-#define lldebugst(type)			lldebugs
-#define llendflush				llendl
-
-
-#define llerror(msg, num)		llerrs << "Error # " << num << ": " << msg << llendl;
-
-#define llwarning(msg, num)		llwarns << "Warning # " << num << ": " << msg << llendl;
-
-#define llassert_always(func)	if (LL_UNLIKELY(!(func))) llerrs << "ASSERT (" << #func << ")" << llendl;
-
-#ifdef SHOW_ASSERT
-#define llassert(func)			llassert_always(func)
-#define llverify(func)			llassert_always(func)
-#else
-#define llassert(func)
-#define llverify(func)			do {if (func) {}} while(0)
-#endif
-
-#ifdef LL_WINDOWS
-#define LL_STATIC_ASSERT(func, msg) static_assert(func, msg)
-#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) static_assert(false, msg)
-#else
-#define LL_STATIC_ASSERT(func, msg) BOOST_STATIC_ASSERT(func)
-#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) BOOST_STATIC_ASSERT(sizeof(type) != 0 && false);
-#endif
-
-// handy compile-time assert - enforce those template parameters! 
-#define cassert(expn) typedef char __C_ASSERT__[(expn)?1:-1]   /* Flawfinder: ignore */
-	//XXX: used in two places in llcommon/llskipmap.h
 
 #endif // LL_LLERRORLEGACY_H
diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h
index 65b0fef354eab6f78efaea6103d01f27dc1104d8..0cbd1da32d0d82e5be8139827e13482b7831fbe3 100755
--- a/indra/llcommon/llevents.h
+++ b/indra/llcommon/llevents.h
@@ -61,7 +61,7 @@
 #include "llsd.h"
 #include "llsingleton.h"
 #include "lldependencies.h"
-#include "ll_template_cast.h"
+#include "llstl.h"
 
 /*==========================================================================*|
 // override this to allow binding free functions with more parameters
diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h
index 45754f3785e6f23481677021d393f35d68d7f1ea..7f61861072e75db2c861babbf1e55533a39d2ebd 100755
--- a/indra/llcommon/llframetimer.h
+++ b/indra/llcommon/llframetimer.h
@@ -35,7 +35,6 @@
  */
 
 #include "lltimer.h"
-#include "timing.h"
 
 class LL_COMMON_API LLFrameTimer 
 {
diff --git a/indra/llcommon/llindexedvector.h b/indra/llcommon/llindexedvector.h
new file mode 100755
index 0000000000000000000000000000000000000000..68c3821802b0822b7f1dbc04d8e281f8fc2a3a00
--- /dev/null
+++ b/indra/llcommon/llindexedvector.h
@@ -0,0 +1,100 @@
+/** 
+ * @file lldarray.h
+ * @brief Wrapped std::vector for backward compatibility.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLDARRAY_H
+#define LL_LLDARRAY_H
+
+#include "llerror.h"
+
+#include <vector>
+#include <map>
+
+//--------------------------------------------------------
+// LLIndexedVector
+//--------------------------------------------------------
+
+template <typename Type, typename Key, int BlockSize = 32> 
+class LLIndexedVector
+{
+public:
+	typedef typename std::vector<Type>::iterator iterator;
+	typedef typename std::vector<Type>::const_iterator const_iterator;
+	typedef typename std::vector<Type>::reverse_iterator reverse_iterator;
+	typedef typename std::vector<Type>::const_reverse_iterator const_reverse_iterator;
+	typedef typename std::vector<Type>::size_type size_type;
+protected:
+	std::vector<Type> mVector;
+	std::map<Key, U32> mIndexMap;
+	
+public:
+	LLIndexedVector() { mVector.reserve(BlockSize); }
+	
+	iterator begin() { return mVector.begin(); }
+	const_iterator begin() const { return mVector.begin(); }
+	iterator end() { return mVector.end(); }
+	const_iterator end() const { return mVector.end(); }
+
+	reverse_iterator rbegin() { return mVector.rbegin(); }
+	const_reverse_iterator rbegin() const { return mVector.rbegin(); }
+	reverse_iterator rend() { return mVector.rend(); }
+	const_reverse_iterator rend() const { return mVector.rend(); }
+
+	void reset() { mVector.resize(0); mIndexMap.resize(0); }
+	bool empty() const { return mVector.empty(); }
+	size_type size() const { return mVector.size(); }
+	
+	Type& operator[](const Key& k)
+	{
+		typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k);
+		if (iter == mIndexMap.end())
+		{
+			U32 n = mVector.size();
+			mIndexMap[k] = n;
+			mVector.push_back(Type());
+			llassert(mVector.size() == mIndexMap.size());
+			return mVector[n];
+		}
+		else
+		{
+			return mVector[iter->second];
+		}
+	}
+
+	const_iterator find(const Key& k) const
+	{
+		typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k);
+		if(iter == mIndexMap.end())
+		{
+			return mVector.end();
+		}
+		else
+		{
+			return mVector.begin() + iter->second;
+		}
+	}
+};
+
+#endif
diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp
index dbd4eba7a08099c5dec1ef539f42f3d5aa82ef2c..aa2f4eb289b5e3e47d09f1cb99bb05ebc3274287 100755
--- a/indra/llcommon/llinitparam.cpp
+++ b/indra/llcommon/llinitparam.cpp
@@ -100,13 +100,13 @@ namespace LLInitParam
 	void Parser::parserWarning(const std::string& message)
 	{
 		if (mParseSilently) return;
-		llwarns << message << llendl;
+		LL_WARNS() << message << LL_ENDL;
 	}
 	
 	void Parser::parserError(const std::string& message)
 	{
 		if (mParseSilently) return;
-		llerrs << message << llendl;
+		LL_ERRS() << message << LL_ENDL;
 	}
 
 
@@ -131,7 +131,7 @@ namespace LLInitParam
 		std::string name(char_name);
 		if ((size_t)param->mParamHandle > mMaxParamOffset)
 		{
-			llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl;
+			LL_ERRS() << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << LL_ENDL;
 		}
 
 		if (name.empty())
@@ -214,7 +214,7 @@ namespace LLInitParam
 			{
 				if (emit_errors)
 				{
-					llwarns << "Invalid param \"" << getParamName(block_data, param) << "\"" << llendl;
+					LL_WARNS() << "Invalid param \"" << getParamName(block_data, param) << "\"" << LL_ENDL;
 				}
 				return false;
 			}
@@ -417,7 +417,7 @@ namespace LLInitParam
 			// Block<T, Base_Class>
 			if ((size_t)handle > block_data.mMaxParamOffset)
 			{
-				llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl;
+				LL_ERRS() << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << LL_ENDL;
 			}
 
 			ParamDescriptorPtr param_descriptor = findParamDescriptor(param);
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index f4e37d21feda62ee9ec6d04248da57dc3ab5291a..349ad530af0447d8bb9fbd6e78942e90154c78aa 100755
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -31,7 +31,7 @@
 #include <map>
 #include <typeinfo>
 
-#include "string_table.h"
+#include "llstringtable.h"
 #include <boost/iterator/transform_iterator.hpp>
 #include <boost/iterator/indirect_iterator.hpp>
 
diff --git a/indra/llcommon/lllinkedqueue.h b/indra/llcommon/lllinkedqueue.h
deleted file mode 100755
index 8336608809c47f291349b76ac44a15a045289dc2..0000000000000000000000000000000000000000
--- a/indra/llcommon/lllinkedqueue.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/** 
- * @file lllinkedqueue.h
- * @brief Declaration of linked queue classes.
- *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLLINKEDQUEUE_H
-#define LL_LLLINKEDQUEUE_H
-
-#include "llerror.h"
-
-// node that actually contains the data
-template <class DATA_TYPE> class LLLinkedQueueNode
-{
-public:
-	DATA_TYPE			mData;
-	LLLinkedQueueNode	*mNextp;
-	LLLinkedQueueNode	*mPrevp;
-
-
-public:
-	LLLinkedQueueNode();
-	LLLinkedQueueNode(const DATA_TYPE data);
-
-	// destructor does not, by default, destroy associated data
-	// however, the mDatap must be NULL to ensure that we aren't causing memory leaks
-	~LLLinkedQueueNode();
-};
-
-
-
-template <class DATA_TYPE> class LLLinkedQueue
-{
-
-public:
-	LLLinkedQueue();
-
-	// destructor destroys list and nodes, but not data in nodes
-	~LLLinkedQueue();
-
-	// Puts at end of FIFO
-	void push(const DATA_TYPE data);
-
-	// Takes off front of FIFO
-	BOOL pop(DATA_TYPE &data);
-	BOOL peek(DATA_TYPE &data);
-
-	void reset();
-
-	S32 getLength() const;
-
-	BOOL isEmpty() const;
-
-	BOOL remove(const DATA_TYPE data);
-
-	BOOL checkData(const DATA_TYPE data) const;
-
-private:
-	// add node to end of list
-	// set mCurrentp to mQueuep
-	void addNodeAtEnd(LLLinkedQueueNode<DATA_TYPE> *nodep);
-
-private:
-	LLLinkedQueueNode<DATA_TYPE> mHead;		// head node
-	LLLinkedQueueNode<DATA_TYPE> mTail;		// tail node
-	S32 mLength;
-};
-
-
-//
-// Nodes
-//
-
-template <class DATA_TYPE>
-LLLinkedQueueNode<DATA_TYPE>::LLLinkedQueueNode() : 
-	mData(), mNextp(NULL), mPrevp(NULL)
-{ }
-
-template <class DATA_TYPE>
-LLLinkedQueueNode<DATA_TYPE>::LLLinkedQueueNode(const DATA_TYPE data) : 
-	mData(data), mNextp(NULL), mPrevp(NULL)
-{ }
-
-template <class DATA_TYPE>
-LLLinkedQueueNode<DATA_TYPE>::~LLLinkedQueueNode()
-{ }
-
-
-//
-// Queue itself
-//
-
-template <class DATA_TYPE>
-LLLinkedQueue<DATA_TYPE>::LLLinkedQueue()
-:	mHead(), 
-	mTail(), 
-	mLength(0)
-{ }
-
-
-// destructor destroys list and nodes, but not data in nodes
-template <class DATA_TYPE>
-LLLinkedQueue<DATA_TYPE>::~LLLinkedQueue()
-{
-	reset();
-}
-
-
-// put data into a node and stick it at the end of the list
-template <class DATA_TYPE>
-void LLLinkedQueue<DATA_TYPE>::push(const DATA_TYPE data)
-{
-	// make the new node
-	LLLinkedQueueNode<DATA_TYPE> *nodep = new LLLinkedQueueNode<DATA_TYPE>(data);
-
-	addNodeAtEnd(nodep);
-}
-
-
-// search the list starting at mHead.mNextp and remove the link with mDatap == data
-// set mCurrentp to mQueuep, or NULL if mQueuep points to node with mDatap == data
-// return TRUE if found, FALSE if not found
-template <class DATA_TYPE>
-BOOL LLLinkedQueue<DATA_TYPE>::remove(const DATA_TYPE data)
-{
-	BOOL b_found = FALSE;
-
-	LLLinkedQueueNode<DATA_TYPE> *currentp = mHead.mNextp;
-
-	while (currentp)
-	{
-		if (currentp->mData == data)
-		{
-			b_found = TRUE;
-
-			// if there is a next one, fix it
-			if (currentp->mNextp)
-			{
-				currentp->mNextp->mPrevp = currentp->mPrevp;
-			}
-			else // we are at end of list
-			{
-				mTail.mPrevp = currentp->mPrevp;
-			}
-
-			// if there is a previous one, fix it
-			if (currentp->mPrevp)
-			{
-				currentp->mPrevp->mNextp = currentp->mNextp;
-			}
-			else // we are at beginning of list
-			{
-				mHead.mNextp = currentp->mNextp;
-			}
-
-			// remove the node
-			delete currentp;
-			mLength--;
-			break;
-		}
-		currentp = currentp->mNextp; 
-	}
-
-	return b_found;
-}
-
-
-// remove all nodes from the list but do not delete associated data
-template <class DATA_TYPE>
-void LLLinkedQueue<DATA_TYPE>::reset()
-{
-	LLLinkedQueueNode<DATA_TYPE> *currentp;
-	LLLinkedQueueNode<DATA_TYPE> *nextp;
-	currentp = mHead.mNextp;
-
-	while (currentp)
-	{
-		nextp = currentp->mNextp;
-		delete currentp;
-		currentp = nextp;
-	}
-
-	// reset mHead and mCurrentp
-	mHead.mNextp = NULL;
-	mTail.mPrevp = NULL;
-	mLength = 0;
-}
-
-template <class DATA_TYPE>
-S32 LLLinkedQueue<DATA_TYPE>::getLength() const
-{
-	return mLength;
-}
-
-template <class DATA_TYPE>
-BOOL LLLinkedQueue<DATA_TYPE>::isEmpty() const
-{
-	return mLength <= 0;
-}
-
-// check to see if data is in list
-// set mCurrentp and mQueuep to the target of search if found, otherwise set mCurrentp to mQueuep
-// return TRUE if found, FALSE if not found
-template <class DATA_TYPE>
-BOOL LLLinkedQueue<DATA_TYPE>::checkData(const DATA_TYPE data) const
-{
-	LLLinkedQueueNode<DATA_TYPE> *currentp = mHead.mNextp;
-
-	while (currentp)
-	{
-		if (currentp->mData == data)
-		{
-			return TRUE;
-		}
-		currentp = currentp->mNextp;
-	}
-	return FALSE;
-}
-
-template <class DATA_TYPE>
-BOOL LLLinkedQueue<DATA_TYPE>::pop(DATA_TYPE &data)
-{
-	LLLinkedQueueNode<DATA_TYPE> *currentp;
-
-	currentp = mHead.mNextp;
-	if (!currentp)
-	{
-		return FALSE;
-	}
-
-	mHead.mNextp = currentp->mNextp;
-	if (currentp->mNextp)
-	{
-		currentp->mNextp->mPrevp = currentp->mPrevp;
-	}
-	else
-	{
-		mTail.mPrevp = currentp->mPrevp;
-	}
-
-	data = currentp->mData;
-	delete currentp;
-	mLength--;
-	return TRUE;
-}
-
-template <class DATA_TYPE>
-BOOL LLLinkedQueue<DATA_TYPE>::peek(DATA_TYPE &data)
-{
-	LLLinkedQueueNode<DATA_TYPE> *currentp;
-
-	currentp = mHead.mNextp;
-	if (!currentp)
-	{
-		return FALSE;
-	}
-	data = currentp->mData;
-	return TRUE;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// private members
-//////////////////////////////////////////////////////////////////////////////////////////
-
-
-// add node to end of list
-// set mCurrentp to mQueuep
-template <class DATA_TYPE>
-void LLLinkedQueue<DATA_TYPE>::addNodeAtEnd(LLLinkedQueueNode<DATA_TYPE> *nodep)
-{
-	// add the node to the end of the list
-	nodep->mNextp = NULL;
-	nodep->mPrevp = mTail.mPrevp;
-	mTail.mPrevp = nodep;
-
-	// if there's something in the list, fix its back pointer
-	if (nodep->mPrevp)
-	{
-		nodep->mPrevp->mNextp = nodep;
-	}
-	else	// otherwise fix the head node
-	{
-		mHead.mNextp = nodep;
-	}
-	mLength++;
-}
-
-#endif
diff --git a/indra/llcommon/lllog.cpp b/indra/llcommon/lllog.cpp
deleted file mode 100755
index fc4058b5c921beef1e41efc6632ed14e10617332..0000000000000000000000000000000000000000
--- a/indra/llcommon/lllog.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/** 
- * @file lllog.cpp
- * @author Don
- * @date 2007-11-27
- * @brief  Class to log messages to syslog for streambase to process.
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-#include "lllog.h"
-
-#include "llapp.h"
-#include "llsd.h"
-#include "llsdserialize.h"
-
-
-class LLLogImpl
-{
-public:
-	LLLogImpl(LLApp* app) : mApp(app) {}
-	~LLLogImpl() {}
-
-	void log(const std::string &message, LLSD& info);
-	bool useLegacyLogMessage(const std::string &message);
-
-private:
-	LLApp* mApp;
-};
-
-
-//@brief Function to log a message to syslog for streambase to collect.
-void LLLogImpl::log(const std::string &message, LLSD& info)
-{
-	static S32 sequence = 0;
-    LLSD log_config = mApp->getOption("log-messages");
-	if (log_config.has(message))
-	{
-		LLSD message_config = log_config[message];
-		if (message_config.has("use-syslog"))
-		{
-			if (! message_config["use-syslog"].asBoolean())
-			{
-				return;
-			}
-		}
-	}
-	llinfos << "LLLOGMESSAGE (" << (sequence++) << ") " << message 
-		<< " " << LLSDNotationStreamer(info) << llendl;
-}
-
-//@brief Function to check if specified legacy log message should be sent.
-bool LLLogImpl::useLegacyLogMessage(const std::string &message)
-{
-    LLSD log_config = mApp->getOption("log-messages");
-	if (log_config.has(message))
-	{
-		LLSD message_config = log_config[message];
-		if (message_config.has("use-legacy"))
-		{
-			return message_config["use-legacy"].asBoolean();
-		}
-	}
-	return true;
-}
-
-
-LLLog::LLLog(LLApp* app)
-{
-	mImpl = new LLLogImpl(app);
-}
-
-LLLog::~LLLog()
-{
-	delete mImpl;
-	mImpl = NULL;
-}
-
-void LLLog::log(const std::string &message, LLSD& info)
-{
-	if (mImpl) mImpl->log(message, info);
-}
-
-bool LLLog::useLegacyLogMessage(const std::string &message)
-{
-	if (mImpl)
-	{
-		return mImpl->useLegacyLogMessage(message);
-	}
-	return true;
-}
-
diff --git a/indra/llcommon/lllog.h b/indra/llcommon/lllog.h
deleted file mode 100755
index 7964412e83c56545fbdcb2b8403cdd04199a73e2..0000000000000000000000000000000000000000
--- a/indra/llcommon/lllog.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @file lllog.h
- * @author Don
- * @date 2007-11-27
- * @brief  Class to log messages to syslog for streambase to process.
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLLOG_H
-#define LL_LLLOG_H
-
-#include <string>
-
-class LLLogImpl;
-class LLApp;
-class LLSD;
-
-class LL_COMMON_API LLLog
-{
-public:
-	LLLog(LLApp* app);
-	virtual ~LLLog();
-
-	virtual void log(const std::string &message, LLSD& info);
-	virtual bool useLegacyLogMessage(const std::string &message);
-
-private:
-	LLLogImpl* mImpl;
-};
-
-#endif /* LL_LLLOG_H */
-
diff --git a/indra/llcommon/llmap.h b/indra/llcommon/llmap.h
deleted file mode 100755
index 6294a15d3b23e5af87722876f584167c0e4ccd49..0000000000000000000000000000000000000000
--- a/indra/llcommon/llmap.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/** 
- * @file llmap.h
- * @brief LLMap class header file
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLMAP_H
-#define LL_LLMAP_H
-
-// llmap uses the fast stl library code in a manner consistant with LLSkipMap, et. al. 
-
-template<class INDEX_TYPE, class MAPPED_TYPE> class LLMap
-{
-private:
-	typedef typename std::map<INDEX_TYPE, MAPPED_TYPE> stl_map_t;
-	typedef typename stl_map_t::iterator stl_iter_t;
-	typedef typename stl_map_t::value_type stl_value_t;
-	
-	stl_map_t mStlMap;
-	stl_iter_t mCurIter;	// *iterator = pair<const INDEX_TYPE, MAPPED_TYPE>
-	MAPPED_TYPE dummy_data;
-	INDEX_TYPE dummy_index;
-	
-public:
-	LLMap() : mStlMap()
-	{
-		memset((void*)(&dummy_data),  0x0, sizeof(MAPPED_TYPE));
-		memset((void*)(&dummy_index), 0x0, sizeof(INDEX_TYPE));
-		mCurIter = mStlMap.begin();
-	}
-	~LLMap()
-	{
-		mStlMap.clear();
-	}
-
-	// use these functions to itterate through a list
-	void resetMap()
-	{
-		mCurIter = mStlMap.begin();
-	}
-
-	// get the current data and bump mCurrentp
-	// This is kind of screwy since it returns a reference;
-	//   We have to have a dummy value for when we reach the end
-	//   or in case we have an empty list. Presumably, this value
-	//   will initialize to some NULL value that will end the iterator.
-	// We really shouldn't be using getNextData() or getNextKey() anyway...
-	MAPPED_TYPE &getNextData()
-	{
-		if (mCurIter == mStlMap.end())
-		{
-			return dummy_data;
-		}
-		else
-		{
-			return (*mCurIter++).second;
-		}
-	}
-
-	const INDEX_TYPE &getNextKey()
-	{
-		if (mCurIter == mStlMap.end())
-		{
-			return dummy_index;
-		}
-		else
-		{
-			return (*mCurIter++).first;
-		}
-	}
-
-	MAPPED_TYPE &getFirstData()
-	{
-		resetMap();
-		return getNextData();
-	}
-
-	const INDEX_TYPE &getFirstKey()
-	{
-		resetMap();
-		return getNextKey();
-	}
-
-	S32 getLength()
-	{
-		return mStlMap.size();
-	}
-
-	void addData(const INDEX_TYPE &index, MAPPED_TYPE pointed_to)
-	{
-		mStlMap.insert(stl_value_t(index, pointed_to));
-	}
-
-	void addData(const INDEX_TYPE &index)
-	{
-		mStlMap.insert(stl_value_t(index, dummy_data));
-	}
-
-	// if index doesn't exist, then insert a new node and return it
-	MAPPED_TYPE &getData(const INDEX_TYPE &index)
-	{
-		std::pair<stl_iter_t, bool> res;
-		res = mStlMap.insert(stl_value_t(index, dummy_data));
-		return res.first->second;
-	}
-
-	// if index doesn't exist, then insert a new node, return it, and set b_new_entry to true
-	MAPPED_TYPE &getData(const INDEX_TYPE &index, BOOL &b_new_entry)
-	{
-		std::pair<stl_iter_t, bool> res;
-		res = mStlMap.insert(stl_value_t(index, dummy_data));
-		b_new_entry = res.second;
-		return res.first->second;
-	}
-
-	// If there, returns the data.
-	// If not, returns NULL.
-	// Never adds entries to the map.
-	MAPPED_TYPE getIfThere(const INDEX_TYPE &index)
-	{
-		stl_iter_t iter;
-		iter = mStlMap.find(index);
-		if (iter == mStlMap.end())
-		{
-			return (MAPPED_TYPE)0;
-		}
-		else
-		{
-			return (*iter).second;
-		}
-	}
-
-
-	// if index doesn't exist, then make a new node and return it
-	MAPPED_TYPE &operator[](const INDEX_TYPE &index)
-	{
-		return getData(index);
-	}
-
-	// do a reverse look-up, return NULL if failed
-	INDEX_TYPE reverseLookup(const MAPPED_TYPE data)
-	{
-		stl_iter_t iter;
-		stl_iter_t end_iter;
-		iter = mStlMap.begin();
-		end_iter = mStlMap.end();
-		while (iter != end_iter)
-		{
-			if ((*iter).second == data)
-				return (*iter).first;
-			iter++;
-		}
-		return (INDEX_TYPE)0;
-	}
-
-	BOOL removeData(const INDEX_TYPE &index)
-	{
-		mCurIter = mStlMap.find(index);
-		if (mCurIter == mStlMap.end())
-		{
-			return FALSE;
-		}
-		else
-		{
-			stl_iter_t iter = mCurIter++; // incrament mCurIter to the next element
-			mStlMap.erase(iter);
-			return TRUE;
-		}
-	}
-
-	// does this index exist?
-	BOOL checkData(const INDEX_TYPE &index)
-	{
-		stl_iter_t iter;
-		iter = mStlMap.find(index);
-		if (iter == mStlMap.end())
-		{
-			return FALSE;
-		}
-		else
-		{
-			mCurIter = iter;
-			return TRUE;
-		}
-	}
-
-	BOOL deleteData(const INDEX_TYPE &index)
-	{
-		mCurIter = mStlMap.find(index);
-		if (mCurIter == mStlMap.end())
-		{
-			return FALSE;
-		}
-		else
-		{
-			stl_iter_t iter = mCurIter++; // incrament mCurIter to the next element
-			delete (*iter).second;
-			mStlMap.erase(iter);
-			return TRUE;
-		}
-	}
-
-	void deleteAllData()
-	{
-		stl_iter_t iter;
-		stl_iter_t end_iter;
-		iter = mStlMap.begin();
-		end_iter = mStlMap.end();
-		while (iter != end_iter)
-		{
-			delete (*iter).second;
-			iter++;
-		}
-		mStlMap.clear();
-		mCurIter = mStlMap.end();
-	}
-	
-	void removeAllData()
-	{
-		mStlMap.clear();
-	}
-};
-
-
-#endif
diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h
deleted file mode 100755
index d3283543f3921f2d00e23ee5e1c06a6b3c2dbb64..0000000000000000000000000000000000000000
--- a/indra/llcommon/llnametable.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/** 
- * @file llnametable.h
- * @brief LLNameTable class is a table to associate pointers with string names
- *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLNAMETABLE_H
-#define LL_LLNAMETABLE_H
-
-#include <map>
-
-#include "string_table.h"
-
-template <class DATA>
-class LLNameTable
-{
-public:
-	LLNameTable()
-	:	mNameMap()
-	{
-	}
-
-	~LLNameTable() 
-	{ 
-	}
-
-	void addEntry(const std::string& name, DATA data)
-	{
-		addEntry(name.c_str(), data);
-	}
-
-	void addEntry(const char *name, DATA data)
-	{
-		char *tablename = gStringTable.addString(name);
-		mNameMap[tablename] = data;
-	}
-
-	BOOL checkName(const std::string& name) const
-	{
-		return checkName(name.c_str());
-	}
-
-	// "logically const" even though it modifies the global nametable
-	BOOL checkName(const char *name) const
-	{
-		char *tablename = gStringTable.addString(name);
-		return mNameMap.count(tablename) ? TRUE : FALSE;
-	}
-
-	DATA resolveName(const std::string& name) const
-	{
-		return resolveName(name.c_str());
-	}
-
-	// "logically const" even though it modifies the global nametable
-	DATA resolveName(const char *name) const
-	{
-		char *tablename = gStringTable.addString(name);
-		const_iter_t iter = mNameMap.find(tablename);
-		if (iter != mNameMap.end())
-			return iter->second;
-		else
-			return 0;
-	}
-
-	// O(N)! (currently only used in one place... (newsim/llstate.cpp))
-	const char *resolveData(const DATA &data) const
-	{
-		const_iter_t iter = mNameMap.begin();
-		const_iter_t end = mNameMap.end();
-		for (; iter != end; ++iter)
-		{
-			if (iter->second == data)
-				return iter->first;
-		}
-   		return NULL;
-	}		
-
-	typedef std::map<const char *, DATA> name_map_t;
-	typedef typename std::map<const char *,DATA>::iterator iter_t;
-	typedef typename std::map<const char *,DATA>::const_iterator const_iter_t;
-	name_map_t		mNameMap;
-};
-
-#endif
diff --git a/indra/llcommon/lloptioninterface.cpp b/indra/llcommon/lloptioninterface.cpp
deleted file mode 100755
index 23fae76dc04814c1d905715cf3bd6f6f3c190402..0000000000000000000000000000000000000000
--- a/indra/llcommon/lloptioninterface.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/** 
- * @file lloptioninterface.cpp
- * @brief 
- *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "lloptioninterface.h"
-
-
-LLOptionInterface::~LLOptionInterface()
-{
-
-}
diff --git a/indra/llcommon/lloptioninterface.h b/indra/llcommon/lloptioninterface.h
deleted file mode 100755
index 93b465db32134eba19bb87079c4a62d0c13fb4e7..0000000000000000000000000000000000000000
--- a/indra/llcommon/lloptioninterface.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/** 
- * @file lloptioninterface.h
- * @brief 
- *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLOPTIONINTERFACE_H
-#define LL_LLOPTIONINTERFACE_H
-
-#include "linden_common.h"
-
-class LLSD;
-class LLOptionInterface
-{
-public:
-    virtual ~LLOptionInterface() = 0;
-	virtual LLSD getOption(const std::string& name) const = 0;
-};
-
-#endif
diff --git a/indra/llcommon/llsecondlifeurls.cpp b/indra/llcommon/llsecondlifeurls.cpp
deleted file mode 100755
index 9154e05e4310d7f8e4997ef0c20e1e86cdf50737..0000000000000000000000000000000000000000
--- a/indra/llcommon/llsecondlifeurls.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/** 
- * @file llsecondlifeurls.cpp
- * @brief Urls used in the product
- *
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-#include "llsecondlifeurls.h"
-/*
-const std::string CREATE_ACCOUNT_URL ( 
-	"http://join.secondlife.com/");
-
-const std::string MANAGE_ACCOUNT ( 
-	"http://secondlife.com/account/");  // *TODO: NOT USED
-
-const std::string AUCTION_URL ( 
-	"http://secondlife.com/auctions/auction-detail.php?id=");
-
-const std::string EVENTS_URL ( 
-	"http://secondlife.com/events/");
-*/
-const std::string TIER_UP_URL ( 
-	"http://secondlife.com/app/landtier"); // *TODO: Translate (simulator)
-
-const std::string DIRECTX_9_URL ( 
-								 "http://secondlife.com/support/"); // *TODO: NOT USED
-/*
-const std::string LAND_URL ( 
-	"http://secondlife.com/app/landtier"); // *TODO: NOT USED
-
-const std::string UPGRADE_TO_PREMIUM_URL (
-	"http://secondlife.com/app/upgrade/"); // *TODO: NOT USED
-
-const std::string AMD_AGP_URL ( 
-	"http://secondlife.com/support/"); // *TODO: NOT USED
-
-const std::string VIA_URL ( 
-	"http://secondlife.com/support/"); // *TODO: NOT USED
-
-const std::string SUPPORT_URL ( 
-    "http://secondlife.com/support/");
-
-const std::string INTEL_CHIPSET_URL ( 
-	"http://secondlife.com/support/"); // *TODO: NOT USED
-
-const std::string SIS_CHIPSET_URL ( 
-	"http://secondlife.com/support/"); // *TODO: NOT USED
-
-const std::string BLOGS_URL ( 
-	"http://blog.secondlife.com/"); // *TODO: NOT USED
-
-const std::string BUY_CURRENCY_URL (
-	"http://secondlife.com/app/currency/");
-
-const std::string LSL_DOC_URL (
-	"http://secondlife.com/app/lsldoc/");  // *TODO: NOT USED
-
-const std::string SL_KB_URL (
-	"http://secondlife.com/knowledgebase/"); // *TODO: NOT USED
-
-const std::string RELEASE_NOTES_BASE_URL (
-	"http://secondlife.com/app/releasenotes/");
-*/
-
diff --git a/indra/llcommon/llsecondlifeurls.h b/indra/llcommon/llsecondlifeurls.h
deleted file mode 100755
index 62f357ffed2ece1a381c09123876efcb554b45f4..0000000000000000000000000000000000000000
--- a/indra/llcommon/llsecondlifeurls.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/** 
- * @file llsecondlifeurls.h
- * @brief Global URLs to pages on our web site
- *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLSECONDLIFEURLS_H
-#define LL_LLSECONDLIFEURLS_H
-/*
-// Account registration web page
-LL_COMMON_API extern const std::string CREATE_ACCOUNT_URL;
-
-// Manage Account
-LL_COMMON_API extern const std::string MANAGE_ACCOUNT;
-
-LL_COMMON_API extern const std::string AUCTION_URL; 
-
-LL_COMMON_API extern const std::string EVENTS_URL;
-*/
-// Tier up to a new land level.
-LL_COMMON_API extern const std::string TIER_UP_URL;
-
-
-// Tier up to a new land level.
-LL_COMMON_API extern const std::string LAND_URL;
-
-// How to get DirectX 9
-LL_COMMON_API extern const std::string DIRECTX_9_URL;
-
-/*
-// Upgrade from basic membership to premium membership
-LL_COMMON_API extern const std::string UPGRADE_TO_PREMIUM_URL;
-
-
-// Out of date VIA chipset
-LL_COMMON_API extern const std::string VIA_URL;
-
-// Support URL
-LL_COMMON_API extern const std::string SUPPORT_URL;
-
-// Linden Blogs page
-LL_COMMON_API extern const std::string BLOGS_URL;
-
-// Currency page
-LL_COMMON_API extern const std::string BUY_CURRENCY_URL;
-
-// LSL script wiki
-LL_COMMON_API extern const std::string LSL_DOC_URL;
-
-// SL KnowledgeBase page
-LL_COMMON_API extern const std::string SL_KB_URL;
-
-// Release Notes Redirect URL for Server and Viewer
-LL_COMMON_API extern const std::string RELEASE_NOTES_BASE_URL;
-*/
-#endif
diff --git a/indra/llcommon/llstatenums.h b/indra/llcommon/llstatenums.h
deleted file mode 100755
index ab9b6709e8045dba63fb4154997fcd0598bc5753..0000000000000000000000000000000000000000
--- a/indra/llcommon/llstatenums.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/** 
- * @file llstatenums.h
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLSTATENUMS_H
-#define LL_LLSTATENUMS_H
-
-enum ESimStatID
-{
-	LL_SIM_STAT_TIME_DILATION         =  0,
-	LL_SIM_STAT_FPS                   =  1,
-	LL_SIM_STAT_PHYSFPS               =  2,
-	LL_SIM_STAT_AGENTUPS              =  3,
-	LL_SIM_STAT_FRAMEMS               =  4,
-	LL_SIM_STAT_NETMS                 =  5,
-	LL_SIM_STAT_SIMOTHERMS            =  6,
-	LL_SIM_STAT_SIMPHYSICSMS          =  7,
-	LL_SIM_STAT_AGENTMS               =  8,
-	LL_SIM_STAT_IMAGESMS              =  9,
-	LL_SIM_STAT_SCRIPTMS              = 10,
-	LL_SIM_STAT_NUMTASKS              = 11,
-	LL_SIM_STAT_NUMTASKSACTIVE        = 12,
-	LL_SIM_STAT_NUMAGENTMAIN          = 13,
-	LL_SIM_STAT_NUMAGENTCHILD         = 14,
-	LL_SIM_STAT_NUMSCRIPTSACTIVE      = 15,
-	LL_SIM_STAT_LSLIPS                = 16,
-	LL_SIM_STAT_INPPS                 = 17,
-	LL_SIM_STAT_OUTPPS                = 18,
-	LL_SIM_STAT_PENDING_DOWNLOADS     = 19,
-	LL_SIM_STAT_PENDING_UPLOADS       = 20,
-	LL_SIM_STAT_VIRTUAL_SIZE_KB       = 21,
-	LL_SIM_STAT_RESIDENT_SIZE_KB      = 22,
-	LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23,
-	LL_SIM_STAT_TOTAL_UNACKED_BYTES   = 24,
-	LL_SIM_STAT_PHYSICS_PINNED_TASKS  = 25,
-	LL_SIM_STAT_PHYSICS_LOD_TASKS     = 26,
-	LL_SIM_STAT_SIMPHYSICSSTEPMS      = 27,
-	LL_SIM_STAT_SIMPHYSICSSHAPEMS     = 28,
-	LL_SIM_STAT_SIMPHYSICSOTHERMS     = 29,
-	LL_SIM_STAT_SIMPHYSICSMEMORY      = 30,
-	LL_SIM_STAT_SCRIPT_EPS            = 31,
-	LL_SIM_STAT_SIMSPARETIME          = 32,
-	LL_SIM_STAT_SIMSLEEPTIME          = 33,
-	LL_SIM_STAT_IOPUMPTIME            = 34,
-	LL_SIM_STAT_PCTSCRIPTSRUN         = 35,
-	LL_SIM_STAT_REGION_IDLE           = 36, // dataserver only
-	LL_SIM_STAT_REGION_IDLE_POSSIBLE  = 37, // dataserver only
-	LL_SIM_STAT_SIMAISTEPTIMEMS       = 38,
-	LL_SIM_STAT_SKIPPEDAISILSTEPS_PS  = 39,
-	LL_SIM_STAT_PCTSTEPPEDCHARACTERS  = 40
-
-};
-
-#endif
diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h
index 424138dad1e7ac9f02f09be1c10ae4be369f6c50..143e71f40c2ca5ebfaf727e028b4f5f3f8177359 100755
--- a/indra/llcommon/llstl.h
+++ b/indra/llcommon/llstl.h
@@ -33,7 +33,6 @@
 #include <vector>
 #include <list>
 #include <set>
-#include <deque>
 #include <typeinfo>
 
 // Use to compare the first element only of a pair
@@ -125,7 +124,7 @@ struct DeletePairedPointerArray
 // compiler, the second unary_function template parameter can be set
 // to void.
 //
-// Here's a snippit showing how you use this object:
+// Here's a snippet showing how you use this object:
 //
 // typedef std::map<int, widget*> map_type;
 // map_type widget_map;
@@ -170,6 +169,49 @@ struct CopyNewPointer
 	}
 };
 
+template<typename T, typename ALLOC>
+void delete_and_clear(std::list<T*, ALLOC>& list)
+{
+	std::for_each(list.begin(), list.end(), DeletePointer());
+	list.clear();
+}
+
+template<typename T, typename ALLOC>
+void delete_and_clear(std::vector<T*, ALLOC>& vector)
+{
+	std::for_each(vector.begin(), vector.end(), DeletePointer());
+	vector.clear();
+}
+
+template<typename T, typename COMPARE, typename ALLOC>
+void delete_and_clear(std::set<T*, COMPARE, ALLOC>& set)
+{
+	std::for_each(set.begin(), set.end(), DeletePointer());
+	set.clear();
+}
+
+template<typename K, typename V, typename COMPARE, typename ALLOC>
+void delete_and_clear(std::map<K, V*, COMPARE, ALLOC>& map)
+{
+	std::for_each(map.begin(), map.end(), DeletePairedPointer());
+	map.clear();
+}
+
+template<typename T>
+void delete_and_clear(T*& ptr)
+{
+	delete ptr;
+	ptr = NULL;
+}
+
+
+template<typename T>
+void delete_and_clear_array(T*& ptr)
+{
+	delete[] ptr;
+	ptr = NULL;
+}
+
 // Simple function to help with finding pointers in maps.
 // For example:
 // 	typedef  map_t;
@@ -229,7 +271,6 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value)
 	}
 };
 
-// Useful for replacing the removeObj() functionality of LLDynamicArray
 // Example:
 //  for (std::vector<T>::iterator iter = mList.begin(); iter != mList.end(); )
 //  {
@@ -238,8 +279,8 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value)
 //    else
 //      ++iter;
 //  }
-template <typename T, typename Iter>
-inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter)
+template <typename T>
+inline typename std::vector<T>::iterator vector_replace_with_last(std::vector<T>& invec, typename std::vector<T>::iterator iter)
 {
 	typename std::vector<T>::iterator last = invec.end(); --last;
 	if (iter == invec.end())
@@ -259,7 +300,6 @@ inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter)
 	}
 };
 
-// Useful for replacing the removeObj() functionality of LLDynamicArray
 // Example:
 //   vector_replace_with_last(mList, x);
 template <typename T>
@@ -522,4 +562,151 @@ namespace std
 	};
 } // std
 
+
+/**
+ * Implementation for ll_template_cast() (q.v.).
+ *
+ * Default implementation: trying to cast two completely unrelated types
+ * returns 0. Typically you'd specify T and U as pointer types, but in fact T
+ * can be any type that can be initialized with 0.
+ */
+template <typename T, typename U>
+struct ll_template_cast_impl
+{
+    T operator()(U)
+    {
+        return 0;
+    }
+};
+
+/**
+ * ll_template_cast<T>(some_value) is for use in a template function when
+ * some_value might be of arbitrary type, but you want to recognize type T
+ * specially.
+ *
+ * It's designed for use with pointer types. Example:
+ * @code
+ * struct SpecialClass
+ * {
+ *     void someMethod(const std::string&) const;
+ * };
+ *
+ * template <class REALCLASS>
+ * void somefunc(const REALCLASS& instance)
+ * {
+ *     const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance);
+ *     if (ptr)
+ *     {
+ *         ptr->someMethod("Call method only available on SpecialClass");
+ *     }
+ * }
+ * @endcode
+ *
+ * Why is this better than dynamic_cast<>? Because unless OtherClass is
+ * polymorphic, the following won't even compile (gcc 4.0.1):
+ * @code
+ * OtherClass other;
+ * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other);
+ * @endcode
+ * to say nothing of this:
+ * @code
+ * void function(int);
+ * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function);
+ * @endcode
+ * ll_template_cast handles these kinds of cases by returning 0.
+ */
+template <typename T, typename U>
+T ll_template_cast(U value)
+{
+    return ll_template_cast_impl<T, U>()(value);
+}
+
+/**
+ * Implementation for ll_template_cast() (q.v.).
+ *
+ * Implementation for identical types: return same value.
+ */
+template <typename T>
+struct ll_template_cast_impl<T, T>
+{
+    T operator()(T value)
+    {
+        return value;
+    }
+};
+
+/**
+ * LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of
+ * type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s --
+ * presuming that @c source can be converted to @c dest by the normal rules of
+ * C++.
+ *
+ * By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's
+ * type is literally identical to @c dest. (This is because of the
+ * straightforward application of template specialization rules.) That can
+ * lead to surprising results, e.g.:
+ *
+ * @code
+ * Foo myFoo;
+ * const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo);
+ * @endcode
+ *
+ * Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt>
+ * -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would
+ * force the compiler to do the right thing.)
+ *
+ * More disappointingly:
+ * @code
+ * struct Base {};
+ * struct Subclass: public Base {};
+ * Subclass object;
+ * Base* ptr = ll_template_cast<Base*>(&object);
+ * @endcode
+ *
+ * Here @c ptr will be 0 because <tt>&object</tt> is of type
+ * <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to
+ * succeed, but without our help ll_template_cast can't recognize it.
+ *
+ * The following would suffice:
+ * @code
+ * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
+ * ...
+ * Base* ptr = ll_template_cast<Base*>(&object);
+ * @endcode
+ *
+ * However, as noted earlier, this is easily fooled:
+ * @code
+ * const Base* ptr = ll_template_cast<const Base*>(&object);
+ * @endcode
+ * would still produce 0 because we haven't yet seen:
+ * @code
+ * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
+ * @endcode
+ *
+ * @TODO
+ * This macro should use Boost type_traits facilities for stripping and
+ * re-adding @c const and @c volatile qualifiers so that invoking
+ * LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all
+ * permitted permutations. It's really not fair to the coder to require
+ * separate:
+ * @code
+ * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
+ * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
+ * LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*);
+ * @endcode
+ *
+ * (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt>
+ * because that's not permitted by normal C++ assignment anyway.)
+ */
+#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE)   \
+template <>                                     \
+struct ll_template_cast_impl<DEST, SOURCE>      \
+{                                               \
+    DEST operator()(SOURCE wrapper)             \
+    {                                           \
+        return wrapper;                         \
+    }                                           \
+}
+
+
 #endif // LL_LLSTL_H
diff --git a/indra/llcommon/llstringtable.cpp b/indra/llcommon/llstringtable.cpp
index 7ad3805351d543f357aa3fb596753692f7cf6c8b..f288999964b2dd5336fc6a03792f0160e2a6bf6f 100755
--- a/indra/llcommon/llstringtable.cpp
+++ b/indra/llcommon/llstringtable.cpp
@@ -317,7 +317,7 @@ void LLStringTable::removeString(const char *str)
 						mUniqueEntries--;
 						if (mUniqueEntries < 0)
 						{
-							llerror("LLStringTable:removeString trying to remove too many strings!", 0);
+							LL_ERRS() << "LLStringTable:removeString trying to remove too many strings!" << LL_ENDL;
 						}
 						delete iter->second;
 						mStringHash.erase(iter);
@@ -343,7 +343,7 @@ void LLStringTable::removeString(const char *str)
 						mUniqueEntries--;
 						if (mUniqueEntries < 0)
 						{
-							llerror("LLStringTable:removeString trying to remove too many strings!", 0);
+							LL_ERRS() << "LLStringTable:removeString trying to remove too many strings!" << LL_ENDL;
 						}
 						strlist->remove(entry);
 						delete entry;
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 25383fc4d84931acf3ae5ee4d72b33bd454d2093..8f5a886a371a242fbc5f5d8580b030ffdafc4ca7 100755
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -43,7 +43,6 @@
 //
 // Locally used constants
 //
-const U32 SEC_PER_DAY = 86400;
 const F64 SEC_TO_MICROSEC = 1000000.f;
 const U64 SEC_TO_MICROSEC_U64 = 1000000;
 const F64 USEC_TO_SEC_F64 = 0.000001;
@@ -204,6 +203,8 @@ F64 calc_clock_frequency(unsigned int uiMeasureMSecs)
 	return 1000000.0; // microseconds, so 1 MHz.
 }
 
+const U64 SEC_TO_MICROSEC_U64 = 1000000;
+
 U64 get_clock_count()
 {
 	// Linux clocks are in microseconds
@@ -226,7 +227,7 @@ void update_clock_frequencies()
 
 // returns a U64 number that represents the number of 
 // microseconds since the unix epoch - Jan 1, 1970
-U64 totalTime()
+LLUnitImplicit<U64, LLUnits::Microseconds> totalTime()
 {
 	U64 current_clock_count = get_clock_count();
 	if (!gTotalTimeClockCount)
@@ -263,7 +264,7 @@ U64 totalTime()
 	}
 
 	// Return the total clock tick count in microseconds.
-	return (U64)(gTotalTimeClockCount*gClocksToMicroseconds);
+	return LLUnits::Microseconds::fromValue(gTotalTimeClockCount*gClocksToMicroseconds);
 }
 
 
@@ -375,7 +376,7 @@ LLUnitImplicit<F32, LLUnits::Seconds> LLTimer::getElapsedTimeAndResetF32()
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void  LLTimer::setTimerExpirySec(F32 expiration)
+void  LLTimer::setTimerExpirySec(LLUnitImplicit<F32, LLUnits::Seconds> expiration)
 {
 	mExpirationTicks = get_clock_count()
 		+ (U64)((F32)(expiration * gClockFrequency));
diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h
index f2dc59e4057aa2dfea3a59ed065de050e51ecd3a..1f2c56432bba2ec827ffe3d2a4555f34b6ee92fc 100755
--- a/indra/llcommon/lltimer.h
+++ b/indra/llcommon/lltimer.h
@@ -91,7 +91,7 @@ class LL_COMMON_API LLTimer
 	void stop() { mStarted = FALSE; }
 	void reset();								// Resets the timer
 	void setLastClockCount(U64 current_count);		// Sets the timer so that the next elapsed call will be relative to this time
-	void setTimerExpirySec(F32 expiration);
+	void setTimerExpirySec(LLUnitImplicit<F32, LLUnits::Seconds> expiration);
 	BOOL checkExpirationAndReset(F32 expiration);
 	BOOL hasExpired() const;
 	LLUnitImplicit<F32, LLUnits::Seconds> getElapsedTimeAndResetF32();	// Returns elapsed time in seconds with reset
@@ -171,6 +171,6 @@ LL_COMMON_API struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_dayli
 LL_COMMON_API void microsecondsToTimecodeString(U64 current_time, std::string& tcstring);
 LL_COMMON_API void secondsToTimecodeString(F32 current_time, std::string& tcstring);
 
-U64 LL_COMMON_API totalTime();					// Returns current system time in microseconds
+LLUnitImplicit<U64, LLUnits::Microseconds> LL_COMMON_API totalTime();					// Returns current system time in microseconds
 
 #endif
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
index d6d8d9da6af5b4dbec36b10ea634b95ee9c667dd..781a4ab7317a9bcb488a50f2208205390e9bed7b 100644
--- a/indra/llcommon/llunit.h
+++ b/indra/llcommon/llunit.h
@@ -29,7 +29,7 @@
 
 #include "stdtypes.h"
 #include "llpreprocessor.h"
-#include "llerrorlegacy.h"
+#include "llerror.h"
 
 template<typename STORAGE_TYPE, typename UNIT_TYPE>
 struct LLUnit
@@ -266,13 +266,29 @@ LLUnit<STORAGE_TYPE, UNIT_TYPE> operator + (SCALAR_TYPE first, LLUnit<STORAGE_TY
 }
 
 template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
-LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second)
+LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
+{
+	LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
+	result += second;
+	return result;
+}
+
+template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
+LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
 {
 	LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
 	result += second;
 	return result;
 }
 
+template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
+LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second)
+{
+	LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
+	result += LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>(second);
+	return result;
+}
+
 template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
 LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
 {
@@ -281,10 +297,10 @@ LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (LLUnitImplicit<STORAGE_TYPE,
 	return result;
 }
 
-template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
-LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
+template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
+LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second)
 {
-	LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
+	LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> result(first);
 	result += second;
 	return result;
 }
@@ -324,6 +340,22 @@ LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnitImplicit<STORAGE_TYP
 	return result;
 }
 
+template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
+LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
+{
+	LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
+	result -= second;
+	return result;
+}
+
+template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
+LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second)
+{
+	LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
+	result -= LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>(second);
+	return result;
+}
+
 template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
 LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator - (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
 {
@@ -343,18 +375,6 @@ LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator - (SCALAR_TYPE first, LLUnitImp
 //
 // operator *
 //
-template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
-LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second)
-{
-	return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first * second.value()));
-}
-
-template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
-LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
-{
-	return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first.value() * second));
-}
-
 template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
 LLUnit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnit<STORAGE_TYPE1, UNIT_TYPE1>, LLUnit<STORAGE_TYPE2, UNIT_TYPE2>)
 {
@@ -364,15 +384,15 @@ LLUnit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnit<STORAGE_TYPE1, UNIT_TYPE1>,
 }
 
 template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
-LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second)
+LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
 {
-	return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first * second.value());
+	return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first.value() * second));
 }
 
 template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
-LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
+LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second)
 {
-	return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first.value() * second);
+	return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first * second.value()));
 }
 
 template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
@@ -383,6 +403,19 @@ LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnitImplicit<STORAGE_TYP
 	return LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>();
 }
 
+template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
+LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
+{
+	return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first.value() * second);
+}
+
+template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
+LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second)
+{
+	return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first * second.value());
+}
+
+
 //
 // operator /
 //
@@ -416,6 +449,18 @@ STORAGE_TYPE1 operator / (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUni
 	return STORAGE_TYPE1(first.value() / first.convert(second));
 }
 
+template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
+STORAGE_TYPE1 operator / (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
+{
+	return STORAGE_TYPE1(first.value() / first.convert(second));
+}
+
+template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
+STORAGE_TYPE1 operator / (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second)
+{
+	return STORAGE_TYPE1(first.value() / first.convert(second));
+}
+
 #define COMPARISON_OPERATORS(op)                                                                                     \
 template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>                                            \
 bool operator op (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second)                                         \
@@ -591,6 +636,7 @@ LL_DECLARE_DERIVED_UNIT(Mibibits, * 1024,		Gibibits, "Gib");
 LL_DECLARE_BASE_UNIT(Seconds, "s");
 LL_DECLARE_DERIVED_UNIT(Seconds, * 60,			Minutes, "min");
 LL_DECLARE_DERIVED_UNIT(Minutes, * 60,			Hours, "h");
+LL_DECLARE_DERIVED_UNIT(Hours, * 24,			Days, "d");
 LL_DECLARE_DERIVED_UNIT(Seconds, / 1000,		Milliseconds, "ms");
 LL_DECLARE_DERIVED_UNIT(Milliseconds, / 1000,	Microseconds, "\x09\x3cs");
 LL_DECLARE_DERIVED_UNIT(Microseconds, / 1000,	Nanoseconds, "ns");
diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h
deleted file mode 100755
index ef68a0eaf5cbd4b9272f8b35d70ed17b51c8f42c..0000000000000000000000000000000000000000
--- a/indra/llcommon/llversionserver.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/** 
- * @file llversionserver.h
- * @brief
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLVERSIONSERVER_H
-#define LL_LLVERSIONSERVER_H
-
-const S32 LL_VERSION_MAJOR = 2;
-const S32 LL_VERSION_MINOR = 1;
-const S32 LL_VERSION_PATCH = 0;
-const S32 LL_VERSION_BUILD = 264760;
-
-const char * const LL_CHANNEL = "Second Life Server";
-
-
-#endif
diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h
deleted file mode 100755
index efcbe76795827d379aca14a7495364093f519ca6..0000000000000000000000000000000000000000
--- a/indra/llcommon/stdenums.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/** 
- * @file stdenums.h
- * @brief Enumerations for indra.
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_STDENUMS_H
-#define LL_STDENUMS_H
-
-//----------------------------------------------------------------------------
-// DEPRECATED - create new, more specific files for shared enums/constants
-//----------------------------------------------------------------------------
-
-// this enum is used by the llview.h (viewer) and the llassetstorage.h (viewer and sim) 
-enum EDragAndDropType
-{
-	DAD_NONE			= 0,
-	DAD_TEXTURE			= 1,
-	DAD_SOUND			= 2,
-	DAD_CALLINGCARD		= 3,
-	DAD_LANDMARK		= 4,
-	DAD_SCRIPT			= 5,
-	DAD_CLOTHING 		= 6,
-	DAD_OBJECT			= 7,
-	DAD_NOTECARD		= 8,
-	DAD_CATEGORY		= 9,
-	DAD_ROOT_CATEGORY 	= 10,
-	DAD_BODYPART		= 11,
-	DAD_ANIMATION		= 12,
-	DAD_GESTURE			= 13,
-	DAD_LINK			= 14,
-	DAD_MESH            = 15,
-	DAD_WIDGET          = 16,
-	DAD_PERSON          = 17,
-	DAD_COUNT           = 18,   // number of types in this enum
-};
-
-// Reasons for drags to be denied.
-// ordered by priority for multi-drag
-enum EAcceptance
-{
-	ACCEPT_POSTPONED,	// we are asynchronously determining acceptance
-	ACCEPT_NO,			// Uninformative, general purpose denial.
-	ACCEPT_NO_LOCKED,	// Operation would be valid, but permissions are set to disallow it.
-	ACCEPT_YES_COPY_SINGLE,	// We'll take a copy of a single item
-	ACCEPT_YES_SINGLE,		// Accepted. OK to drag and drop single item here.
-	ACCEPT_YES_COPY_MULTI,	// We'll take a copy of multiple items
-	ACCEPT_YES_MULTI		// Accepted. OK to drag and drop multiple items here.
-};
-
-// This is used by the DeRezObject message to determine where to put
-// derezed tasks.
-enum EDeRezDestination
-{
-	DRD_SAVE_INTO_AGENT_INVENTORY = 0,
-	DRD_ACQUIRE_TO_AGENT_INVENTORY = 1,		// try to leave copy in world
-	DRD_SAVE_INTO_TASK_INVENTORY = 2,
-	DRD_ATTACHMENT = 3,
-	DRD_TAKE_INTO_AGENT_INVENTORY = 4,		// delete from world
-	DRD_FORCE_TO_GOD_INVENTORY = 5,			// force take copy
-	DRD_TRASH = 6,
-	DRD_ATTACHMENT_TO_INV = 7,
-	DRD_ATTACHMENT_EXISTS = 8,
-	DRD_RETURN_TO_OWNER = 9,				// back to owner's inventory
-	DRD_RETURN_TO_LAST_OWNER = 10,			// deeded object back to last owner's inventory
-
-	DRD_COUNT = 11
-};
-
-
-// This is used by the return to owner code to determine the reason
-// that this object is being returned.
-enum EReturnReason
-{
-	RR_GENERIC = 0,
-	RR_SANDBOX = 1,
-	RR_PARCEL_OWNER = 2,
-	RR_PARCEL_AUTO = 3,
-	RR_PARCEL_FULL = 4,
-	RR_OFF_WORLD = 5,
-	
-	RR_COUNT = 6
-};
-
-// This is used for filling in the first byte of the ExtraID field of
-// the ObjectProperties message.
-enum EObjectPropertiesExtraID
-{
-	OPEID_NONE = 0,
-	OPEID_ASSET_ID = 1,
-	OPEID_FROM_TASK_ID = 2,
-
-	OPEID_COUNT = 3
-};
-
-enum EAddPosition
-{
-	ADD_TOP,
-	ADD_BOTTOM,
-	ADD_DEFAULT
-};
-
-enum LLGroupChange
-{
-	GC_PROPERTIES,
-	GC_MEMBER_DATA,
-	GC_ROLE_DATA,
-	GC_ROLE_MEMBER_DATA,
-	GC_TITLES,
-	GC_ALL
-};
-
-//----------------------------------------------------------------------------
-// DEPRECATED - create new, more specific files for shared enums/constants
-//----------------------------------------------------------------------------
-
-#endif
diff --git a/indra/llcommon/string_table.h b/indra/llcommon/string_table.h
deleted file mode 100755
index fe6416fb5066aa1d60ab390675794a99a31aee5b..0000000000000000000000000000000000000000
--- a/indra/llcommon/string_table.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/** 
- * @file string_table.h
- * @brief Legacy wrapper header.
- *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-#include "llstringtable.h"
diff --git a/indra/llcommon/tests/bitpack_test.cpp b/indra/llcommon/tests/bitpack_test.cpp
index afc0c18cd01ad7b6de21b547e1407e02bb4ba442..9bfd5670684b327fb08eccea6d610de164b5759c 100755
--- a/indra/llcommon/tests/bitpack_test.cpp
+++ b/indra/llcommon/tests/bitpack_test.cpp
@@ -28,7 +28,7 @@
  
 #include "linden_common.h"
 
-#include "../bitpack.h"
+#include "../llbitpack.h"
 
 #include "../test/lltut.h"
 
diff --git a/indra/llcommon/timing.h b/indra/llcommon/timing.h
deleted file mode 100755
index c408d4c44655e04f325714122c38849374f9f929..0000000000000000000000000000000000000000
--- a/indra/llcommon/timing.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/** 
- * @file timing.h
- * @brief Cross-platform routines for doing timing.
- *
- * $LicenseInfo:firstyear=2000&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_TIMING_H					
-#define LL_TIMING_H
-
-
-#if LL_LINUX || LL_DARWIN || LL_SOLARIS
-#include <sys/time.h>
-#endif
-
-
-const F32 SEC_TO_MICROSEC = 1000000.f;
-const U64 SEC_TO_MICROSEC_U64 = 1000000;
-const U32 SEC_PER_DAY = 86400;
-
-// functionality has been moved lltimer.{cpp,h}.  This file will be deprecated in the future.
-
-#endif
diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h
index 1510d7e0b3d33ea4d0acc4e012c496a824da1ac8..abd6426d68e8fc14c5a62fb5f61202a62d60d042 100755
--- a/indra/llcrashlogger/llcrashlogger.h
+++ b/indra/llcrashlogger/llcrashlogger.h
@@ -34,6 +34,11 @@
 #include "llsd.h"
 #include "llcontrol.h"
 
+// Crash reporter behavior
+const S32 CRASH_BEHAVIOR_ASK = 0;
+const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1;
+const S32 CRASH_BEHAVIOR_NEVER_SEND = 2;
+
 class LLCrashLogger : public LLApp
 {
 public:
diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt
index e45c809e7e5433b6b776a93bac5843fcb15fe7ef..0a1f93bd8033807f8ed4b4373b551bddf840ee24 100755
--- a/indra/llinventory/CMakeLists.txt
+++ b/indra/llinventory/CMakeLists.txt
@@ -19,6 +19,7 @@ include_directories(
 set(llinventory_SOURCE_FILES
     llcategory.cpp
     lleconomy.cpp
+    llfoldertype.cpp
     llinventory.cpp
     llinventorydefines.cpp
     llinventorytype.cpp
@@ -36,6 +37,7 @@ set(llinventory_HEADER_FILES
 
     llcategory.h
     lleconomy.h
+    llfoldertype.h
     llinventory.h
     llinventorydefines.h
     llinventorytype.h
diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp
similarity index 100%
rename from indra/llcommon/llfoldertype.cpp
rename to indra/llinventory/llfoldertype.cpp
diff --git a/indra/llcommon/llfoldertype.h b/indra/llinventory/llfoldertype.h
similarity index 100%
rename from indra/llcommon/llfoldertype.h
rename to indra/llinventory/llfoldertype.h
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index 99716ed7be6d13290756c80b191385eed8c25d73..47b06af5b852e0c47382d59b869ecc27cbbd7f0b 100755
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -27,7 +27,6 @@
 #ifndef LL_LLINVENTORY_H
 #define LL_LLINVENTORY_H
 
-#include "lldarray.h"
 #include "llfoldertype.h"
 #include "llinventorytype.h"
 #include "llpermissions.h"
@@ -124,7 +123,7 @@ class LLInventoryObject : public LLRefCount
 class LLInventoryItem : public LLInventoryObject
 {
 public:
-	typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t;
+	typedef std::vector<LLPointer<LLInventoryItem> > item_array_t;
 
 	//--------------------------------------------------------------------
 	// Initialization
@@ -235,7 +234,7 @@ class LLInventoryItem : public LLInventoryObject
 class LLInventoryCategory : public LLInventoryObject
 {
 public:
-	typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t;
+	typedef std::vector<LLPointer<LLInventoryCategory> > cat_array_t;
 
 	//--------------------------------------------------------------------
 	// Initialization
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index 37c603348e3342a1ed9191e72cffcf47d125cc04..23a4e4b077103aa486dc19708cae8bef41f35c84 100755
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -136,7 +136,7 @@ LLParcel::LLParcel(const LLUUID &owner_id,
 // virtual
 LLParcel::~LLParcel()
 {
-    // user list cleaned up by LLDynamicArray destructor.
+    // user list cleaned up by std::vector destructor.
 }
 
 void LLParcel::init(const LLUUID &owner_id,
@@ -1082,7 +1082,7 @@ void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group)
 		mGroupID.setNull();
 	}
 	mSaleTimerExpires.start();
-	mSaleTimerExpires.setTimerExpirySec(DEFAULT_USEC_SALE_TIMEOUT / SEC_TO_MICROSEC);
+	mSaleTimerExpires.setTimerExpirySec(LLUnits::Microseconds::fromValue(DEFAULT_USEC_SALE_TIMEOUT));
 	mStatus = OS_LEASE_PENDING;
 	mClaimDate = time(NULL);
 	setAuctionID(0);
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 41914446d1545cb54297a17d049c7d79d92c629b..e4ab46929f093ce3760532dfaf45e22076bfe15e 100755
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -44,7 +44,6 @@
 #include "m3math.h"
 #include "llmatrix3a.h"
 #include "lloctree.h"
-#include "lldarray.h"
 #include "llvolume.h"
 #include "llvolumeoctree.h"
 #include "llstl.h"
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index 164b8d6652591b356dd03f6c1c9bc1656e46b3fd..a4291df7dbe2d083d9df87ff566611641d2c428c 100755
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -42,7 +42,6 @@ class LLVolumeFace;
 class LLVolume;
 class LLVolumeTriangle;
 
-#include "lldarray.h"
 #include "lluuid.h"
 #include "v4color.h"
 //#include "vmath.h"
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt
index d193e367eb61fe7631d7c5b265eadf623d71e480..ca48e613d27d93dbbc364adfdba79bd5485d02e0 100755
--- a/indra/llmessage/CMakeLists.txt
+++ b/indra/llmessage/CMakeLists.txt
@@ -27,6 +27,7 @@ set(llmessage_SOURCE_FILES
     llares.cpp
     llareslistener.cpp
     llassetstorage.cpp
+    llavatarname.cpp
     llavatarnamecache.cpp
     llblowfishcipher.cpp
     llbuffer.cpp
@@ -114,6 +115,7 @@ set(llmessage_HEADER_FILES
     llares.h
     llareslistener.h
     llassetstorage.h
+    llavatarname.h
     llavatarnamecache.h
     llblowfishcipher.h
     llbuffer.h
@@ -128,6 +130,7 @@ set(llmessage_HEADER_FILES
     lldbstrings.h
     lldispatcher.h
     lleventflags.h
+    llextendedstatus.h
     llfiltersd2xmlrpc.h
     llfollowcamparams.h
     llhost.h
diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h
index 563ff9e07794c00cb34bd86d60de97b280c719f0..6ffd7ad309a95659d436515de620165021563be1 100755
--- a/indra/llmessage/llassetstorage.h
+++ b/indra/llmessage/llassetstorage.h
@@ -34,11 +34,11 @@
 #include "lltimer.h"
 #include "llnamevalue.h"
 #include "llhost.h"
-#include "stdenums.h" 	// for EDragAndDropType
 #include "lltransfermanager.h" // For LLTSCode enum
 #include "llassettype.h"
 #include "llstring.h"
 #include "llextendedstatus.h"
+#include "llxfer.h"
 
 // Forward declarations
 class LLMessageSystem;
@@ -51,6 +51,15 @@ class LLSD;
 // HTTP Uploads also timeout if they take longer than this.
 const F32 LL_ASSET_STORAGE_TIMEOUT = 5 * 60.0f;  
 
+
+// Specific error codes
+const int LL_ERR_ASSET_REQUEST_FAILED = -1;
+//const int LL_ERR_ASSET_REQUEST_INVALID = -2;
+const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3;
+const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4;
+const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5;
+const int LL_ERR_PRICE_MISMATCH = -23018;
+
 class LLAssetInfo
 {
 protected:
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llmessage/llavatarname.cpp
similarity index 100%
rename from indra/llcommon/llavatarname.cpp
rename to indra/llmessage/llavatarname.cpp
diff --git a/indra/llcommon/llavatarname.h b/indra/llmessage/llavatarname.h
similarity index 100%
rename from indra/llcommon/llavatarname.h
rename to indra/llmessage/llavatarname.h
diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h
index 430d6358f77673280e3a84cb8773dd165a666ba3..11d4e1b11ca44de5b7153acb6947143b9eee16ae 100755
--- a/indra/llmessage/llcircuit.h
+++ b/indra/llmessage/llcircuit.h
@@ -34,7 +34,6 @@
 #include "llerror.h"
 
 #include "lltimer.h"
-#include "timing.h"
 #include "net.h"
 #include "llhost.h"
 #include "llpacketack.h"
@@ -51,6 +50,8 @@ const F32 LL_AVERAGED_PING_MIN =  100;    // msec  // IW: increased to avoid ret
 const U32 INITIAL_PING_VALUE_MSEC = 1000; // initial value for the ping delay, or for ping delay for an unknown circuit
 
 const TPACKETID LL_MAX_OUT_PACKET_ID = 0x01000000;
+const int LL_ERR_CIRCUIT_GONE   = -23017;
+const int LL_ERR_TCP_TIMEOUT    = -23016;
 
 // 0 - flags
 // [1,4] - packetid
diff --git a/indra/llcommon/llextendedstatus.h b/indra/llmessage/llextendedstatus.h
similarity index 100%
rename from indra/llcommon/llextendedstatus.h
rename to indra/llmessage/llextendedstatus.h
diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp
index 7dcf160c9ba9c3ccb8d88a4b84d09cdbbac7d01f..9a4d22ab0b3ae4669745a6e2744c2e218c1d55af 100755
--- a/indra/llmessage/llhttpassetstorage.cpp
+++ b/indra/llmessage/llhttpassetstorage.cpp
@@ -36,6 +36,7 @@
 #include "llproxy.h"
 #include "llvfile.h"
 #include "llvfs.h"
+#include "llxfer.h"
 
 #ifdef LL_STANDALONE
 # include <zlib.h>
@@ -43,6 +44,8 @@
 # include "zlib/zlib.h"
 #endif
 
+const	char* const	LOCAL_ASSET_URL_FORMAT		= "http://%s:12041/asset";
+
 const U32 MAX_RUNNING_REQUESTS = 1;
 const F32 MAX_PROCESSING_TIME = 0.005f;
 const S32 CURL_XFER_BUFFER_SIZE = 65536;
diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h
index ae8e0087c14d84c590d2f178ce7b8f2469bcc7e6..70a91d8a6fe40a72dcf63327291bf574e6f9aa2f 100755
--- a/indra/llmessage/llmessagetemplate.h
+++ b/indra/llmessage/llmessagetemplate.h
@@ -27,9 +27,9 @@
 #ifndef LL_LLMESSAGETEMPLATE_H
 #define LL_LLMESSAGETEMPLATE_H
 
-#include "lldarray.h"
 #include "message.h" // TODO: babbage: Remove...
 #include "llstl.h"
+#include "llindexedvector.h"
 
 class LLMsgVarData
 {
@@ -102,7 +102,7 @@ class LLMsgBlkData
 	}
 
 	S32									mBlockNumber;
-	typedef LLDynamicArrayIndexed<LLMsgVarData, const char *, 8> msg_var_data_map_t;
+	typedef LLIndexedVector<LLMsgVarData, const char *, 8> msg_var_data_map_t;
 	msg_var_data_map_t					mMemberVarData;
 	char								*mName;
 	S32									mTotalSize;
@@ -225,7 +225,7 @@ class LLMessageBlock
 
 	friend std::ostream&	 operator<<(std::ostream& s, LLMessageBlock &msg);
 
-	typedef LLDynamicArrayIndexed<LLMessageVariable*, const char *, 8> message_variable_map_t;
+	typedef LLIndexedVector<LLMessageVariable*, const char *, 8> message_variable_map_t;
 	message_variable_map_t 					mMemberVariables;
 	char									*mName;
 	EMsgBlockType							mType;
@@ -391,7 +391,7 @@ class LLMessageTemplate
 	}
 
 public:
-	typedef LLDynamicArrayIndexed<LLMessageBlock*, char*, 8> message_block_map_t;
+	typedef LLIndexedVector<LLMessageBlock*, char*, 8> message_block_map_t;
 	message_block_map_t						mMemberBlocks;
 	char									*mName;
 	EMsgFrequency							mFrequency;
diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp
index d7994030296a05fdf9066b33aa043e7def812893..f2bdcfad53f72f0d8f06ef9b30d029fba36b1417 100755
--- a/indra/llmessage/llnamevalue.cpp
+++ b/indra/llmessage/llnamevalue.cpp
@@ -33,7 +33,7 @@
 
 #include "u64.h"
 #include "llstring.h"
-#include "string_table.h"
+#include "llstringtable.h"
 
 // Anonymous enumeration to provide constants in this file.
 // *NOTE: These values may be used in sscanf statements below as their
diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h
index 273de475f8736a0274701b909cac3601bb1aad92..f8b556b5fee21f9ff33cc0eecd38591c0986987a 100755
--- a/indra/llmessage/llnamevalue.h
+++ b/indra/llmessage/llnamevalue.h
@@ -41,7 +41,7 @@
 // SitObject STRING
 // SitPosition VEC3
 
-#include "string_table.h"
+#include "llstringtable.h"
 #include "llmath.h"
 #include "v3math.h"
 #include "lldbstrings.h"
diff --git a/indra/llmessage/llpacketbuffer.cpp b/indra/llmessage/llpacketbuffer.cpp
index e69631eb3b6ce50519f9bf39b5b60eee8cf6c071..22e4dc1e8df0a302c14f9fae81e176bc3ed0420d 100755
--- a/indra/llmessage/llpacketbuffer.cpp
+++ b/indra/llmessage/llpacketbuffer.cpp
@@ -29,7 +29,7 @@
 #include "llpacketbuffer.h"
 
 #include "net.h"
-#include "timing.h"
+#include "lltimer.h"
 #include "llhost.h"
 
 ///////////////////////////////////////////////////////////
diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp
index fc6e9c519302d9da1790c21d77daf6cf8f99f2e6..a8c568a365f65dd4a3d7a716f829b00135531023 100755
--- a/indra/llmessage/llpacketring.cpp
+++ b/indra/llmessage/llpacketring.cpp
@@ -41,7 +41,6 @@
 #include "llproxy.h"
 #include "llrand.h"
 #include "message.h"
-#include "timing.h"
 #include "u64.h"
 
 ///////////////////////////////////////////////////////////
diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h
index f9348eb11f100cd9e11ade66cdb27625dd8858b0..edf5eeb82d0b4ddee1fe30aa393ebc69a68bb7a1 100755
--- a/indra/llmessage/llxfer.h
+++ b/indra/llmessage/llxfer.h
@@ -32,6 +32,10 @@
 #include "llextendedstatus.h"
 
 const S32 LL_XFER_LARGE_PAYLOAD = 7680;
+const S32 LL_ERR_FILE_EMPTY     = -44;
+const int LL_ERR_FILE_NOT_FOUND = -43;
+const int LL_ERR_CANNOT_OPEN_FILE = -42;
+const int LL_ERR_EOF = -39;
 
 typedef enum ELLXferStatus {
 	e_LL_XFER_UNINITIALIZED,
diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp
index 00b9d81611b6d1dba65bbe6706d9b34b1207c47a..e74eb7476331eaa662ba77c9f276b1bc23b6507e 100755
--- a/indra/llmessage/llxfermanager.cpp
+++ b/indra/llmessage/llxfermanager.cpp
@@ -677,7 +677,7 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
 		ack_info.mID = id;
 		ack_info.mPacketNum = decodePacketNum(packetnum);
 		ack_info.mRemoteHost = mesgsys->getSender();
-		mXferAckQueue.push(ack_info);
+		mXferAckQueue.push_back(ack_info);
 	}
 
 	if (isLastPacket(packetnum))
@@ -1088,15 +1088,15 @@ void LLXferManager::retransmitUnackedPackets ()
 	// so we don't blow through bandwidth.
 	//
 
-	while (mXferAckQueue.getLength())
+	while (mXferAckQueue.size())
 	{
 		if (mAckThrottle.checkOverflow(1000.0f*8.0f))
 		{
 			break;
 		}
-		//llinfos << "Confirm packet queue length:" << mXferAckQueue.getLength() << llendl;
-		LLXferAckInfo ack_info;
-		mXferAckQueue.pop(ack_info);
+		//llinfos << "Confirm packet queue length:" << mXferAckQueue.size() << llendl;
+		LLXferAckInfo ack_info = mXferAckQueue.front();
+		mXferAckQueue.pop_front();
 		//llinfos << "Sending confirm packet" << llendl;
 		sendConfirmPacket(gMessageSystem, ack_info.mID, ack_info.mPacketNum, ack_info.mRemoteHost);
 		mAckThrottle.throttleOverflow(1000.f*8.f); // Assume 1000 bytes/packet
diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h
index b84bccb5b79c14f51ae50530eaa8f3fdc8bb29a6..b3d110e7a145bf897fa67725765c7fda0ff6c723 100755
--- a/indra/llmessage/llxfermanager.h
+++ b/indra/llmessage/llxfermanager.h
@@ -41,7 +41,7 @@ class LLVFS;
 #include "message.h"
 #include "llassetstorage.h"
 #include "lldir.h"
-#include "lllinkedqueue.h"
+#include <deque>
 #include "llthrottle.h"
 
 class LLHostStatus
@@ -80,7 +80,7 @@ class LLXferManager
 	S32    mMaxIncomingXfers;
 
 	BOOL	mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth
-	LLLinkedQueue<LLXferAckInfo> mXferAckQueue;
+	std::deque<LLXferAckInfo> mXferAckQueue;
 	LLThrottle mAckThrottle;
  public:
 
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index ae95087377f4fe19197189c6e42c37c14429d536..4a4cc57e20e9e441d5ccd868af3c01d790a57ddf 100755
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -47,10 +47,8 @@
 
 // linden library headers
 #include "indra_constants.h"
-#include "lldarray.h"
 #include "lldir.h"
 #include "llerror.h"
-#include "llerrorlegacy.h"
 #include "llfasttimer.h"
 #include "llhttpclient.h"
 #include "llhttpnodeadapter.h"
@@ -73,7 +71,6 @@
 #include "lltransfermanager.h"
 #include "lluuid.h"
 #include "llxfermanager.h"
-#include "timing.h"
 #include "llquaternion.h"
 #include "u64.h"
 #include "v3dmath.h"
@@ -120,7 +117,7 @@ namespace
 			{
 				LL_WARNS("Messaging") << "error status " << status
 						<< " for message " << mMessageName
-						<< " reason " << reason << llendl;
+						<< " reason " << reason << LL_ENDL;
 			}
 			// TODO: Map status in to useful error code.
 			if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_TCP_TIMEOUT);
@@ -155,7 +152,7 @@ void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response,
 	std::string name = context["request"]["wildcard"]["message-name"];
 	char* namePtr = LLMessageStringTable::getInstance()->getString(name.c_str());
 	
-	lldebugs << "Setting mLastSender " << input["sender"].asString() << llendl;
+	lldebugs << "Setting mLastSender " << input["sender"].asString() << LL_ENDL;
 	gMessageSystem->mLastSender = LLHost(input["sender"].asString());
 	gMessageSystem->mPacketsIn += 1;
 	gMessageSystem->mLLSDMessageReader->setMessage(namePtr, input["body"]);
@@ -284,14 +281,14 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
 		mbError = TRUE;
 		mErrorCode = error;
 	}
-//	LL_DEBUGS("Messaging") <<  << "*** port: " << mPort << llendl;
+//	LL_DEBUGS("Messaging") <<  << "*** port: " << mPort << LL_ENDL;
 
 	//
 	// Create the data structure that we can poll on
 	//
 	if (!gAPRPoolp)
 	{
-		LL_ERRS("Messaging") << "No APR pool before message system initialization!" << llendl;
+		LL_ERRS("Messaging") << "No APR pool before message system initialization!" << LL_ENDL;
 		ll_init_apr();
 	}
 	apr_socket_t *aprSocketp = NULL;
@@ -329,7 +326,7 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure
 {
 	if(filename.empty())
 	{
-		LL_ERRS("Messaging") << "No template filename specified" << llendl;
+		LL_ERRS("Messaging") << "No template filename specified" << LL_ENDL;
 		mbError = TRUE;
 		return;
 	}
@@ -338,9 +335,9 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure
 	if(!_read_file_into_string(template_body, filename))
 	{
 		if (failure_is_fatal) {
-			LL_ERRS("Messaging") << "Failed to open template: " << filename << llendl;
+			LL_ERRS("Messaging") << "Failed to open template: " << filename << LL_ENDL;
 		} else {
-			LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl;
+			LL_WARNS("Messaging") << "Failed to open template: " << filename << LL_ENDL;
 		}
 		mbError = TRUE;
 		return;
@@ -566,7 +563,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 			// Ones that are non-zero but below the minimum packet size are worrisome.
 			if (receive_size > 0)
 			{
-				LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << llendl;
+				LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << LL_ENDL;
 				callExceptionFunc(MX_PACKET_TOO_SHORT);
 			}
 			// no data in packet receive buffer
@@ -592,7 +589,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 					// the next one
 					LL_WARNS("Messaging") << "Malformed packet received. Packet size "
 						<< receive_size << " with invalid no. of acks " << acks
-						<< llendl;
+						<< LL_ENDL;
 					valid_packet = FALSE;
 					continue;
 				}
@@ -620,7 +617,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 					memcpy(&mem_id, &mTrueReceiveBuffer[true_rcv_size], /* Flawfinder: ignore*/
 					     sizeof(TPACKETID));
 					packet_id = ntohl(mem_id);
-					//LL_INFOS("Messaging") << "got ack: " << packet_id << llendl;
+					//LL_INFOS("Messaging") << "got ack: " << packet_id << LL_ENDL;
 					cdp->ackReliablePacket(packet_id);
 				}
 				if (!cdp->getUnackedPacketCount())
@@ -652,14 +649,14 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 						//	LL_WARNS("Messaging") << "DISCARDED PACKET HOST MISMATCH! HOST: "
 						//			<< host << " CIRCUIT: "
 						//			<< mCircuitInfo.mCurrentCircuit->mHost
-						//			<< llendl;
+						//			<< LL_ENDL;
 						//}
 						// ***************************************
 						//mCircuitInfo.mCurrentCircuit->mAcks.put(mCurrentRecvPacketID);
 						cdp->collectRAck(mCurrentRecvPacketID);
 					}
 								 
-					LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << llendl;
+					LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << LL_ENDL;
 					if(mVerboseLog)
 					{
 						std::ostringstream str;
@@ -671,7 +668,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 							<< " resent "
 							<< ((acks > 0) ? "acks" : "")
 							<< " DISCARD DUPLICATE";
-						LL_INFOS("Messaging") << str.str() << llendl;
+						LL_INFOS("Messaging") << str.str() << LL_ENDL;
 					}
 					mPacketsIn++;
 					valid_packet = FALSE;
@@ -750,7 +747,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
 			{
 				if (mbProtected  && (!cdp))
 				{
-					LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << llendl;
+					LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << LL_ENDL;
 					mOffCircuitPackets++;
 				}
 				else
@@ -820,7 +817,7 @@ void LLMessageSystem::processAcks()
 
 		if (!mDenyTrustedCircuitSet.empty())
 		{
-			LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << llendl;
+			LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << LL_ENDL;
 			for (host_set_t::iterator hostit = mDenyTrustedCircuitSet.begin(); hostit != mDenyTrustedCircuitSet.end(); ++hostit)
 			{
 				reallySendDenyTrustedCircuit(*hostit);
@@ -894,7 +891,7 @@ LLSD LLMessageSystem::getBuiltMessageLLSD() const
 	else
 	{
 		// TODO: implement as below?
-		llerrs << "Message not built as LLSD." << llendl; 
+		llerrs << "Message not built as LLSD." << LL_ENDL; 
 	}
 	return result;
 }
@@ -1147,7 +1144,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n
 		// explicitly sent as reliable, so they don't have a callback
 //		LL_WARNS("Messaging") << "LLMessageSystem::sendMessage: Sending unreliable "
 //				<< mMessageBuilder->getMessageName() << " message via HTTP"
-//				<< llendl;
+//				<< LL_ENDL;
 		return new LLFnPtrResponder(
 			NULL,
 			NULL,
@@ -1183,11 +1180,11 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 			if(mVerboseLog)
 			{
 				LL_INFOS_ONCE("Messaging") << "MSG: -> " << host << "\tUNKNOWN CIRCUIT:\t"
-						<< mMessageBuilder->getMessageName() << llendl;
+						<< mMessageBuilder->getMessageName() << LL_ENDL;
 			}
 			LL_WARNS_ONCE("Messaging") << "sendMessage - Trying to send "
 					<< mMessageBuilder->getMessageName() << " on unknown circuit "
-					<< host << llendl;
+					<< host << LL_ENDL;
 			return 0;
 		}
 		else
@@ -1206,11 +1203,11 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 			if(mVerboseLog)
 			{
 				LL_INFOS("Messaging") << "MSG: -> " << host << "\tDEAD CIRCUIT\t\t"
-						<< mMessageBuilder->getMessageName() << llendl;
+						<< mMessageBuilder->getMessageName() << LL_ENDL;
 			}
 			LL_WARNS("Messaging") << "sendMessage - Trying to send message "
 					<< mMessageBuilder->getMessageName() << " to dead circuit "
-					<< host << llendl;
+					<< host << LL_ENDL;
 			return 0;
 		}
 	}
@@ -1255,7 +1252,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 			LL_WARNS("Messaging") << "sendMessage - Trying to send "
 					<< ((buffer_length > 4000) ? "EXTRA " : "")
 					<< "BIG message " << mMessageBuilder->getMessageName() << " - "
-					<< buffer_length << llendl;
+					<< buffer_length << LL_ENDL;
 		}
 	}
 	if (mSendReliable)
@@ -1317,7 +1314,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 				// append_acout_count is incorrect or that
 				// MAX_BUFFER_SIZE has fallen below MTU which is bad
 				// and probably programmer error.
-			    LL_ERRS("Messaging") << "Buffer packing failed due to size.." << llendl;
+			    LL_ERRS("Messaging") << "Buffer packing failed due to size.." << LL_ENDL;
 			}
 		}
 
@@ -1358,7 +1355,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
 			std::ostream_iterator<TPACKETID> append(str, " ");
 			std::copy(acks.begin(), acks.end(), append);
 		}
-		LL_INFOS("Messaging") << str.str() << llendl;
+		LL_INFOS("Messaging") << str.str() << LL_ENDL;
 	}
 
 
@@ -1382,7 +1379,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
 			<< nullToEmpty(mMessageReader->getMessageName())
 			<< (recv_reliable ? " reliable" : "")
  			<< " REJECTED";
-		LL_INFOS("Messaging") << str.str() << llendl;
+		LL_INFOS("Messaging") << str.str() << LL_ENDL;
 	}
 	// nope!
 	// cout << "Rejecting unexpected message " << mCurrentMessageTemplate->mName << " from " << hex << ip << " , " << dec << port << endl;
@@ -1390,7 +1387,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
 	// Keep track of rejected messages as well
 	if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
 	{
-		LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
+		LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << LL_ENDL;
 	}
 	else
 	{
@@ -1409,7 +1406,7 @@ S32 LLMessageSystem::sendMessage(
 {
 	if (!(host.isOk()))
 	{
-		LL_WARNS("Messaging") << "trying to send message to invalid host"	<< llendl;
+		LL_WARNS("Messaging") << "trying to send message to invalid host"	<< LL_ENDL;
 		return 0;
 	}
 
@@ -1427,14 +1424,14 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host )
 		LL_WARNS("Messaging") << "Received trusted message on untrusted circuit. "
 				<< "Will reply with deny. "
 				<< "Message: " << nullToEmpty(mMessageReader->getMessageName())
-				<< " Host: " << host << llendl;
+				<< " Host: " << host << LL_ENDL;
 	}
 
 	if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
 	{
 		LL_WARNS("Messaging") << "got more than " << MAX_MESSAGE_COUNT_NUM
 			<< " packets without clearing counts"
-			<< llendl;
+			<< LL_ENDL;
 	}
 	else
 	{
@@ -1452,7 +1449,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
 {
 	if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
 	{
-		LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
+		LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << LL_ENDL;
 	}
 	else
 	{
@@ -1481,7 +1478,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
 			<< (recv_reliable ? " reliable" : "")
 			<< (recv_resent ? " resent" : "")
 			<< (recv_acks ? " acks" : "");
-		LL_INFOS("Messaging") << str.str() << llendl;
+		LL_INFOS("Messaging") << str.str() << LL_ENDL;
 	}
 }
 
@@ -1491,54 +1488,54 @@ void LLMessageSystem::sanityCheck()
 
 //	if (!mCurrentRMessageData)
 //	{
-//		LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << LL_ENDL;
 //	}
 
 //	if (!mCurrentRMessageTemplate)
 //	{
-//		LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << LL_ENDL;
 //	}
 
 //	if (!mCurrentRTemplateBlock)
 //	{
-//		LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << LL_ENDL;
 //	}
 
 //	if (!mCurrentRDataBlock)
 //	{
-//		LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << LL_ENDL;
 //	}
 
 //	if (!mCurrentSMessageData)
 //	{
-//		LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << LL_ENDL;
 //	}
 
 //	if (!mCurrentSMessageTemplate)
 //	{
-//		LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << LL_ENDL;
 //	}
 
 //	if (!mCurrentSTemplateBlock)
 //	{
-//		LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << LL_ENDL;
 //	}
 
 //	if (!mCurrentSDataBlock)
 //	{
-//		LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << llendl;
+//		LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << LL_ENDL;
 //	}
 }
 
 void LLMessageSystem::showCircuitInfo()
 {
-	LL_INFOS("Messaging") << mCircuitInfo << llendl;
+	LL_INFOS("Messaging") << mCircuitInfo << LL_ENDL;
 }
 
 
 void LLMessageSystem::dumpCircuitInfo()
 {
-	lldebugst(LLERR_CIRCUIT_INFO) << mCircuitInfo << llendl;
+	LL_DEBUGS("Messaging") << mCircuitInfo << LL_ENDL;
 }
 
 /* virtual */
@@ -1582,7 +1579,7 @@ void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted)
 
 void LLMessageSystem::disableCircuit(const LLHost &host)
 {
-	LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << llendl;
+	LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << LL_ENDL;
 	U32 code = gMessageSystem->findCircuitCode( host );
 
 	// Don't need to do this, as we're removing the circuit info anyway - djs 01/28/03
@@ -1595,7 +1592,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
 		code_session_map_t::iterator it = mCircuitCodes.find(code);
 		if(it != mCircuitCodes.end())
 		{
-			LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << llendl;
+			LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << LL_ENDL;
 			//mCircuitCodes.removeData(code);
 			mCircuitCodes.erase(it);
 		}
@@ -1611,7 +1608,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
 			U32 old_port = (U32)(ip_port & (U64)0xFFFFFFFF);
 			U32 old_ip = (U32)(ip_port >> 32);
 
-			LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl;
+			LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << LL_ENDL;
 			gMessageSystem->mIPPortToCircuitCode.erase(ip_port);
 		}
 		mCircuitInfo.removeCircuitData(host);
@@ -1621,7 +1618,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
 		// Sigh, since we can open circuits which don't have circuit
 		// codes, it's possible for this to happen...
 		
-		LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << llendl;
+		LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << LL_ENDL;
 	}
 
 }
@@ -1652,7 +1649,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit)
 
 	if (!host.isOk())
 	{
-		LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << llendl;
+		LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << LL_ENDL;
 		return TRUE;
 	}
 
@@ -1663,7 +1660,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit)
 	}
 	else
 	{
-		LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << llendl;
+		LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << LL_ENDL;
 		return FALSE;
 	}
 }
@@ -1674,7 +1671,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit)
 
 	if (!host.isOk())
 	{
-		LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << llendl;
+		LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << LL_ENDL;
 		return FALSE;
 	}
 
@@ -1685,7 +1682,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit)
 	}
 	else
 	{
-		LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << llendl;
+		LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << LL_ENDL;
 		return FALSE;
 	}
 }
@@ -1699,7 +1696,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host)
 	}
 	else
 	{
-		LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << llendl;
+		LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << LL_ENDL;
 		return FALSE;
 	}
 }
@@ -1851,18 +1848,18 @@ void LLMessageSystem::processAssignCircuitCode(LLMessageSystem* msg, void**)
 	{
 		LL_WARNS("Messaging") << "AssignCircuitCode, bad session id. Expecting "
 				<< msg->getMySessionID() << " but got " << session_id
-				<< llendl;
+				<< LL_ENDL;
 		return;
 	}
 	U32 code;
 	msg->getU32Fast(_PREHASH_CircuitCode, _PREHASH_Code, code);
 	if (!code)
 	{
-		LL_ERRS("Messaging") << "Assigning circuit code of zero!" << llendl;
+		LL_ERRS("Messaging") << "Assigning circuit code of zero!" << LL_ENDL;
 	}
 	
 	msg->mOurCircuitCode = code;
-	LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << llendl;
+	LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << LL_ENDL;
 }
 */
 
@@ -1886,20 +1883,20 @@ bool LLMessageSystem::addCircuitCode(U32 code, const LLUUID& session_id)
 {
 	if(!code)
 	{
-		LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << llendl;
+		LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << LL_ENDL;
 		return false;
 	}
 	code_session_map_t::iterator it = mCircuitCodes.find(code);
 	if(it == mCircuitCodes.end())
 	{
-		LL_INFOS("Messaging") << "New circuit code " << code << " added" << llendl;
+		LL_INFOS("Messaging") << "New circuit code " << code << " added" << LL_ENDL;
 		//msg->mCircuitCodes[circuit_code] = circuit_code;
 		
 		mCircuitCodes.insert(code_session_map_t::value_type(code, session_id));
 	}
 	else
 	{
-		LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << llendl;
+		LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << LL_ENDL;
 	}
 	return true;
 }
@@ -1933,7 +1930,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 			// Whoah, abort!  We don't know anything about this circuit code.
 			LL_WARNS("Messaging") << "UseCircuitCode for " << circuit_code_in
 					<< " received without AddCircuitCode message - aborting"
-					<< llendl;
+					<< LL_ENDL;
 			return;
 		}
 
@@ -1945,7 +1942,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 		{
 			LL_WARNS("Messaging") << "UseCircuitCode unmatched session id. Got "
 					<< session_id << " but expected " << (*it).second
-					<< llendl;
+					<< LL_ENDL;
 			return;
 		}
 
@@ -1958,7 +1955,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 			if ((ip_port_old == ip_port_in) && (circuit_code_old == circuit_code_in))
 			{
 				// Current information is the same as incoming info, ignore
-				LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << llendl;
+				LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << LL_ENDL;
 				return;
 			}
 
@@ -1968,27 +1965,27 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 			msg->mIPPortToCircuitCode.erase(ip_port_old);
 			U32 old_port = (U32)(ip_port_old & (U64)0xFFFFFFFF);
 			U32 old_ip = (U32)(ip_port_old >> 32);
-			LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << llendl;
+			LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << LL_ENDL;
 		}
 
 		if (circuit_code_old)
 		{
 			LLHost cur_host(ip, port);
 
-			LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << llendl;
+			LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << LL_ENDL;
 			msg->disableCircuit(cur_host);
 			if (circuit_code_old == circuit_code_in)
 			{
-				LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << llendl;
-				LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << llendl;
-				LL_WARNS("Messaging") << "Permanently disabling circuit" << llendl;
+				LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << LL_ENDL;
+				LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << LL_ENDL;
+				LL_WARNS("Messaging") << "Permanently disabling circuit" << LL_ENDL;
 				return;
 			}
 			else
 			{
 				LL_WARNS("Messaging") << "Circuit code changed for " << msg->getSender()
 						<< " from " << circuit_code_old << " to "
-						<< circuit_code_in << llendl;
+						<< circuit_code_in << LL_ENDL;
 			}
 		}
 
@@ -2030,7 +2027,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 
 		LL_INFOS("Messaging") << "Circuit code " << circuit_code_in << " from "
 				<< msg->getSender() << " for agent " << id << " in session "
-				<< session_id << llendl;
+				<< session_id << LL_ENDL;
 
 		const LLUseCircuitCodeResponder* responder =
 			(const LLUseCircuitCodeResponder*) user;
@@ -2041,7 +2038,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
 	}
 	else
 	{
-		LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << llendl;
+		LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << LL_ENDL;
 	}
 }
 
@@ -2063,7 +2060,7 @@ void LLMessageSystem::processError(LLMessageSystem* msg, void**)
 
 	LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - "
 		<< error_code << " " << error_token << " " << error_id << " \""
-		<< error_system << "\" \"" << error_message << "\"" << llendl;
+		<< error_system << "\" \"" << error_message << "\"" << LL_ENDL;
 }
 
 
@@ -2099,7 +2096,7 @@ void LLMessageSystem::dispatch(
 				gMessageSystem->mMessageTemplates.end()) &&
 		!LLMessageConfig::isValidMessage(msg_name))
 	{
-		LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << llendl;
+		LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << LL_ENDL;
 		responsep->notFound("Invalid message name");
 		return;
 	}
@@ -2110,12 +2107,12 @@ void LLMessageSystem::dispatch(
 	if (!handler)
 	{
 		LL_WARNS("Messaging")	<< "LLMessageService::dispatch > no handler for "
-				<< path << llendl;
+				<< path << LL_ENDL;
 		return;
 	}
 	// enable this for output of message names
-	//LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << llendl;
-	//lldebugs << "data: " << LLSDNotationStreamer(message) << llendl;	   
+	//LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << LL_ENDL;
+	//LL_DEBUGS() << "data: " << LLSDNotationStreamer(message) << LL_ENDL;	   
 
 	handler->post(responsep, context, message);
 }
@@ -2233,7 +2230,7 @@ S32 LLMessageSystem::sendError(
 	else
 	{
 		LL_WARNS("Messaging") << "Data and message were too large -- data removed."
-			<< llendl;
+			<< LL_ENDL;
 		addBinaryData("Data", NULL, 0);
 	}
 	return sendReliable(host);
@@ -2253,7 +2250,7 @@ void	process_packet_ack(LLMessageSystem *msgsystem, void** /*user_data*/)
 		for (S32 i = 0; i < ack_count; i++)
 		{
 			msgsystem->getU32Fast(_PREHASH_Packets, _PREHASH_ID, packet_id, i);
-//			LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << llendl;
+//			LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << LL_ENDL;
 			cdp->ackReliablePacket(packet_id);
 		}
 		if (!cdp->getUnackedPacketCount())
@@ -2274,12 +2271,12 @@ void process_log_messages(LLMessageSystem* msg, void**)
 	
 	if (log_message)
 	{
-		LL_INFOS("Messaging") << "Starting logging via message" << llendl;
+		LL_INFOS("Messaging") << "Starting logging via message" << LL_ENDL;
 		msg->startLogging();
 	}
 	else
 	{
-		LL_INFOS("Messaging") << "Stopping logging via message" << llendl;
+		LL_INFOS("Messaging") << "Stopping logging via message" << LL_ENDL;
 		msg->stopLogging();
 	}
 }*/
@@ -2299,7 +2296,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
 	if (!cdp)
 	{
 		LL_WARNS("Messaging") << "Attempt to create trusted circuit without circuit data: "
-				<< msg->getSender() << llendl;
+				<< msg->getSender() << LL_ENDL;
 		return;
 	}
 
@@ -2318,13 +2315,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
 		if( msg->getBlockUntrustedInterface() )
 		{
 			LL_WARNS("Messaging") << "Ignoring CreateTrustedCircuit on public interface from host: "
-				<< msg->getSender() << llendl;
+				<< msg->getSender() << LL_ENDL;
 			return;
 		}
 		else
 		{
 			LL_WARNS("Messaging") << "Processing CreateTrustedCircuit on public interface from host: "
-				<< msg->getSender() << llendl;
+				<< msg->getSender() << LL_ENDL;
 		}
 	}
 
@@ -2340,7 +2337,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
 	if(msg->isMatchingDigestForWindowAndUUIDs(their_digest, TRUST_TIME_WINDOW, local_id, remote_id))
 	{
 		cdp->setTrusted(TRUE);
-		LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << llendl;
+		LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << LL_ENDL;
 		return;
 	}
 	else if (cdp->getTrusted())
@@ -2350,13 +2347,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
 		// the message system is being slow.  Don't bother sending the deny, as it may continually
 		// ping-pong back and forth on a very hosed circuit.
 		LL_WARNS("Messaging") << "Ignoring bad digest from known trusted circuit: " << their_digest
-			<< " host: " << msg->getSender() << llendl;
+			<< " host: " << msg->getSender() << LL_ENDL;
 		return;
 	}
 	else
 	{
 		LL_WARNS("Messaging") << "Bad digest from known circuit: " << their_digest
-				<< " host: " << msg->getSender() << llendl;
+				<< " host: " << msg->getSender() << LL_ENDL;
 		msg->sendDenyTrustedCircuit(msg->getSender());
 		return;
 	}
@@ -2392,13 +2389,13 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
 		if( msg->getBlockUntrustedInterface() )
 		{
 			LL_WARNS("Messaging") << "Ignoring DenyTrustedCircuit on public interface from host: "
-				<< msg->getSender() << llendl;
+				<< msg->getSender() << LL_ENDL;
 			return;
 		}
 		else
 		{
 			LL_WARNS("Messaging") << "Processing DenyTrustedCircuit on public interface from host: "
-				<< msg->getSender() << llendl;
+				<< msg->getSender() << LL_ENDL;
 		}
 	}
 
@@ -2411,7 +2408,7 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
 	// *TODO: probably should keep a count of number of resends
 	// per circuit, and stop resending after a while.
 	LL_INFOS("Messaging") << "Got DenyTrustedCircuit. Sending CreateTrustedCircuit to "
-			<< msg->getSender() << llendl;
+			<< msg->getSender() << LL_ENDL;
 	msg->sendCreateTrustedCircuit(msg->getSender(), local_id, remote_id);
 }
 
@@ -2527,11 +2524,11 @@ bool start_messaging_system(
 		if (gMessageSystem->mMessageFileVersionNumber != gPrehashVersionNumber)
 		{
 			LL_INFOS("AppInit") << "Message template version does not match prehash version number" << LL_ENDL;
-			LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << llendl;
+			LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << LL_ENDL;
 		}
 		else
 		{
-			LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << llendl;
+			LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << LL_ENDL;
 		}
 	}
 
@@ -2577,7 +2574,7 @@ void LLMessageSystem::startLogging()
 	str << "\t<-\tincoming message" <<std::endl;
 	str << "\t->\toutgoing message" << std::endl;
 	str << "     <>        host           size    zero      id name";
-	LL_INFOS("Messaging") << str.str() << llendl;
+	LL_INFOS("Messaging") << str.str() << LL_ENDL;
 }
 
 void LLMessageSystem::stopLogging()
@@ -2585,7 +2582,7 @@ void LLMessageSystem::stopLogging()
 	if(mVerboseLog)
 	{
 		mVerboseLog = FALSE;
-		LL_INFOS("Messaging") << "END MESSAGE LOG" << llendl;
+		LL_INFOS("Messaging") << "END MESSAGE LOG" << LL_ENDL;
 	}
 }
 
@@ -2693,7 +2690,7 @@ void end_messaging_system(bool print_summary)
 		{
 			std::ostringstream str;
 			gMessageSystem->summarizeLogs(str);
-			LL_INFOS("Messaging") << str.str().c_str() << llendl;
+			LL_INFOS("Messaging") << str.str().c_str() << LL_ENDL;
 		}
 
 		delete gMessageSystem;
@@ -2746,7 +2743,7 @@ void LLMessageSystem::dumpReceiveCounts()
 
 	if(mNumMessageCounts > 0)
 	{
-		LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl;
+		LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << LL_ENDL;
 		for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(),
 				 end = mMessageTemplates.end();
 			 iter != end; iter++)
@@ -2755,7 +2752,7 @@ void LLMessageSystem::dumpReceiveCounts()
 			if (mt->mReceiveCount > 0)
 			{
 				LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes
-						<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl;
+						<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << LL_ENDL;
 			}
 		}
 	}
@@ -2872,7 +2869,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
 	if ((*data_size ) < LL_MINIMUM_VALID_PACKET_SIZE)
 	{
 		LL_WARNS("Messaging") << "zeroCodeExpand() called with data_size of " << *data_size
-			<< llendl;
+			<< LL_ENDL;
 	}
 
 	mTotalBytesIn += *data_size;
@@ -2911,7 +2908,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
 	{
 		if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-1]))
 		{
-			LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << llendl;
+			LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << LL_ENDL;
 			callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
 			outptr = mEncodedRecvBuffer;					
 			break;
@@ -2923,7 +2920,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
 				*outptr++ = *inptr++;
   				if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-256]))
   				{
-  					LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << llendl;
+  					LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << LL_ENDL;
 					callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
 					outptr = mEncodedRecvBuffer;
 					count = -1;
@@ -2942,7 +2939,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
 			{
   				if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-(*inptr)]))
 				{
-  					LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << llendl;
+  					LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << LL_ENDL;
 					callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
 					outptr = mEncodedRecvBuffer;					
 				}
@@ -2966,7 +2963,7 @@ void LLMessageSystem::addTemplate(LLMessageTemplate *templatep)
 	if (mMessageTemplates.count(templatep->mName) > 0)
 	{	
 		LL_ERRS("Messaging") << templatep->mName << " already  used as a template name!"
-			<< llendl;
+			<< LL_ENDL;
 	}
 	mMessageTemplates[templatep->mName] = templatep;
 	mMessageNumbers[templatep->mMessageNumber] = templatep;
@@ -2982,7 +2979,7 @@ void LLMessageSystem::setHandlerFuncFast(const char *name, void (*handler_func)(
 	}
 	else
 	{
-		LL_ERRS("Messaging") << name << " is not a known message name!" << llendl;
+		LL_ERRS("Messaging") << name << " is not a known message name!" << LL_ENDL;
 	}
 }
 
@@ -2995,7 +2992,7 @@ bool LLMessageSystem::callHandler(const char *name,
 	if(iter == mMessageTemplates.end())
 	{
 		LL_WARNS("Messaging") << "LLMessageSystem::callHandler: unknown message " 
-			<< name << llendl;
+			<< name << LL_ENDL;
 		return false;
 	}
 
@@ -3006,7 +3003,7 @@ bool LLMessageSystem::callHandler(const char *name,
 			<< name 
 			<< " from "
 			<< (trustedSource ? "trusted " : "untrusted ")
-			<< "source" << llendl;
+			<< "source" << LL_ENDL;
 		return false;
 	}
 
@@ -3142,7 +3139,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << LL_ENDL;
 	}
 
 	U32 now = (U32)time(NULL);
@@ -3161,7 +3158,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << LL_ENDL;
 	}
 	
 	char our_digest[MD5HEX_STR_SIZE];	/* Flawfinder: ignore */
@@ -3208,7 +3205,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << LL_ENDL;
 	}
 
 	U32 now = (U32)time(NULL);
@@ -3227,7 +3224,7 @@ bool LLMessageSystem::isMatchingDigestForWindow(const char* digest, S32 const wi
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << LL_ENDL;
 	}
 	
 	char our_digest[MD5HEX_STR_SIZE];	/* Flawfinder: ignore */
@@ -3261,12 +3258,12 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID
 	char digest[MD5HEX_STR_SIZE];	/* Flawfinder: ignore */
 	if (id1.isNull())
 	{
-		LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << llendl;
+		LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << LL_ENDL;
 		return;
 	}
 	if (id2.isNull())
 	{
-		LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << llendl;
+		LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << LL_ENDL;
 		return;
 	}
 	generateDigestForWindowAndUUIDs(digest, TRUST_TIME_WINDOW, id1, id2);
@@ -3274,7 +3271,7 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID
 	nextBlockFast(_PREHASH_DataBlock);
 	addUUIDFast(_PREHASH_EndPointID, id1);
 	addBinaryDataFast(_PREHASH_Digest, digest, MD5HEX_STR_BYTES);
-	LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << llendl;
+	LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << LL_ENDL;
 	sendMessage(host);
 }
 
@@ -3288,10 +3285,10 @@ void LLMessageSystem::reallySendDenyTrustedCircuit(const LLHost &host)
 	LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
 	if (!cdp)
 	{
-		LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << llendl;
+		LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << LL_ENDL;
 		return;
 	}
-	LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << llendl;
+	LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << LL_ENDL;
 	newMessageFast(_PREHASH_DenyTrustedCircuit);
 	nextBlockFast(_PREHASH_DataBlock);
 	addUUIDFast(_PREHASH_EndPointID, cdp->getLocalEndPointID());
@@ -3312,7 +3309,7 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
 	std::string shared_secret = get_shared_secret();
 	if(shared_secret.empty())
 	{
-		LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << llendl;
+		LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << LL_ENDL;
 	}
 	LLTimer timeout;
 
@@ -3364,8 +3361,8 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
 
 void LLMessageSystem::dumpPacketToLog()
 {
-	LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << llendl;
-	LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << llendl;
+	LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << LL_ENDL;
+	LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << LL_ENDL;
 	char line_buffer[256];		/* Flawfinder: ignore */
 	S32 i;
 	S32 cur_line_pos = 0;
@@ -3380,13 +3377,13 @@ void LLMessageSystem::dumpPacketToLog()
 		if (cur_line_pos >= 16)
 		{
 			cur_line_pos = 0;
-			LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl;
+			LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << LL_ENDL;
 			cur_line++;
 		}
 	}
 	if (cur_line_pos)
 	{
-		LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl;
+		LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << LL_ENDL;
 	}
 }
 
@@ -3930,7 +3927,7 @@ void LLMessageSystem::getStringFast(const char *block, const char *var,
 {
 	if(buffer_size <= 0)
 	{
-		LL_WARNS("Messaging") << "buffer_size <= 0" << llendl;
+		LL_WARNS("Messaging") << "buffer_size <= 0" << LL_ENDL;
 	}
 	mMessageReader->getString(block, var, buffer_size, s, blocknum);
 }
@@ -4039,7 +4036,7 @@ void LLMessageSystem::banUdpMessage(const std::string& name)
 	}
 	else
 	{
-		llwarns << "Attempted to ban an unknown message: " << name << "." << llendl;
+		LL_WARNS() << "Attempted to ban an unknown message: " << name << "." << LL_ENDL;
 	}
 }
 const LLHost& LLMessageSystem::getSender() const
diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h
index e94e2282a0f8f722d83d3e9d99366fa92d56ade6..05e384d9395000de2e5ac1b6f5c3752d225c2db8 100755
--- a/indra/llmessage/message.h
+++ b/indra/llmessage/message.h
@@ -45,7 +45,7 @@
 
 #include "llerror.h"
 #include "net.h"
-#include "string_table.h"
+#include "llstringtable.h"
 #include "llcircuit.h"
 #include "lltimer.h"
 #include "llpacketring.h"
diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h
index 0f2437479df8bdd861091fd913a49705de931eef..beb67bae4ea0d6af8020d7dfc4048990e38b631b 100755
--- a/indra/llmessage/net.h
+++ b/indra/llmessage/net.h
@@ -67,5 +67,8 @@ const S32	ETHERNET_MTU_BYTES = 1500;
 const S32	MTUBITS = MTUBYTES*8;
 const S32	MTUU32S = MTUBITS/32;
 
+// For automatic port discovery when running multiple viewers on one host
+const	U32		PORT_DISCOVERY_RANGE_MIN		= 13000;
+const	U32		PORT_DISCOVERY_RANGE_MAX		= PORT_DISCOVERY_RANGE_MIN + 50;
 
 #endif
diff --git a/indra/llmessage/partsyspacket.cpp b/indra/llmessage/partsyspacket.cpp
index ad2161425854f12c2b0d4d953855c32b60796108..b07a0506170b59a774b935f1e9de4b4110f57abf 100755
--- a/indra/llmessage/partsyspacket.cpp
+++ b/indra/llmessage/partsyspacket.cpp
@@ -28,7 +28,7 @@
 #include "linden_common.h"
 
 #include "partsyspacket.h"
-#include "imageids.h"
+#include "indra_constants.h"
 
 // this function is global
 void gSetInitDataDefaults(LLPartInitData *setMe)
diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp
index e5d7f1944837e1e214c30135677d805401cd00e3..cdf5fdb3c62df32044360269f41e4c11296885c7 100755
--- a/indra/llmessage/patch_code.cpp
+++ b/indra/llmessage/patch_code.cpp
@@ -31,7 +31,7 @@
 #include "v3math.h"
 #include "patch_dct.h"
 #include "patch_code.h"
-#include "bitpack.h"
+#include "llbitpack.h"
 
 U32 gPatchSize, gWordBits;
 
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt
index 8173083a85000006a49ef52e0cfa87daac2f334f..d1475cf7342a2fb86751c6254c4c7952f4acad2b 100755
--- a/indra/llprimitive/CMakeLists.txt
+++ b/indra/llprimitive/CMakeLists.txt
@@ -42,6 +42,7 @@ set(llprimitive_HEADER_FILES
     CMakeLists.txt
 
     legacy_object_types.h
+    lllslconstants.h
     llmaterial.h
     llmaterialid.h
     llmaterialtable.h
diff --git a/indra/llcommon/lllslconstants.h b/indra/llprimitive/lllslconstants.h
similarity index 100%
rename from indra/llcommon/lllslconstants.h
rename to indra/llprimitive/lllslconstants.h
diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp
index b4539ebee9f8d909094013d7032813ca5c37b7a8..4709e769c163befedce2e0804202fa6bf97bdd33 100755
--- a/indra/llprimitive/llmaterialtable.cpp
+++ b/indra/llprimitive/llmaterialtable.cpp
@@ -27,10 +27,10 @@
 #include "linden_common.h"
 
 #include "llmaterialtable.h"
+#include "indra_constants.h"
 #include "llstl.h"
 #include "material_codes.h"
 #include "sound_ids.h"
-#include "imageids.h"
 
 LLMaterialTable LLMaterialTable::basic(1);
 
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 2fa77177f58e704f4c7e3eece97e42e90a432041..1b4c68481fb7b246033850192d9ca68f568f5c14 100755
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -38,7 +38,6 @@
 #include "lldatapacker.h"
 #include "llsdutil_math.h"
 #include "llprimtexturelist.h"
-#include "imageids.h"
 #include "llmaterialid.h"
 
 /**
diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h
index 47a21beaaf8fbb0574e86192e84ac7dc8def6599..9edbbff34cbb655e6dcd2a6641d87e9d94eaa64c 100755
--- a/indra/llprimitive/llprimitive.h
+++ b/indra/llprimitive/llprimitive.h
@@ -540,7 +540,7 @@ void LLPrimitive::setPosition(const F32 x, const F32 y, const F32 z)
 	}
 	else
 	{
-		llerrs << "Non Finite in LLPrimitive::setPosition(x,y,z) for " << pCodeToString(mPrimitiveCode) << llendl;
+		LL_ERRS() << "Non Finite in LLPrimitive::setPosition(x,y,z) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
 	}
 }
 
@@ -553,7 +553,7 @@ void LLPrimitive::setPosition(const LLVector3& pos)
 	}
 	else
 	{
-		llerrs << "Non Finite in LLPrimitive::setPosition(LLVector3) for " << pCodeToString(mPrimitiveCode) << llendl;
+		LL_ERRS() << "Non Finite in LLPrimitive::setPosition(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
 	}
 }
 
@@ -565,7 +565,7 @@ void LLPrimitive::setAngularVelocity(const LLVector3& avel)
 	}
 	else
 	{
-		llerror("Non Finite in LLPrimitive::setAngularVelocity", 0);
+		LL_ERRS() << "Non Finite in LLPrimitive::setAngularVelocity" << LL_ENDL;
 	}
 }
 
@@ -577,7 +577,7 @@ void LLPrimitive::setAngularVelocity(const F32 x, const F32 y, const F32 z)
 	}
 	else
 	{
-		llerror("Non Finite in LLPrimitive::setAngularVelocity", 0);
+		LL_ERRS() << "Non Finite in LLPrimitive::setAngularVelocity" << LL_ENDL;
 	}
 }
 
@@ -589,7 +589,7 @@ void LLPrimitive::setVelocity(const LLVector3& vel)
 	}
 	else
 	{
-		llerrs << "Non Finite in LLPrimitive::setVelocity(LLVector3) for " << pCodeToString(mPrimitiveCode) << llendl;
+		LL_ERRS() << "Non Finite in LLPrimitive::setVelocity(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
 	}
 }
 
@@ -601,7 +601,7 @@ void LLPrimitive::setVelocity(const F32 x, const F32 y, const F32 z)
 	}
 	else
 	{
-		llerrs << "Non Finite in LLPrimitive::setVelocity(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << llendl;
+		LL_ERRS() << "Non Finite in LLPrimitive::setVelocity(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
 	}
 }
 
@@ -613,7 +613,7 @@ void LLPrimitive::setVelocityX(const F32 x)
 	}
 	else
 	{
-		llerror("Non Finite in LLPrimitive::setVelocityX", 0);
+		LL_ERRS() << "Non Finite in LLPrimitive::setVelocityX" << LL_ENDL;
 	}
 }
 
@@ -625,7 +625,7 @@ void LLPrimitive::setVelocityY(const F32 y)
 	}
 	else
 	{
-		llerror("Non Finite in LLPrimitive::setVelocityY", 0);
+		LL_ERRS() << "Non Finite in LLPrimitive::setVelocityY" << LL_ENDL;
 	}
 }
 
@@ -637,7 +637,7 @@ void LLPrimitive::setVelocityZ(const F32 z)
 	}
 	else
 	{
-		llerror("Non Finite in LLPrimitive::setVelocityZ", 0);
+		LL_ERRS() << "Non Finite in LLPrimitive::setVelocityZ" << LL_ENDL;
 	}
 }
 
@@ -649,7 +649,7 @@ void LLPrimitive::addVelocity(const LLVector3& vel)
 	}
 	else
 	{
-		llerror("Non Finite in LLPrimitive::addVelocity", 0);
+		LL_ERRS() << Non Finite in LLPrimitive::addVelocity" << LL_ENDL;
 	}
 }
 
@@ -661,7 +661,7 @@ void LLPrimitive::setAcceleration(const LLVector3& accel)
 	}
 	else
 	{
-		llerrs << "Non Finite in LLPrimitive::setAcceleration(LLVector3) for " << pCodeToString(mPrimitiveCode) << llendl;
+		LL_ERRS() << "Non Finite in LLPrimitive::setAcceleration(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
 	}
 }
 
@@ -673,7 +673,7 @@ void LLPrimitive::setAcceleration(const F32 x, const F32 y, const F32 z)
 	}
 	else
 	{
-		llerrs << "Non Finite in LLPrimitive::setAcceleration(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << llendl;
+		LL_ERRS() << "Non Finite in LLPrimitive::setAcceleration(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << LL_ENDL;
 	}
 }
 #endif // CHECK_FOR_FINITE
diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp
index 16e5f894e24c2e0543b7aaa4c08664b76a17cffd..b072ce3964c382ba43cdb2a5d9dc66f769afb5cc 100755
--- a/indra/llprimitive/tests/llmediaentry_test.cpp
+++ b/indra/llprimitive/tests/llmediaentry_test.cpp
@@ -39,7 +39,7 @@
 #include "llsdserialize.h"
 
 #include "../llmediaentry.h"
-#include "lllslconstants.h"
+#include "indra_constants.h"
 
 #define DEFAULT_MEDIA_ENTRY "<llsd>\n\
  <map>\n\
diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp
index c0045c80447bd22dd940d9ae39a149c558f8261e..e4279ea1e05568c4d8dac4300b924e422c91f45b 100755
--- a/indra/llrender/llpostprocess.cpp
+++ b/indra/llrender/llpostprocess.cpp
@@ -58,7 +58,7 @@ LLPostProcess::LLPostProcess(void) :
 					
 	/*  Do nothing.  Needs to be updated to use our current shader system, and to work with the move into llrender.
 	std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME));
-	LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL;
+	LL_DEBUGS("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL;
 
 	llifstream effectsXML(pathName);
 
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index c4270a62bd85321936aa8f8031a09158d45a8365..b3864b3711b057d8e871fffc777ed0b07f70fd98 100755
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -142,6 +142,7 @@ set(llui_HEADER_FILES
     llbutton.h
     llcallbackmap.h
     llchatentry.h
+    llchat.h
     llcheckboxctrl.h
     llclipboard.h
     llcombobox.h
@@ -281,7 +282,9 @@ if(LL_TESTS)
   include(LLAddBuildTest)
   SET(llui_TEST_SOURCE_FILES
       llurlmatch.cpp
-      llurlentry.cpp
       )
   LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}")
+  # INTEGRATION TESTS
+  set(test_libs llui llmessage llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
+  LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}")
 endif(LL_TESTS)
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index ce4d1374788acf4d3dcf29ae41a5975e616488d0..ed12f686a1722f635e55128fd79c853a114c265a 100755
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -591,7 +591,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
 
 		// We only handle the click if the click both started and ended within us
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl;
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << llendl;
 	}
 	return TRUE;
 }
diff --git a/indra/llcommon/llchat.h b/indra/llui/llchat.h
similarity index 100%
rename from indra/llcommon/llchat.h
rename to indra/llui/llchat.h
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp
index 14173fdbb0a6f9fdbb228896fd113b411875f50a..1d18cb2bb039173911f85608e27903314d7d0a01 100755
--- a/indra/llui/llclipboard.cpp
+++ b/indra/llui/llclipboard.cpp
@@ -88,6 +88,7 @@ bool LLClipboard::pasteFromClipboard(std::vector<LLUUID>& inv_objects) const
 {
 	bool res = false;
 	S32 count = mObjects.size();
+	inv_objects.reserve(inv_objects.size() + count);
 	if (count > 0)
 	{
 		res = true;
diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h
index fd2e7610df4bda53d4809748478a2479fa2b84a8..58d80e26876419977f48b4f216dbb780a5a76609 100755
--- a/indra/llui/llclipboard.h
+++ b/indra/llui/llclipboard.h
@@ -31,7 +31,6 @@
 
 #include "llstring.h"
 #include "lluuid.h"
-#include "stdenums.h"
 #include "llsingleton.h"
 #include "llassettype.h"
 #include "llinventory.h"
diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h
index 2cdcbd88fee61ebe638c8ce09792e898ed5e2a20..a7b089c8f92571f166644ad8b9fdf0151d13e16b 100755
--- a/indra/llui/llctrlselectioninterface.h
+++ b/indra/llui/llctrlselectioninterface.h
@@ -28,8 +28,8 @@
 #define LLCTRLSELECTIONINTERFACE_H
 
 #include "stdtypes.h"
-#include "stdenums.h"
 #include "llstring.h"
+#include "llui.h"
 
 class LLSD;
 class LLUUID;
diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp
index 5f69c6af31581b1024312c947e7abe332afbfb47..a36bc4743e036b4a1c11d8610ff5602974881693 100755
--- a/indra/llui/lldraghandle.cpp
+++ b/indra/llui/lldraghandle.cpp
@@ -365,13 +365,13 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask)
 		mDragLastScreenY += delta_y;
 
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" <<llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" <<llendl;		
 		handled = TRUE;
 	}
 	else
 	{
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << llendl;		
 		handled = TRUE;
 	}
 
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 97a52fada4a01c4162d3238478580b14452799ec..43c22f8bf3e453239f11877472e64415dfc00117 100755
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -520,7 +520,7 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
 
 	if (!item_pair->first) 
 	{
-		llwarning("Attempt to selet an item pair containing null panel item", 0);
+		LL_WARNS() << "Attempt to selet an item pair containing null panel item" << LL_ENDL;
 		return;
 	}
 
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index d06e2c93342e102d742b12f1316487997599ca0a..11802904e4470348cff811646a1171f1f3078209 100755
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -653,7 +653,7 @@ void LLFloater::onVisibilityChange ( BOOL new_visibility )
 
 void LLFloater::openFloater(const LLSD& key)
 {
-	llinfos << "Opening floater " << getName() << llendl;
+	LL_INFOS() << "Opening floater " << getName() << LL_ENDL;
 	mKey = key; // in case we need to open ourselves again
 	
 	if (getSoundFlags() != SILENT 
@@ -706,7 +706,7 @@ void LLFloater::openFloater(const LLSD& key)
 
 void LLFloater::closeFloater(bool app_quitting)
 {
-	llinfos << "Closing floater " << getName() << llendl;
+	LL_INFOS() << "Closing floater " << getName() << LL_ENDL;
 	if (app_quitting)
 	{
 		LLFloater::sQuitting = true;
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 8aa1eb7cd59b68196cd660c169914ce8b3f30a47..5628baa4a1ec96d72407971792eda80f120556e2 100755
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -255,8 +255,6 @@ LLFolderView::~LLFolderView( void )
 	mRenamer = NULL;
 	mStatusTextBox = NULL;
 
-	mAutoOpenItems.removeAllNodes();
-
 	if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die();
 
 	mAutoOpenItems.removeAllNodes();
@@ -736,7 +734,7 @@ void LLFolderView::removeSelectedItems()
 			}
 			else
 			{
-				llinfos << "Cannot delete " << item->getName() << llendl;
+				LL_INFOS() << "Cannot delete " << item->getName() << LL_ENDL;
 				return;
 			}
 		}
@@ -762,20 +760,21 @@ void LLFolderView::removeSelectedItems()
 		}
 		else if (count > 1)
 		{
-			LLDynamicArray<LLFolderViewModelItem*> listeners;
+			std::vector<LLFolderViewModelItem*> listeners;
 			LLFolderViewModelItem* listener;
 
 			setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
 
+			listeners.reserve(count);
 			for(S32 i = 0; i < count; ++i)
 			{
 				listener = items[i]->getViewModelItem();
-				if(listener && (listeners.find(listener) == LLDynamicArray<LLFolderViewModelItem*>::FAIL))
+				if(listener && (std::find(listeners.begin(), listeners.end(), listener) == listeners.end()))
 				{
-					listeners.put(listener);
+					listeners.push_back(listener);
 				}
 			}
-			listener = static_cast<LLFolderViewModelItem*>(listeners.get(0));
+			listener = static_cast<LLFolderViewModelItem*>(listeners.at(0));
 			if(listener)
 			{
 				listener->removeBatch(listeners);
@@ -1282,7 +1281,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
 
 	if (uni_char > 0x7f)
 	{
-		llwarns << "LLFolderView::handleUnicodeCharHere - Don't handle non-ascii yet, aborting" << llendl;
+		LL_WARNS() << "LLFolderView::handleUnicodeCharHere - Don't handle non-ascii yet, aborting" << LL_ENDL;
 		return FALSE;
 	}
 
@@ -1744,14 +1743,14 @@ void LLFolderView::update()
 
 void LLFolderView::dumpSelectionInformation()
 {
-	llinfos << "LLFolderView::dumpSelectionInformation()" << llendl;
-	llinfos << "****************************************" << llendl;
+	LL_INFOS() << "LLFolderView::dumpSelectionInformation()" << LL_NEWLINE
+				<< "****************************************" << LL_ENDL;
 	selected_items_t::iterator item_it;
 	for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
 	{
-		llinfos << "  " << (*item_it)->getName() << llendl;
+		LL_INFOS() << "  " << (*item_it)->getName() << LL_ENDL;
 	}
-	llinfos << "****************************************" << llendl;
+	LL_INFOS() << "****************************************" << LL_ENDL;
 }
 
 void LLFolderView::updateRenamerPosition()
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 11fccdace440cb00f692c709961f3526a466ae5b..652e22c7bcb2d9579b98581afae59d325676df44 100755
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -39,7 +39,6 @@
 
 #include "lluictrl.h"
 #include "v4color.h"
-#include "stdenums.h"
 #include "lldepthstack.h"
 #include "lleditmenuhandler.h"
 #include "llfontgl.h"
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index c7910cb883e79f24aeaae1a05bd84cedb1186039..b5ac7db4e70a2186d94d1205cc3072293afccf96 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -636,7 +636,7 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 	}
 	if (handled)
 	{
-		lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewItem" << llendl;
+		LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFolderViewItem" << llendl;
 	}
 
 	return handled;
@@ -1753,7 +1753,7 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask,
 	{
 		handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
 
-		lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewFolder" << llendl;
+		LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFolderViewFolder" << llendl;
 	}
 
 	return TRUE;
diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h
index efa0925a4a9364b493d44ab096ae723f100962a1..a19bb99d9dc8786cc2691a5c1c8c9f25fb1eb9f9 100755
--- a/indra/llui/lliconctrl.h
+++ b/indra/llui/lliconctrl.h
@@ -31,7 +31,6 @@
 #include "v4color.h"
 #include "lluictrl.h"
 #include "lluiimage.h"
-#include "stdenums.h"
 
 class LLTextBox;
 class LLUICtrlFactory;
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 795dacdbb069702ee69888eba6cd72200847c316..0d232cc2cf9ba1613a7b1d649c2e2827884047a8 100755
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -94,7 +94,7 @@ BOOL LLKeywords::loadFromFile( const std::string& filename )
 	file.open(filename);	/* Flawfinder: ignore */
 	if( file.fail() )
 	{
-		llinfos << "LLKeywords::loadFromFile()  Unable to open file: " << filename << llendl;
+		LL_INFOS() << "LLKeywords::loadFromFile()  Unable to open file: " << filename << LL_ENDL;
 		return mLoaded;
 	}
 
@@ -102,7 +102,7 @@ BOOL LLKeywords::loadFromFile( const std::string& filename )
 	file >> buffer;
 	if( strcmp( buffer, "llkeywords" ) )
 	{
-		llinfos << filename << " does not appear to be a keyword file" << llendl;
+		LL_INFOS() << filename << " does not appear to be a keyword file" << LL_ENDL;
 		return mLoaded;
 	}
 
@@ -112,7 +112,7 @@ BOOL LLKeywords::loadFromFile( const std::string& filename )
 	file >> version_num;
 	if( strcmp(buffer, "version") || version_num != (U32)KEYWORD_FILE_CURRENT_VERSION )
 	{
-		llinfos << filename << " does not appear to be a version " << KEYWORD_FILE_CURRENT_VERSION << " keyword file" << llendl;
+		LL_INFOS() << filename << " does not appear to be a version " << KEYWORD_FILE_CURRENT_VERSION << " keyword file" << LL_ENDL;
 		return mLoaded;
 	}
 
@@ -342,7 +342,7 @@ LLColor3 LLKeywords::readColor( const std::string& s )
 	S32 values_read = sscanf(s.c_str(), "%f, %f, %f]", &r, &g, &b );
 	if( values_read != 3 )
 	{
-		llinfos << " poorly formed color in keyword file" << llendl;
+		LL_INFOS() << " poorly formed color in keyword file" << LL_ENDL;
 	}
 	return LLColor3( r, g, b );
 }
@@ -553,7 +553,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
 						S32 seg_start = cur - base;
 						S32 seg_end = seg_start + seg_len;
 
-						// llinfos << "Seg: [" << word.c_str() << "]" << llendl;
+						// LL_INFOS() << "Seg: [" << word.c_str() << "]" << LL_ENDL;
 
 						insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, defaultColor, editor);
 					}
@@ -620,10 +620,10 @@ void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSe
 #ifdef _DEBUG
 void LLKeywords::dump()
 {
-	llinfos << "LLKeywords" << llendl;
+	LL_INFOS() << "LLKeywords" << LL_ENDL;
 
 
-	llinfos << "LLKeywords::sWordTokenMap" << llendl;
+	LL_INFOS() << "LLKeywords::sWordTokenMap" << LL_ENDL;
 	word_token_map_t::iterator word_token_iter = mWordTokenMap.begin();
 	while( word_token_iter != mWordTokenMap.end() )
 	{
@@ -632,7 +632,7 @@ void LLKeywords::dump()
 		++word_token_iter;
 	}
 
-	llinfos << "LLKeywords::sLineTokenList" << llendl;
+	LL_INFOS() << "LLKeywords::sLineTokenList" << LL_ENDL;
 	for (token_list_t::iterator iter = mLineTokenList.begin();
 		 iter != mLineTokenList.end(); ++iter)
 	{
@@ -641,7 +641,7 @@ void LLKeywords::dump()
 	}
 
 
-	llinfos << "LLKeywords::sDelimiterTokenList" << llendl;
+	LL_INFOS() << "LLKeywords::sDelimiterTokenList" << LL_ENDL;
 	for (token_list_t::iterator iter = mDelimiterTokenList.begin();
 		 iter != mDelimiterTokenList.end(); ++iter)
 	{
@@ -652,12 +652,12 @@ void LLKeywords::dump()
 
 void LLKeywordToken::dump()
 {
-	llinfos << "[" << 
+	LL_INFOS() << "[" << 
 		mColor.mV[VX] << ", " <<
 		mColor.mV[VY] << ", " <<
 		mColor.mV[VZ] << "] [" <<
 		wstring_to_utf8str(mToken) << "]" <<
-		llendl;
+		LL_ENDL;
 }
 
 #endif  // DEBUG
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 5478e85e13a01842bb4f359d95e2167d398491b5..f2e9843bf381d16ab58b67032157b8d5d9170912 100755
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -855,14 +855,14 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
 		mKeystrokeTimer.reset();
 
 		getWindow()->setCursor(UI_CURSOR_IBEAM);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << llendl;		
 		handled = TRUE;
 	}
 
 	if( !handled  )
 	{
 		getWindow()->setCursor(UI_CURSOR_IBEAM);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << llendl;		
 		handled = TRUE;
 	}
 
diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp
index 8c2be449045f563a837530eba4d6abb30d366eb7..8aefef07e24ce667a8fff09fd8759cf18acc1bad 100755
--- a/indra/llui/llmodaldialog.cpp
+++ b/indra/llui/llmodaldialog.cpp
@@ -181,7 +181,7 @@ BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask)
 	if( childrenHandleHover(x, y, mask) == NULL )
 	{
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << llendl;		
 	}
 	return TRUE;
 }
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index 70bcfb5b4f92053621f45dbdb48902a0444c954f..17d07f4daeb046a38a3e24a27e0d965106c25afa 100755
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -356,12 +356,12 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask)
 		onCommit();
 
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << llendl;		
 	}
 	else
 	{
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << llendl;		
 	}
 	return TRUE;
 }
diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp
index 820e7cb26af36021a92d63c11645700fab644a1c..7488af2e05ad180b3ee78cb2f19364007d59f4cd 100755
--- a/indra/llui/llresmgr.cpp
+++ b/indra/llui/llresmgr.cpp
@@ -45,33 +45,6 @@ LLResMgr::LLResMgr()
 void LLResMgr::setLocale( LLLOCALE_ID locale_id )
 {
 	mLocale = locale_id;
-
-	//RN: for now, use normal 'C' locale for everything but specific UI input/output routines
-//	switch( locale_id )
-//	{
-//	case LLLOCALE_USA: 
-//#if LL_WINDOWS
-//		// Windows doesn't use ISO country codes.
-//		llinfos << "Setting locale to " << setlocale( LC_ALL, "english-usa" ) << llendl;
-//#else	
-//		// posix version should work everywhere else.
-//		llinfos << "Setting locale to " << setlocale( LC_ALL, "en_US" ) << llendl;
-//#endif
-//		break;
-//	case LLLOCALE_UK:
-//#if LL_WINDOWS
-//		// Windows doesn't use ISO country codes.
-//		llinfos << "Setting locale to " << setlocale( LC_ALL, "english-uk" ) << llendl;
-//#else
-//		// posix version should work everywhere else.
-//		llinfos << "Setting locale to " << setlocale( LC_ALL, "en_GB" ) << llendl;
-//#endif
-//		break;
-//	default:
-//		llassert(0);
-//		setLocale(LLLOCALE_USA);
-//		break;
-//	}
 }
 
 char LLResMgr::getDecimalPoint() const					
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index bef18547481751ece00f3f7857f32c250ecd1c3c..f92e8f41ea396da209e2dde657a83f64556c7b12 100755
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -381,7 +381,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
 		}
 
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << llendl;		
 		handled = TRUE;
 	}
 	else
@@ -393,7 +393,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
 	if( !handled )
 	{
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)"  << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)"  << llendl;		
 		handled = TRUE;
 	}
 
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index 3b5fb2adfba3d9326d8a0fa7900ca9bb84ffea90..93eea75952bdfd355224c6fb0ac877c48f9dbb68 100755
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -155,7 +155,6 @@ LLScrollContainer::~LLScrollContainer( void )
 // virtual
 void LLScrollContainer::scrollHorizontal( S32 new_pos )
 {
-	//llinfos << "LLScrollContainer::scrollHorizontal()" << llendl;
 	if( mScrolledView )
 	{
 		LLRect doc_rect = mScrolledView->getRect();
@@ -167,7 +166,6 @@ void LLScrollContainer::scrollHorizontal( S32 new_pos )
 // virtual
 void LLScrollContainer::scrollVertical( S32 new_pos )
 {
-	// llinfos << "LLScrollContainer::scrollVertical() " << new_pos << llendl;
 	if( mScrolledView )
 	{
 		LLRect doc_rect = mScrolledView->getRect();
diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h
index b67236c9398de0d35656642476cb5d90a5989c32..f64cf43a8ed48ce2c8863979535bdf4e3e5fd4b8 100755
--- a/indra/llui/llscrollcontainer.h
+++ b/indra/llui/llscrollcontainer.h
@@ -31,7 +31,6 @@
 #ifndef LL_V4COLOR_H
 #include "v4color.h"
 #endif
-#include "stdenums.h"
 #include "llcoord.h"
 #include "llscrollbar.h"
 
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 7f04c92b27c07ad7da55d8dc2915671d68fefb64..f335b5dec3515900702792a4e36c879f3eb44685 100755
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1464,8 +1464,6 @@ void LLScrollListCtrl::drawItems()
 				mLineHeight );
 			item->setRect(item_rect);
 
-			//llinfos << item_rect.getWidth() << llendl;
-
 			max_columns = llmax(max_columns, item->getNumColumns());
 
 			LLColor4 fg_color;
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 8fa06cc49945016319424c4ddb494fb40a59413f..40a49074c1b370e48c63a1a701d564c7f5d49f4e 100755
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -34,7 +34,6 @@
 
 #include "lluictrl.h"
 #include "llctrlselectioninterface.h"
-//#include "lldarray.h"
 #include "llfontgl.h"
 #include "llui.h"
 #include "llstring.h"	// LLWString
diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp
index db72234f94d95ff7f4f5d491168acfa8c228362a..ddddbe6f30028ad16f714f93e08cbb2402d0a890 100755
--- a/indra/llui/llslider.cpp
+++ b/indra/llui/llslider.cpp
@@ -188,12 +188,12 @@ BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask)
 			setValueAndCommit(t * (mMaxValue - mMinValue) + mMinValue );
 		}
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << llendl;
 	}
 	else
 	{
 		getWindow()->setCursor(UI_CURSOR_ARROW);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << llendl;		
 	}
 	return TRUE;
 }
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 2543bd8f0afaa8295ab9baa6d46a637c50f49d73..1af36c6fdb5233060d6154dc102e5cd8e46e3070 100755
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -152,9 +152,9 @@ LLStatBar::LLStatBar(const Params& p)
 	mCurMaxBar(p.bar_max),
     mCurMinBar(0),
 	mDecimalDigits(p.decimal_digits),
-	mNumFrames(p.num_frames),
+	mNumHistoryFrames(p.num_frames),
+	mNumShortHistoryFrames(p.num_frames_short),
 	mMaxHeight(p.max_height),
-	mPerSec(p.show_per_sec),
 	mDisplayBar(p.show_bar),
 	mDisplayHistory(p.show_history),
 	mOrientation(p.orientation),
@@ -221,36 +221,28 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
 
 void LLStatBar::draw()
 {
-	F32 current = 0, 
-		min     = 0, 
-		max     = 0,
-		mean    = 0;
+	F32 current		= 0, 
+		min			= 0, 
+		max			= 0,
+		mean		= 0;
 
     bool show_data = false;
     
 	LLLocalClipRect _(getLocalRect());
 	LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
 
+	S32 num_frames = mDisplayHistory ? mNumHistoryFrames : mNumShortHistoryFrames;
+
 	std::string unit_label;
 	if (mCountFloatp)
 	{
 		LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); 
 		unit_label = mUnitLabel.empty() ? mCountFloatp->getUnitLabel() : mUnitLabel;
-		if (mPerSec)
-		{
-			unit_label += "/s";
-			current = last_frame_recording.getPerSec(*mCountFloatp);
-			min     = frame_recording.getPeriodMinPerSec(*mCountFloatp, mNumFrames);
-			max     = frame_recording.getPeriodMaxPerSec(*mCountFloatp, mNumFrames);
-			mean    = frame_recording.getPeriodMeanPerSec(*mCountFloatp, mNumFrames);
-		}
-		else
-		{
-			current = last_frame_recording.getSum(*mCountFloatp);
-			min     = frame_recording.getPeriodMin(*mCountFloatp, mNumFrames);
-			max     = frame_recording.getPeriodMax(*mCountFloatp, mNumFrames);
-			mean    = frame_recording.getPeriodMean(*mCountFloatp, mNumFrames);
-		}
+		unit_label += "/s";
+		current = last_frame_recording.getPerSec(*mCountFloatp);
+		min     = frame_recording.getPeriodMinPerSec(*mCountFloatp, num_frames);
+		max     = frame_recording.getPeriodMaxPerSec(*mCountFloatp, num_frames);
+		mean    = frame_recording.getPeriodMeanPerSec(*mCountFloatp, num_frames);
 
 		// always show count-style data
 		show_data = true;
@@ -262,11 +254,11 @@ void LLStatBar::draw()
 
 		// only show data if there is an event in the relevant time period
 		current = last_frame_recording.getMean(*mEventFloatp);
-		min     = frame_recording.getPeriodMin(*mEventFloatp, mNumFrames);
-		max     = frame_recording.getPeriodMax(*mEventFloatp, mNumFrames);
-		mean    = frame_recording.getPeriodMean(*mEventFloatp, mNumFrames);
-		
-		show_data = frame_recording.getSampleCount(*mEventFloatp, mNumFrames) != 0;
+		min     = frame_recording.getPeriodMin(*mEventFloatp, num_frames);
+		max     = frame_recording.getPeriodMax(*mEventFloatp, num_frames);
+		mean    = frame_recording.getPeriodMean(*mEventFloatp, num_frames);
+
+		show_data = frame_recording.getSampleCount(*mEventFloatp, num_frames) != 0;
 	}
 	else if (mSampleFloatp)
 	{
@@ -275,9 +267,9 @@ void LLStatBar::draw()
 		unit_label = mUnitLabel.empty() ? mSampleFloatp->getUnitLabel() : mUnitLabel;
 
 		current = last_frame_recording.getMean(*mSampleFloatp);
-		min     = frame_recording.getPeriodMin(*mSampleFloatp, mNumFrames);
-		max     = frame_recording.getPeriodMax(*mSampleFloatp, mNumFrames);
-		mean    = frame_recording.getPeriodMean(*mSampleFloatp, mNumFrames);
+		min     = frame_recording.getPeriodMin(*mSampleFloatp, num_frames);
+		max     = frame_recording.getPeriodMax(*mSampleFloatp, num_frames);
+		mean    = frame_recording.getPeriodMean(*mSampleFloatp, num_frames);
 
 		// always show sample data if we've ever grabbed any samples
 		show_data = mSampleFloatp->getPrimaryAccumulator()->hasValue();
@@ -472,18 +464,16 @@ void LLStatBar::draw()
                 S32 i;
                 gGL.color4f( 1.f, 0.f, 0.f, 1.f );
                 gGL.begin( LLRender::QUADS );
-                const S32 max_frame = llmin(mNumFrames, num_values);
+                const S32 max_frame = llmin(num_frames, num_values);
                 U32 num_samples = 0;
                 for (i = 1; i <= max_frame; i++)
                 {
-                    F32 offset = ((F32)i / (F32)mNumFrames) * span;
+                    F32 offset = ((F32)i / (F32)num_frames) * span;
                     LLTrace::Recording& recording = frame_recording.getPrevRecording(i);
 
                     if (mCountFloatp)
                     {
-                        value       = mPerSec 
-                                        ? recording.getPerSec(*mCountFloatp) 
-                                        : recording.getSum(*mCountFloatp);
+                        value       = recording.getPerSec(*mCountFloatp);
                         num_samples = recording.getSampleCount(*mCountFloatp);
                     }
                     else if (mEventFloatp)
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index fc925b1a74a1e4c663573815b055e4f548507852..5aed98fecf0e51414f0b8b182b49176d8834d1cf 100755
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -46,12 +46,12 @@ class LLStatBar : public LLView
 
 		Optional<U32>			decimal_digits;
 
-		Optional<bool>			show_per_sec,
-								show_bar,
+		Optional<bool>			show_bar,
 								show_history,
 								scale_range;
 
 		Optional<S32>			num_frames,
+								num_frames_short,
 								max_height;
 		Optional<std::string>	stat;
 		Optional<EOrientation>	orientation;
@@ -63,11 +63,11 @@ class LLStatBar : public LLView
 			bar_max("bar_max", 0.f),
 			tick_spacing("tick_spacing", 0.f),
 			decimal_digits("decimal_digits", 3),
-			show_per_sec("show_per_sec", true),
 			show_bar("show_bar", false),
 			show_history("show_history", false),
 			scale_range("scale_range", true),
 			num_frames("num_frames", 200),
+			num_frames_short("num_frames_short", 20),
 			max_height("max_height", 100),
 			stat("stat"),
 			orientation("orientation", VERTICAL)
@@ -96,10 +96,10 @@ class LLStatBar : public LLView
 				 mLabelSpacing;
 	F32			 mTickValue;
 	U32          mDecimalDigits;
-	S32			 mNumFrames;
+	S32			 mNumHistoryFrames,
+				 mNumShortHistoryFrames;
 	S32			 mMaxHeight;
-	bool         mPerSec,				// Use the per sec stats.
-				 mDisplayBar,			// Display the bar graph.
+	bool         mDisplayBar,			// Display the bar graph.
 				 mDisplayHistory,
 				 mAutoScaleMax,
 				 mAutoScaleMin;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 834f21309707f71d92f85d9cd2978d62b394fb17..eb5a04d8e5c229af59ff9a1afab9eed65e68dc1c 100755
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -781,7 +781,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
 			setCursorAtLocalPos( clamped_x, clamped_y, true );
 			mSelectionEnd = mCursorPos;
 		}
-		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << llendl;		
 		getWindow()->setCursor(UI_CURSOR_IBEAM);
 		handled = TRUE;
 	}
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 969e0727047f7ff4659d9783bd91914e3229b42b..49b6980c8108a40e2d8f7ac24f43dab9185918fd 100755
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -32,10 +32,8 @@
 #include "llrect.h"
 #include "llkeywords.h"
 #include "llframetimer.h"
-#include "lldarray.h"
 #include "llstyle.h"
 #include "lleditmenuhandler.h"
-#include "lldarray.h"
 #include "llviewborder.h" // for params
 #include "lltextbase.h"
 #include "lltextvalidate.h"
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 4ebfd0fd6e73a2cd44b40ceb1a44a5e9f80e1dd6..f3ed3fcb49562c5c50085cbc65d26d49c31422e5 100755
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -55,6 +55,52 @@ class LLWindow;
 class LLView;
 class LLHelp;
 
+
+// this enum is used by the llview.h (viewer) and the llassetstorage.h (viewer and sim) 
+enum EDragAndDropType
+{
+	DAD_NONE			= 0,
+	DAD_TEXTURE			= 1,
+	DAD_SOUND			= 2,
+	DAD_CALLINGCARD		= 3,
+	DAD_LANDMARK		= 4,
+	DAD_SCRIPT			= 5,
+	DAD_CLOTHING 		= 6,
+	DAD_OBJECT			= 7,
+	DAD_NOTECARD		= 8,
+	DAD_CATEGORY		= 9,
+	DAD_ROOT_CATEGORY 	= 10,
+	DAD_BODYPART		= 11,
+	DAD_ANIMATION		= 12,
+	DAD_GESTURE			= 13,
+	DAD_LINK			= 14,
+	DAD_MESH            = 15,
+	DAD_WIDGET          = 16,
+	DAD_PERSON          = 17,
+	DAD_COUNT           = 18,   // number of types in this enum
+};
+
+// Reasons for drags to be denied.
+// ordered by priority for multi-drag
+enum EAcceptance
+{
+	ACCEPT_POSTPONED,	// we are asynchronously determining acceptance
+	ACCEPT_NO,			// Uninformative, general purpose denial.
+	ACCEPT_NO_LOCKED,	// Operation would be valid, but permissions are set to disallow it.
+	ACCEPT_YES_COPY_SINGLE,	// We'll take a copy of a single item
+	ACCEPT_YES_SINGLE,		// Accepted. OK to drag and drop single item here.
+	ACCEPT_YES_COPY_MULTI,	// We'll take a copy of multiple items
+	ACCEPT_YES_MULTI		// Accepted. OK to drag and drop multiple items here.
+};
+
+enum EAddPosition
+{
+	ADD_TOP,
+	ADD_BOTTOM,
+	ADD_DEFAULT
+};
+
+
 void make_ui_sound(const char* name);
 void make_ui_sound_deferred(const char * name);
 
diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h
index cb40c8558235cf65867575818ac254265c5a3dcb..07e02de6d857acbd31632a6d038d3c28e6e7a097 100755
--- a/indra/llui/lluistring.h
+++ b/indra/llui/lluistring.h
@@ -42,12 +42,12 @@
 // LLUIString mMessage("Welcome [USERNAME] to [SECONDLIFE]!");
 // mMessage.setArg("[USERNAME]", "Steve");
 // mMessage.setArg("[SECONDLIFE]", "Second Life");
-// llinfos << mMessage.getString() << llendl; // outputs "Welcome Steve to Second Life"
+// LL_INFOS() << mMessage.getString() << LL_ENDL; // outputs "Welcome Steve to Second Life"
 // mMessage.setArg("[USERNAME]", "Joe");
-// llinfos << mMessage.getString() << llendl; // outputs "Welcome Joe to Second Life"
+// LL_INFOS() << mMessage.getString() << LL_ENDL; // outputs "Welcome Joe to Second Life"
 // mMessage = "Bienvenido a la [SECONDLIFE] [USERNAME]"
 // mMessage.setArg("[SECONDLIFE]", "Segunda Vida");
-// llinfos << mMessage.getString() << llendl; // outputs "Bienvenido a la Segunda Vida Joe"
+// LL_INFOS() << mMessage.getString() << LL_ENDL; // outputs "Bienvenido a la Segunda Vida Joe"
 
 // Implementation Notes:
 // Attempting to have operator[](const std::string& s) return mArgs[s] fails because we have
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 8c6c32178af66856990ff00967c639d6560afeb4..d4684e2e1e1f04185863f8b36b838c10e781ce34 100755
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -32,6 +32,7 @@
 #include "lluicolor.h"
 #include "llstyle.h"
 
+#include "llavatarname.h"
 #include "llhost.h" // for resolving parcel name by parcel id
 
 #include <boost/signals2.hpp>
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 0568fa889a34aa8901ac22b4266edcd9d4ff2e2b..cd23ce7df1d18fe88cff3c0c47208916fcaf311e 100755
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -42,7 +42,6 @@
 #include "llui.h"
 #include "lluistring.h"
 #include "llviewquery.h"
-#include "stdenums.h"
 #include "lluistring.h"
 #include "llcursortypes.h"
 #include "lluictrlfactory.h"
@@ -67,6 +66,7 @@ const BOOL	NOT_MOUSE_OPAQUE = FALSE;
 
 const U32 GL_NAME_UI_RESERVED = 2;
 
+
 // maintains render state during traversal of UI tree
 class LLViewDrawContext
 {
diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h
index 2c016d2560669373ad832b0a9aad9f678f88732f..a0a13267ac796eadcb69d3b0fd4a3150cbc710ec 100755
--- a/indra/llui/llviewmodel.h
+++ b/indra/llui/llviewmodel.h
@@ -37,9 +37,9 @@
 #include "llpointer.h"
 #include "llsd.h"
 #include "llrefcount.h"
-#include "stdenums.h"
 #include "llstring.h"
 #include "lltrace.h"
+#include "llui.h"
 #include <string>
 
 class LLScrollListItem;
diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt
index 67dce8c0737e7fda21ff4fb057451aeac2e1bc0f..f19fdf48902189137afeefa0df7b8ac0114110fb 100755
--- a/indra/llvfs/CMakeLists.txt
+++ b/indra/llvfs/CMakeLists.txt
@@ -15,7 +15,6 @@ set(llvfs_SOURCE_FILES
     lldir.cpp
     lldiriterator.cpp
     lllfsthread.cpp
-    llpidlock.cpp
     llvfile.cpp
     llvfs.cpp
     llvfsthread.cpp
@@ -28,7 +27,6 @@ set(llvfs_HEADER_FILES
     lldirguard.h
     lldiriterator.h
     lllfsthread.h
-    llpidlock.h
     llvfile.h
     llvfs.h
     llvfsthread.h
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 6899e9a44a3ff73702813ac8efdaa5fa0f8eec60..b7e71b87a8d6d1f21aa7fb19bd41c030e5744853 100755
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -926,22 +926,22 @@ bool LLDir::setCacheDir(const std::string &path)
 
 void LLDir::dumpCurrentDirectories()
 {
-	LL_DEBUGS2("AppInit","Directories") << "Current Directories:" << LL_ENDL;
-
-	LL_DEBUGS2("AppInit","Directories") << "  CurPath:               " << getCurPath() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  AppName:               " << getAppName() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  ExecutableFilename:    " << getExecutableFilename() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  ExecutableDir:         " << getExecutableDir() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  WorkingDir:            " << getWorkingDir() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  AppRODataDir:          " << getAppRODataDir() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  OSUserDir:             " << getOSUserDir() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  OSUserAppDir:          " << getOSUserAppDir() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  LindenUserDir:         " << getLindenUserDir() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  TempDir:               " << getTempDir() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  CAFile:				 " << getCAFile() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  SkinBaseDir:           " << getSkinBaseDir() << LL_ENDL;
-	LL_DEBUGS2("AppInit","Directories") << "  SkinDir:               " << getSkinDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "Current Directories:" << LL_ENDL;
+
+	LL_DEBUGS("AppInit","Directories") << "  CurPath:               " << getCurPath() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  AppName:               " << getAppName() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  ExecutableFilename:    " << getExecutableFilename() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  ExecutableDir:         " << getExecutableDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  WorkingDir:            " << getWorkingDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  AppRODataDir:          " << getAppRODataDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  OSUserDir:             " << getOSUserDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  OSUserAppDir:          " << getOSUserAppDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  LindenUserDir:         " << getLindenUserDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  TempDir:               " << getTempDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  CAFile:				 " << getCAFile() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  SkinBaseDir:           " << getSkinBaseDir() << LL_ENDL;
+	LL_DEBUGS("AppInit","Directories") << "  SkinDir:               " << getSkinDir() << LL_ENDL;
 }
 
 std::string LLDir::add(const std::string& path, const std::string& name) const
diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp
deleted file mode 100755
index 3b83d1b9e3e9edab5f97e4d312e8fd5dbc1e49a1..0000000000000000000000000000000000000000
--- a/indra/llvfs/llpidlock.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/** 
- * @file llformat.cpp
- * @date   January 2007
- * @brief string formatting utility
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#include "llpidlock.h"
-#include "lldir.h"
-#include "llsd.h"
-#include "llsdserialize.h"
-#include "llnametable.h"
-#include "llframetimer.h"
-
-#if LL_WINDOWS   //For windows platform.
-
-#include "llwin32headerslean.h"
-
-namespace {
-	inline DWORD getpid() {
-		return GetCurrentProcessId();
-	}
-}
-
-bool isProcessAlive(U32 pid)
-{
-	return (bool) GetProcessVersion((DWORD)pid);
-}
-
-#else   //Everyone Else
-bool isProcessAlive(U32 pid)
-{   
-	return (bool) kill( (pid_t)pid, 0);
-}
-#endif //Everyone else.
-
-
-	
-class LLPidLockFile
-{
-	public:
-		LLPidLockFile( ) :
-			mAutosave(false),
-			mSaving(false),
-			mWaiting(false),
-			mPID(getpid()),
-			mNameTable(NULL),
-			mClean(true)
-		{
-			mLockName = gDirUtilp->getTempDir() + gDirUtilp->getDirDelimiter() + "savelock";
-		}
-		bool requestLock(LLNameTable<void *> *name_table, bool autosave,
-						bool force_immediate=FALSE, F32 timeout=300.0);
-		bool checkLock();
-		void releaseLock();
-
-	private:
-		void writeLockFile(LLSD pids);
-	public:
-		static LLPidLockFile& instance(); // return the singleton black list file
-			 
-		bool mAutosave;
-		bool mSaving;
-		bool mWaiting;
-		LLFrameTimer mTimer;
-		U32  mPID;
-		std::string mLockName;
-		std::string mSaveName;
-		LLSD mPIDS_sd;
-		LLNameTable<void*> *mNameTable;
-		bool mClean;
-};
-
-LLPidLockFile& LLPidLockFile::instance()
-{   
-	static LLPidLockFile the_file;
-	return the_file;
-}
-
-void LLPidLockFile::writeLockFile(LLSD pids)
-{
-	llofstream ofile(mLockName);
-
-	if (!LLSDSerialize::toXML(pids,ofile))
-	{
-		llwarns << "Unable to write concurrent save lock file." << llendl;
-	}
-	ofile.close();
-}
-
-bool LLPidLockFile::requestLock(LLNameTable<void *> *name_table, bool autosave,
-								bool force_immediate, F32 timeout)
-{
-	bool readyToSave = FALSE;
-
-	if (mSaving) return FALSE;	//Bail out if we're currently saving.  Will not queue another save.
-	
-	if (!mWaiting){
-		mNameTable=name_table;
-		mAutosave = autosave;
-	}
-
-	LLSD out_pids;
-	out_pids.append( (LLSD::Integer)mPID );
-
-	llifstream ifile(mLockName);
-
-	if (ifile.is_open()) 
-	{									//If file exists, we need to decide whether or not to continue.
-		if ( force_immediate
-			|| mTimer.hasExpired() )	//Only deserialize if we REALLY need to.
-		{
-
-			LLSD in_pids;
-
-			LLSDSerialize::fromXML(in_pids, ifile);	
-
-			//Clean up any dead PIDS that might be in there.
-			for (LLSD::array_iterator i=in_pids.beginArray();
-				i !=in_pids.endArray();
-				++i)
-			{
-				U32 stored_pid=(*i).asInteger();
-
-				if (isProcessAlive(stored_pid))
-				{
-					out_pids.append( (*i) );
-				}
-			}
-
-			readyToSave=TRUE;
-		}
-		ifile.close();
-	}
-	else
-	{
-		readyToSave=TRUE;
-	}
-
-	if (!mWaiting)				//Not presently waiting to save.  Queue up.
-	{
-		mTimer.resetWithExpiry(timeout);
-		mWaiting=TRUE;
-	}
-
-	if (readyToSave)
-	{	//Potential race condition won't kill us. Ignore it.
-		writeLockFile(out_pids);
-		mSaving=TRUE;
-	}
-	
-	return readyToSave;
-}
-
-bool LLPidLockFile::checkLock()
-{
-	return mWaiting;
-}
-
-void LLPidLockFile::releaseLock()
-{
-	llifstream ifile(mLockName);
-	LLSD in_pids;
-	LLSD out_pids;
-	bool write_file=FALSE;
-
-	LLSDSerialize::fromXML(in_pids, ifile);	
-
-	//Clean up this PID and any dead ones.
-	for (LLSD::array_iterator i=in_pids.beginArray();
-		i !=in_pids.endArray();
-		++i)
-	{
-		U32 stored_pid=(*i).asInteger();
-
-		if (stored_pid != mPID && isProcessAlive(stored_pid))
-		{
-			out_pids.append( (*i) );
-			write_file=TRUE;
-		}
-	}
-	ifile.close();
-
-	if (write_file)
-	{
-		writeLockFile(out_pids);
-	}
-	else
-	{
-		unlink(mLockName.c_str());
-	}
-
-	mSaving=FALSE;
-	mWaiting=FALSE;
-}
-
-//LLPidLock
-
-void LLPidLock::initClass() { 
-	(void) LLPidLockFile::instance(); 
-}
-
-bool LLPidLock::checkLock() 
-{
-	return LLPidLockFile::instance().checkLock();
-}
-
-bool LLPidLock::requestLock(LLNameTable<void *> *name_table, bool autosave,
-								bool force_immediate, F32 timeout)
-{
-	return LLPidLockFile::instance().requestLock(name_table,autosave,force_immediate,timeout);
-}
-
-void LLPidLock::releaseLock() 
-{ 
-	return LLPidLockFile::instance().releaseLock(); 
-}
-
-bool LLPidLock::isClean() 
-{ 
-	return LLPidLockFile::instance().mClean; 
-}
-
-//getters
-LLNameTable<void *> * LLPidLock::getNameTable() 
-{ 
-    return LLPidLockFile::instance().mNameTable; 
-}
-
-bool LLPidLock::getAutosave() 
-{ 
-	return LLPidLockFile::instance().mAutosave; 
-}
-
-bool LLPidLock::getClean() 
-{ 
-	return LLPidLockFile::instance().mClean; 
-}
-
-std::string LLPidLock::getSaveName() 
-{ 
-	return LLPidLockFile::instance().mSaveName; 
-}
-
-//setters
-void LLPidLock::setClean(bool clean) 
-{ 
-	LLPidLockFile::instance().mClean=clean; 
-}
-
-void LLPidLock::setSaveName(std::string savename) 
-{ 
-	LLPidLockFile::instance().mSaveName=savename; 
-}
diff --git a/indra/llvfs/llvfs.h b/indra/llvfs/llvfs.h
index 63f0f289334f1d2f57f1662b90c5ae650cbe5fad..39f31a221b9143c19fe529aa9433d04640b8cd53 100755
--- a/indra/llvfs/llvfs.h
+++ b/indra/llvfs/llvfs.h
@@ -29,7 +29,6 @@
 
 #include <deque>
 #include "lluuid.h"
-#include "linked_lists.h"
 #include "llassettype.h"
 #include "llthread.h"
 
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 4c6e7061192005be34154266197d50787472d234..8713ef21a3f3d91649debfef76e1be5bb0d27032 100755
--- a/indra/llwindow/CMakeLists.txt
+++ b/indra/llwindow/CMakeLists.txt
@@ -38,6 +38,7 @@ include_directories(SYSTEM
     )
 
 set(llwindow_SOURCE_FILES
+    llcursortypes.cpp
     llkeyboard.cpp
     llkeyboardheadless.cpp
     llwindowheadless.cpp
@@ -48,6 +49,7 @@ set(llwindow_SOURCE_FILES
 set(llwindow_HEADER_FILES
     CMakeLists.txt
 
+    llcursortypes.h
     llkeyboard.h
     llkeyboardheadless.h
     llwindowheadless.h
diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llwindow/llcursortypes.cpp
similarity index 100%
rename from indra/llcommon/llcursortypes.cpp
rename to indra/llwindow/llcursortypes.cpp
diff --git a/indra/llcommon/llcursortypes.h b/indra/llwindow/llcursortypes.h
similarity index 100%
rename from indra/llcommon/llcursortypes.h
rename to indra/llwindow/llcursortypes.h
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp
index 8b356ba1387099345db95809228b1e8f49e9e235..41d4d41e835048a657fa55b3ed830442683dcdb0 100755
--- a/indra/llwindow/llkeyboard.cpp
+++ b/indra/llwindow/llkeyboard.cpp
@@ -258,7 +258,7 @@ BOOL LLKeyboard::handleTranslatedKeyUp(KEY translated_key, U32 translated_mask)
 		handled = mCallbacks->handleTranslatedKeyUp(translated_key, translated_mask);
 	}
 	
-	lldebugst(LLERR_USER_INPUT) << "keyup -" << translated_key << "-" << llendl;
+	LL_DEBUGS("UserInput") << "keyup -" << translated_key << "-" << llendl;
 
 	return handled;
 }
diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h
index 276074d4cadd8a7aa4e3db4019b738d0d13337de..c066b89c90b7b5d0fabeb7e97d3e676f5da1f383 100755
--- a/indra/llwindow/llkeyboard.h
+++ b/indra/llwindow/llkeyboard.h
@@ -30,7 +30,7 @@
 #include <map>
 #include <boost/function.hpp>
 
-#include "string_table.h"
+#include "llstringtable.h"
 #include "lltimer.h"
 #include "indra_constants.h"
 
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 93b9d36939002d60729f52e7a1c5ddf4b284d34f..6a8f0b59d1f3a226bc72dc6e0fcb03187f59dc74 100755
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -39,7 +39,6 @@
 
 #include "llerror.h"
 #include "llkeyboard.h"
-#include "linked_lists.h"
 #include "llwindowcallbacks.h"
 
 
diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h
index ee7d1d50b7e1de8cb81e372330c9de128fda49ec..2b8e44919397df6abbad05822d3b01cb9ae4b05a 100755
--- a/indra/llxml/llcontrol.h
+++ b/indra/llxml/llcontrol.h
@@ -29,8 +29,6 @@
 
 #include "llboost.h"
 #include "llevent.h"
-#include "llnametable.h"
-#include "llmap.h"
 #include "llstring.h"
 #include "llrect.h"
 #include "llrefcount.h"
diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h
index bdcb56f1f30d2cbbb43d52ec8258485de576fc57..69fbc95bb04f8ea7a5778a539801300df086ec42 100755
--- a/indra/llxml/llxmltree.h
+++ b/indra/llxml/llxmltree.h
@@ -32,7 +32,7 @@
 #include <list>
 #include "llstring.h"
 #include "llxmlparser.h"
-#include "string_table.h"
+#include "llstringtable.h"
 
 class LLColor4;
 class LLColor4U;
diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l
index 1bb38bbf655f5c3313db95b81055e6cb52b2a2eb..019d2278428cea9a462def3ac9ff2c9ce1407c72 100755
--- a/indra/lscript/lscript_compile/indra.l
+++ b/indra/lscript/lscript_compile/indra.l
@@ -25,7 +25,6 @@ FS			(f|F)
 #include "indra.y.hpp"
 #include "lltimer.h"
 #include "indra_constants.h"
-#include "llagentconstants.h"
 #include "lllslconstants.h"
 #include "lluuid.h"
 #include "llassetstorage.h"
diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp
index 95b2f35a94ecb8c4c1c104791ac1b74c57f0e187..b6c3dd3a8669044d603159fe56e6b2fc20f7db55 100755
--- a/indra/lscript/lscript_compile/lscript_bytecode.cpp
+++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp
@@ -40,8 +40,8 @@ LLScriptJumpTable::LLScriptJumpTable()
 
 LLScriptJumpTable::~LLScriptJumpTable()
 {
-	mLabelMap.deleteAllData();
-	mJumpMap.deleteAllData();
+	delete_and_clear(mLabelMap);
+	delete_and_clear(mJumpMap);
 }
 
 void LLScriptJumpTable::addLabel(char *name, S32 offset)
@@ -203,17 +203,14 @@ void LLScriptByteCodeChunk::addJump(char *name)
 
 void LLScriptByteCodeChunk::connectJumps()
 {
-	char *jump;
-	S32 offset, jumppos;
-
 	if (mJumpTable)
 	{
-		for (jump = mJumpTable->mJumpMap.getFirstKey();
-			 jump;
-			 jump = mJumpTable->mJumpMap.getNextKey())
+		for(std::map<char *, S32 *>::iterator it = mJumpTable->mJumpMap.begin(), end_it = mJumpTable->mJumpMap.end();
+			it != end_it;
+			++it)
 		{
-			jumppos = *mJumpTable->mJumpMap[jump];
-			offset = *mJumpTable->mLabelMap[jump] - jumppos;
+			S32 jumppos = *it->second;
+			S32 offset = *mJumpTable->mLabelMap[it->first] - jumppos;
 			jumppos = jumppos - 4;
 			integer2bytestream(mCodeChunk, jumppos, offset);
 		}
diff --git a/indra/lscript/lscript_compile/lscript_bytecode.h b/indra/lscript/lscript_compile/lscript_bytecode.h
index 0933c78b6f77b32e71e37914f540a9aee3ced763..1908bebcb9a9bb84b4c315a2760eb490ed38db8f 100755
--- a/indra/lscript/lscript_compile/lscript_bytecode.h
+++ b/indra/lscript/lscript_compile/lscript_bytecode.h
@@ -29,6 +29,7 @@
 
 #include "lscript_byteconvert.h"
 #include "lscript_scope.h"
+#include <map>
 
 class LLScriptJumpTable
 {
@@ -39,8 +40,8 @@ class LLScriptJumpTable
 	void addLabel(char *name, S32 offset);
 	void addJump(char *name, S32 offset);
 
-	LLMap<char *, S32 *> mLabelMap;
-	LLMap<char *, S32 *> mJumpMap;
+	std::map<char *, S32 *> mLabelMap;
+	std::map<char *, S32 *> mJumpMap;
 };
 
 class LLScriptByteCodeChunk
diff --git a/indra/lscript/lscript_compile/lscript_scope.h b/indra/lscript/lscript_compile/lscript_scope.h
index 5b2a73ad92e4d83bfffbe1de7c0da793fcf5ebec..ffff91c81bc0a3cc01fbf5ff4c030aac944ac2e3 100755
--- a/indra/lscript/lscript_compile/lscript_scope.h
+++ b/indra/lscript/lscript_compile/lscript_scope.h
@@ -27,8 +27,8 @@
 #ifndef LL_LSCRIPT_SCOPE_H
 #define LL_LSCRIPT_SCOPE_H
 
-#include "string_table.h"
-#include "llmap.h"
+#include <map>
+#include "llstringtable.h"
 #include "lscript_byteformat.h"
 
 typedef enum e_lscript_identifier_type
@@ -301,13 +301,13 @@ class LLScriptScope
 
 	~LLScriptScope()	
 	{
-		mEntryMap.deleteAllData();
+		delete_and_clear(mEntryMap);
 	}
 
 	LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type)
 	{
 		const char *name = mSTable->addString(identifier);
-		if (!mEntryMap.checkData(name))
+		if (mEntryMap.find(name) == mEntryMap.end())
 		{
 			if (idtype == LIT_FUNCTION)
 				mEntryMap[name] = new LLScriptScopeEntry(name, idtype, type, mFunctionCount++);
@@ -324,18 +324,10 @@ class LLScriptScope
 		}
 	}
 
-	BOOL checkEntry(const char *identifier)
+	bool checkEntry(const char *identifier)
 	{
 		const char *name = mSTable->addString(identifier);
-		if (mEntryMap.checkData(name))
-		{
-			return TRUE;
-		}
-		else
-		{
-			// identifier already exists at this scope
-			return FALSE;
-		}
+		return mEntryMap.find(name) != mEntryMap.end();
 	}
 
 	LLScriptScopeEntry *findEntry(const char *identifier)
@@ -345,10 +337,11 @@ class LLScriptScope
 
 		while (scope)
 		{
-			if (scope->mEntryMap.checkData(name))
+			entry_map_t::iterator found_it = mEntryMap.find(name);
+			if (found_it != mEntryMap.end())
 			{
 				// cool, we found it at this scope
-				return scope->mEntryMap[name];
+				return found_it->second;
 			}
 			scope = scope->mParentScope;
 		}
@@ -362,24 +355,25 @@ class LLScriptScope
 
 		while (scope)
 		{
-			if (scope->mEntryMap.checkData(name))
+			entry_map_t::iterator found_it = scope->mEntryMap.find(name);
+			if (found_it != scope->mEntryMap.end())
 			{
 				// need to check type, and if type is function we need to check both types
 				if (idtype == LIT_FUNCTION)
 				{
-					if (scope->mEntryMap[name]->mIDType == LIT_FUNCTION)
+					if (found_it->second->mIDType == LIT_FUNCTION)
 					{
-						return scope->mEntryMap[name];
+						return (found_it->second);
 					}
-					else if (scope->mEntryMap[name]->mIDType == LIT_LIBRARY_FUNCTION)
+					else if (found_it->second->mIDType == LIT_LIBRARY_FUNCTION)
 					{
-						return scope->mEntryMap[name];
+						return (found_it->second);
 					}
 				}
-				else if (scope->mEntryMap[name]->mIDType == idtype)
+				else if (found_it->second->mIDType == idtype)
 				{
 					// cool, we found it at this scope
-					return scope->mEntryMap[name];
+					return (found_it->second);
 				}
 			}
 			scope = scope->mParentScope;
@@ -392,11 +386,12 @@ class LLScriptScope
 		mParentScope = scope;
 	}
 
-	LLMap<const char *, LLScriptScopeEntry *>	mEntryMap;
-	LLScriptScope						*mParentScope;
-	LLStringTable						*mSTable;
-	S32									mFunctionCount;
-	S32									mStateCount;
+	typedef std::map<const char *, LLScriptScopeEntry *> entry_map_t;
+	entry_map_t		mEntryMap;
+	LLScriptScope*	mParentScope;
+	LLStringTable*	mSTable;
+	S32				mFunctionCount;
+	S32				mStateCount;
 };
 
 extern LLStringTable *gScopeStringTable;
diff --git a/indra/lscript/lscript_compile/lscript_tree.h b/indra/lscript/lscript_compile/lscript_tree.h
index bf29f44518643b5ba37a47aae0b5dbbdb435b173..047c220b172479b4a7d8abd682650790983ab756 100755
--- a/indra/lscript/lscript_compile/lscript_tree.h
+++ b/indra/lscript/lscript_compile/lscript_tree.h
@@ -29,7 +29,6 @@
 
 #include "v3math.h"
 #include "llquaternion.h"
-#include "linked_lists.h"
 #include "lscript_error.h"
 #include "lscript_typecheck.h"
 #include "lscript_byteformat.h"
@@ -2304,20 +2303,20 @@ class LLScriptAllocationManager
 	LLScriptAllocationManager() {}
 	~LLScriptAllocationManager() 
 	{
-		mAllocationList.deleteAllData();
+		deleteAllocations();
 	}
 
 	void addAllocation(LLScriptFilePosition *ptr)
 	{
-		mAllocationList.addData(ptr);
+		mAllocationList.push_front(ptr);
 	}
 
 	void deleteAllocations()
 	{
-		mAllocationList.deleteAllData();
+		delete_and_clear(mAllocationList);
 	}
 
-	LLLinkedList<LLScriptFilePosition> mAllocationList;
+	std::list<LLScriptFilePosition*> mAllocationList;
 };
 
 extern LLScriptAllocationManager *gAllocationManager;
diff --git a/indra/lscript/lscript_execute.h b/indra/lscript/lscript_execute.h
index fc491ead0fec38ab75ac573be0f0a69fd068150a..576c2ca2b71423a088689df3d11fb9e93e3fa4c7 100755
--- a/indra/lscript/lscript_execute.h
+++ b/indra/lscript/lscript_execute.h
@@ -27,9 +27,10 @@
 #ifndef LL_LSCRIPT_EXECUTE_H
 #define LL_LSCRIPT_EXECUTE_H
 
+#include "stdtypes.h"
 #include "lscript_byteconvert.h"
-#include "linked_lists.h"
 #include "lscript_library.h"
+#include "llstl.h"
 
 class LLTimer;
 
@@ -262,7 +263,7 @@ class LLScriptEventData
 		S32 i, number = bytestream2integer(src, offset);
 		for (i = 0; i < number; i++)
 		{
-			mEventDataList.addData(new LLScriptDataCollection(src, offset));
+			mEventDataList.push_front(new LLScriptDataCollection(src, offset));
 		}
 	}
 
@@ -271,32 +272,32 @@ class LLScriptEventData
 		S32 i, number = bytestream2integer(src, offset);
 		for (i = 0; i < number; i++)
 		{
-			mEventDataList.addData(new LLScriptDataCollection(src, offset));
+			mEventDataList.push_front(new LLScriptDataCollection(src, offset));
 		}
 	}
 
 	~LLScriptEventData()	
 	{
-		mEventDataList.deleteAllData();
+		delete_and_clear(mEventDataList);
 	}
 
 	void addEventData(LLScriptDataCollection *data)
 	{
-		if (mEventDataList.getLength() < MAX_EVENTS_IN_QUEUE)
-			mEventDataList.addDataAtEnd(data);
+		if (mEventDataList.size() < MAX_EVENTS_IN_QUEUE)
+			mEventDataList.push_back(data);
 		else
 			delete data;
 	}
 	LLScriptDataCollection *getNextEvent(LSCRIPTStateEventType type)
 	{
-		LLScriptDataCollection *temp;
-		for (temp = mEventDataList.getFirstData();
-			 temp;
-			 temp = mEventDataList.getNextData())
+		for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
+			it != end_it;
+			++it)
 		{
+			LLScriptDataCollection* temp = *it;
 			if (temp->mType == type)
 			{
-				mEventDataList.removeCurrentData();
+				mEventDataList.erase(it);
 				return temp;
 			}
 		}
@@ -305,24 +306,24 @@ class LLScriptEventData
 	LLScriptDataCollection *getNextEvent()
 	{
 		LLScriptDataCollection *temp;
-		temp = mEventDataList.getFirstData();
+		temp = mEventDataList.front();
 		if (temp)
 		{
-			mEventDataList.removeCurrentData();
+			mEventDataList.pop_front();
 			return temp;
 		}
 		return NULL;
 	}
 	void removeEventType(LSCRIPTStateEventType type)
 	{
-		LLScriptDataCollection *temp;
-		for (temp = mEventDataList.getFirstData();
-			 temp;
-			 temp = mEventDataList.getNextData())
+		for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
+			it != end_it;
+			++it)
 		{
-			if (temp->mType == type)
+			if ((*it)->mType == type)
 			{
-				mEventDataList.deleteCurrentData();
+				delete *it;
+				mEventDataList.erase(it);
 			}
 		}
 	}
@@ -332,12 +333,11 @@ class LLScriptEventData
 		S32 size = 0;
 		// number in linked list
 		size += 4;
-		LLScriptDataCollection *temp;
-		for (temp = mEventDataList.getFirstData();
-			 temp;
-			 temp = mEventDataList.getNextData())
+		for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
+			it != end_it;
+			++it)
 		{
-			size += temp->getSavedSize();
+			size += (*it)->getSavedSize();
 		}
 		return size;
 	}
@@ -346,19 +346,18 @@ class LLScriptEventData
 	{
 		S32 offset = 0;
 		// number in linked list
-		S32 number = mEventDataList.getLength();
+		S32 number = mEventDataList.size();
 		integer2bytestream(dest, offset, number);
-		LLScriptDataCollection *temp;
-		for (temp = mEventDataList.getFirstData();
-			 temp;
-			 temp = mEventDataList.getNextData())
+		for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
+			it != end_it;
+			++it)
 		{
-			offset += temp->write2bytestream(dest + offset);
+			offset += (*it)->write2bytestream(dest + offset);
 		}
 		return offset;
 	}
 
-	LLLinkedList<LLScriptDataCollection>	mEventDataList;
+	std::list<LLScriptDataCollection*>	mEventDataList;
 };
 
 class LLScriptExecute
@@ -474,9 +473,9 @@ class LLScriptExecuteLSL2 : public LLScriptExecute
 	virtual ~LLScriptExecuteLSL2();
 
 	virtual S32 getVersion() const {return get_register(mBuffer, LREG_VN);}
-	virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();}
+	virtual void deleteAllEvents() {delete_and_clear(mEventData.mEventDataList);}
 	virtual void addEvent(LLScriptDataCollection* event);
-	virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();}
+	virtual U32 getEventCount() {return mEventData.mEventDataList.size();}
 	virtual void removeEventType(LSCRIPTStateEventType event_type);
 	virtual S32 getFaults() {return get_register(mBuffer, LREG_FR);}
 	virtual void setFault(LSCRIPTRunTimeFaults fault) {set_fault(mBuffer, fault);}
diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp
index e9b4d1fcbbe7547d6c3cfd2904640552d827adcc..70cdecbb188448229f9340717e8d672b522805de 100755
--- a/indra/lscript/lscript_execute/lscript_execute.cpp
+++ b/indra/lscript/lscript_execute/lscript_execute.cpp
@@ -417,10 +417,13 @@ void LLScriptExecuteLSL2::callEventHandler(LSCRIPTStateEventType event, const LL
 void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice)
 {
 	S32 major_version = getMajorVersion();
-	LLScriptDataCollection* eventdata;
 
-	for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData())
+	for (std::list<LLScriptDataCollection*>::iterator it = mEventData.mEventDataList.begin(), end_it = mEventData.mEventDataList.end();
+		it != end_it;
+		++it)
 	{
+		LLScriptDataCollection* eventdata = *it;
+
 		if (eventdata->mType == event)
 		{
 			// push a zero to be popped
@@ -458,7 +461,8 @@ void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, co
 			S32			opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event);
 			set_ip(mBuffer, opcode_start);
 
-			mEventData.mEventDataList.deleteCurrentData();
+			delete *it;
+			mEventData.mEventDataList.erase(it);
 			break;
 		}
 	}
diff --git a/indra/lscript/lscript_execute/lscript_readlso.h b/indra/lscript/lscript_execute/lscript_readlso.h
index a545a9daf8bc2bdf91abfeb2afda4d59aace2b94..f3b2b66746a0f92c23c51e57db76921dedad91af 100755
--- a/indra/lscript/lscript_execute/lscript_readlso.h
+++ b/indra/lscript/lscript_execute/lscript_readlso.h
@@ -28,7 +28,6 @@
 #define LL_LSCRIPT_READLSO_H
 
 #include "lscript_byteconvert.h"
-#include "linked_lists.h"
 
 // list of op code print functions
 void print_noop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 3689c2856d84b88e6ab1b40534bb8fbae992e5e9..1b779e5c99db18156f8e8981273efbf7f82c1851 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -682,6 +682,7 @@ set(viewer_HEADER_FILES
     CMakeLists.txt
     ViewerInstall.cmake
     groupchatlistener.h
+    llaccountingcost.h
     llaccountingcostmanager.h
     llagent.h
     llagentaccess.h
@@ -1221,7 +1222,6 @@ set(viewer_HEADER_FILES
     llvosky.h
     llvosurfacepatch.h
     llvotree.h
-    llvotreenew.h
     llvovolume.h
     llvowater.h
     llvowlsky.h
@@ -1250,6 +1250,7 @@ set(viewer_HEADER_FILES
     macmain.h
     noise.h
     pipeline.h
+    roles_constants.h
     VertexCache.h
     VorbisFramework.h
     )
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index 92a241857e02e055ce8c0ba7a71d06257b86e635..b500c370984ec1ac45bbbe34d254cadd2e1773c0 100755
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -42,6 +42,7 @@
 						</array>
 					<key>tags</key>
 						<array>
+							<string>SceneLoadTiming</string>
 						<!-- sample entry for debugging specific items	
 						     <string>Avatar</string>
 						     <string>Voice</string>		
diff --git a/indra/llvfs/llpidlock.h b/indra/newview/llaccountingcost.h
similarity index 54%
rename from indra/llvfs/llpidlock.h
rename to indra/newview/llaccountingcost.h
index d3295f4911054dd7d8974a20b9400f2488b7f712..bc770fe1d237eb1d1145495c9e5394af8e43dc9d 100755
--- a/indra/llvfs/llpidlock.h
+++ b/indra/newview/llaccountingcost.h
@@ -1,10 +1,10 @@
 /** 
- * @file llpidlock.h
- * @brief System information debugging classes.
+ * @file llaccountingcost.h
+ * @
  *
  * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2011, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,36 +24,32 @@
  * $/LicenseInfo$
  */
 
-#ifndef LL_PIDLOCK_H
-#define LL_PIDLOCK_H
-#include "llnametable.h"
+#ifndef LL_ACCOUNTINGQUOTA_H
+#define LL_ACCOUNTINGQUOTA_H
 
-class LLSD;
-class LLFrameTimer;
-
-#if !LL_WINDOWS	//For non-windows platforms.
-#include <signal.h>
-#endif
-
-namespace LLPidLock
+//SelectionQuota atm does not require a id
+struct SelectionCost
 {
-    void initClass(); // { (void) LLPidLockFile::instance(); }
+	SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost )
+	//: mTransactionId( transactionId)
+	: mPhysicsCost( physicsCost )
+	, mNetworkCost( networkCost )
+	, mSimulationCost( simulationCost )
+	{
+	}
+	SelectionCost()
+	: mPhysicsCost( 0.0f )
+	, mNetworkCost( 0.0f )
+	, mSimulationCost( 0.0f )
+	{}
+	
+	F32 mPhysicsCost, mNetworkCost, mSimulationCost;	
+	//LLTransactionID mTransactionId;
+};
 
-	bool requestLock( LLNameTable<void *> *name_table=NULL, bool autosave=TRUE,
-					  bool force_immediate=FALSE, F32 timeout=300.0);
-	bool checkLock(); 
-	void releaseLock(); 
-	bool isClean(); 
+typedef enum { Roots = 0 , Prims } eSelectionType;
+
+#endif
 
-	//getters
-	LLNameTable<void *> * getNameTable(); 
-	bool getAutosave(); 
-	bool getClean(); 
-	std::string getSaveName(); 
 
-	//setters
-	void setClean(bool clean); 
-	void setSaveName(std::string savename); 
-};
 
-#endif // LL_PIDLOCK_H
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 8ec74bb268f4ab6101dcb8f91acd9ad6397cecba..460ae62522561571c3f32482e8fce9b0dcc5c945 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -2991,7 +2991,7 @@ LLQuaternion LLAgent::getHeadRotation()
 	return rot;
 }
 
-void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request)
+void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request)
 {
 	if (gAgentID.isNull())
 	{
@@ -3006,7 +3006,7 @@ void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimReque
 	msg->addUUIDFast(_PREHASH_AgentID, getID());
 	msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
 
-	for (S32 i = 0; i < anim_ids.count(); i++)
+	for (S32 i = 0; i < anim_ids.size(); i++)
 	{
 		if (anim_ids[i].isNull())
 		{
@@ -3204,10 +3204,10 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **)
 	// Remove the group if it already exists remove it and add the new data to pick up changes.
 	LLGroupData gd;
 	gd.mID = group_id;
-	S32 index = gAgent.mGroups.find(gd);
-	if (index != -1)
+	std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
+	if (found_it != gAgent.mGroups.end())
 	{
-		gAgent.mGroups.remove(index);
+		gAgent.mGroups.erase(found_it);
 		if (gAgent.getGroupID() == group_id)
 		{
 			gAgent.mGroupID.setNull();
@@ -3281,10 +3281,10 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode
 			// and add the new data to pick up changes.
 			LLGroupData gd;
 			gd.mID = group_id;
-			S32 index = gAgent.mGroups.find(gd);
-			if (index != -1)
+			std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
+			if (found_it != gAgent.mGroups.end())
 			{
-				gAgent.mGroups.remove(index);
+				gAgent.mGroups.erase(found_it);
 				if (gAgent.getGroupID() == group_id)
 				{
 					gAgent.mGroupID.setNull();
@@ -3337,7 +3337,6 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **)
 	
 	S32 count = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
 	LLGroupData group;
-	S32 index = -1;
 	bool need_floater_update = false;
 	for(S32 i = 0; i < count; ++i)
 	{
@@ -3352,12 +3351,12 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **)
 		{
 			need_floater_update = true;
 			// Remove the group if it already exists remove it and add the new data to pick up changes.
-			index = gAgent.mGroups.find(group);
-			if (index != -1)
+			std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
+			if (found_it != gAgent.mGroups.end())
 			{
-				gAgent.mGroups.remove(index);
+				gAgent.mGroups.erase(found_it);
 			}
-			gAgent.mGroups.put(group);
+			gAgent.mGroups.push_back(group);
 		}
 		if (need_floater_update)
 		{
@@ -3396,7 +3395,6 @@ class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode
 		{
 
 			LLGroupData group;
-			S32 index = -1;
 			bool need_floater_update = false;
 
 			group.mID = (*iter_group)["GroupID"].asUUID();
@@ -3413,12 +3411,12 @@ class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode
 			{
 				need_floater_update = true;
 				// Remove the group if it already exists remove it and add the new data to pick up changes.
-				index = gAgent.mGroups.find(group);
-				if (index != -1)
+				std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
+				if (found_it != gAgent.mGroups.end())
 				{
-					gAgent.mGroups.remove(index);
+					gAgent.mGroups.erase(found_it);
 				}
-				gAgent.mGroups.put(group);
+				gAgent.mGroups.push_back(group);
 			}
 			if (need_floater_update)
 			{
@@ -4203,11 +4201,12 @@ void LLAgent::fidget()
 
 void LLAgent::stopFidget()
 {
-	LLDynamicArray<LLUUID> anims;
-	anims.put(ANIM_AGENT_STAND_1);
-	anims.put(ANIM_AGENT_STAND_2);
-	anims.put(ANIM_AGENT_STAND_3);
-	anims.put(ANIM_AGENT_STAND_4);
+	std::vector<LLUUID> anims;
+	anims.reserve(4);
+	anims.push_back(ANIM_AGENT_STAND_1);
+	anims.push_back(ANIM_AGENT_STAND_2);
+	anims.push_back(ANIM_AGENT_STAND_3);
+	anims.push_back(ANIM_AGENT_STAND_4);
 
 	gAgent.sendAnimationRequests(anims, ANIM_REQUEST_STOP);
 }
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 4153fbbfff860502bfbf559daa2cc314792d9ccf..093a65682a45c47ecdeaff4dab73e5dd07eaebe4 100755
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -29,13 +29,11 @@
 
 #include "indra_constants.h"
 #include "llevent.h" 				// LLObservable base class
-#include "llagentconstants.h"
 #include "llagentdata.h" 			// gAgentID, gAgentSessionID
 #include "llcharacter.h"
 #include "llcoordframe.h"			// for mFrameAgent
 #include "llavatarappearancedefines.h"
 #include "llpermissionsflags.h"
-#include "lldarray.h"
 
 #include <boost/function.hpp>
 #include <boost/shared_ptr.hpp>
@@ -431,7 +429,7 @@ class LLAgent : public LLOldEvents::LLObservable
 	void            stopCurrentAnimations();
 	void			requestStopMotion(LLMotion* motion);
 	void			onAnimStop(const LLUUID& id);
-	void			sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request);
+	void			sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request);
 	void			sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
 	void			endAnimationUpdateUI();
 	void			unpauseAnimation() { mPauseRequest = NULL; }
@@ -800,7 +798,7 @@ class LLAgent : public LLOldEvents::LLObservable
 	// Only used for building titles.
 	BOOL			isGroupMember() const 		{ return !mGroupID.isNull(); } 
 public:
-	LLDynamicArray<LLGroupData> mGroups;
+	std::vector<LLGroupData> mGroups;
 
 	//--------------------------------------------------------------------
 	// Group Title
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index a4c0b056ac192f5384cb81e41fad73520279fb1d..87c44a391d5699c56fa931532b00aa235a552664 100755
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -504,7 +504,7 @@ void LLAgentListener::lookAt(LLSD const & event_data) const
 void LLAgentListener::getGroups(const LLSD& event) const
 {
     LLSD reply(LLSD::emptyArray());
-    for (LLDynamicArray<LLGroupData>::const_iterator
+    for (std::vector<LLGroupData>::const_iterator
              gi(mAgent.mGroups.begin()), gend(mAgent.mGroups.end());
          gi != gend; ++gi)
     {
diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp
index 192ed141c746beb7bf368a43b3faec34d9b949d8..7a04cfb48b5b104e3105083961a77c7097852d6e 100755
--- a/indra/newview/llagentpicksinfo.cpp
+++ b/indra/newview/llagentpicksinfo.cpp
@@ -28,9 +28,11 @@
 #include "llagentpicksinfo.h"
 
 #include "llagent.h"
-#include "llavatarconstants.h"
 #include "llavatarpropertiesprocessor.h"
 
+const S32 MAX_AVATAR_PICKS = 10;
+
+
 class LLAgentPicksInfo::LLAgentPicksObserver : public LLAvatarPropertiesObserver
 {
 public:
diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp
index c7872fc5f61e5f9ee169947061db292e48fef769..0dd107f349d5b9c1cb4f00eb211b21a6bafe2edd 100755
--- a/indra/newview/llagentpilot.cpp
+++ b/indra/newview/llagentpilot.cpp
@@ -97,11 +97,12 @@ void LLAgentPilot::loadTxt(const std::string& filename)
 		llinfos << "Opening pilot file " << filename << llendl;
 	}
 
-	mActions.reset();
+	mActions.clear();
 	S32 num_actions;
 
 	file >> num_actions;
 
+	mActions.reserve(num_actions);
 	for (S32 i = 0; i < num_actions; i++)
 	{
 		S32 action_type;
@@ -109,7 +110,7 @@ void LLAgentPilot::loadTxt(const std::string& filename)
 		file >> new_action.mTime >> action_type;
 		file >> new_action.mTarget.mdV[VX] >> new_action.mTarget.mdV[VY] >> new_action.mTarget.mdV[VZ];
 		new_action.mType = (EActionType)action_type;
-		mActions.put(new_action);
+		mActions.push_back(new_action);
 	}
 
 	mOverrideCamera = false;
@@ -137,7 +138,7 @@ void LLAgentPilot::loadXML(const std::string& filename)
 		llinfos << "Opening pilot file " << filename << llendl;
 	}
 
-	mActions.reset();
+	mActions.clear();
 	LLSD record;
 	while (!file.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(record, file))
 	{
@@ -150,7 +151,7 @@ void LLAgentPilot::loadXML(const std::string& filename)
 		action.mCameraXAxis = ll_vector3_from_sd(record["camera_xaxis"]);
 		action.mCameraYAxis = ll_vector3_from_sd(record["camera_yaxis"]);
 		action.mCameraZAxis = ll_vector3_from_sd(record["camera_zaxis"]);
-		mActions.put(action);
+		mActions.push_back(action);
 	}
 	mOverrideCamera = true;
 	file.close();
@@ -174,10 +175,10 @@ void LLAgentPilot::saveTxt(const std::string& filename)
 		llinfos << "Couldn't open " << filename << ", aborting agentpilot save!" << llendl;
 	}
 
-	file << mActions.count() << '\n';
+	file << mActions.size() << '\n';
 
 	S32 i;
-	for (i = 0; i < mActions.count(); i++)
+	for (i = 0; i < mActions.size(); i++)
 	{
 		file << mActions[i].mTime << "\t" << mActions[i].mType << "\t";
 		file << std::setprecision(32) << mActions[i].mTarget.mdV[VX] << "\t" << mActions[i].mTarget.mdV[VY] << "\t" << mActions[i].mTarget.mdV[VZ];
@@ -198,7 +199,7 @@ void LLAgentPilot::saveXML(const std::string& filename)
 	}
 
 	S32 i;
-	for (i = 0; i < mActions.count(); i++)
+	for (i = 0; i < mActions.size(); i++)
 	{
 		Action& action = mActions[i];
 		LLSD record;
@@ -217,7 +218,7 @@ void LLAgentPilot::saveXML(const std::string& filename)
 
 void LLAgentPilot::startRecord()
 {
-	mActions.reset();
+	mActions.clear();
 	mTimer.reset();
 	addAction(STRAIGHT);
 	mRecording = TRUE;
@@ -244,7 +245,7 @@ void LLAgentPilot::addAction(enum EActionType action_type)
 	action.mCameraYAxis = cam->getYAxis();
 	action.mCameraZAxis = cam->getZAxis();
 	mLastRecordTime = (F32)action.mTime;
-	mActions.put(action);
+	mActions.push_back(action);
 }
 
 void LLAgentPilot::startPlayback()
@@ -255,7 +256,7 @@ void LLAgentPilot::startPlayback()
 		mCurrentAction = 0;
 		mTimer.reset();
 
-		if (mActions.count())
+		if (mActions.size())
 		{
 			llinfos << "Starting playback, moving to waypoint 0" << llendl;
 			gAgent.startAutoPilotGlobal(mActions[0].mTarget);
@@ -291,7 +292,7 @@ void LLAgentPilot::moveCamera()
 	if (!getOverrideCamera())
 		return;
 
-	if (mCurrentAction<mActions.count())
+	if (mCurrentAction<mActions.size())
 	{
 		S32 start_index = llmax(mCurrentAction-1,0);
 		S32 end_index = mCurrentAction;
@@ -331,7 +332,7 @@ void LLAgentPilot::updateTarget()
 {
 	if (mPlaying)
 	{
-		if (mCurrentAction < mActions.count())
+		if (mCurrentAction < mActions.size())
 		{
 			if (0 == mCurrentAction)
 			{
@@ -355,7 +356,7 @@ void LLAgentPilot::updateTarget()
 				//gAgent.stopAutoPilot();
 				mCurrentAction++;
 
-				if (mCurrentAction < mActions.count())
+				if (mCurrentAction < mActions.size())
 				{
 					gAgent.startAutoPilotGlobal(mActions[mCurrentAction].mTarget);
 					moveCamera();
diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h
index dd1709ec0c21cb1af0d562a96d865c21c0a8c1d3..f6b63760862e4e9ec5c372583fdecd649e102754 100755
--- a/indra/newview/llagentpilot.h
+++ b/indra/newview/llagentpilot.h
@@ -30,7 +30,6 @@
 #include "stdtypes.h"
 #include "lltimer.h"
 #include "v3dmath.h"
-#include "lldarray.h"
 
 // Class that drives the agent around according to a "script".
 
@@ -113,7 +112,7 @@ class LLAgentPilot
 		LLVector3		mCameraZAxis;
 	};
 
-	LLDynamicArray<Action>	mActions;
+	std::vector<Action>	mActions;
 	LLTimer					mTimer;
 
 };
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index e158dc7505be00fa9e98b984463f3810655b7ebb..4a25b8c2054b284b9f4575a9e198c3906bb7152e 100755
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -958,7 +958,7 @@ class OnWearableItemCreatedCB: public LLInventoryCallback
 	{
 		llinfos << "One item created " << inv_item.asString() << llendl;
 		LLViewerInventoryItem *item = gInventory.getItem(inv_item);
-		mItemsToLink.put(item);
+		mItemsToLink.push_back(item);
 		updatePendingWearable(inv_item);
 	}
 	~OnWearableItemCreatedCB()
@@ -1235,7 +1235,7 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
 
 // Assumes existing wearables are not dirty.
 void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
-										 const LLDynamicArray< LLViewerWearable* >& wearables,
+										 const std::vector< LLViewerWearable* >& wearables,
 										 BOOL remove)
 {
 	llinfos << "setWearableOutfit() start" << llendl;
@@ -1254,8 +1254,8 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 		}
 	}
 
-	S32 count = wearables.count();
-	llassert(items.count() == count);
+	S32 count = wearables.size();
+	llassert(items.size() == count);
 
 	S32 i;
 	for (i = 0; i < count; i++)
@@ -1538,7 +1538,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
 
 	std::set<LLUUID> requested_item_ids;
 	std::set<LLUUID> current_item_ids;
-	for (S32 i=0; i<obj_item_array.count(); i++)
+	for (S32 i=0; i<obj_item_array.size(); i++)
 		requested_item_ids.insert(obj_item_array[i].get()->getLinkedUUID());
 
 	// Build up list of objects to be removed and items currently attached.
@@ -1624,7 +1624,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo
 void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array)
 {
 	// Build a compound message to send all the objects that need to be rezzed.
-	S32 obj_count = obj_item_array.count();
+	S32 obj_count = obj_item_array.size();
 
 	// Limit number of packets to send
 	const S32 MAX_PACKETS_TO_SEND = 10;
@@ -1655,7 +1655,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
 			msg->addBOOLFast(_PREHASH_FirstDetachAll, false );
 		}
 
-		const LLInventoryItem* item = obj_item_array.get(i).get();
+		const LLInventoryItem* item = obj_item_array.at(i).get();
 		msg->nextBlockFast(_PREHASH_ObjectData );
 		msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID());
 		msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner());
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 5be4648636792a5c883750c57b635b1ea5abb46a..02d24892b5e5e9bbd2e11ffc55bf4295c088633c 100755
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -107,7 +107,7 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>, public LLWearable
 	/*virtual*/void	wearableUpdated(LLWearable *wearable, BOOL removed);
 public:
 	void			setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false);
-	void			setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove);
+	void			setWearableOutfit(const LLInventoryItem::item_array_t& items, const std::vector< LLViewerWearable* >& wearables, BOOL remove);
 	void			setWearableName(const LLUUID& item_id, const std::string& new_name);
 	// *TODO: Move this into llappearance/LLWearableData ?
 	void			addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index);
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index 8b6b6db525058d2547a04262d55deffaf41e27f1..4a8d122dd8f0f68e943b9af20ff78b7382f3f102 100755
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -54,7 +54,7 @@ void order_my_outfits_cb()
 		//My Outfits should at least contain saved initial outfit and one another outfit
 		if (cats->size() < 2)
 		{
-			llwarning("My Outfits category was not populated properly", 0);
+			LL_WARNS() << "My Outfits category was not populated properly" << LL_ENDL;
 			return;
 		}
 
@@ -127,7 +127,7 @@ void LLInitialWearablesFetch::processContents()
 									LLInventoryModel::EXCLUDE_TRASH, is_wearable);
 
 	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
-	if (wearable_array.count() > 0)
+	if (wearable_array.size() > 0)
 	{
 		gAgentWearables.notifyLoadingStarted();
 		LLAppearanceMgr::instance().updateAppearanceFromCOF();
@@ -326,7 +326,7 @@ void LLLibraryOutfitsFetch::folderDone()
 	
 	// Early out if we already have items in My Outfits
 	// except the case when My Outfits contains just initial outfit
-	if (cat_array.count() > 1)
+	if (cat_array.size() > 1)
 	{
 		mOutfitsPopulated = true;
 		return;
@@ -342,9 +342,9 @@ void LLLibraryOutfitsFetch::folderDone()
 									cat_array, wearable_array, 
 									LLInventoryModel::EXCLUDE_TRASH,
 									matchFolderFunctor);
-	if (cat_array.count() > 0)
+	if (cat_array.size() > 0)
 	{
-		const LLViewerInventoryCategory *cat = cat_array.get(0);
+		const LLViewerInventoryCategory *cat = cat_array.at(0);
 		mLibraryClothingID = cat->getUUID();
 	}
 
@@ -374,7 +374,7 @@ void LLLibraryOutfitsFetch::outfitsDone()
 	gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, 
 								  LLInventoryModel::EXCLUDE_TRASH);
 	
-	llassert(cat_array.count() > 0);
+	llassert(cat_array.size() > 0);
 	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
 		 iter != cat_array.end();
 		 ++iter)
@@ -401,7 +401,7 @@ void LLLibraryOutfitsFetch::outfitsDone()
 									matchFolderFunctor);
 	if (cat_array.size() > 0)
 	{
-		const LLViewerInventoryCategory *cat = cat_array.get(0);
+		const LLViewerInventoryCategory *cat = cat_array.at(0);
 		mImportedClothingID = cat->getUUID();
 	}
 	
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index fd9236c8b384cf6403edb779c320396cc1a80e04..a18448da6e37f4d74741f7c7c8ae10673675e58b 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -148,11 +148,11 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string
 									item_array,
 									LLInventoryModel::EXCLUDE_TRASH,
 									has_name);
-	if (0 == cat_array.count())
+	if (0 == cat_array.size())
 		return LLUUID();
 	else
 	{
-		LLViewerInventoryCategory *cat = cat_array.get(0);
+		LLViewerInventoryCategory *cat = cat_array.at(0);
 		if (cat)
 			return cat->getUUID();
 		else
@@ -754,9 +754,9 @@ void LLWearableHoldingPattern::onAllComplete()
 	}
 
 	// Activate all gestures in this folder
-	if (mGestItems.count() > 0)
+	if (mGestItems.size() > 0)
 	{
-		LL_DEBUGS("Avatar") << self_av_string() << "Activating " << mGestItems.count() << " gestures" << LL_ENDL;
+		LL_DEBUGS("Avatar") << self_av_string() << "Activating " << mGestItems.size() << " gestures" << LL_ENDL;
 		
 		LLGestureMgr::instance().activateGestures(mGestItems);
 		
@@ -779,7 +779,7 @@ void LLWearableHoldingPattern::onAllComplete()
 	// Update attachments to match those requested.
 	if (isAgentAvatarValid())
 	{
-		LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.count() << " attachments" << LL_ENDL;
+		LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.size() << " attachments" << LL_ENDL;
 		LLAgentWearables::userUpdateAttachments(mObjItems);
 	}
 
@@ -1155,9 +1155,9 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items)
 	// encountered, so we actually keep the *last* of each duplicate
 	// item.  This is needed to give the right priority when adding
 	// duplicate items to an existing outfit.
-	for (S32 i=items.count()-1; i>=0; i--)
+	for (S32 i=items.size()-1; i>=0; i--)
 	{
-		LLViewerInventoryItem *item = items.get(i);
+		LLViewerInventoryItem *item = items.at(i);
 		LLUUID item_id = item->getLinkedUUID();
 		if (items_seen.find(item_id)!=items_seen.end())
 			continue;
@@ -1168,7 +1168,7 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items)
 		 it != tmp_list.end();
 		 ++it)
 	{
-		new_items.put(*it);
+		new_items.push_back(*it);
 	}
 	items = new_items;
 }
@@ -1464,7 +1464,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL
 	LLInventoryModel::cat_array_t* cats;
 	LLInventoryModel::item_array_t* items;
 	gInventory.getDirectDescendentsOf(src_id, cats, items);
-	llinfos << "copying " << items->count() << " items" << llendl;
+	llinfos << "copying " << items->size() << " items" << llendl;
 	for (LLInventoryModel::item_array_t::const_iterator iter = items->begin();
 		 iter != items->end();
 		 ++iter)
@@ -1644,9 +1644,9 @@ void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category)
 	LLInventoryModel::item_array_t items;
 	gInventory.collectDescendents(category, cats, items,
 								  LLInventoryModel::EXCLUDE_TRASH);
-	for (S32 i = 0; i < items.count(); ++i)
+	for (S32 i = 0; i < items.size(); ++i)
 	{
-		LLViewerInventoryItem *item = items.get(i);
+		LLViewerInventoryItem *item = items.at(i);
 		if (item->getActualType() != LLAssetType::AT_LINK_FOLDER)
 			continue;
 		if (item->getIsLinkType())
@@ -1666,9 +1666,9 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin
 	LLInventoryModel::item_array_t items;
 	gInventory.collectDescendents(category, cats, items,
 								  LLInventoryModel::EXCLUDE_TRASH);
-	for (S32 i = 0; i < items.count(); ++i)
+	for (S32 i = 0; i < items.size(); ++i)
 	{
-		LLViewerInventoryItem *item = items.get(i);
+		LLViewerInventoryItem *item = items.at(i);
 		if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER))
 			continue;
 		if (item->getIsLinkType())
@@ -1718,9 +1718,9 @@ void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid,
 							  LLInventoryModel::item_array_t& items,
 							  LLPointer<LLInventoryCallback> cb)
 {
-	for (S32 i=0; i<items.count(); i++)
+	for (S32 i=0; i<items.size(); i++)
 	{
-		const LLInventoryItem* item = items.get(i).get();
+		const LLInventoryItem* item = items.at(i).get();
 		link_inventory_item(gAgent.getID(),
 							item->getLinkedUUID(),
 							cat_uuid,
@@ -1749,9 +1749,9 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 	{
 		LLInventoryModel::item_array_t gest_items;
 		getDescendentsOfAssetType(cof, gest_items, LLAssetType::AT_GESTURE, false);
-		for(S32 i = 0; i  < gest_items.count(); ++i)
+		for(S32 i = 0; i  < gest_items.size(); ++i)
 		{
-			LLViewerInventoryItem *gest_item = gest_items.get(i);
+			LLViewerInventoryItem *gest_item = gest_items.at(i);
 			if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) )
 			{
 				LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
@@ -1798,10 +1798,10 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 	
 	// Create links to new COF contents.
 	LLInventoryModel::item_array_t all_items;
-	all_items += body_items;
-	all_items += wear_items;
-	all_items += obj_items;
-	all_items += gest_items;
+	std::copy(body_items.begin(), body_items.end(), std::back_inserter(all_items));
+	std::copy(wear_items.begin(), wear_items.end(), std::back_inserter(all_items));
+	std::copy(obj_items.begin(), obj_items.end(), std::back_inserter(all_items));
+	std::copy(gest_items.begin(), gest_items.end(), std::back_inserter(all_items));
 
 	// Will link all the above items.
 	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
@@ -1856,7 +1856,8 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
 {
 	lldebugs << "updateAgentWearables()" << llendl;
 	LLInventoryItem::item_array_t items;
-	LLDynamicArray< LLViewerWearable* > wearables;
+	std::vector< LLViewerWearable* > wearables;
+	wearables.reserve(32);
 
 	// For each wearable type, find the wearables of that type.
 	for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
@@ -1871,14 +1872,14 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
 				LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
 				if( item && (item->getAssetUUID() == wearable->getAssetID()) )
 				{
-					items.put(item);
-					wearables.put(wearable);
+					items.push_back(item);
+					wearables.push_back(wearable);
 				}
 			}
 		}
 	}
 
-	if(wearables.count() > 0)
+	if(wearables.size() > 0)
 	{
 		gAgentWearables.setWearableOutfit(items, wearables, !append);
 	}
@@ -1905,7 +1906,7 @@ bool sort_by_actual_description(const LLInventoryItem* item1, const LLInventoryI
 {
 	if (!item1 || !item2) 
 	{
-		llwarning("either item1 or item2 is NULL", 0);
+		LL_WARNS() << "either item1 or item2 is NULL" << LL_ENDL;
 		return true;
 	}
 
@@ -1922,7 +1923,7 @@ void item_array_diff(LLInventoryModel::item_array_t& full_list,
 		 ++it)
 	{
 		LLViewerInventoryItem *item = *it;
-		if (keep_list.find(item) < 0) // Why on earth does LLDynamicArray need to redefine find()?
+		if (std::find(keep_list.begin(), keep_list.end(), item) == keep_list.end())
 		{
 			kill_list.push_back(item);
 		}
@@ -2036,7 +2037,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
 	dumpItemArray(wear_items,"asset_dump: wear_item");
 	dumpItemArray(obj_items,"asset_dump: obj_item");
 
-	if(!wear_items.count())
+	if(!wear_items.size())
 	{
 		LLNotificationsUtil::add("CouldNotPutOnOutfit");
 		return;
@@ -2056,9 +2057,9 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
 	// callback will be called (and this object deleted)
 	// before the final getNextData().
 
-	for(S32 i = 0; i  < wear_items.count(); ++i)
+	for(S32 i = 0; i  < wear_items.size(); ++i)
 	{
-		LLViewerInventoryItem *item = wear_items.get(i);
+		LLViewerInventoryItem *item = wear_items.at(i);
 		LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
 
 		// Fault injection: use debug setting to test asset 
@@ -2301,10 +2302,10 @@ void LLAppearanceMgr::wearOutfitByName(const std::string& name)
 									has_name);
 	bool copy_items = false;
 	LLInventoryCategory* cat = NULL;
-	if (cat_array.count() > 0)
+	if (cat_array.size() > 0)
 	{
 		// Just wear the first one that matches
-		cat = cat_array.get(0);
+		cat = cat_array.at(0);
 	}
 	else
 	{
@@ -2313,9 +2314,9 @@ void LLAppearanceMgr::wearOutfitByName(const std::string& name)
 										item_array,
 										LLInventoryModel::EXCLUDE_TRASH,
 										has_name);
-		if(cat_array.count() > 0)
+		if(cat_array.size() > 0)
 		{
-			cat = cat_array.get(0);
+			cat = cat_array.at(0);
 			copy_items = true;
 		}
 	}
@@ -2426,10 +2427,10 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
 								  LLInventoryModel::EXCLUDE_TRASH);
 	bool linked_already = false;
 	U32 count = 0;
-	for (S32 i=0; i<item_array.count(); i++)
+	for (S32 i=0; i<item_array.size(); i++)
 	{
 		// Are these links to the same object?
-		const LLViewerInventoryItem* inv_item = item_array.get(i).get();
+		const LLViewerInventoryItem* inv_item = item_array.at(i).get();
 		const LLWearableType::EType wearable_type = inv_item->getWearableType();
 
 		const bool is_body_part =    (wearable_type == LLWearableType::WT_SHAPE) 
@@ -2502,12 +2503,12 @@ LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& i
 									  cat_array,
 									  item_array,
 									  LLInventoryModel::EXCLUDE_TRASH);
-		for (S32 i=0; i<item_array.count(); i++)
+		for (S32 i=0; i<item_array.size(); i++)
 		{
-			const LLViewerInventoryItem* inv_item = item_array.get(i).get();
+			const LLViewerInventoryItem* inv_item = item_array.at(i).get();
 			if (inv_item->getLinkedUUID() == vitem->getLinkedUUID())
 			{
-				result.put(item_array.get(i));
+				result.push_back(item_array.at(i));
 			}
 		}
 	}
@@ -2579,9 +2580,9 @@ void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id)
 								  cat_array,
 								  item_array,
 								  LLInventoryModel::EXCLUDE_TRASH);
-	for (S32 i=0; i<item_array.count(); i++)
+	for (S32 i=0; i<item_array.size(); i++)
 	{
-		const LLInventoryItem* item = item_array.get(i).get();
+		const LLInventoryItem* item = item_array.at(i).get();
 		if (item->getIsLinkType() && item->getLinkedUUID() == item_id)
 		{
 			gInventory.purgeObject(item->getUUID());
@@ -2611,7 +2612,7 @@ bool sort_by_linked_uuid(const LLViewerInventoryItem* item1, const LLViewerInven
 {
 	if (!item1 || !item2)
 	{
-		llwarning("item1, item2 cannot be null, something is very wrong", 0);
+		LL_WARNS() << "item1, item2 cannot be null, something is very wrong" << LL_ENDL;
 		return true;
 	}
 
@@ -2653,7 +2654,7 @@ void LLAppearanceMgr::updateIsDirty()
 		gInventory.collectDescendentsIf(base_outfit, outfit_cats, outfit_items,
 									  LLInventoryModel::EXCLUDE_TRASH, collector);
 
-		if(outfit_items.count() != cof_items.count())
+		if(outfit_items.size() != cof_items.size())
 		{
 			// Current outfit folder should have one more item than the outfit folder.
 			// this one item is the link back to the outfit folder itself.
@@ -2667,8 +2668,8 @@ void LLAppearanceMgr::updateIsDirty()
 
 		for (U32 i = 0; i < cof_items.size(); ++i)
 		{
-			LLViewerInventoryItem *item1 = cof_items.get(i);
-			LLViewerInventoryItem *item2 = outfit_items.get(i);
+			LLViewerInventoryItem *item1 = cof_items.at(i);
+			LLViewerInventoryItem *item2 = outfit_items.at(i);
 
 			if (item1->getLinkedUUID() != item2->getLinkedUUID() || 
 				item1->getName() != item2->getName() ||
@@ -2839,9 +2840,9 @@ void LLAppearanceMgr::divvyWearablesByType(const LLInventoryModel::item_array_t&
 	items_by_type.resize(LLWearableType::WT_COUNT);
 	if (items.empty()) return;
 
-	for (S32 i=0; i<items.count(); i++)
+	for (S32 i=0; i<items.size(); i++)
 	{
-		LLViewerInventoryItem *item = items.get(i);
+		LLViewerInventoryItem *item = items.at(i);
 		if (!item)
 		{
 			LL_WARNS("Appearance") << "NULL item found" << llendl;
@@ -2879,7 +2880,7 @@ struct WearablesOrderComparator
 	{
 		if (!item1 || !item2)
 		{
-			llwarning("either item1 or item2 is NULL", 0);
+			LL_WARNS() << "either item1 or item2 is NULL" << LL_ENDL;
 			return true;
 		}
 		
@@ -3122,9 +3123,9 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder
 		LLInventoryModel::item_array_t item_array;
 		gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(),
 									  cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
-		for (S32 i=0; i<item_array.count(); i++)
+		for (S32 i=0; i<item_array.size(); i++)
 		{
-			const LLViewerInventoryItem* inv_item = item_array.get(i).get();
+			const LLViewerInventoryItem* inv_item = item_array.at(i).get();
 			local_items.insert(inv_item->getUUID());
 			LL_DEBUGS("Avatar") << "item_id: " << inv_item->getUUID()
 								<< " linked_item_id: " << inv_item->getLinkedUUID()
@@ -3159,9 +3160,9 @@ LLSD LLAppearanceMgr::dumpCOF() const
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t item_array;
 	gInventory.collectDescendents(getCOF(),cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
-	for (S32 i=0; i<item_array.count(); i++)
+	for (S32 i=0; i<item_array.size(); i++)
 	{
-		const LLViewerInventoryItem* inv_item = item_array.get(i).get();
+		const LLViewerInventoryItem* inv_item = item_array.at(i).get();
 		LLSD item;
 		LLUUID item_id(inv_item->getUUID());
 		md5.update((unsigned char*)item_id.mData, 16);
@@ -3505,7 +3506,7 @@ void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg)
 	llinfos << llendl;
 	llinfos << str << llendl;
 	S32 hitcount = 0;
-	for(S32 i=0; i<items.count(); i++)
+	for(S32 i=0; i<items.size(); i++)
 	{
 		LLViewerInventoryItem *item = items.get(i);
 		if (item)
@@ -3513,15 +3514,15 @@ void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg)
 		llinfos << i <<" "<< item->getName() <<llendl;
 	}
 #endif
-	llinfos << msg << " count " << items.count() << llendl;
+	llinfos << msg << " count " << items.size() << llendl;
 }
 
 void LLAppearanceMgr::dumpItemArray(const LLInventoryModel::item_array_t& items,
 									const std::string& msg)
 {
-	for (S32 i=0; i<items.count(); i++)
+	for (S32 i=0; i<items.size(); i++)
 	{
-		LLViewerInventoryItem *item = items.get(i);
+		LLViewerInventoryItem *item = items.at(i);
 		LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
 		LLUUID asset_id;
 		if (linked_item)
@@ -3703,7 +3704,7 @@ class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver
 									  cat_array,
 									  item_array,
 									  LLInventoryModel::EXCLUDE_TRASH);
-		S32 count = item_array.count();
+		S32 count = item_array.size();
 		if(!count)
 		{
 			llwarns << "Nothing fetched in category " << mComplete.front()
@@ -3715,11 +3716,11 @@ class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver
 			return;
 		}
 
-		llinfos << "stage1 got " << item_array.count() << " items, passing to stage2 " << llendl;
+		llinfos << "stage1 got " << item_array.size() << " items, passing to stage2 " << llendl;
 		uuid_vec_t ids;
 		for(S32 i = 0; i < count; ++i)
 		{
-			ids.push_back(item_array.get(i)->getUUID());
+			ids.push_back(item_array.at(i)->getUUID());
 		}
 		
 		gInventory.removeObserver(this);
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a208745822c54d1cef49b38a3aba8bc9585143e2..9c954e5a677ea38d86b2184eda785cfcbdac3350 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -294,12 +294,12 @@ U32	gFrameCount = 0;
 U32 gForegroundFrameCount = 0; // number of frames that app window was in foreground
 LLPumpIO* gServicePump = NULL;
 
-U64 gFrameTime = 0;
-F32 gFrameTimeSeconds = 0.f;
-LLUnit<F32, LLUnits::Seconds> gFrameIntervalSeconds = 0.f;
+LLUnitImplicit<U64, LLUnits::Microseconds> gFrameTime = 0;
+LLUnitImplicit<F32, LLUnits::Seconds> gFrameTimeSeconds = 0.f;
+LLUnitImplicit<F32, LLUnits::Seconds> gFrameIntervalSeconds = 0.f;
 F32 gFPSClamped = 10.f;						// Pretend we start at target rate.
 F32 gFrameDTClamped = 0.f;					// Time between adjacent checks to network for packets
-U64	gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds
+LLUnitImplicit<U64, LLUnits::Microseconds>	gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds
 U32 gFrameStalls = 0;
 const F64 FRAME_STALL_THRESHOLD = 1.0;
 
@@ -662,7 +662,7 @@ LLTextureFetch* LLAppViewer::sTextureFetch = NULL;
 
 std::string getRuntime()
 {
-	return llformat("%g", LLTimer::getElapsedSeconds().value());
+	return llformat("%.4f", (F32)LLTimer::getElapsedSeconds().value());
 }
 
 LLAppViewer::LLAppViewer() 
@@ -1260,7 +1260,7 @@ LLFastTimer::DeclareTimer FTM_FRAME("Frame");
 
 bool LLAppViewer::mainLoop()
 {
-	llinfos << "***********************Entering main_loop***********************" << llendflush;
+	llinfos << "***********************Entering main_loop***********************" << LL_ENDL;
 
 	mMainloopTimeout = new LLWatchdogTimeout();
 	
@@ -1465,7 +1465,7 @@ bool LLAppViewer::mainLoop()
 					ms_sleep(500);
 				}
 
-				const F64 max_idle_time = llmin(.005*10.0*gFrameTimeSeconds, 0.005); // 5 ms a second
+				const F64 max_idle_time = llmin(.005*10.0*gFrameTimeSeconds, LLUnitImplicit<F32, LLUnits::Seconds>(0.005f)); // 5 ms a second
 				idleTimer.reset();
 				S32 total_work_pending = 0;
 				S32 total_io_pending = 0;	
@@ -1588,7 +1588,7 @@ bool LLAppViewer::mainLoop()
 
 	destroyMainloopTimeout();
 
-	llinfos << "***********************Exiting main_loop***********************" << llendflush;
+	llinfos << "***********************Exiting main_loop***********************" << LL_ENDL;
 
 	return true;
 }
@@ -1621,7 +1621,7 @@ void LLAppViewer::flushVFSIO()
 		{
 			break;
 		}
-		llinfos << "Waiting for pending IO to finish: " << pending << llendflush;
+		llinfos << "Waiting for pending IO to finish: " << pending << LL_ENDL;
 		ms_sleep(100);
 	}
 }
@@ -1685,7 +1685,7 @@ bool LLAppViewer::cleanup()
 	
 	disconnectViewer();
 
-	llinfos << "Viewer disconnected" << llendflush;
+	llinfos << "Viewer disconnected" << LL_ENDL;
 
 	display_cleanup(); 
 
@@ -1693,7 +1693,7 @@ bool LLAppViewer::cleanup()
 
 	LLError::logToFixedBuffer(NULL);
 
-	llinfos << "Cleaning Up" << llendflush;
+	llinfos << "Cleaning Up" << LL_ENDL;
 
 	// shut down mesh streamer
 	gMeshRepo.shutdown();
@@ -1708,7 +1708,7 @@ bool LLAppViewer::cleanup()
 		LLHUDObject::updateAll();
 		LLHUDManager::getInstance()->cleanupEffects();
 		LLHUDObject::cleanupHUDObjects();
-		llinfos << "HUD Objects cleaned up" << llendflush;
+		llinfos << "HUD Objects cleaned up" << LL_ENDL;
 	}
 
 	LLKeyframeDataCache::clear();
@@ -1739,7 +1739,7 @@ bool LLAppViewer::cleanup()
 
 	LLCalc::cleanUp();
 
-	llinfos << "Global stuff deleted" << llendflush;
+	llinfos << "Global stuff deleted" << LL_ENDL;
 
 	if (gAudiop)
 	{
@@ -1763,7 +1763,7 @@ bool LLAppViewer::cleanup()
 	// such that we can suck rectangle information out of
 	// it.
 	cleanupSavedSettings();
-	llinfos << "Settings patched up" << llendflush;
+	llinfos << "Settings patched up" << LL_ENDL;
 
 	// delete some of the files left around in the cache.
 	removeCacheFiles("*.wav");
@@ -1774,29 +1774,29 @@ bool LLAppViewer::cleanup()
 	removeCacheFiles("*.bodypart");
 	removeCacheFiles("*.clothing");
 
-	llinfos << "Cache files removed" << llendflush;
+	llinfos << "Cache files removed" << LL_ENDL;
 
 	// Wait for any pending VFS IO
 	flushVFSIO();
-	llinfos << "Shutting down Views" << llendflush;
+	llinfos << "Shutting down Views" << LL_ENDL;
 
 	// Destroy the UI
 	if( gViewerWindow)
 		gViewerWindow->shutdownViews();
 
-	llinfos << "Cleaning up Inventory" << llendflush;
+	llinfos << "Cleaning up Inventory" << LL_ENDL;
 	
 	// Cleanup Inventory after the UI since it will delete any remaining observers
 	// (Deleted observers should have already removed themselves)
 	gInventory.cleanupInventory();
 
-	llinfos << "Cleaning up Selections" << llendflush;
+	llinfos << "Cleaning up Selections" << LL_ENDL;
 	
 	// Clean up selection managers after UI is destroyed, as UI may be observing them.
 	// Clean up before GL is shut down because we might be holding on to objects with texture references
 	LLSelectMgr::cleanupGlobals();
 	
-	llinfos << "Shutting down OpenGL" << llendflush;
+	llinfos << "Shutting down OpenGL" << LL_ENDL;
 
 	// Shut down OpenGL
 	if( gViewerWindow)
@@ -1808,10 +1808,10 @@ bool LLAppViewer::cleanup()
 		// Therefore must do this before destroying the message system.
 		delete gViewerWindow;
 		gViewerWindow = NULL;
-		llinfos << "ViewerWindow deleted" << llendflush;
+		llinfos << "ViewerWindow deleted" << LL_ENDL;
 	}
 
-	llinfos << "Cleaning up Keyboard & Joystick" << llendflush;
+	llinfos << "Cleaning up Keyboard & Joystick" << LL_ENDL;
 	
 	// viewer UI relies on keyboard so keep it aound until viewer UI isa gone
 	delete gKeyboard;
@@ -1820,7 +1820,7 @@ bool LLAppViewer::cleanup()
 	// Turn off Space Navigator and similar devices
 	LLViewerJoystick::getInstance()->terminate();
 	
-	llinfos << "Cleaning up Objects" << llendflush;
+	llinfos << "Cleaning up Objects" << LL_ENDL;
 	
 	LLViewerObject::cleanupVOClasses();
 
@@ -1842,11 +1842,11 @@ bool LLAppViewer::cleanup()
 	LLVolumeMgr* volume_manager = LLPrimitive::getVolumeManager();
 	if (!volume_manager->cleanup())
 	{
-		llwarns << "Remaining references in the volume manager!" << llendflush;
+		llwarns << "Remaining references in the volume manager!" << LL_ENDL;
 	}
 	LLPrimitive::cleanupVolumeManager();
 
-	llinfos << "Additional Cleanup..." << llendflush;	
+	llinfos << "Additional Cleanup..." << LL_ENDL;	
 	
 	LLViewerParcelMgr::cleanupGlobals();
 
@@ -1867,10 +1867,10 @@ bool LLAppViewer::cleanup()
 	// Also after shutting down the messaging system since it has VFS dependencies
 
 	//
-	llinfos << "Cleaning up VFS" << llendflush;
+	llinfos << "Cleaning up VFS" << LL_ENDL;
 	LLVFile::cleanupClass();
 
-	llinfos << "Saving Data" << llendflush;
+	llinfos << "Saving Data" << LL_ENDL;
 	
 	// Store the time of our current logoff
 	gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
@@ -1897,7 +1897,7 @@ bool LLAppViewer::cleanup()
 	else
 	{
 		gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
-		llinfos << "Saved settings" << llendflush;
+		llinfos << "Saved settings" << LL_ENDL;
 	}
 
 	std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings"));
@@ -1914,7 +1914,7 @@ bool LLAppViewer::cleanup()
 
 	if (mPurgeOnExit)
 	{
-		llinfos << "Purging all cache files on exit" << llendflush;
+		llinfos << "Purging all cache files on exit" << LL_ENDL;
 		gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*");
 	}
 
@@ -1931,7 +1931,7 @@ bool LLAppViewer::cleanup()
 	// Stop the plugin read thread if it's running.
 	LLPluginProcessParent::setUseReadThread(false);
 
-	llinfos << "Shutting down Threads" << llendflush;
+	llinfos << "Shutting down Threads" << LL_ENDL;
 
 	// Let threads finish
 	LLTimer idleTimer;
@@ -1969,7 +1969,7 @@ bool LLAppViewer::cleanup()
 	sTextureFetch->shutDownTextureCacheThread() ;
 	sTextureFetch->shutDownImageDecodeThread() ;
 
-	llinfos << "Shutting down message system" << llendflush;
+	llinfos << "Shutting down message system" << LL_ENDL;
 	end_messaging_system();
 
 	// *NOTE:Mani - The following call is not thread safe. 
@@ -2008,7 +2008,7 @@ bool LLAppViewer::cleanup()
 
 	LLMetricPerformanceTesterBasic::cleanClass() ;
 
-	llinfos << "Cleaning up Media and Textures" << llendflush;
+	llinfos << "Cleaning up Media and Textures" << LL_ENDL;
 
 	//Note:
 	//LLViewerMedia::cleanupClass() has to be put before gTextureList.shutdown()
@@ -2031,7 +2031,7 @@ bool LLAppViewer::cleanup()
 	}
 #endif
 
-	llinfos << "Misc Cleanup" << llendflush;
+	llinfos << "Misc Cleanup" << LL_ENDL;
 	
 	// For safety, the LLVFS has to be deleted *after* LLVFSThread. This should be cleaned up.
 	// (LLVFS doesn't know about LLVFSThread so can't kill pending requests) -Steve
@@ -2051,7 +2051,7 @@ bool LLAppViewer::cleanup()
 	// is at the right resolution before we launch IE.
 	if (!gLaunchFileOnQuit.empty())
 	{
-		llinfos << "Launch file on quit." << llendflush;
+		llinfos << "Launch file on quit." << LL_ENDL;
 #if LL_WINDOWS
 		// Indicate an application is starting.
 		SetCursor(LoadCursor(NULL, IDC_WAIT));
@@ -2061,7 +2061,7 @@ bool LLAppViewer::cleanup()
 		ms_sleep(1000);
 
 		LLWeb::loadURLExternal( gLaunchFileOnQuit, false );
-		llinfos << "File launched." << llendflush;
+		llinfos << "File launched." << LL_ENDL;
 	}
 	llinfos << "Cleaning up LLProxy." << llendl;
 	LLProxy::cleanupClass();
@@ -2075,7 +2075,7 @@ bool LLAppViewer::cleanup()
 
 	ll_close_fail_log();
 
-    llinfos << "Goodbye!" << llendflush;
+    llinfos << "Goodbye!" << LL_ENDL;
 
 	// return 0;
 	return true;
@@ -4559,7 +4559,7 @@ void LLAppViewer::idle()
 	{
 		LLFastTimer t(FTM_NETWORK);
 		// Update spaceserver timeinfo
-	    LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC));
+	    LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw));
     
     
 	    //////////////////////////////////////
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index e7dd6050445df09f997ef16b5ecaa7b6317a95d7..60a1045f58f26170913155c64c931fa18fbdbb2b 100755
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -334,12 +334,12 @@ extern U32 gForegroundFrameCount;
 
 extern LLPumpIO* gServicePump;
 
-extern U64      gFrameTime;					// The timestamp of the most-recently-processed frame
-extern F32		gFrameTimeSeconds;			// Loses msec precision after ~4.5 hours...
-extern LLUnit<F32, LLUnits::Seconds>		gFrameIntervalSeconds;		// Elapsed time between current and previous gFrameTimeSeconds
+extern LLUnitImplicit<U64, LLUnits::Microseconds>	gStartTime;
+extern LLUnitImplicit<U64, LLUnits::Microseconds>   gFrameTime;					// The timestamp of the most-recently-processed frame
+extern LLUnitImplicit<F32, LLUnits::Seconds>		gFrameTimeSeconds;			// Loses msec precision after ~4.5 hours...
+extern LLUnitImplicit<F32, LLUnits::Seconds>		gFrameIntervalSeconds;		// Elapsed time between current and previous gFrameTimeSeconds
 extern F32		gFPSClamped;				// Frames per second, smoothed, weighted toward last frame
 extern F32		gFrameDTClamped;
-extern U64		gStartTime;
 extern U32 		gFrameStalls;
 
 extern LLTimer gRenderStartTime;
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index b7cdcb058b883191cb3644b63430483f73084732..f08d2c2a037b38260e4b6fd3048b5c05635008ff 100755
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -53,7 +53,6 @@
 #include <stdlib.h>
 
 #include "llweb.h"
-#include "llsecondlifeurls.h"
 
 #include "llviewernetwork.h"
 #include "llmd5.h"
@@ -307,14 +306,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
 		// app cleanup if there was a problem.
 		//
 #if WINDOWS_CRT_MEM_CHECKS
-    llinfos << "CRT Checking memory:" << llendflush;
+    llinfos << "CRT Checking memory:" << LL_ENDL;
 	if (!_CrtCheckMemory())
 	{
-		llwarns << "_CrtCheckMemory() failed at prior to cleanup!" << llendflush;
+		llwarns << "_CrtCheckMemory() failed at prior to cleanup!" << LL_ENDL;
 	}
 	else
 	{
-		llinfos << " No corruption detected." << llendflush;
+		llinfos << " No corruption detected." << LL_ENDL;
 	}
 #endif
 	
@@ -323,14 +322,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
 	viewer_app_ptr->cleanup();
 	
 #if WINDOWS_CRT_MEM_CHECKS
-    llinfos << "CRT Checking memory:" << llendflush;
+    llinfos << "CRT Checking memory:" << LL_ENDL;
 	if (!_CrtCheckMemory())
 	{
-		llwarns << "_CrtCheckMemory() failed after cleanup!" << llendflush;
+		llwarns << "_CrtCheckMemory() failed after cleanup!" << LL_ENDL;
 	}
 	else
 	{
-		llinfos << " No corruption detected." << llendflush;
+		llinfos << " No corruption detected." << LL_ENDL;
 	}
 #endif
 	 
@@ -568,7 +567,7 @@ bool LLAppViewerWin32::initHardwareTest()
 			if (OSBTN_NO== button)
 			{
 				LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL;
-				LLWeb::loadURLExternal(DIRECTX_9_URL, false);
+				LLWeb::loadURLExternal("http://secondlife.com/support/, false);
 				return false;
 			}
 			gWarningSettings.setBOOL("AboutDirectX9", FALSE);
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index b513a52ff7c56c360c3f04af6edfdd900bb16201..1d774e6eac873b9120b4394dd8f0bcbe092396d0 100755
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -33,7 +33,6 @@
 
 #include "llavatarnamecache.h"	// IDEVO
 #include "llsd.h"
-#include "lldarray.h"
 #include "llnotifications.h"
 #include "llnotificationsutil.h"
 #include "roles_constants.h"    // for GP_MEMBER_INVITE
@@ -74,6 +73,12 @@
 #include "llslurl.h"			// IDEVO
 #include "llsidepanelinventory.h"
 
+// Flags for kick message
+const U32 KICK_FLAGS_DEFAULT	= 0x0;
+const U32 KICK_FLAGS_FREEZE		= 1 << 0;
+const U32 KICK_FLAGS_UNFREEZE	= 1 << 1;
+
+
 // static
 void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name)
 {
@@ -164,7 +169,7 @@ void LLAvatarActions::offerTeleport(const LLUUID& invitee)
 	if (invitee.isNull())
 		return;
 
-	LLDynamicArray<LLUUID> ids;
+	std::vector<LLUUID> ids;
 	ids.push_back(invitee);
 	offerTeleport(ids);
 }
@@ -242,8 +247,9 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floate
 		return;
 	}
 
-	// convert vector into LLDynamicArray for addSession
-	LLDynamicArray<LLUUID> id_array;
+	// convert vector into std::vector for addSession
+	std::vector<LLUUID> id_array;
+	id_array.reserve(ids.size());
 	for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
 	{
 		id_array.push_back(*it);
@@ -288,7 +294,9 @@ bool LLAvatarActions::canCall()
 void LLAvatarActions::startConference(const uuid_vec_t& ids, const LLUUID& floater_id)
 {
 	// *HACK: Copy into dynamic array
-	LLDynamicArray<LLUUID> id_array;
+	std::vector<LLUUID> id_array;
+
+	id_array.reserve(ids.size());
 	for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
 	{
 		id_array.push_back(*it);
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index 6e1198cd09885b89f2b3d6c268f74558b410eef4..dd5f5eddf4d0e4a4f3d1957d80bb6229dce7668f 100755
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -27,7 +27,6 @@
 #ifndef LL_LLAVATARACTIONS_H
 #define LL_LLAVATARACTIONS_H
 
-#include "lldarray.h"
 #include "llsd.h"
 #include "lluuid.h"
 
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index f34ad2376994316c71cc874fd33af9e695a542a8..0d1ecc9c473af97586011558efec912444cad54d 100755
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -32,7 +32,6 @@
 
 // viewer includes
 #include "llagent.h"
-#include "llavatarconstants.h"
 #include "llcallingcard.h" // for LLAvatarTracker
 #include "llavataractions.h"
 #include "llmenugl.h"
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 9f02f301a187390dad5879bda3fe83e64e750fca..8846d1317d1e173a469be467b3a4502c4e3ab7b7 100755
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -586,7 +586,7 @@ bool LLAvatarItemComparator::compare(const LLPanel* item1, const LLPanel* item2)
 	
 	if (!avatar_item1 || !avatar_item2)
 	{
-		llerror("item1 and item2 cannot be null", 0);
+		LL_ERRS() << "item1 and item2 cannot be null" << LL_ENDL;
 		return true;
 	}
 
diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp
index 706bc42ea07cac99f442f40438bfd7fa9bd58e31..f095ef25d1096fab7e1ec7da2223656031d22a49 100755
--- a/indra/newview/llavatarpropertiesprocessor.cpp
+++ b/indra/newview/llavatarpropertiesprocessor.cpp
@@ -36,7 +36,6 @@
 #include "llstartup.h"
 
 // Linden library includes
-#include "llavatarconstants.h"	// AVATAR_TRANSACTED, etc.
 #include "lldate.h"
 #include "lltrans.h"
 #include "llui.h"				// LLUI::getLanguage()
diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h
index fdb88a41a11b760d50c53d0d17281c1b235d79ef..1dcd2c9b907b674a1f80d1f442914d408bba0e9c 100755
--- a/indra/newview/llavatarpropertiesprocessor.h
+++ b/indra/newview/llavatarpropertiesprocessor.h
@@ -33,6 +33,14 @@
 #include <list>
 #include <map>
 
+// For Flags in AvatarPropertiesReply
+const U32 AVATAR_ALLOW_PUBLISH			= 0x1 << 0;	// whether profile is externally visible or not
+const U32 AVATAR_MATURE_PUBLISH			= 0x1 << 1;	// profile is "mature"
+const U32 AVATAR_IDENTIFIED				= 0x1 << 2;	// whether avatar has provided payment info
+const U32 AVATAR_TRANSACTED				= 0x1 << 3;	// whether avatar has actively used payment info
+const U32 AVATAR_ONLINE					= 0x1 << 4; // the online status of this avatar, if known.
+const U32 AVATAR_AGEVERIFIED			= 0x1 << 5;	// whether avatar has been age-verified
+
 /*
 *TODO Vadim: This needs some refactoring:
 - Remove EAvatarProcessorType in favor of separate observers, derived from a common parent (to get rid of void*).
diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp
index 066cb71677a810488557f1594ff32806256c66cd..5133ceb64f99c57cd54db3bc1419473ff0a3912a 100755
--- a/indra/newview/llblocklist.cpp
+++ b/indra/newview/llblocklist.cpp
@@ -246,7 +246,7 @@ bool LLBlockListItemComparator::compare(const LLPanel* item1, const LLPanel* ite
 
 	if (!blocked_item1 || !blocked_item2)
 	{
-		llerror("blocked_item1 and blocked_item2 cannot be null", 0);
+		LL_ERRS() << "blocked_item1 and blocked_item2 cannot be null" << LL_ENDL;
 		return true;
 	}
 
diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp
index b883941963d5f25d25b9df03fe40646dad78de18..9b575872370fc732c75bb95eea061cfd51d71284 100755
--- a/indra/newview/llchatbar.cpp
+++ b/indra/newview/llchatbar.cpp
@@ -28,7 +28,6 @@
 
 #include "llchatbar.h"
 
-#include "imageids.h"
 #include "llfontgl.h"
 #include "llrect.h"
 #include "llerror.h"
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index e86d6930e89025c04ebb19a369fdb2f99758c89a..b5bb303b657954f8bbeea089d58f6844815d6b88 100755
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -477,7 +477,7 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel
 {
 	for (U32 i = 0; i < cof_items.size(); ++i)
 	{
-		LLViewerInventoryItem* item = cof_items.get(i);
+		LLViewerInventoryItem* item = cof_items.at(i);
 		if (!item) continue;
 
 		const LLAssetType::EType item_type = item->getType();
diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp
index f1f7da5fd1f7f5865b5330578588c4fee9129656..a03178adf62cab76d674bae981c42f72361976d7 100755
--- a/indra/newview/llcolorswatch.cpp
+++ b/indra/newview/llcolorswatch.cpp
@@ -37,13 +37,11 @@
 #include "llui.h"
 #include "llrender.h"
 #include "lluiconstants.h"
-#include "llviewercontrol.h"
 #include "llbutton.h"
-#include "lltextbox.h"
 #include "llfloatercolorpicker.h"
 #include "llviewborder.h"
-#include "llviewertexturelist.h"
 #include "llfocusmgr.h"
+#include "lltextbox.h"
 
 static LLDefaultChildRegistry::Register<LLColorSwatchCtrl> r("color_swatch");
 
@@ -239,16 +237,9 @@ void LLColorSwatchCtrl::draw()
 	}
 	else
 	{
-		if (!mFallbackImageName.empty())
+		if (mFallbackImage.notNull())
 		{
-			LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName, FTT_LOCAL_FILE, TRUE, 
-				LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
-			if( fallback_image->getComponents() == 4 )
-			{	
-				gl_rect_2d_checkerboard( interior );
-			}	
-			gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), fallback_image, LLColor4::white % alpha);
-			fallback_image->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
+			mFallbackImage->draw(interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), LLColor4::white % alpha);
 		}
 		else
 		{
diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h
index 5bdd1712d2002cc84166b2643fb5fd9b7057085e..df907567ab8f69839a715a462b49be5bcf2b127a 100755
--- a/indra/newview/llcolorswatch.h
+++ b/indra/newview/llcolorswatch.h
@@ -30,16 +30,13 @@
 #include "lluictrl.h"
 #include "v4color.h"
 #include "llfloater.h"
-#include "llviewertexture.h"
 #include "lltextbox.h"
 
 //
 // Classes
 //
 class LLColor4;
-class LLTextBox;
 class LLFloaterColorPicker;
-class LLViewerTexture;
 
 class LLColorSwatchCtrl
 : public LLUICtrl
@@ -87,7 +84,7 @@ class LLColorSwatchCtrl
 	void			setCanApplyImmediately(BOOL apply) { mCanApplyImmediately = apply; }
 	void			setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; }
 	void			setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; }
-	void			setFallbackImageName(const std::string& name) { mFallbackImageName = name; }
+	void			setFallbackImage(LLPointer<LLUIImage> image) { mFallbackImage = image; }
 
 	void			showPicker(BOOL take_focus);
 
@@ -103,20 +100,20 @@ class LLColorSwatchCtrl
 	void			closeFloaterColorPicker();
 
 protected:
-	BOOL			mValid;
-	LLColor4		mColor;
-	LLUIColor		mBorderColor;
-	LLTextBox*		mCaption;
-	LLHandle<LLFloater> mPickerHandle;
-	LLViewBorder*	mBorder;
-	BOOL			mCanApplyImmediately;
-	commit_callback_t mOnCancelCallback;
-	commit_callback_t mOnSelectCallback;
-	S32             mLabelWidth;
-	S32             mLabelHeight;
+	bool					mValid;
+	LLColor4				mColor;
+	LLUIColor				mBorderColor;
+	LLTextBox*				mCaption;
+	LLHandle<LLFloater>		mPickerHandle;
+	class LLViewBorder*		mBorder;
+	bool					mCanApplyImmediately;
+	commit_callback_t		mOnCancelCallback,
+							mOnSelectCallback;
+	S32						mLabelWidth,
+							mLabelHeight;
 
 	LLPointer<LLUIImage> mAlphaGradientImage;
-	std::string		mFallbackImageName;
+	LLPointer<LLUIImage> mFallbackImage;
 };
 
 #endif  // LL_LLBUTTON_H
diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp
index d70d575eabc22f0034cabfe19e55babb34dfc2e6..055a69727e2769a22789f5264502ba4a83381529 100755
--- a/indra/newview/llcompilequeue.cpp
+++ b/indra/newview/llcompilequeue.cpp
@@ -45,7 +45,6 @@
 #include "llviewerobject.h"
 #include "llviewerobjectlist.h"
 #include "llviewerregion.h"
-#include "lscript_rt_interface.h"
 #include "llviewercontrol.h"
 #include "llviewerobject.h"
 #include "llviewerregion.h"
@@ -154,7 +153,7 @@ void LLFloaterScriptQueue::onCloseBtn(void* user_data)
 
 void LLFloaterScriptQueue::addObject(const LLUUID& id)
 {
-	mObjectIDs.put(id);
+	mObjectIDs.push_back(id);
 }
 
 BOOL LLFloaterScriptQueue::start()
@@ -163,7 +162,7 @@ BOOL LLFloaterScriptQueue::start()
 
 	LLStringUtil::format_map_t args;
 	args["[START]"] = mStartString;
-	args["[COUNT]"] = llformat ("%d", mObjectIDs.count());
+	args["[COUNT]"] = llformat ("%d", mObjectIDs.size());
 	buffer = getString ("Starting", args);
 	
 	getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM);
@@ -173,18 +172,18 @@ BOOL LLFloaterScriptQueue::start()
 
 BOOL LLFloaterScriptQueue::isDone() const
 {
-	return (mCurrentObjectID.isNull() && (mObjectIDs.count() == 0));
+	return (mCurrentObjectID.isNull() && (mObjectIDs.size() == 0));
 }
 
 // go to the next object. If no objects left, it falls out silently
 // and waits to be killed by the window being closed.
 BOOL LLFloaterScriptQueue::nextObject()
 {
-	S32 count;
+	U32 count;
 	BOOL successful_start = FALSE;
 	do
 	{
-		count = mObjectIDs.count();
+		count = mObjectIDs.size();
 		llinfos << "LLFloaterScriptQueue::nextObject() - " << count
 				<< " objects left to process." << llendl;
 		mCurrentObjectID.setNull();
@@ -195,7 +194,7 @@ BOOL LLFloaterScriptQueue::nextObject()
 		llinfos << "LLFloaterScriptQueue::nextObject() "
 				<< (successful_start ? "successful" : "unsuccessful")
 				<< llendl; 
-	} while((mObjectIDs.count() > 0) && !successful_start);
+	} while((mObjectIDs.size() > 0) && !successful_start);
 	if(isDone() && !mDone)
 	{
 		mDone = true;
@@ -212,13 +211,13 @@ BOOL LLFloaterScriptQueue::popNext()
 	// get the first element off of the container, and attempt to get
 	// the inventory.
 	BOOL rv = FALSE;
-	S32 count = mObjectIDs.count();
+	S32 count = mObjectIDs.size();
 	if(mCurrentObjectID.isNull() && (count > 0))
 	{
-		mCurrentObjectID = mObjectIDs.get(0);
+		mCurrentObjectID = mObjectIDs.at(0);
 		llinfos << "LLFloaterScriptQueue::popNext() - mCurrentID: "
 				<< mCurrentObjectID << llendl;
-		mObjectIDs.remove(0);
+		mObjectIDs.erase(mObjectIDs.begin());
 		LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID);
 		if(obj)
 		{
@@ -306,7 +305,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
 				item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) )
 			{
 				LLPointer<LLViewerInventoryItem> script = new LLViewerInventoryItem(item);
-				mCurrentScripts.put(script);
+				mCurrentScripts.push_back(script);
 				asset_item_map.insert(std::make_pair(item->getAssetUUID(), item));
 			}
 		}
@@ -388,37 +387,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
 			}
 			else
 			{
-				// It's now in the file, now compile it.
-				buffer = LLTrans::getString("CompileQueueDownloadedCompiling") + (": ") + data->mScriptName;
-
-				// Write script to local file for compilation.
-				LLFILE *fp = LLFile::fopen(filename, "wb");	 /*Flawfinder: ignore*/
-				if (fp)
-				{
-					const S32 buf_size = 65536;
-					U8 copy_buf[buf_size];
-					
-					while (file.read(copy_buf, buf_size)) 	 /*Flawfinder: ignore*/
-					{
-						if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1)
-						{
-							// return a bad file error if we can't write the whole thing
-							status = LL_ERR_CANNOT_OPEN_FILE;
-						}
-					}
-
-					fclose(fp);
-				}
-				else
-				{
-					llerrs << "Unable to find object to compile" << llendl;
-				}
-
-				// TODO: babbage: No compile if no cap.
-				queue->compile(filename, data->mItemId);
-					
-				// Delete it after we're done compiling?
-				LLFile::remove(filename);
+				buffer = LLTrans::getString("CompileQueueServiceUnavailable") + (": ") + data->mScriptName;
 			}
 		}
 	}
@@ -455,138 +424,6 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
 	delete data;
 }
 
-// static
-void LLFloaterCompileQueue::onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
-{
-	llinfos << "LLFloaterCompileQueue::onSaveTextComplete()" << llendl;
-	if (status)
-	{
-		llwarns << "Unable to save text for script." << llendl;
-		LLSD args;
-		args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
-		LLNotificationsUtil::add("CompileQueueSaveText", args);
-	}
-}
-
-// static
-void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
-{
-	llinfos << "LLFloaterCompileQueue::onSaveBytecodeComplete()" << llendl;
-	LLCompileQueueData* data = (LLCompileQueueData*)user_data;
-	LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance<LLFloaterCompileQueue>("compile_queue", data->mQueueID);
-	if(queue && (0 == status) && data)
-	{
-		queue->saveItemByItemID(data->mItemId);
-		queue->removeItemByItemID(data->mItemId);
-	}
-	else
-	{
-		llwarns << "Unable to save bytecode for script." << llendl;
-		LLSD args;
-		args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
-		LLNotificationsUtil::add("CompileQueueSaveBytecode", args);
-	}
-	delete data;
-	data = NULL;
-}
-
-// compile the file given and save it out.
-void LLFloaterCompileQueue::compile(const std::string& filename,
-									const LLUUID& item_id)
-{
-	LLUUID new_asset_id;
-	LLTransactionID tid;
-	tid.generate();
-	new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
-	
-	std::string uuid_string;
-	new_asset_id.toString(uuid_string);
-	std::string dst_filename;
-	dst_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".lso";
-	std::string err_filename;
-	err_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".out";
-
-	gAssetStorage->storeAssetData(filename, tid,
-								  LLAssetType::AT_LSL_TEXT,
-								  &onSaveTextComplete, NULL, FALSE);
-
-	const BOOL compile_to_mono = FALSE;
-	if(!lscript_compile(filename.c_str(), dst_filename.c_str(),
-						err_filename.c_str(), compile_to_mono,
-						uuid_string.c_str(), gAgent.isGodlike()))
-	{
-		llwarns << "compile failed" << llendl;
-		removeItemByItemID(item_id);
-	}
-	else
-	{
-		llinfos << "compile successful." << llendl;
-		
-		// Save LSL bytecode
-		LLCompileQueueData* data = new LLCompileQueueData(getKey().asUUID(), item_id);
-		gAssetStorage->storeAssetData(dst_filename, new_asset_id,
-									LLAssetType::AT_LSL_BYTECODE,
-									&LLFloaterCompileQueue::onSaveBytecodeComplete,
-									(void*)data, FALSE);
-	}
-}
-
-void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id)
-{
-	llinfos << "LLFloaterCompileQueue::removeItemByAssetID()" << llendl;
-	for(S32 i = 0; i < mCurrentScripts.count(); )
-	{
-		if(asset_id == mCurrentScripts.get(i)->getUUID())
-		{
-			mCurrentScripts.remove(i);
-		}
-		else
-		{
-			++i;
-		}
-	}
-	if(mCurrentScripts.count() == 0)
-	{
-		nextObject();
-	}
-}
-
-const LLInventoryItem* LLFloaterCompileQueue::findItemByItemID(const LLUUID& asset_id) const
-{
-	LLInventoryItem* result = NULL;
-	S32 count = mCurrentScripts.count();
-	for(S32 i = 0; i < count; ++i)
-	{
-		if(asset_id == mCurrentScripts.get(i)->getUUID())
-		{
-			result = mCurrentScripts.get(i);
-		}
-	}
-	return result;
-}
-
-void LLFloaterCompileQueue::saveItemByItemID(const LLUUID& asset_id)
-{
-	llinfos << "LLFloaterCompileQueue::saveItemByAssetID()" << llendl;
-	LLViewerObject* viewer_object = gObjectList.findObject(mCurrentObjectID);
-	if(viewer_object)
-	{
-		S32 count = mCurrentScripts.count();
-		for(S32 i = 0; i < count; ++i)
-		{
-			if(asset_id == mCurrentScripts.get(i)->getUUID())
-			{
-				// *FIX: this auto-resets active to TRUE. That might
-				// be a bad idea.
-				viewer_object->saveScript(mCurrentScripts.get(i), TRUE, false);
-			}
-		}
-	}
-	else
-	{
-		llwarns << "Unable to finish save!" << llendl;
-	}
-}
 
 ///----------------------------------------------------------------------------
 /// Class LLFloaterResetQueue
@@ -608,8 +445,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj,
 {
 	// find all of the lsl, leaving off duplicates. We'll remove
 	// all matching asset uuids on compilation success.
-	LLDynamicArray<const char*> names;
-	
+
 	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
 	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it)
@@ -660,8 +496,6 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj,
 {
 	// find all of the lsl, leaving off duplicates. We'll remove
 	// all matching asset uuids on compilation success.
-	LLDynamicArray<const char*> names;
-	
 	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
 	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it)
@@ -710,13 +544,31 @@ LLFloaterNotRunQueue::~LLFloaterNotRunQueue()
 { 
 }
 
+void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id)
+{
+	llinfos << "LLFloaterCompileQueue::removeItemByAssetID()" << llendl;
+	for(S32 i = 0; i < mCurrentScripts.size(); )
+	{
+		if(asset_id == mCurrentScripts.at(i)->getUUID())
+		{
+			vector_replace_with_last(mCurrentScripts, mCurrentScripts.begin() + i);
+		}
+		else
+		{
+			++i;
+		}
+	}
+	if(mCurrentScripts.empty())
+	{
+		nextObject();
+	}
+}
+
 void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj,
 										  LLInventoryObject::object_list_t* inv)
 {
 	// find all of the lsl, leaving off duplicates. We'll remove
 	// all matching asset uuids on compilation success.
-	LLDynamicArray<const char*> names;
-	
 	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
 	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it)
diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h
index 4ddab29d00eba0b62ccfa6c98dbb6cbadaca2c3f..28f4625de87d09bc1347c7adebe5fef440c2c60c 100755
--- a/indra/newview/llcompilequeue.h
+++ b/indra/newview/llcompilequeue.h
@@ -27,11 +27,9 @@
 #ifndef LL_LLCOMPILEQUEUE_H
 #define LL_LLCOMPILEQUEUE_H
 
-#include "lldarray.h"
 #include "llinventory.h"
 #include "llviewerobject.h"
 #include "llvoinventorylistener.h"
-#include "llmap.h"
 #include "lluuid.h"
 
 #include "llfloater.h"
@@ -96,7 +94,7 @@ class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener
 	LLButton* mCloseBtn;
 
 	// Object Queue
-	LLDynamicArray<LLUUID> mObjectIDs;
+	std::vector<LLUUID> mObjectIDs;
 	LLUUID mCurrentObjectID;
 	bool mDone;
 
@@ -146,24 +144,6 @@ class LLFloaterCompileQueue : public LLFloaterScriptQueue
 								LLAssetType::EType type,
 								void* user_data, S32 status, LLExtStat ext_status);
 
-	static void onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status);
-
-	static void onSaveBytecodeComplete(const LLUUID& asset_id,
-									   void* user_data,
-									   S32 status, LLExtStat ext_status);
-
-	// compile the file given and save it out.
-	void compile(const std::string& filename, const LLUUID& asset_id);
-	
-	// remove any object in mScriptScripts with the matching uuid.
-	void removeItemByAssetID(const LLUUID& asset_id);
-
-	// save the items indicated by the item id.
-	void saveItemByItemID(const LLUUID& item_id);
-
-	// find InventoryItem given item id.
-	const LLInventoryItem* findItemByItemID(const LLUUID& item_id) const;
-	
 protected:
 	LLViewerInventoryItem::item_array_t mCurrentScripts;
 
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index 7883e4cb894c0c4eead6a694be438b2ce0d4e761..7ecc572a8a56cc93a555ad67b888e10bea1edb52 100755
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -37,21 +37,16 @@
 
 const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec
 
-struct ConversationParams
-{
-	ConversationParams(time_t time)
-	:	mTime(time),
-		mTimestamp(LLConversation::createTimestamp(time))
-	{}
-
-	time_t		mTime;
-	std::string	mTimestamp;
-	SessionType	mConversationType;
-	std::string	mConversationName;
-	std::string	mHistoryFileName;
-	LLUUID		mSessionID;
-	LLUUID		mParticipantID;
-	bool		mHasOfflineIMs;
+struct ConversationParams : public LLInitParam::Block<ConversationParams>
+{
+	Mandatory<LLUnit<U64, LLUnits::Seconds> >	time;
+	Mandatory<std::string>						timestamp;
+	Mandatory<SessionType>						conversation_type;
+	Mandatory<std::string>						conversation_name,
+												history_filename;
+	Mandatory<LLUUID>							session_id,
+												participant_id;
+	Mandatory<bool>								has_offline_ims;
 };
 
 /************************************************************************/
@@ -59,14 +54,14 @@ struct ConversationParams
 /************************************************************************/
 
 LLConversation::LLConversation(const ConversationParams& params)
-:	mTime(params.mTime),
-	mTimestamp(params.mTimestamp),
-	mConversationType(params.mConversationType),
-	mConversationName(params.mConversationName),
-	mHistoryFileName(params.mHistoryFileName),
-	mSessionID(params.mSessionID),
-	mParticipantID(params.mParticipantID),
-	mHasOfflineIMs(params.mHasOfflineIMs)
+:	mTime(params.time),
+	mTimestamp(params.timestamp),
+	mConversationType(params.conversation_type),
+	mConversationName(params.conversation_name),
+	mHistoryFileName(params.history_filename),
+	mSessionID(params.session_id),
+	mParticipantID(params.participant_id),
+	mHasOfflineIMs(params.has_offline_ims)
 {
 	setListenIMFloaterOpened();
 }
@@ -118,11 +113,11 @@ void LLConversation::onIMFloaterShown(const LLUUID& session_id)
 }
 
 // static
-const std::string LLConversation::createTimestamp(const time_t& utc_time)
+const std::string LLConversation::createTimestamp(const LLUnit<U64, LLUnits::Seconds>& utc_time)
 {
 	std::string timeStr;
 	LLSD substitution;
-	substitution["datetime"] = (S32) utc_time;
+	substitution["datetime"] = (S32)utc_time.value();
 
 	timeStr = "["+LLTrans::getString ("TimeMonth")+"]/["
 				 +LLTrans::getString ("TimeDay")+"]/["
@@ -137,8 +132,8 @@ const std::string LLConversation::createTimestamp(const time_t& utc_time)
 
 bool LLConversation::isOlderThan(U32 days) const
 {
-	time_t now = time_corrected();
-	U32 age = (U32)((now - mTime) / SEC_PER_DAY); // age of conversation in days
+	LLUnit<U64, LLUnits::Seconds> now = time_corrected();
+	LLUnit<U32, LLUnits::Days> age = now - mTime;
 
 	return age > days;
 }
@@ -485,7 +480,7 @@ bool LLConversationLog::saveToFile(const std::string& filename)
 		// [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a|
 
 		fprintf(fp, "[%lld] %d %d %d %s| %s %s %s|\n",
-				(S64)conv_it->getTime(),
+				(S64)conv_it->getTime().value(),
 				(S32)conv_it->getConversationType(),
 				(S32)0,
 				(S32)conv_it->hasOfflineMessages(),
@@ -539,13 +534,14 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
 				conv_id_buffer,
 				history_file_name);
 
-		ConversationParams params((time_t)time);
-		params.mConversationType = (SessionType)stype;
-		params.mHasOfflineIMs = has_offline_ims;
-		params.mConversationName = std::string(conv_name_buffer);
-		params.mParticipantID = LLUUID(part_id_buffer);
-		params.mSessionID = LLUUID(conv_id_buffer);
-		params.mHistoryFileName = std::string(history_file_name);
+		ConversationParams params;
+		params.time(time)
+			.conversation_type((SessionType)stype)
+			.has_offline_ims(has_offline_ims)
+			.conversation_name(conv_name_buffer)
+			.participant_id(LLUUID(part_id_buffer))
+			.session_id(LLUUID(conv_id_buffer))
+			.history_filename(history_file_name);
 
 		LLConversation conversation(params);
 
diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h
index 265b1f0ef04a0c74b492c2073acc1da315b87612..5d94cb64979bd1e4c0dbef60be6dc032dcaed736 100755
--- a/indra/newview/llconversationlog.h
+++ b/indra/newview/llconversationlog.h
@@ -55,7 +55,8 @@ class LLConversation
 	const LLUUID&		getSessionID()			const	{ return mSessionID; }
 	const LLUUID&		getParticipantID()		const	{ return mParticipantID; }
 	const std::string&	getTimestamp()			const	{ return mTimestamp; }
-	const time_t&		getTime()				const	{ return mTime; }
+	const LLUnit<U64, LLUnits::Seconds>&
+						getTime()				const	{ return mTime; }
 	bool				hasOfflineMessages()	const	{ return mHasOfflineIMs; }
 
 	void setConversationName(std::string conv_name) { mConversationName = conv_name; }
@@ -75,7 +76,7 @@ class LLConversation
 	/*
 	 * returns string representation(in form of: mm/dd/yyyy hh:mm) of time when conversation was started
 	 */
-	static const std::string createTimestamp(const time_t& utc_time);
+	static const std::string createTimestamp(const LLUnit<U64, LLUnits::Seconds>& utc_time);
 
 private:
 
@@ -87,7 +88,7 @@ class LLConversation
 
 	boost::signals2::connection mIMFloaterShowedConnection;
 
-	time_t			mTime; // last interaction time
+	LLUnit<U64, LLUnits::Seconds> mTime; // last interaction time
 	SessionType		mConversationType;
 	std::string		mConversationName;
 	std::string		mHistoryFileName;
diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp
index 5ab108b39fbc3279120a71c3933d9bdcd2c44ca2..bd5e0b8f88fc33710f390f48b0cc92e97256b22c 100755
--- a/indra/newview/llconversationloglist.cpp
+++ b/indra/newview/llconversationloglist.cpp
@@ -490,7 +490,7 @@ bool LLConversationLogListItemComparator::compare(const LLPanel* item1, const LL
 
 	if (!conversation_item1 || !conversation_item2)
 	{
-		llerror("conversation_item1 and conversation_item2 cannot be null", 0);
+		LL_ERRS() << "conversation_item1 and conversation_item2 cannot be null" << LL_ENDL;
 		return true;
 	}
 
@@ -518,8 +518,8 @@ bool LLConversationLogListNameComparator::doCompare(const LLConversationLogListI
 
 bool LLConversationLogListDateComparator::doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const
 {
-	time_t date1 = conversation1->getConversation()->getTime();
-	time_t date2 = conversation2->getConversation()->getTime();
+	LLUnit<U64, LLUnits::Seconds> date1 = conversation1->getConversation()->getTime();
+	LLUnit<U64, LLUnits::Seconds> date2 = conversation2->getConversation()->getTime();
 	const LLUUID& id1 = conversation1->getConversation()->getParticipantID();
 	const LLUUID& id2 = conversation2->getConversation()->getParticipantID();
 
diff --git a/indra/newview/lldebugmessagebox.h b/indra/newview/lldebugmessagebox.h
index 211af9e0742d0e48892a96c2b0502b77bdc3bd46..87a0910662aa119a456424f2f6b1aa2f5b774c8c 100755
--- a/indra/newview/lldebugmessagebox.h
+++ b/indra/newview/lldebugmessagebox.h
@@ -28,7 +28,6 @@
 #ifndef LL_LLDEBUGMESSAGEBOX_H
 #define LL_LLDEBUGMESSAGEBOX_H
 
-#include "lldarray.h"
 #include "llfloater.h"
 #include "v3math.h"
 #include "lltextbox.h"
diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp
index 63dd59b020ae6bf7fb983a44ea10f8ed17491c88..98c1685feb9b802ff07a9b32606313b9894a46e9 100755
--- a/indra/newview/lldebugview.cpp
+++ b/indra/newview/lldebugview.cpp
@@ -33,7 +33,6 @@
 #include "llconsole.h"
 #include "lltextureview.h"
 #include "llresmgr.h"
-#include "imageids.h"
 #include "llviewercontrol.h"
 #include "llviewerwindow.h"
 #include "llappviewer.h"
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 628f7f7bfb14ab659dbcc1a5665f3472b484140b..c59ce04646cfdc9bcf869e9b885fc817909f8379 100755
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -79,7 +79,7 @@ LLTrace::MemStatHandle	LLDrawable::sMemStat("LLDrawable");
 // static
 U32 LLDrawable::sNumZombieDrawables = 0;
 F32 LLDrawable::sCurPixelAngle = 0;
-LLDynamicArray<LLPointer<LLDrawable>, 32 > LLDrawable::sDeadList;
+std::vector<LLPointer<LLDrawable> > LLDrawable::sDeadList;
 
 #define FORCE_INVISIBLE_AREA 16.f
 
@@ -196,7 +196,7 @@ void LLDrawable::markDead()
 
 	// We're dead.  Free up all of our references to other objects
 	cleanupReferences();
-//	sDeadList.put(this);
+//	sDeadList.push_back(this);
 }
 
 LLVOVolume* LLDrawable::getVOVolume() const
@@ -277,7 +277,7 @@ void LLDrawable::cleanupDeadDrawables()
 {
 	/*
 	S32 i;
-	for (i = 0; i < sDeadList.count(); i++)
+	for (i = 0; i < sDeadList.size(); i++)
 	{
 		if (sDeadList[i]->getNumRefs() > 1)
 		{
@@ -286,7 +286,7 @@ void LLDrawable::cleanupDeadDrawables()
 		}
 	}
 	*/
-	sDeadList.reset();
+	sDeadList.clear();
 }
 
 S32 LLDrawable::findReferences(LLDrawable *drawablep)
diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h
index b7c5aeb5a87b331e591caba870fbf3228b23e558..08fbd7d2118f2037a52d9dec0a49fd82ee5dc1cb 100755
--- a/indra/newview/lldrawable.h
+++ b/indra/newview/lldrawable.h
@@ -38,7 +38,6 @@
 #include "llvector4a.h"
 #include "llquaternion.h"
 #include "xform.h"
-#include "lldarray.h"
 #include "llviewerobject.h"
 #include "llrect.h"
 #include "llappviewer.h" // for gFrameTimeSeconds
@@ -310,7 +309,7 @@ class LLDrawable
 	LLVector3		mCurrentScale;
 	
 	static U32 sNumZombieDrawables;
-	static LLDynamicArray<LLPointer<LLDrawable>, 32> sDeadList;
+	static std::vector<LLPointer<LLDrawable> > sDeadList;
 } LL_ALIGN_POSTFIX(16);
 
 
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index 7f7d9f65c60c048a26d02438e278dd21893f190f..edc368c29ece89a92faa387acfd20afce9d81695 100755
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -28,8 +28,6 @@
 
 #include "lldrawpoolsky.h"
 
-#include "imageids.h"
-
 #include "llagent.h"
 #include "lldrawable.h"
 #include "llface.h"
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 6d90667194fd3a8bb3ad7ca9508fe9495e3a1501..fc531a0c7400b9346bfcedfe9d23fe0603684b3a 100755
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -727,7 +727,7 @@ void LLFavoritesBarCtrl::updateButtons()
 	int first_changed_item_index = 0;
 	int rightest_point = getRect().mRight - mMoreTextBox->getRect().getWidth();
 	//lets find first changed button
-	while (child_it != childs->end() && first_changed_item_index < mItems.count())
+	while (child_it != childs->end() && first_changed_item_index < mItems.size())
 	{
 		LLFavoriteLandmarkButton* button = dynamic_cast<LLFavoriteLandmarkButton*> (*child_it);
 		if (button)
@@ -749,7 +749,7 @@ void LLFavoritesBarCtrl::updateButtons()
 	}
 	// now first_changed_item_index should contains a number of button that need to change
 
-	if (first_changed_item_index <= mItems.count())
+	if (first_changed_item_index <= mItems.size())
 	{
 		// Rebuild the buttons only
 		// child_list_t is a linked list, so safe to erase from the middle if we pre-increment the iterator
@@ -787,7 +787,7 @@ void LLFavoritesBarCtrl::updateButtons()
 		//last_right_edge is saving coordinates
 		LLButton* last_new_button = NULL;
 		int j = first_changed_item_index;
-		for (; j < mItems.count(); j++)
+		for (; j < mItems.size(); j++)
 		{
 			last_new_button = createButton(mItems[j], button_params, last_right_edge);
 			if (!last_new_button)
@@ -801,7 +801,7 @@ void LLFavoritesBarCtrl::updateButtons()
 		}
 		mFirstDropDownItem = j;
 		// Chevron button
-		if (mFirstDropDownItem < mItems.count())
+		if (mFirstDropDownItem < mItems.size())
 		{
 			// if updateButton had been called it means:
 			//or there are some new favorites, or width had been changed
@@ -963,9 +963,9 @@ void LLFavoritesBarCtrl::updateMenuItems(LLToggleableMenu* menu)
 
 	U32 widest_item = 0;
 
-	for (S32 i = mFirstDropDownItem; i < mItems.count(); i++)
+	for (S32 i = mFirstDropDownItem; i < mItems.size(); i++)
 	{
-		LLViewerInventoryItem* item = mItems.get(i);
+		LLViewerInventoryItem* item = mItems.at(i);
 		const std::string& item_name = item->getName();
 
 		LLFavoriteLandmarkMenuItem::Params item_params;
@@ -1221,12 +1221,12 @@ BOOL LLFavoritesBarCtrl::isClipboardPasteable() const
 		return FALSE;
 	}
 
-	LLDynamicArray<LLUUID> objects;
+	std::vector<LLUUID> objects;
 	LLClipboard::instance().pasteFromClipboard(objects);
-	S32 count = objects.count();
+	S32 count = objects.size();
 	for(S32 i = 0; i < count; i++)
 	{
-		const LLUUID &item_id = objects.get(i);
+		const LLUUID &item_id = objects.at(i);
 
 		// Can't paste folders
 		const LLInventoryCategory *cat = gInventory.getCategory(item_id);
@@ -1250,13 +1250,13 @@ void LLFavoritesBarCtrl::pasteFromClipboard() const
 	if(model && isClipboardPasteable())
 	{
 		LLInventoryItem* item = NULL;
-		LLDynamicArray<LLUUID> objects;
+		std::vector<LLUUID> objects;
 		LLClipboard::instance().pasteFromClipboard(objects);
-		S32 count = objects.count();
+		S32 count = objects.size();
 		LLUUID parent_id(mFavoriteFolderId);
 		for(S32 i = 0; i < count; i++)
 		{
-			item = model->getItem(objects.get(i));
+			item = model->getItem(objects.at(i));
 			if (item)
 			{
 				copy_inventory_item(
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index ddb9d3bc4369ab4d03c2dcbd41884776158e5488..c05f27d2ee6dea5418b0e74b3875b64ef737bf07 100755
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -36,7 +36,6 @@
 
 #include "llsys.h"
 #include "llgl.h"
-#include "llsecondlifeurls.h"
 
 #include "llappviewer.h"
 #include "llhttpclient.h"
diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp
index e2850f51818ad9830a47f438e3212fa4d9dcaf14..2e1afc68b40427407430d97a731f5c37e508db0f 100755
--- a/indra/newview/llfirstuse.cpp
+++ b/indra/newview/llfirstuse.cpp
@@ -96,6 +96,11 @@ void LLFirstUse::newInventory(bool enable)
 	// firstUseNotification("FirstInventoryOffer", enable, "HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left"));
 }
 
+// first clean starts at 3 AM
+const S32 SANDBOX_FIRST_CLEAN_HOUR = 3;
+// clean every <n> hours
+const S32 SANDBOX_CLEAN_FREQ = 12;
+
 // static
 void LLFirstUse::useSandbox()
 {
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 93502daac732eb885aae73334e3461a0db7513cb..229a55ad23db0289ea1fa43672ee971b05075ae6 100755
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -34,7 +34,6 @@
 // Viewer includes
 #include "llagent.h"
 #include "llappviewer.h" 
-#include "llsecondlifeurls.h"
 #include "llvoiceclient.h"
 #include "lluictrlfactory.h"
 #include "llviewertexteditor.h"
diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp
index 39b6e465f3fa32e27cc608f0fe32020b4bbec5d3..086da158addeb2733fb659337ed6a6001d90d193 100755
--- a/indra/newview/llfloaterbulkpermission.cpp
+++ b/indra/newview/llfloaterbulkpermission.cpp
@@ -36,7 +36,6 @@
 #include "llviewerobject.h"
 #include "llviewerobjectlist.h"
 #include "llviewerregion.h"
-#include "lscript_rt_interface.h"
 #include "llviewercontrol.h"
 #include "llviewerinventory.h"
 #include "llviewerobject.h"
@@ -75,17 +74,17 @@ void LLFloaterBulkPermission::doApply()
 	class ModifiableGatherer : public LLSelectedNodeFunctor
 	{
 	public:
-		ModifiableGatherer(LLDynamicArray<LLUUID>& q) : mQueue(q) {}
+		ModifiableGatherer(std::vector<LLUUID>& q) : mQueue(q) { mQueue.reserve(32); }
 		virtual bool apply(LLSelectNode* node)
 		{
 			if( node->allowOperationOnNode(PERM_MODIFY, GP_OBJECT_MANIPULATE) )
 			{
-				mQueue.put(node->getObject()->getID());
+				mQueue.push_back(node->getObject()->getID());
 			}
 			return true;
 		}
 	private:
-		LLDynamicArray<LLUUID>& mQueue;
+		std::vector<LLUUID>& mQueue;
 	};
 	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
 	list->deleteAllItems();
@@ -169,7 +168,7 @@ void LLFloaterBulkPermission::onCommitCopy()
 
 BOOL LLFloaterBulkPermission::start()
 {
-	// note: number of top-level objects to modify is mObjectIDs.count().
+	// note: number of top-level objects to modify is mObjectIDs.size().
 	getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("start_text"));
 	return nextObject();
 }
@@ -181,7 +180,7 @@ BOOL LLFloaterBulkPermission::nextObject()
 	BOOL successful_start = FALSE;
 	do
 	{
-		count = mObjectIDs.count();
+		count = mObjectIDs.size();
 		//llinfos << "Objects left to process = " << count << llendl;
 		mCurrentObjectID.setNull();
 		if(count > 0)
@@ -189,7 +188,7 @@ BOOL LLFloaterBulkPermission::nextObject()
 			successful_start = popNext();
 			//llinfos << (successful_start ? "successful" : "unsuccessful") << llendl; 
 		}
-	} while((mObjectIDs.count() > 0) && !successful_start);
+	} while((mObjectIDs.size() > 0) && !successful_start);
 
 	if(isDone() && !mDone)
 	{
@@ -205,12 +204,12 @@ BOOL LLFloaterBulkPermission::popNext()
 {
 	// get the head element from the container, and attempt to get its inventory.
 	BOOL rv = FALSE;
-	S32 count = mObjectIDs.count();
+	S32 count = mObjectIDs.size();
 	if(mCurrentObjectID.isNull() && (count > 0))
 	{
-		mCurrentObjectID = mObjectIDs.get(0);
+		mCurrentObjectID = mObjectIDs.at(0);
 		//llinfos << "mCurrentID: " << mCurrentObjectID << llendl;
-		mObjectIDs.remove(0);
+		mObjectIDs.erase(mObjectIDs.begin());
 		LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID);
 		if(obj)
 		{
diff --git a/indra/newview/llfloaterbulkpermission.h b/indra/newview/llfloaterbulkpermission.h
index 7dd05df7ee15e0962b648d120b689671d787d8f6..88532ed1249f8508ec8b2391003f3f0abbcdd74c 100755
--- a/indra/newview/llfloaterbulkpermission.h
+++ b/indra/newview/llfloaterbulkpermission.h
@@ -28,11 +28,9 @@
 #ifndef LL_LLBULKPERMISSION_H
 #define LL_LLBULKPERMISSION_H
 
-#include "lldarray.h"
 #include "llinventory.h"
 #include "llviewerobject.h"
 #include "llvoinventorylistener.h"
-#include "llmap.h"
 #include "lluuid.h"
 
 #include "llfloater.h"
@@ -78,7 +76,7 @@ class LLFloaterBulkPermission : public LLFloater, public LLVOInventoryListener
 	void onUncheckAll() { doCheckUncheckAll(FALSE); }
 	
 	// returns true if this is done
-	BOOL isDone() const { return (mCurrentObjectID.isNull() || (mObjectIDs.count() == 0)); }
+	BOOL isDone() const { return (mCurrentObjectID.isNull() || (mObjectIDs.size() == 0)); }
 
 	//Read the settings and Apply the permissions
 	void doApply();
@@ -90,7 +88,7 @@ class LLFloaterBulkPermission : public LLFloater, public LLVOInventoryListener
 	LLButton* mCloseBtn;
 
 	// Object Queue
-	LLDynamicArray<LLUUID> mObjectIDs;
+	std::vector<LLUUID> mObjectIDs;
 	LLUUID mCurrentObjectID;
 	BOOL mDone;
 
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index 6aebe85e7a36fb7d048c6de7605cbbe82bfc741a..9425f5645e5c731fe5502fa208cb25b4678f3e51 100755
--- a/indra/newview/llfloatercolorpicker.cpp
+++ b/indra/newview/llfloatercolorpicker.cpp
@@ -162,12 +162,7 @@ void LLFloaterColorPicker::createUI ()
 	// create palette
 	for ( S32 each = 0; each < numPaletteColumns * numPaletteRows; ++each )
 	{
-		std::ostringstream codec;
-		codec << "ColorPaletteEntry" << std::setfill ( '0' ) << std::setw ( 2 ) << each + 1;
-
-		// argh!
-		const std::string s ( codec.str () );
-		mPalette.push_back ( new LLColor4 ( LLUIColorTable::instance().getColor ( s )  ) );
+		mPalette.push_back(new LLColor4(LLUIColorTable::instance().getColor(llformat("ColorPaletteEntry%02d", each + 1))));
 	}
 }
 
diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h
index bab061771260790292ef80457bee968df7ded26e..d4d22b643a79d8830160c42e0ae145a627510836 100755
--- a/indra/newview/llfloatercolorpicker.h
+++ b/indra/newview/llfloatercolorpicker.h
@@ -33,7 +33,6 @@
 #include "llpointer.h"
 #include "llcolorswatch.h"
 #include "llspinctrl.h"
-#include "lltextureentry.h"
 
 class LLButton;
 class LLLineEditor;
@@ -121,7 +120,7 @@ class LLFloaterColorPicker
 			   void onClickPipette ( );
 		static void onTextCommit ( LLUICtrl* ctrl, void* data );
 		static void onImmediateCheck ( LLUICtrl* ctrl, void* data );
-			   void onColorSelect( const LLTextureEntry& te );
+			   void onColorSelect( const class LLTextureEntry& te );
 	private:
 		// draws color selection palette
 		void drawPalette ();
@@ -171,7 +170,7 @@ class LLFloaterColorPicker
 		const S32 mPaletteRegionHeight;
 
 		// image used to compose color grid
-		LLPointer<LLViewerTexture> mRGBImage;
+		LLPointer<class LLViewerTexture> mRGBImage;
 
 		// current swatch in use
 		LLColorSwatchCtrl* mSwatch;
diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
index a6dafda3e698235c06ff09fa0c3819f9f9940294..3e303e0932aa7b6431eb2eec5cee631c313775b0 100755
--- a/indra/newview/llfloaterevent.cpp
+++ b/indra/newview/llfloaterevent.cpp
@@ -45,7 +45,6 @@
 #include "llmediactrl.h"
 #include "llfloaterworldmap.h"
 #include "llinventorymodel.h"
-#include "llsecondlifeurls.h"
 #include "llslurl.h"
 #include "lltextbox.h"
 #include "lltexteditor.h"
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 56051ff68458f5cbd589ae833028116bbad3be41..1452d53265274d510b7d7944d69e01b8460c550c 100755
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -400,9 +400,9 @@ bool LLFloaterGesture::isActionEnabled(const LLSD& command)
 		if(!LLClipboard::instance().hasContents())
 			return false;
 
-		LLDynamicArray<LLUUID> ids;
+		std::vector<LLUUID> ids;
 		LLClipboard::instance().pasteFromClipboard(ids);
-		for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
+		for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
 		{
 			LLInventoryItem* item = gInventory.getItem(*it);
 			
@@ -514,7 +514,7 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
 	}
 	else if ("paste" == command_name)
 	{
-		LLDynamicArray<LLUUID> ids;
+		std::vector<LLUUID> ids;
 		LLClipboard::instance().pasteFromClipboard(ids);
 		if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID))
 			return;
@@ -522,7 +522,7 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
 		llassert(gesture_dir);
 		LLPointer<GestureCopiedCallback> cb = new GestureCopiedCallback(this);
 
-		for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
+		for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
 		{
 			LLInventoryItem* item = gInventory.getItem(*it);
 			if(gesture_dir && item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp
index d84364a68a76e4fac73e28bfad7f4bc5330ae099..dbe7fee108e92e821f4f83eefe831f81c2b542e9 100755
--- a/indra/newview/llfloatergroups.cpp
+++ b/indra/newview/llfloatergroups.cpp
@@ -171,7 +171,7 @@ void LLPanelGroups::reset()
 	{
 		group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
 	}
-	getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count()));
+	getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size()));
 	getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups));
 
 	init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID());
@@ -182,7 +182,7 @@ BOOL LLPanelGroups::postBuild()
 {
 	childSetCommitCallback("group list", onGroupList, this);
 
-	getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count()));
+	getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size()));
 	getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups));
 
 	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("group list");
@@ -341,7 +341,7 @@ void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata)
 
 void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U64 powers_mask)
 {
-	S32 count = gAgent.mGroups.count();
+	S32 count = gAgent.mGroups.size();
 	LLUUID id;
 	if (!group_list) return;
 
@@ -349,8 +349,8 @@ void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U
 
 	for(S32 i = 0; i < count; ++i)
 	{
-		id = gAgent.mGroups.get(i).mID;
-		LLGroupData* group_datap = &gAgent.mGroups.get(i);
+		id = gAgent.mGroups.at(i).mID;
+		LLGroupData* group_datap = &gAgent.mGroups.at(i);
 		if ((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0))
 		{
 			std::string style = "NORMAL";
diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp
index 98e9b74278a9cd8f583af666618df2358c0aedae..ea94dcd7b6ccb8d977f209fad87a4c047af2cea2 100755
--- a/indra/newview/llfloaterlandholdings.cpp
+++ b/indra/newview/llfloaterlandholdings.cpp
@@ -72,19 +72,19 @@ BOOL LLFloaterLandHoldings::postBuild()
 	grant_list->sortByColumnIndex(0, TRUE);
 	grant_list->setDoubleClickCallback(onGrantList, this);
 
-	S32 count = gAgent.mGroups.count();
+	S32 count = gAgent.mGroups.size();
 	for(S32 i = 0; i < count; ++i)
 	{
-		LLUUID id(gAgent.mGroups.get(i).mID);
+		LLUUID id(gAgent.mGroups.at(i).mID);
 
 		LLSD element;
 		element["id"] = id;
 		element["columns"][0]["column"] = "group";
-		element["columns"][0]["value"] = gAgent.mGroups.get(i).mName;
+		element["columns"][0]["value"] = gAgent.mGroups.at(i).mName;
 		element["columns"][0]["font"] = "SANSSERIF";
 
 		LLUIString areastr = getString("area_string");
-		areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.get(i).mContribution));
+		areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.at(i).mContribution));
 		element["columns"][1]["column"] = "area";
 		element["columns"][1]["value"] = areastr;
 		element["columns"][1]["font"] = "SANSSERIF";
diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp
index 29a3e6ac3a020bfa16283167ecd85eeef5ba897c..1e9cf62067397aacdcf5f7b0152ce1c42698543a 100755
--- a/indra/newview/llfloateroutbox.cpp
+++ b/indra/newview/llfloateroutbox.cpp
@@ -281,7 +281,7 @@ void LLFloaterOutbox::setStatusString(const std::string& statusString)
 
 void LLFloaterOutbox::updateFolderCount()
 {
-	S32 item_count = 0;
+	U32 item_count = 0;
 
 	if (mOutboxId.notNull())
 	{
@@ -289,7 +289,7 @@ void LLFloaterOutbox::updateFolderCount()
 		LLInventoryModel::item_array_t * items;
 		gInventory.getDirectDescendentsOf(mOutboxId, cats, items);
 
-		item_count = cats->count() + items->count();
+		item_count = cats->size() + items->size();
 	}
 	
 	mOutboxItemCount = item_count;
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 55b03986d01098f3975c6121afbccb0b70727fb6..9cb7d95e6139094988459c2adeccd59323685798 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -37,7 +37,6 @@
 #include "message.h"
 #include "llfloaterautoreplacesettings.h"
 #include "llagent.h"
-#include "llavatarconstants.h"
 #include "llcheckboxctrl.h"
 #include "llcolorswatch.h"
 #include "llcombobox.h"
@@ -113,6 +112,10 @@
 const F32 MAX_USER_FAR_CLIP = 512.f;
 const F32 MIN_USER_FAR_CLIP = 64.f;
 const F32 BANDWIDTH_UPDATER_TIMEOUT = 0.5f;
+char const* const VISIBILITY_DEFAULT = "default";
+char const* const VISIBILITY_HIDDEN = "hidden";
+char const* const VISIBILITY_VISIBLE = "visible";
+char const* const VISIBILITY_INVISIBLE = "invisible";
 
 //control value for middle mouse as talk2push button
 const static std::string MIDDLE_MOUSE_CV = "MiddleMouse";
diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h
index 6edc46cf7990887381d8006e4dc238eabba591d6..28d2aa58e2344f9ed1f10f4fbbbaaf99b204e932 100755
--- a/indra/newview/llfloatertopobjects.h
+++ b/indra/newview/llfloatertopobjects.h
@@ -31,6 +31,22 @@
 
 class LLUICtrl;
 
+// Bits for simulator performance query flags
+enum LAND_STAT_FLAGS
+{
+	STAT_FILTER_BY_PARCEL	= 0x00000001,
+	STAT_FILTER_BY_OWNER	= 0x00000002,
+	STAT_FILTER_BY_OBJECT	= 0x00000004,
+	STAT_FILTER_BY_PARCEL_NAME	= 0x00000008,
+	STAT_REQUEST_LAST_ENTRY	= 0x80000000,
+};
+
+enum LAND_STAT_REPORT_TYPE
+{
+	STAT_REPORT_TOP_SCRIPTS = 0,
+	STAT_REPORT_TOP_COLLIDERS
+};
+
 class LLFloaterTopObjects : public LLFloater
 {
 	friend class LLFloaterReg;
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 137b5446cfe41409b09d7557b8a43163e3013742..3f947ce32c6248818d531f34397fa6a57a7d1485 100755
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -570,9 +570,9 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
 	buildLandmarkIDLists();
 	BOOL found = FALSE;
 	S32 idx;
-	for (idx = 0; idx < mLandmarkItemIDList.count(); idx++)
+	for (idx = 0; idx < mLandmarkItemIDList.size(); idx++)
 	{
-		if ( mLandmarkItemIDList.get(idx) == landmark_item_id)
+		if ( mLandmarkItemIDList.at(idx) == landmark_item_id)
 		{
 			found = TRUE;
 			break;
@@ -581,13 +581,13 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
 	
 	if (found && iface->setCurrentByID( landmark_item_id ) ) 
 	{
-		LLUUID asset_id = mLandmarkAssetIDList.get( idx );
+		LLUUID asset_id = mLandmarkAssetIDList.at( idx );
 		std::string name;
 		LLComboBox* combo = getChild<LLComboBox>( "landmark combo");
 		if (combo) name = combo->getSimple();
 		mTrackedStatus = LLTracker::TRACKING_LANDMARK;
-		LLTracker::trackLandmark(mLandmarkAssetIDList.get( idx ),	// assetID
-								 mLandmarkItemIDList.get( idx ), // itemID
+		LLTracker::trackLandmark(mLandmarkAssetIDList.at( idx ),	// assetID
+								 mLandmarkItemIDList.at( idx ), // itemID
 								 name);			// name
 		
 		if( asset_id != sHomeID )
@@ -911,15 +911,15 @@ void LLFloaterWorldMap::buildLandmarkIDLists()
 		list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
 	}
 	
-	mLandmarkItemIDList.reset();
-	mLandmarkAssetIDList.reset();
+	mLandmarkItemIDList.clear();
+	mLandmarkAssetIDList.clear();
 	
 	// Get all of the current landmarks
-	mLandmarkAssetIDList.put( LLUUID::null );
-	mLandmarkItemIDList.put( LLUUID::null );
+	mLandmarkAssetIDList.push_back( LLUUID::null );
+	mLandmarkItemIDList.push_back( LLUUID::null );
 	
-	mLandmarkAssetIDList.put( sHomeID );
-	mLandmarkItemIDList.put( sHomeID );
+	mLandmarkAssetIDList.push_back( sHomeID );
+	mLandmarkItemIDList.push_back( sHomeID );
 	
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t items;
@@ -932,15 +932,18 @@ void LLFloaterWorldMap::buildLandmarkIDLists()
 	
 	std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers());
 	
-	S32 count = items.count();
+	mLandmarkAssetIDList.reserve(mLandmarkAssetIDList.size() + items.size());
+	mLandmarkItemIDList.reserve(mLandmarkItemIDList.size() + items.size());
+
+	S32 count = items.size();
 	for(S32 i = 0; i < count; ++i)
 	{
-		LLInventoryItem* item = items.get(i);
+		LLInventoryItem* item = items.at(i);
 		
 		list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID());
 		
-		mLandmarkAssetIDList.put( item->getAssetUUID() );
-		mLandmarkItemIDList.put( item->getUUID() );
+		mLandmarkAssetIDList.push_back( item->getAssetUUID() );
+		mLandmarkItemIDList.push_back( item->getUUID() );
 	}
 	
 	list->selectFirstItem();
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index e3b83b2579855a4f712f13e40b552a04301ef002..84ca5a7a71e2d1a36b41679ad9cd10e3eb5e6a54 100755
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -32,7 +32,6 @@
 #ifndef LL_LLFLOATERWORLDMAP_H
 #define LL_LLFLOATERWORLDMAP_H
 
-#include "lldarray.h"
 #include "llfloater.h"
 #include "llhudtext.h"
 #include "llmapimagetype.h"
@@ -166,8 +165,8 @@ class LLFloaterWorldMap : public LLFloater
 	// enable/disable teleport destination coordinates 
 	void enableTeleportCoordsDisplay( bool enabled );
 
-	LLDynamicArray<LLUUID>	mLandmarkAssetIDList;
-	LLDynamicArray<LLUUID>	mLandmarkItemIDList;
+	std::vector<LLUUID>	mLandmarkAssetIDList;
+	std::vector<LLUUID>	mLandmarkItemIDList;
 
 	static const LLUUID	sHomeID;
 
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index 16ed3f990c7cc13a4ff2b1604db0e64489b4982d..1771a8f491022b9a235dd2feb3becebc8cac95a3 100755
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -67,10 +67,10 @@ inline const std::string get_friend_all_subfolder_name()
 
 void move_from_to_arrays(LLInventoryModel::cat_array_t& from, LLInventoryModel::cat_array_t& to)
 {
-	while (from.count() > 0)
+	while (from.size() > 0)
 	{
-		to.put(from.get(0));
-		from.remove(0);
+		to.push_back(from.at(0));
+		from.erase(from.begin());
 	}
 }
 
@@ -82,7 +82,7 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect
 	gInventory.collectDescendentsIf(parentFolderUUID, cats, items,
 		LLInventoryModel::EXCLUDE_TRASH, matchFunctor);
 
-	S32 cats_count = cats.count();
+	S32 cats_count = cats.size();
 
 	if (cats_count > 1)
 	{
@@ -92,7 +92,7 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect
 			<< LL_ENDL;
 	}
 
-	return (cats_count >= 1) ? cats.get(0)->getUUID() : LLUUID::null;
+	return (cats_count >= 1) ? cats.at(0)->getUUID() : LLUUID::null;
 }
 
 /**
@@ -207,7 +207,7 @@ bool LLFriendCardsManager::isItemInAnyFriendsList(const LLViewerInventoryItem* i
 	LLInventoryModel::item_array_t items;
 	findMatchedFriendCards(item->getCreatorUUID(), items);
 
-	return items.count() > 0;
+	return items.size() > 0;
 }
 
 
@@ -242,9 +242,9 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje
 			{
 				LLUUID creator_id = item->getCreatorUUID();
 				LLViewerInventoryItem* cur_item = NULL;
-				for ( S32 i = items->count() - 1; i >= 0; --i )
+				for ( S32 i = items->size() - 1; i >= 0; --i )
 				{
-					cur_item = items->get(i);
+					cur_item = items->at(i);
 					if ( creator_id == cur_item->getCreatorUUID() )
 					{
 						result = true;
@@ -259,9 +259,9 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje
 			// Note: UUID's of compared items also may be not equal.
 			std::string obj_name = obj->getName();
 			LLViewerInventoryItem* cur_item = NULL;
-			for ( S32 i = items->count() - 1; i >= 0; --i )
+			for ( S32 i = items->size() - 1; i >= 0; --i )
 			{
-				cur_item = items->get(i);
+				cur_item = items->at(i);
 				if ( obj->getType() != cur_item->getType() )
 					continue;
 				if ( obj_name == cur_item->getName() )
@@ -279,9 +279,9 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje
 		// then return true. Note: UUID's of compared items also may be not equal.
 		std::string obj_name = obj->getName();
 		LLViewerInventoryCategory* cur_cat = NULL;
-		for ( S32 i = cats->count() - 1; i >= 0; --i )
+		for ( S32 i = cats->size() - 1; i >= 0; --i )
 		{
-			cur_cat = cats->get(i);
+			cur_cat = cats->at(i);
 			if ( obj->getType() != cur_cat->getType() )
 				continue;
 			if ( obj_name == cur_cat->getName() )
@@ -381,10 +381,10 @@ void LLFriendCardsManager::findMatchedFriendCards(const LLUUID& avatarID, LLInve
 	LLInventoryModel::cat_array_t subFolders;
 	subFolders.push_back(friendFolder);
 
-	while (subFolders.count() > 0)
+	while (subFolders.size() > 0)
 	{
-		LLViewerInventoryCategory* cat = subFolders.get(0);
-		subFolders.remove(0);
+		LLViewerInventoryCategory* cat = subFolders.at(0);
+		subFolders.erase(subFolders.begin());
 
 		gInventory.collectDescendentsIf(cat->getUUID(), cats, items, 
 			LLInventoryModel::EXCLUDE_TRASH, matchFunctor);
diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp
index 72bea8db104a125aea12ffa2f39e5dc57903b3ea..2ecd9fa7f725677ef27a9be78c5de3b9fe24e96e 100755
--- a/indra/newview/llgiveinventory.cpp
+++ b/indra/newview/llgiveinventory.cpp
@@ -248,11 +248,11 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent,
 		items,
 		LLInventoryModel::EXCLUDE_TRASH,
 		giveable);
-	S32 count = cats.count();
+	S32 count = cats.size();
 	bool complete = true;
 	for(S32 i = 0; i < count; ++i)
 	{
-		if (!gInventory.isCategoryComplete(cats.get(i)->getUUID()))
+		if (!gInventory.isCategoryComplete(cats.at(i)->getUUID()))
 		{
 			complete = false;
 			break;
@@ -263,7 +263,7 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent,
 		LLNotificationsUtil::add("IncompleteInventory");
 		give_successful = false;
 	}
-	count = items.count() + cats.count();
+	count = items.size() + cats.size();
 	if (count > MAX_ITEMS)
 	{
 		LLNotificationsUtil::add("TooManyItems");
@@ -447,10 +447,10 @@ bool LLGiveInventory::handleCopyProtectedCategory(const LLSD& notification, cons
 				items,
 				LLInventoryModel::EXCLUDE_TRASH,
 				remove);
-			S32 count = items.count();
+			S32 count = items.size();
 			for(S32 i = 0; i < count; ++i)
 			{
-				gInventory.deleteObject(items.get(i)->getUUID());
+				gInventory.deleteObject(items.at(i)->getUUID());
 			}
 			gInventory.notifyObservers();
 
@@ -504,7 +504,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent,
 	// MAX ITEMS is based on (sizeof(uuid)+2) * count must be <
 	// MTUBYTES or 18 * count < 1200 => count < 1200/18 =>
 	// 66. I've cut it down a bit from there to give some pad.
-	S32 count = items.count() + cats.count();
+	S32 count = items.size() + cats.size();
 	if (count > MAX_ITEMS)
 	{
 		LLNotificationsUtil::add("TooManyItems");
@@ -530,21 +530,21 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent,
 		memcpy(pos, &(cat->getUUID()), UUID_BYTES);		/* Flawfinder: ignore */
 		pos += UUID_BYTES;
 		S32 i;
-		count = cats.count();
+		count = cats.size();
 		for(i = 0; i < count; ++i)
 		{
 			memcpy(pos, &type, sizeof(U8));		/* Flawfinder: ignore */
 			pos += sizeof(U8);
-			memcpy(pos, &(cats.get(i)->getUUID()), UUID_BYTES);		/* Flawfinder: ignore */
+			memcpy(pos, &(cats.at(i)->getUUID()), UUID_BYTES);		/* Flawfinder: ignore */
 			pos += UUID_BYTES;
 		}
-		count = items.count();
+		count = items.size();
 		for(i = 0; i < count; ++i)
 		{
-			type = (U8)items.get(i)->getType();
+			type = (U8)items.at(i)->getType();
 			memcpy(pos, &type, sizeof(U8));		/* Flawfinder: ignore */
 			pos += sizeof(U8);
-			memcpy(pos, &(items.get(i)->getUUID()), UUID_BYTES);		/* Flawfinder: ignore */
+			memcpy(pos, &(items.at(i)->getUUID()), UUID_BYTES);		/* Flawfinder: ignore */
 			pos += UUID_BYTES;
 		}
 		pack_instant_message(
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index a0f2918bd786338340f7b9fa606c2021ef2323b2..0324629c6e6b8c7020834f20e1ed67ba1da1e6e2 100755
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -210,17 +210,17 @@ void LLGroupActions::leave(const LLUUID& group_id)
 	if (group_id.isNull())
 		return;
 
-	S32 count = gAgent.mGroups.count();
+	S32 count = gAgent.mGroups.size();
 	S32 i;
 	for (i = 0; i < count; ++i)
 	{
-		if(gAgent.mGroups.get(i).mID == group_id)
+		if(gAgent.mGroups.at(i).mID == group_id)
 			break;
 	}
 	if (i < count)
 	{
 		LLSD args;
-		args["GROUP"] = gAgent.mGroups.get(i).mName;
+		args["GROUP"] = gAgent.mGroups.at(i).mName;
 		LLSD payload;
 		payload["group_id"] = group_id;
 		LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, onLeaveGroup);
diff --git a/indra/newview/llgroupiconctrl.cpp b/indra/newview/llgroupiconctrl.cpp
index 2d0fc26c2a140e69a6210e55cd3a0470f9b6c4b1..6abf9ea637675cae1bafd8a927812e579ea22df9 100755
--- a/indra/newview/llgroupiconctrl.cpp
+++ b/indra/newview/llgroupiconctrl.cpp
@@ -30,33 +30,21 @@
 
 #include "llagent.h"
 #include "llviewertexture.h"
-/*
-#include "llavatarconstants.h"
-#include "llcallingcard.h" // for LLAvatarTracker
-#include "llavataractions.h"
-#include "llmenugl.h"
-#include "lluictrlfactory.h"
-
-#include "llcachename.h"
-#include "llagentdata.h"
-#include "llfloaterimsession.h"
-*/
 
 static LLDefaultChildRegistry::Register<LLGroupIconCtrl> g_i("group_icon");
 
 LLGroupIconCtrl::Params::Params()
-:	group_id("group_id")
-,	draw_tooltip("draw_tooltip", true)
-,	default_icon_name("default_icon_name")
-{
-}
+:	group_id("group_id"),
+	draw_tooltip("draw_tooltip", true),
+	default_icon_name("default_icon_name")
+{}
 
 
 LLGroupIconCtrl::LLGroupIconCtrl(const LLGroupIconCtrl::Params& p)
-:	LLIconCtrl(p)
-,	mGroupId(LLUUID::null)
-,	mDrawTooltip(p.draw_tooltip)
-,	mDefaultIconName(p.default_icon_name)
+:	LLIconCtrl(p),
+	mGroupId(LLUUID::null),
+	mDrawTooltip(p.draw_tooltip),
+	mDefaultIconName(p.default_icon_name)
 {
 	mPriority = LLViewerFetchedTexture::BOOST_ICON;
 
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index aba3d74d878152478e2354ab87a9cb479682f8a1..b1b7a87ae8612965ca4b9685574c3cc983d7fbb0 100755
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -163,7 +163,7 @@ static bool findInsensitive(std::string haystack, const std::string& needle_uppe
 void LLGroupList::refresh()
 {
 	const LLUUID& 		highlight_id	= gAgent.getGroupID();
-	S32					count			= gAgent.mGroups.count();
+	S32					count			= gAgent.mGroups.size();
 	LLUUID				id;
 	bool				have_filter		= !mNameFilter.empty();
 
@@ -171,8 +171,8 @@ void LLGroupList::refresh()
 
 	for(S32 i = 0; i < count; ++i)
 	{
-		id = gAgent.mGroups.get(i).mID;
-		const LLGroupData& group_data = gAgent.mGroups.get(i);
+		id = gAgent.mGroups.at(i).mID;
+		const LLGroupData& group_data = gAgent.mGroups.at(i);
 		if (have_filter && !findInsensitive(group_data.mName, mNameFilter))
 			continue;
 		addNewItem(id, group_data.mName, group_data.mInsigniaID, ADD_BOTTOM);
diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h
index d8c1ab7ef5f92d2ea65b6b0cea1e11e7e5e6ddb7..d107fceb4978ca57b2fbef6f3841aea610953bcb 100755
--- a/indra/newview/llgroupmgr.h
+++ b/indra/newview/llgroupmgr.h
@@ -35,6 +35,17 @@
 
 class LLMessageSystem;
 
+
+enum LLGroupChange
+{
+	GC_PROPERTIES,
+	GC_MEMBER_DATA,
+	GC_ROLE_DATA,
+	GC_ROLE_MEMBER_DATA,
+	GC_TITLES,
+	GC_ALL
+};
+
 class LLGroupMgrObserver
 {
 public:
diff --git a/indra/newview/llhudicon.h b/indra/newview/llhudicon.h
index 87455ec3f4857802c828949e61a189e369b4365a..e00a985ddc0b96f7f98033a6077987271ec6ecc5 100755
--- a/indra/newview/llhudicon.h
+++ b/indra/newview/llhudicon.h
@@ -38,7 +38,6 @@
 #include "llfontgl.h"
 #include <set>
 #include <vector>
-#include "lldarray.h"
 
 // Renders a 2D icon billboard floating at the location specified.
 class LLViewerTexture;
diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp
index 8f14b53db0a14bcc37bfccac9fa5b918502469e5..8ad432fbad9c55399680618b6402ea45da4fd4b1 100755
--- a/indra/newview/llhudmanager.cpp
+++ b/indra/newview/llhudmanager.cpp
@@ -60,7 +60,7 @@ void LLHUDManager::updateEffects()
 {
 	LLFastTimer ftm(FTM_HUD_EFFECTS);
 	S32 i;
-	for (i = 0; i < mHUDEffects.count(); i++)
+	for (i = 0; i < mHUDEffects.size(); i++)
 	{
 		LLHUDEffect *hep = mHUDEffects[i];
 		if (hep->isDead())
@@ -74,7 +74,7 @@ void LLHUDManager::updateEffects()
 void LLHUDManager::sendEffects()
 {
 	S32 i;
-	for (i = 0; i < mHUDEffects.count(); i++)
+	for (i = 0; i < mHUDEffects.size(); i++)
 	{
 		LLHUDEffect *hep = mHUDEffects[i];
 		if (hep->isDead())
@@ -105,18 +105,18 @@ void LLHUDManager::sendEffects()
 //static
 void LLHUDManager::shutdownClass()
 {
-	getInstance()->mHUDEffects.reset();
+	getInstance()->mHUDEffects.clear();
 }
 
 void LLHUDManager::cleanupEffects()
 {
 	S32 i = 0;
 
-	while (i < mHUDEffects.count())
+	while (i < mHUDEffects.size())
 	{
 		if (mHUDEffects[i]->isDead())
 		{
-			mHUDEffects.remove(i);
+			mHUDEffects.erase(mHUDEffects.begin() + i);
 		}
 		else
 		{
@@ -140,7 +140,7 @@ LLHUDEffect *LLHUDManager::createViewerEffect(const U8 type, BOOL send_to_sim, B
 	hep->setNeedsSendToSim(send_to_sim);
 	hep->setOriginatedHere(originated_here);
 
-	mHUDEffects.put(hep);
+	mHUDEffects.push_back(hep);
 	return hep;
 }
 
@@ -159,20 +159,20 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat
 		effectp = NULL;
 		LLHUDEffect::getIDType(mesgsys, k, effect_id, effect_type);
 		S32 i;
-		for (i = 0; i < LLHUDManager::getInstance()->mHUDEffects.count(); i++)
+		for (i = 0; i < LLHUDManager::getInstance()->mHUDEffects.size(); i++)
 		{
 			LLHUDEffect *cur_effectp = LLHUDManager::getInstance()->mHUDEffects[i];
 			if (!cur_effectp)
 			{
 				llwarns << "Null effect in effect manager, skipping" << llendl;
-				LLHUDManager::getInstance()->mHUDEffects.remove(i);
+				LLHUDManager::getInstance()->mHUDEffects.erase(LLHUDManager::getInstance()->mHUDEffects.begin() + i);
 				i--;
 				continue;
 			}
 			if (cur_effectp->isDead())
 			{
 	//			llwarns << "Dead effect in effect manager, removing" << llendl;
-				LLHUDManager::getInstance()->mHUDEffects.remove(i);
+				LLHUDManager::getInstance()->mHUDEffects.erase(LLHUDManager::getInstance()->mHUDEffects.begin() + i);
 				i--;
 				continue;
 			}
diff --git a/indra/newview/llhudmanager.h b/indra/newview/llhudmanager.h
index effea8f0346b9801f682e73c68f573e8ce4bd235..9c5d49decd0aff979431310167fdacb95fcc520e 100755
--- a/indra/newview/llhudmanager.h
+++ b/indra/newview/llhudmanager.h
@@ -30,7 +30,6 @@
 // Responsible for managing all HUD elements.
 
 #include "llhudobject.h"
-#include "lldarray.h"
 
 class LLHUDEffect;
 class LLMessageSystem;
@@ -55,7 +54,7 @@ class LLHUDManager : public LLSingleton<LLHUDManager>
 	static LLColor4 sChildColor;
 
 protected:
-	LLDynamicArray<LLPointer<LLHUDEffect>, 32> mHUDEffects;
+	std::vector<LLPointer<LLHUDEffect> > mHUDEffects;
 };
 
 #endif // LL_LLHUDMANAGER_H
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 7e18d37fe1cb9040d4ebc0aacf7b7091c82f1c68..89ea5ff73ae1beee176f54f84d6e46439fc05e4c 100755
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2397,7 +2397,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
 					llinfos << "Corrected session name is " << correct_session_name << llendl; 
 					break;
 				default: 
-					llwarning("Received an empty session name from a server and failed to generate a new proper session name", 0);
+					LL_WARNS() << "Received an empty session name from a server and failed to generate a new proper session name" << LL_ENDL;
 					break;
 				}
 			}
@@ -2782,8 +2782,8 @@ LLUUID LLIMMgr::addSession(
 	EInstantMessage dialog,
 	const LLUUID& other_participant_id, bool voice)
 {
-	LLDynamicArray<LLUUID> ids;
-	ids.put(other_participant_id);
+	std::vector<LLUUID> ids;
+	ids.push_back(other_participant_id);
 	LLUUID session_id = addSession(name, dialog, other_participant_id, ids, voice);
 	return session_id;
 }
@@ -2794,17 +2794,17 @@ LLUUID LLIMMgr::addSession(
 	const std::string& name,
 	EInstantMessage dialog,
 	const LLUUID& other_participant_id,
-	const LLDynamicArray<LLUUID>& ids, bool voice,
+	const std::vector<LLUUID>& ids, bool voice,
 	const LLUUID& floater_id)
 {
-	if (0 == ids.getLength())
+	if (ids.empty())
 	{
 		return LLUUID::null;
 	}
 
 	if (name.empty())
 	{
-		llwarning("Session name cannot be null!", 0);
+		LL_WARNS() << "Session name cannot be null!" << LL_ENDL;
 		return LLUUID::null;
 	}
 
@@ -3245,9 +3245,9 @@ bool LLIMMgr::isNonFriendSessionNotified(const LLUUID& session_id)
 
 void LLIMMgr::noteOfflineUsers(
 	const LLUUID& session_id,
-	const LLDynamicArray<LLUUID>& ids)
+	const std::vector<LLUUID>& ids)
 {
-	S32 count = ids.count();
+	S32 count = ids.size();
 	if(count == 0)
 	{
 		const std::string& only_user = LLTrans::getString("only_user_message");
@@ -3260,11 +3260,11 @@ void LLIMMgr::noteOfflineUsers(
 		LLIMModel& im_model = LLIMModel::instance();
 		for(S32 i = 0; i < count; ++i)
 		{
-			info = at.getBuddyInfo(ids.get(i));
+			info = at.getBuddyInfo(ids.at(i));
 			LLAvatarName av_name;
 			if (info
 				&& !info->isOnline()
-				&& LLAvatarNameCache::get(ids.get(i), &av_name))
+				&& LLAvatarNameCache::get(ids.at(i), &av_name))
 			{
 				LLUIString offline = LLTrans::getString("offline_message");
 				// Use display name only because this user is your friend
@@ -3276,7 +3276,7 @@ void LLIMMgr::noteOfflineUsers(
 }
 
 void LLIMMgr::noteMutedUsers(const LLUUID& session_id,
-								  const LLDynamicArray<LLUUID>& ids)
+								  const std::vector<LLUUID>& ids)
 {
 	// Don't do this if we don't have a mute list.
 	LLMuteList *ml = LLMuteList::getInstance();
@@ -3285,14 +3285,14 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id,
 		return;
 	}
 
-	S32 count = ids.count();
+	S32 count = ids.size();
 	if(count > 0)
 	{
 		LLIMModel* im_model = LLIMModel::getInstance();
 		
 		for(S32 i = 0; i < count; ++i)
 		{
-			if( ml->isMuted(ids.get(i)) )
+			if( ml->isMuted(ids.at(i)) )
 			{
 				LLUIString muted = LLTrans::getString("muted_message");
 
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 2d036cbc2f89b61c80ade8b6278dfeedf65ca971..382b0e0a77602162cae94458b1f3167e53c60e4e 100755
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -33,7 +33,6 @@
 
 #include "lllogchat.h"
 #include "llvoicechannel.h"
-#include "lldarray.h"
 
 class LLAvatarName;
 class LLFriendObserver;
@@ -354,7 +353,7 @@ class LLIMMgr : public LLSingleton<LLIMMgr>
 	LLUUID addSession(const std::string& name,
 					  EInstantMessage dialog,
 					  const LLUUID& other_participant_id,
-					  const LLDynamicArray<LLUUID>& ids, bool voice = false,
+					  const std::vector<LLUUID>& ids, bool voice = false,
 					  const LLUUID& floater_id = LLUUID::null);
 
 	/**
@@ -457,8 +456,8 @@ class LLIMMgr : public LLSingleton<LLIMMgr>
 	// prints a simple message if they are not online. Used to help
 	// reduce 'hello' messages to the linden employees unlucky enough
 	// to have their calling card in the default inventory.
-	void noteOfflineUsers(const LLUUID& session_id, const LLDynamicArray<LLUUID>& ids);
-	void noteMutedUsers(const LLUUID& session_id, const LLDynamicArray<LLUUID>& ids);
+	void noteOfflineUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids);
+	void noteMutedUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids);
 
 	void processIMTypingCore(const LLIMInfo* im_info, BOOL typing);
 
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index c8ee8135a6b4be0476a01c6660988a56d05a6be6..6915ba45570787d055a03e26272c880478ee12bc 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -328,7 +328,7 @@ void LLInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch)
 		if (cat)
 		{
 			gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE );
-			for (j=0; j<descendent_items.count(); j++)
+			for (j=0; j<descendent_items.size(); j++)
 			{
 				if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
 				{
@@ -490,12 +490,12 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
 	}
 
 	// In normal mode, we need to check each element of the clipboard to know if we can paste or not
-	LLDynamicArray<LLUUID> objects;
+	std::vector<LLUUID> objects;
 	LLClipboard::instance().pasteFromClipboard(objects);
-	S32 count = objects.count();
+	S32 count = objects.size();
 	for(S32 i = 0; i < count; i++)
 	{
-		const LLUUID &item_id = objects.get(i);
+		const LLUUID &item_id = objects.at(i);
 
 		// Folders are pastable if all items in there are copyable
 		const LLInventoryCategory *cat = model->getCategory(item_id);
@@ -530,12 +530,12 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 		return FALSE;
 	}
 
-	LLDynamicArray<LLUUID> objects;
+	std::vector<LLUUID> objects;
 	LLClipboard::instance().pasteFromClipboard(objects);
-	S32 count = objects.count();
+	S32 count = objects.size();
 	for(S32 i = 0; i < count; i++)
 	{
-		const LLInventoryItem *item = model->getItem(objects.get(i));
+		const LLInventoryItem *item = model->getItem(objects.at(i));
 		if (item)
 		{
 			if (!LLAssetType::lookupCanLink(item->getActualType()))
@@ -543,7 +543,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 				return FALSE;
 			}
 		}
-		const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i));
+		const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i));
 		if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
 		{
 			return FALSE;
@@ -861,7 +861,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
 		}
 
 		*id = obj->getUUID();
-		//object_ids.put(obj->getUUID());
+		//object_ids.push_back(obj->getUUID());
 
 		if (*type == DAD_CATEGORY)
 		{
@@ -2048,15 +2048,15 @@ BOOL LLFolderBridge::isClipboardPasteable() const
 			return FALSE;
 		}
 
-		LLDynamicArray<LLUUID> objects;
+		std::vector<LLUUID> objects;
 		LLClipboard::instance().pasteFromClipboard(objects);
 		const LLViewerInventoryCategory *current_cat = getCategory();
 
 		// Search for the direct descendent of current Friends subfolder among all pasted items,
 		// and return false if is found.
-		for(S32 i = objects.count() - 1; i >= 0; --i)
+		for(S32 i = objects.size() - 1; i >= 0; --i)
 		{
-			const LLUUID &obj_id = objects.get(i);
+			const LLUUID &obj_id = objects.at(i);
 			if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
 			{
 				return FALSE;
@@ -2086,12 +2086,12 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const
 	{
 		const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat );
 		const LLUUID &current_cat_id = current_cat->getUUID();
-		LLDynamicArray<LLUUID> objects;
+		std::vector<LLUUID> objects;
 		LLClipboard::instance().pasteFromClipboard(objects);
-		S32 count = objects.count();
+		S32 count = objects.size();
 		for(S32 i = 0; i < count; i++)
 		{
-			const LLUUID &obj_id = objects.get(i);
+			const LLUUID &obj_id = objects.at(i);
 			const LLInventoryCategory *cat = model->getCategory(obj_id);
 			if (cat)
 			{
@@ -2165,9 +2165,9 @@ int get_folder_levels(LLInventoryCategory* inv_cat)
 
 	int max_child_levels = 0;
 
-	for (S32 i=0; i < cats->count(); ++i)
+	for (S32 i=0; i < cats->size(); ++i)
 	{
-		LLInventoryCategory* category = cats->get(i);
+		LLInventoryCategory* category = cats->at(i);
 		max_child_levels = llmax(max_child_levels, get_folder_levels(category));
 	}
 
@@ -2277,7 +2277,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 		if (is_movable)
 		{
 			model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE);
-			for (S32 i=0; i < descendent_categories.count(); ++i)
+			for (S32 i=0; i < descendent_categories.size(); ++i)
 			{
 				LLInventoryCategory* category = descendent_categories[i];
 				if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
@@ -2290,7 +2290,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 		}
 		if (is_movable && move_is_into_trash)
 		{
-			for (S32 i=0; i < descendent_items.count(); ++i)
+			for (S32 i=0; i < descendent_items.size(); ++i)
 			{
 				LLInventoryItem* item = descendent_items[i];
 				if (get_is_item_worn(item->getUUID()))
@@ -2302,7 +2302,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 		}
 		if (is_movable && move_is_into_landmarks)
 		{
-			for (S32 i=0; i < descendent_items.count(); ++i)
+			for (S32 i=0; i < descendent_items.size(); ++i)
 			{
 				LLViewerInventoryItem* item = descendent_items[i];
 
@@ -2326,7 +2326,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 			}
 			else
 			{
-				int dragged_folder_count = descendent_categories.count();
+				int dragged_folder_count = descendent_categories.size();
 				int existing_item_count = 0;
 				int existing_folder_count = 0;
 				
@@ -2365,8 +2365,8 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 
 					model->collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE);
 					
-					existing_folder_count += existing_categories.count();
-					existing_item_count += existing_items.count();
+					existing_folder_count += existing_categories.size();
+					existing_item_count += existing_items.size();
 				}
 				else
 				{
@@ -2376,7 +2376,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				}
 
 				const int nested_folder_count = existing_folder_count + dragged_folder_count;
-				const int nested_item_count = existing_item_count + descendent_items.count();
+				const int nested_item_count = existing_item_count + descendent_items.size();
 				
 				if (nested_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount"))
 				{
@@ -2391,7 +2391,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				
 				if (is_movable == TRUE)
 				{
-					for (S32 i=0; i < descendent_items.count(); ++i)
+					for (S32 i=0; i < descendent_items.size(); ++i)
 					{
 						LLInventoryItem* item = descendent_items[i];
 						if (!can_move_to_outbox(item, tooltip_msg))
@@ -2447,7 +2447,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 			// Look for any gestures and deactivate them
 			if (move_is_into_trash)
 			{
-				for (S32 i=0; i < descendent_items.count(); i++)
+				for (S32 i=0; i < descendent_items.size(); i++)
 				{
 					LLInventoryItem* item = descendent_items[i];
 					if (item->getType() == LLAssetType::AT_GESTURE
@@ -2711,13 +2711,13 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer)
 		S32 item_count(0);
 		if( item_array )
 		{			
-			item_count = item_array->count();
+			item_count = item_array->size();
 		}
 		
 		S32 cat_count(0);
 		if( cat_array )
 		{			
-			cat_count = cat_array->count();
+			cat_count = cat_array->size();
 		}
 
 		// Move to next if current folder empty
@@ -2735,7 +2735,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer)
 		{
 			for (S32 i = 0; i < item_count; ++i)
 			{
-				ids.push_back(item_array->get(i)->getUUID());
+				ids.push_back(item_array->at(i)->getUUID());
 			}
 			outfit = new LLRightClickInventoryFetchObserver(ids);
 		}
@@ -2744,7 +2744,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer)
 		{
 			for (S32 i = 0; i < cat_count; ++i)
 			{
-				ids.push_back(cat_array->get(i)->getUUID());
+				ids.push_back(cat_array->at(i)->getUUID());
 			}
 			categories = new LLRightClickInventoryFetchDescendentsObserver(ids);
 		}
@@ -3153,7 +3153,7 @@ void LLFolderBridge::pasteFromClipboard()
 		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
 		const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
 
-		LLDynamicArray<LLUUID> objects;
+		std::vector<LLUUID> objects;
 		LLClipboard::instance().pasteFromClipboard(objects);
 
 		if (move_is_into_outbox)
@@ -3166,7 +3166,7 @@ void LLFolderBridge::pasteFromClipboard()
 
 				BOOL can_list = TRUE;
 
-				for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
+				for (std::vector<LLUUID>::const_iterator iter = objects.begin();
 					(iter != objects.end()) && (can_list == TRUE);
 					++iter)
 				{
@@ -3197,7 +3197,7 @@ void LLFolderBridge::pasteFromClipboard()
 
 		const LLUUID parent_id(mUUID);
 
-		for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
+		for (std::vector<LLUUID>::const_iterator iter = objects.begin();
 			 iter != objects.end();
 			 ++iter)
 		{
@@ -3289,9 +3289,9 @@ void LLFolderBridge::pasteLinkFromClipboard()
 
 		const LLUUID parent_id(mUUID);
 
-		LLDynamicArray<LLUUID> objects;
+		std::vector<LLUUID> objects;
 		LLClipboard::instance().pasteFromClipboard(objects);
-		for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
+		for (std::vector<LLUUID>::const_iterator iter = objects.begin();
 			 iter != objects.end();
 			 ++iter)
 		{
@@ -3352,7 +3352,7 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv
 								item_array,
 								LLInventoryModel::EXCLUDE_TRASH,
 								is_type);
-	return ((item_array.count() > 0) ? TRUE : FALSE );
+	return ((item_array.size() > 0) ? TRUE : FALSE );
 }
 
 void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items, menuentry_vec_t& disabled_items)
@@ -4044,7 +4044,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 					
 					gInventory.collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE);
 					
-					existing_item_count += existing_items.count();
+					existing_item_count += existing_items.size();
 				}
 				
 				if (existing_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount"))
@@ -4341,8 +4341,8 @@ bool check_category(LLInventoryModel* model,
 	LLInventoryModel::item_array_t descendent_items;
 	model->collectDescendents(cat_id, descendent_categories, descendent_items, TRUE);
 
-	S32 num_descendent_categories = descendent_categories.count();
-	S32 num_descendent_items = descendent_items.count();
+	S32 num_descendent_categories = descendent_categories.size();
+	S32 num_descendent_items = descendent_items.size();
 
 	if (num_descendent_categories + num_descendent_items == 0)
 	{
diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h
index b183a2052d7a301fecd8a24d79b3243c91b72588..1aa230df9934645bee644bbc301a960a64d0dde8 100755
--- a/indra/newview/llinventoryitemslist.h
+++ b/indra/newview/llinventoryitemslist.h
@@ -29,8 +29,6 @@
 #ifndef LL_LLINVENTORYITEMSLIST_H
 #define LL_LLINVENTORYITEMSLIST_H
 
-#include "lldarray.h"
-
 // newview
 #include "llflatlistview.h"
 
@@ -46,7 +44,7 @@ class LLInventoryItemsList : public LLFlatListViewEx
 
 	virtual ~LLInventoryItemsList();
 
-	void refreshList(const LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array);
+	void refreshList(const std::vector<LLPointer<LLViewerInventoryItem> > item_array);
 
 	boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb);
 
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 935fe2b4d0e88c6c70c7e5f310ebaf7e4755f9e0..81c72fd320fcb490ae92db527333bec9c44fb102 100755
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -112,7 +112,7 @@ bool LLCanCache::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
 			S32 descendents_actual = 0;
 			if(cats && items)
 			{
-				descendents_actual = cats->count() + items->count();
+				descendents_actual = cats->size() + items->size();
 			}
 			if(descendents_server == descendents_actual)
 			{
@@ -389,12 +389,12 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe
 		cats = get_ptr_in_map(mParentChildCategoryTree, root_id);
 		if(cats)
 		{
-			S32 count = cats->count();
+			S32 count = cats->size();
 			for(S32 i = 0; i < count; ++i)
 			{
-				if(cats->get(i)->getPreferredType() == preferred_type)
+				if(cats->at(i)->getPreferredType() == preferred_type)
 				{
-					rv = cats->get(i)->getUUID();
+					rv = cats->at(i)->getUUID();
 					break;
 				}
 			}
@@ -426,12 +426,12 @@ const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::ETyp
 		cats = get_ptr_in_map(mParentChildCategoryTree, root_id);
 		if(cats)
 		{
-			S32 count = cats->count();
+			S32 count = cats->size();
 			for(S32 i = 0; i < count; ++i)
 			{
-				if(cats->get(i)->getPreferredType() == preferred_type)
+				if(cats->at(i)->getPreferredType() == preferred_type)
 				{
-					rv = cats->get(i)->getUUID();
+					rv = cats->at(i)->getUUID();
 					break;
 				}
 			}
@@ -631,13 +631,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id,
 	cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id);
 	if(cat_array)
 	{
-		S32 count = cat_array->count();
+		S32 count = cat_array->size();
 		for(S32 i = 0; i < count; ++i)
 		{
-			LLViewerInventoryCategory* cat = cat_array->get(i);
+			LLViewerInventoryCategory* cat = cat_array->at(i);
 			if(add(cat,NULL))
 			{
-				cats.put(cat);
+				cats.push_back(cat);
 			}
 			collectDescendentsIf(cat->getUUID(), cats, items, include_trash, add);
 		}
@@ -651,10 +651,10 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id,
 	// Note: if making it fully recursive, need more checking against infinite loops.
 	if (follow_folder_links && item_array)
 	{
-		S32 count = item_array->count();
+		S32 count = item_array->size();
 		for(S32 i = 0; i < count; ++i)
 		{
-			item = item_array->get(i);
+			item = item_array->at(i);
 			if (item && item->getActualType() == LLAssetType::AT_LINK_FOLDER)
 			{
 				LLViewerInventoryCategory *linked_cat = item->getLinkedCategory();
@@ -668,7 +668,7 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id,
 						// BAP should this be added here?  May not
 						// matter if it's only being used in current
 						// outfit traversal.
-						cats.put(LLPointer<LLViewerInventoryCategory>(linked_cat));
+						cats.push_back(LLPointer<LLViewerInventoryCategory>(linked_cat));
 					}
 					collectDescendentsIf(linked_cat->getUUID(), cats, items, include_trash, add, FALSE);
 				}
@@ -679,13 +679,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id,
 	// Move onto items
 	if(item_array)
 	{
-		S32 count = item_array->count();
+		S32 count = item_array->size();
 		for(S32 i = 0; i < count; ++i)
 		{
-			item = item_array->get(i);
+			item = item_array->at(i);
 			if(add(NULL, item))
 			{
-				items.put(item);
+				items.push_back(item);
 			}
 		}
 	}
@@ -793,7 +793,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
 	}
 #endif
 
-	LLViewerInventoryItem* old_item = getItem(item->getUUID());
+	LLPointer<LLViewerInventoryItem> old_item = getItem(item->getUUID());
 	LLPointer<LLViewerInventoryItem> new_item;
 	if(old_item)
 	{
@@ -809,12 +809,12 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
 			item_array = get_ptr_in_map(mParentChildItemTree, old_parent_id);
 			if(item_array)
 			{
-				item_array->removeObj(old_item);
+				vector_replace_with_last(*item_array, old_item);
 			}
 			item_array = get_ptr_in_map(mParentChildItemTree, new_parent_id);
 			if(item_array)
 			{
-				item_array->put(old_item);
+				item_array->push_back(old_item);
 			}
 			mask |= LLInventoryObserver::STRUCTURE;
 		}
@@ -840,7 +840,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
 			{
 				// *FIX: bit of a hack to call update server from here...
 				new_item->updateServer(TRUE);
-				item_array->put(new_item);
+				item_array->push_back(new_item);
 			}
 			else
 			{
@@ -868,7 +868,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
 			item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, parent_id);
 			if(item_array)
 			{
-				item_array->put(new_item);
+				item_array->push_back(new_item);
 			}
 			else
 			{
@@ -883,7 +883,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
 					// *FIX: bit of a hack to call update server from
 					// here...
 					new_item->updateServer(TRUE);
-					item_array->put(new_item);
+					item_array->push_back(new_item);
 				}
 				else
 				{
@@ -965,7 +965,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat)
 		return;
 	}
 
-	LLViewerInventoryCategory* old_cat = getCategory(cat->getUUID());
+	LLPointer<LLViewerInventoryCategory> old_cat = getCategory(cat->getUUID());
 	if(old_cat)
 	{
 		// We already have an old category, modify it's values
@@ -979,12 +979,12 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat)
 			cat_array = getUnlockedCatArray(old_parent_id);
 			if(cat_array)
 			{
-				cat_array->removeObj(old_cat);
+				vector_replace_with_last(*cat_array, old_cat);
 			}
 			cat_array = getUnlockedCatArray(new_parent_id);
 			if(cat_array)
 			{
-				cat_array->put(old_cat);
+				cat_array->push_back(old_cat);
 			}
 			mask |= LLInventoryObserver::STRUCTURE;
             mask |= LLInventoryObserver::INTERNAL;
@@ -1008,7 +1008,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat)
 		cat_array = getUnlockedCatArray(cat->getParentUUID());
 		if(cat_array)
 		{
-			cat_array->put(new_cat);
+			cat_array->push_back(new_cat);
 		}
 
 		// make space in the tree for this category's children.
@@ -1037,27 +1037,27 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
 				<< cat_id << llendl;
 		return;
 	}
-	LLViewerInventoryCategory* cat = getCategory(object_id);
+	LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id);
 	if(cat && (cat->getParentUUID() != cat_id))
 	{
 		cat_array_t* cat_array;
 		cat_array = getUnlockedCatArray(cat->getParentUUID());
-		if(cat_array) cat_array->removeObj(cat);
+		if(cat_array) vector_replace_with_last(*cat_array, cat);
 		cat_array = getUnlockedCatArray(cat_id);
 		cat->setParent(cat_id);
-		if(cat_array) cat_array->put(cat);
+		if(cat_array) cat_array->push_back(cat);
 		addChangedMask(LLInventoryObserver::STRUCTURE, object_id);
 		return;
 	}
-	LLViewerInventoryItem* item = getItem(object_id);
+	LLPointer<LLViewerInventoryItem> item = getItem(object_id);
 	if(item && (item->getParentUUID() != cat_id))
 	{
 		item_array_t* item_array;
 		item_array = getUnlockedItemArray(item->getParentUUID());
-		if(item_array) item_array->removeObj(item);
+		if(item_array) vector_replace_with_last(*item_array, item);
 		item_array = getUnlockedItemArray(cat_id);
 		item->setParent(cat_id);
-		if(item_array) item_array->put(item);
+		if(item_array) item_array->push_back(item);
 		addChangedMask(LLInventoryObserver::STRUCTURE, object_id);
 		return;
 	}
@@ -1143,14 +1143,14 @@ void LLInventoryModel::deleteObject(const LLUUID& id)
 	item_array_t* item_list = getUnlockedItemArray(parent_id);
 	if(item_list)
 	{
-		LLViewerInventoryItem* item = (LLViewerInventoryItem*)((LLInventoryObject*)obj);
-		item_list->removeObj(item);
+		LLPointer<LLViewerInventoryItem> item = (LLViewerInventoryItem*)((LLInventoryObject*)obj);
+		vector_replace_with_last(*item_list, item);
 	}
 	cat_array_t* cat_list = getUnlockedCatArray(parent_id);
 	if(cat_list)
 	{
-		LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj);
-		cat_list->removeObj(cat);
+		LLPointer<LLViewerInventoryCategory> cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj);
+		vector_replace_with_last(*cat_list, cat);
 	}
 	item_list = getUnlockedItemArray(id);
 	if(item_list)
@@ -1282,7 +1282,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
 							   categories,
 							   items,
 							   INCLUDE_TRASH);
-			S32 count = items.count();
+			S32 count = items.size();
 
 			item_map_t::iterator item_map_end = mItemMap.end();
 			cat_map_t::iterator cat_map_end = mCategoryMap.end();
@@ -1290,7 +1290,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
 
 			for(S32 i = 0; i < count; ++i)
 			{
-				uu_id = items.get(i)->getUUID();
+				uu_id = items.at(i)->getUUID();
 
 				// This check prevents the deletion of a previously deleted item.
 				// This is necessary because deletion is not done in a hierarchical
@@ -1302,10 +1302,10 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
 				}
 			}
 
-			count = categories.count();
+			count = categories.size();
 			for(S32 i = 0; i < count; ++i)
 			{
-				uu_id = categories.get(i)->getUUID();
+				uu_id = categories.at(i)->getUUID();
 				if (mCategoryMap.find(uu_id) != cat_map_end)
 				{
 					deleteObject(uu_id);
@@ -1481,11 +1481,11 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const
 	//item_array_t* items = get_ptr_in_map(mParentChildItemTree, folder_id);
 	//if(categories)
 	//{
-	//	known_descendents += categories->count();
+	//	known_descendents += categories->size();
 	//}
 	//if(items)
 	//{
-	//	known_descendents += items->count();
+	//	known_descendents += items->size();
 	//}
 	return cat->fetch();
 }
@@ -1499,7 +1499,7 @@ void LLInventoryModel::cache(
 	LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id);
 	if(!root_cat) return;
 	cat_array_t categories;
-	categories.put(root_cat);
+	categories.push_back(root_cat);
 	item_array_t items;
 
 	LLCanCache can_cache(this);
@@ -1612,7 +1612,7 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const
 			S32 descendents_actual = 0;
 			if(cats && items)
 			{
-				descendents_actual = cats->count() + items->count();
+				descendents_actual = cats->size() + items->size();
 			}
 			if(descendents_server == descendents_actual)
 			{
@@ -1727,12 +1727,12 @@ LLInventoryModel::EHasChildren LLInventoryModel::categoryHasChildren(
 
 	// Shouldn't have to run this, but who knows.
 	parent_cat_map_t::const_iterator cat_it = mParentChildCategoryTree.find(cat->getUUID());
-	if (cat_it != mParentChildCategoryTree.end() && cat_it->second->count() > 0)
+	if (cat_it != mParentChildCategoryTree.end() && cat_it->second->size() > 0)
 	{
 		return CHILDREN_YES;
 	}
 	parent_item_map_t::const_iterator item_it = mParentChildItemTree.find(cat->getUUID());
-	if (item_it != mParentChildItemTree.end() && item_it->second->count() > 0)
+	if (item_it != mParentChildItemTree.end() && item_it->second->size() > 0)
 	{
 		return CHILDREN_YES;
 	}
@@ -1752,7 +1752,7 @@ bool LLInventoryModel::isCategoryComplete(const LLUUID& cat_id) const
 		S32 descendents_actual = 0;
 		if(cats && items)
 		{
-			descendents_actual = cats->count() + items->count();
+			descendents_actual = cats->size() + items->size();
 		}
 		if(descendents_server == descendents_actual)
 		{
@@ -1850,7 +1850,7 @@ bool LLInventoryModel::loadSkeleton(
 			// found to generate a set of categories we should add. We
 			// will go through each category loaded and if the version
 			// does not match, invalidate the version.
-			S32 count = categories.count();
+			S32 count = categories.size();
 			cat_set_t::iterator not_cached = temp_cats.end();
 			std::set<LLUUID> cached_ids;
 			for(S32 i = 0; i < count; ++i)
@@ -2060,7 +2060,7 @@ void LLInventoryModel::buildParentChildMap()
 	for(cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
 	{
 		LLViewerInventoryCategory* cat = cit->second;
-		cats.put(cat);
+		cats.push_back(cat);
 		if (mParentChildCategoryTree.count(cat->getUUID()) == 0)
 		{
 			llassert_always(mCategoryLock[cat->getUUID()] == false);
@@ -2088,16 +2088,16 @@ void LLInventoryModel::buildParentChildMap()
 	// Now we have a structure with all of the categories that we can
 	// iterate over and insert into the correct place in the child
 	// category tree. 
-	S32 count = cats.count();
+	S32 count = cats.size();
 	S32 i;
 	S32 lost = 0;
 	for(i = 0; i < count; ++i)
 	{
-		LLViewerInventoryCategory* cat = cats.get(i);
+		LLViewerInventoryCategory* cat = cats.at(i);
 		catsp = getUnlockedCatArray(cat->getParentUUID());
 		if(catsp)
 		{
-			catsp->put(cat);
+			catsp->push_back(cat);
 		}
 		else
 		{
@@ -2130,7 +2130,7 @@ void LLInventoryModel::buildParentChildMap()
 			catsp = getUnlockedCatArray(cat->getParentUUID());
 			if(catsp)
 			{
-				catsp->put(cat);
+				catsp->push_back(cat);
 			}
 			else
 			{		
@@ -2157,20 +2157,20 @@ void LLInventoryModel::buildParentChildMap()
 		for(item_map_t::iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit)
 		{
 			item = (*iit).second;
-			items.put(item);
+			items.push_back(item);
 		}
 	}
-	count = items.count();
+	count = items.size();
 	lost = 0;
 	uuid_vec_t lost_item_ids;
 	for(i = 0; i < count; ++i)
 	{
 		LLPointer<LLViewerInventoryItem> item;
-		item = items.get(i);
+		item = items.at(i);
 		itemsp = getUnlockedItemArray(item->getParentUUID());
 		if(itemsp)
 		{
-			itemsp->put(item);
+			itemsp->push_back(item);
 		}
 		else
 		{
@@ -2187,7 +2187,7 @@ void LLInventoryModel::buildParentChildMap()
 			itemsp = getUnlockedItemArray(item->getParentUUID());
 			if(itemsp)
 			{
-				itemsp->put(item);
+				itemsp->push_back(item);
 			}
 			else
 			{
@@ -2355,7 +2355,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
 			LLPointer<LLViewerInventoryCategory> inv_cat = new LLViewerInventoryCategory(LLUUID::null);
 			if(inv_cat->importFileLocal(file))
 			{
-				categories.put(inv_cat);
+				categories.push_back(inv_cat);
 			}
 			else
 			{
@@ -2383,7 +2383,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
 				}
 				else
 				{
-					items.put(inv_item);
+					items.push_back(inv_item);
 				}
 			}
 			else
@@ -2423,7 +2423,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
 	}
 
 	fprintf(file, "\tinv_cache_version\t%d\n",sCurrentInvCacheVersion);
-	S32 count = categories.count();
+	S32 count = categories.size();
 	S32 i;
 	for(i = 0; i < count; ++i)
 	{
@@ -2434,7 +2434,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
 		}
 	}
 
-	count = items.count();
+	count = items.size();
 	for(i = 0; i < count; ++i)
 	{
 		items[i]->exportFile(file);
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 964adf5e50c810e3f54e39227ece5103d28b8c9b..69dba495d7632a6e59298c6a021c16d083a6993d 100755
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -29,7 +29,6 @@
 
 #include "llassettype.h"
 #include "llfoldertype.h"
-#include "lldarray.h"
 #include "llframetimer.h"
 #include "llcurl.h"
 #include "lluuid.h"
@@ -75,8 +74,8 @@ class LLInventoryModel
 		CHILDREN_MAYBE
 	};
 
-	typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;
-	typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
+	typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
+	typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
 	typedef std::set<LLUUID> changed_items_t;
 
 	class fetchInventoryResponder : public LLCurl::Responder
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 9db175ec2e03b938e529c3926f29d8a7a76032a8..1083a6b37d3c93bd01713db2e2f85f62c846601c 100755
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -398,7 +398,7 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven
 		// from memory.
 		return TRUE;
 	}
-	const S32 current_num_known_descendents = cats->count() + items->count();
+	const S32 current_num_known_descendents = cats->size() + items->size();
 	
 	// Got the number of descendents that we were expecting, so we're done.
 	if (current_num_known_descendents == expected_num_descendents)
@@ -724,7 +724,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask)
 			continue;
 		}
 		
-		const S32 current_num_known_descendents = cats->count() + items->count();
+		const S32 current_num_known_descendents = cats->size() + items->size();
 
 		LLCategoryData& cat_data = (*iter).second;
 
@@ -791,7 +791,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t
 		}
 		else
 		{
-			current_num_known_descendents = cats->count() + items->count();
+			current_num_known_descendents = cats->size() + items->size();
 		}
 	}
 
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 4fdb05bc8264424dc012dca1b8d0d510412ccef2..8190887ba6b304b300de89f4b55a2059bc66326e 100755
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -1024,7 +1024,7 @@ bool LLInventoryPanel::beginIMSession()
 
 	std::string name;
 
-	LLDynamicArray<LLUUID> members;
+	std::vector<LLUUID> members;
 	EInstantMessage type = IM_SESSION_CONFERENCE_START;
 
 	std::set<LLFolderViewItem*>::const_iterator iter;
@@ -1052,7 +1052,7 @@ bool LLInventoryPanel::beginIMSession()
 												item_array,
 												LLInventoryModel::EXCLUDE_TRASH,
 												is_buddy);
-				S32 count = item_array.count();
+				S32 count = item_array.size();
 				if(count > 0)
 				{
 					//*TODO by what to replace that?
@@ -1063,10 +1063,10 @@ bool LLInventoryPanel::beginIMSession()
 					LLUUID id;
 					for(S32 i = 0; i < count; ++i)
 					{
-						id = item_array.get(i)->getCreatorUUID();
+						id = item_array.at(i)->getCreatorUUID();
 						if(at.isBuddyOnline(id))
 						{
-							members.put(id);
+							members.push_back(id);
 						}
 					}
 				}
@@ -1086,7 +1086,7 @@ bool LLInventoryPanel::beginIMSession()
 
 						if(at.isBuddyOnline(id))
 						{
-							members.put(id);
+							members.push_back(id);
 						}
 					}
 				} //if IT_CALLINGCARD
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 00a90325ad0161417bca2ac914bd69d2875cd2e7..8b50a43a8450614795ff5b10d5083eeb7f578bf6 100755
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -29,7 +29,6 @@
 #define LL_LLINVENTORYPANEL_H
 
 #include "llassetstorage.h"
-#include "lldarray.h"
 #include "llfolderviewitem.h"
 #include "llfolderviewmodelinventory.h"
 #include "llfloater.h"
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 2d7454b636b2254b512c3907ff9debf80285fc26..60272749ffc654aa2c71ce5aebeac0ce187bdf61 100755
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -292,7 +292,7 @@ void LLLogChat::saveHistory(const std::string& filename,
 	if (tmp_filename.empty())
 	{
 		std::string warn = "Chat history filename [" + filename + "] is empty!";
-		llwarning(warn, 666);
+		LL_WARNS() << warn << LL_ENDL;
 		llassert(tmp_filename.size());
 		return;
 	}
@@ -662,7 +662,7 @@ void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const
 {
 	if (!im.isMap())
 	{
-		llwarning("invalid LLSD type of an instant message", 0);
+		LL_WARNS() << "invalid LLSD type of an instant message" << LL_ENDL;
 		return;
 	}
 
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index a7d6cb5eac0ae4e35b201b07162952d903585965..edb2d5e02412ce8a664be83c5dd3cbd49e4e6a87 100755
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -226,11 +226,11 @@ BOOL LLManip::handleHover(S32 x, S32 y, MASK mask)
 			setMouseCapture( FALSE );
 		}
 
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLManip (active)" << llendl;
+		LL_DEBUGS("UserInput") << "hover handled by LLManip (active)" << llendl;
 	}
 	else
 	{
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLManip (inactive)" << llendl;
+		LL_DEBUGS("UserInput") << "hover handled by LLManip (inactive)" << llendl;
 	}
 	gViewerWindow->setCursor(UI_CURSOR_ARROW);
 	return TRUE;
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 9b05c7561713ae1d1b3ade317d0a5303a951ced6..e2be3331ed6d26a9fbf6327d2dba2e29cc58d7e3 100755
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -519,12 +519,12 @@ BOOL LLManipRotate::handleHover(S32 x, S32 y, MASK mask)
 			drag(x, y);
 		}
 
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipRotate (active)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLManipRotate (active)" << llendl;		
 	}
 	else
 	{
 		highlightManipulators(x, y);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipRotate (inactive)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLManipRotate (inactive)" << llendl;		
 	}
 
 	gViewerWindow->setCursor(UI_CURSOR_TOOLROTATE);
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 15788d6ffd48e98ae1452ead913cbcea1c326762..b4348f2a0e8ab17b02b81a3cde954074ad150d28 100755
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -413,7 +413,7 @@ BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask)
 		{
 			drag( x, y );
 		}
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipScale (active)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLManipScale (active)" << llendl;		
 	}
 	else
 	{
@@ -543,7 +543,7 @@ void LLManipScale::highlightManipulators(S32 x, S32 y)
 		}
 	}
 
-	lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipScale (inactive)" << llendl;
+	LL_DEBUGS("UserInput") << "hover handled by LLManipScale (inactive)" << llendl;
 }
 
 
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 01337cfaedada1e10de7d25a6302bb57f0419a8b..cfea8a333090c7989a588766551253802df12b14 100755
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -412,7 +412,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 	// Bail out if mouse not down.
 	if( !hasMouseCapture() )
 	{
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (inactive)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (inactive)" << llendl;		
 		// Always show cursor
 		// gViewerWindow->setCursor(UI_CURSOR_ARROW);
 		gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
@@ -448,7 +448,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 	// rotation above.
 	if( x == mLastHoverMouseX && y == mLastHoverMouseY && !rotated)
 	{
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (mouse unmoved)" << llendl;
+		LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse unmoved)" << llendl;
 		gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
 		return TRUE;
 	}
@@ -461,7 +461,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 	{
 		if (abs(mMouseDownX - x) < MOUSE_DRAG_SLOP && abs(mMouseDownY - y) < MOUSE_DRAG_SLOP )
 		{
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (mouse inside slop)" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse inside slop)" << llendl;
 			gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
 			return TRUE;
 		}
@@ -478,7 +478,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 
 				// When we make the copy, we don't want to do any other processing.
 				// If so, the object will also be moved, and the copy will be offset.
-				lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (made copy)" << llendl;
+				LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (made copy)" << llendl;
 				gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
 			}
 		}
@@ -531,7 +531,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 
 		if (relative_move.magVecSquared() > max_drag_distance * max_drag_distance)
 		{
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (too far)" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (too far)" << llendl;
 			gViewerWindow->setCursor(UI_CURSOR_NOLOCKED);
 			return TRUE;
 		}
@@ -776,7 +776,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 	gAgentCamera.clearFocusObject();
 	dialog_refresh_all();		// ??? is this necessary?
 
-	lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (active)" << llendl;
+	LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (active)" << llendl;
 	gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE);
 	return TRUE;
 }
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index 7f396b7b7ed42d4067feb20800efdaf14ad69483..3417651ddb4bb9c5d9135401db9bc98ecb67221f 100755
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -125,7 +125,7 @@ BOOL LLNameListCtrl::handleDragAndDrop(
 	}
 
 	handled = TRUE;
-	lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLNameListCtrl " << getName() << llendl;
+	LL_DEBUGS("UserInput") << "dragAndDrop handled by LLNameListCtrl " << getName() << llendl;
 
 	return handled;
 }
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 679b1bdcda6ebbdeac2f9b44116ddfc14e47ee59..b6a9aae213cd48883c2b37e102e48b4ad4c89709 100755
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -29,7 +29,6 @@
 
 #include "llagent.h"
 #include "llavataractions.h"
-#include "llavatarconstants.h"	// AVATAR_ONLINE
 #include "llcallingcard.h"
 #include "llcombobox.h"
 #include "lldateutil.h"			// ageFromDate()
diff --git a/indra/newview/llpanelcontents.h b/indra/newview/llpanelcontents.h
index 62ccb64a4cd619d7e73194ce839466c251f1d849..ad62e13bc282360a8bceb3428aadbb8cf37abe5b 100755
--- a/indra/newview/llpanelcontents.h
+++ b/indra/newview/llpanelcontents.h
@@ -31,7 +31,6 @@
 #include "llpanel.h"
 #include "llinventory.h"
 #include "lluuid.h"
-#include "llmap.h"
 #include "llviewerobject.h"
 #include "llvoinventorylistener.h"
 
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index a499fa1d872aa205279636f3c2a518be2b77c685..5bdd88dd509d9fa4ac76455d3435a7b18af4b87a 100755
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -1071,7 +1071,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as)
 			LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID());
 		if (links.size()>0)
 		{
-			link_item = links.get(0).get();
+			link_item = links.at(0).get();
 			if (link_item && link_item->getIsLinkType())
 			{
 				description = link_item->getActualDescription();
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 7ef427fa3e8780b923f3a89d2d313ec17636405e..df37a188fa5e1364b5c8e86c008762683f0558b1 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -1323,7 +1323,7 @@ void LLPanelFace::updateUI()
 				// to avoid getting overwritten with the default on some UI state changes.
 				//
 				if (!material->getSpecularID().isNull())
-		{
+				{
 					getChild<LLColorSwatchCtrl>("shinycolorswatch")->setOriginal(material->getSpecularLightColor());
 					getChild<LLColorSwatchCtrl>("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE);
 				}
@@ -1334,9 +1334,9 @@ void LLPanelFace::updateUI()
 		
 				if ( ((channel_to_edit == LLRender::NORMAL_MAP) && material->getNormalID().isNull())
 					||((channel_to_edit == LLRender::SPECULAR_MAP) && material->getSpecularID().isNull()))
-		{
+				{
 					channel_to_edit = LLRender::DIFFUSE_MAP;
-		}
+				}
 
 				LLSelectMgr::getInstance()->setTextureChannel(channel_to_edit);
 
@@ -1345,15 +1345,15 @@ void LLPanelFace::updateUI()
 				texture_ctrl->setImageAssetID(material->getNormalID());
 
 				if (!material->getNormalID().isNull())
-		{
+				{
 					material->getNormalOffset(offset_x,offset_y);
 					material->getNormalRepeat(repeat_x,repeat_y);
 
 					if (identical_planar_texgen)
-				{
+					{
 						repeat_x *= 2.0f;
 						repeat_y *= 2.0f;
-				}
+					}
 			
 					rot = material->getNormalRotation();
 					getChild<LLUICtrl>("bumpyScaleU")->setValue(repeat_x);
@@ -1398,7 +1398,7 @@ void LLPanelFace::updateUI()
 		if(mColorSwatch)
 		{
 			mColorSwatch->setEnabled( FALSE );			
-			mColorSwatch->setFallbackImageName("locked_image.j2c" );
+			mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") );
 			mColorSwatch->setValid(FALSE);
 		}
 		getChildView("color trans")->setEnabled(FALSE);
diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index c927aeacb30d4b495e9110bc5501ce5595042ea4..524305e3fef8342102b69d59e25b4ea900001332 100755
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -131,7 +131,7 @@ class LLGroupMoneyTabEventHandler
 
 
 
-	static LLMap<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs;
+	static std::map<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs;
 	static std::map<LLPanel*, LLGroupMoneyTabEventHandler*> sTabsToHandlers;
 protected:
 	LLGroupMoneyTabEventHandlerImpl* mImplementationp;
@@ -534,7 +534,7 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)
 
 
 //static
-LLMap<LLUUID, LLPanelGroupLandMoney*> LLPanelGroupLandMoney::sGroupIDs;
+std::map<LLUUID, LLPanelGroupLandMoney*> LLPanelGroupLandMoney::sGroupIDs;
 
 LLPanelGroupLandMoney::LLPanelGroupLandMoney() :
 	LLPanelGroupTab() 
@@ -547,13 +547,13 @@ LLPanelGroupLandMoney::LLPanelGroupLandMoney() :
 	//will then only be working for the last panel for a given group id :(
 
 	//FIXME - add to setGroupID()
-	//LLPanelGroupLandMoney::sGroupIDs.addData(group_id, this);
+	//LLPanelGroupLandMoney::sGroupIDs.insert(group_id, this);
 }
 
 LLPanelGroupLandMoney::~LLPanelGroupLandMoney()
 {
 	delete mImplementationp;
-	LLPanelGroupLandMoney::sGroupIDs.removeData(mGroupID);
+	LLPanelGroupLandMoney::sGroupIDs.erase(mGroupID);
 }
 
 void LLPanelGroupLandMoney::activate()
@@ -821,15 +821,15 @@ void LLPanelGroupLandMoney::processPlacesReply(LLMessageSystem* msg, void**)
 	LLUUID group_id;
 	msg->getUUID("AgentData", "QueryID", group_id);
 
-	LLPanelGroupLandMoney* selfp = sGroupIDs.getIfThere(group_id);
-	if(!selfp)
+	group_id_map_t::iterator found_it = sGroupIDs.find(group_id);
+	if(found_it == sGroupIDs.end())
 	{
 		llinfos << "Group Panel Land L$ " << group_id << " no longer in existence."
 				<< llendl;
 		return;
 	}
 
-	selfp->mImplementationp->processGroupLand(msg);
+	found_it->second->mImplementationp->processGroupLand(msg);
 }
 
 
@@ -885,7 +885,7 @@ void LLGroupMoneyTabEventHandlerImpl::updateButtons()
 //** LLGroupMoneyTabEventHandler Functions **
 //*******************************************
 
-LLMap<LLUUID, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sInstanceIDs;
+std::map<LLUUID, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sInstanceIDs;
 std::map<LLPanel*, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sTabsToHandlers;
 
 LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_buttonp,
@@ -922,13 +922,13 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto
 		tab_containerp->setCommitCallback(boost::bind(&LLGroupMoneyTabEventHandler::onClickTab, this));
 	}
 
-	sInstanceIDs.addData(mImplementationp->mPanelID, this);
+	sInstanceIDs.insert(std::make_pair(mImplementationp->mPanelID, this));
 	sTabsToHandlers[panelp] = this;
 }
 
 LLGroupMoneyTabEventHandler::~LLGroupMoneyTabEventHandler()
 {
-	sInstanceIDs.removeData(mImplementationp->mPanelID);
+	sInstanceIDs.erase(mImplementationp->mPanelID);
 	sTabsToHandlers.erase(mImplementationp->mTabPanelp);
 
 	delete mImplementationp;
@@ -1122,10 +1122,10 @@ void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg
 
 	LLUUID request_id;
 	msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id );
-	LLGroupMoneyTabEventHandler* selfp = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id);
+	LLGroupMoneyTabEventHandler* selfp = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
 	if (!selfp)
 	{
-		llwarns << "GroupAccountDetails recieved for non-existent group panel." << llendl;
+		llwarns << "GroupAccountDetails received for non-existent group panel." << llendl;
 		return;
 	}
 
@@ -1302,7 +1302,7 @@ void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem
 
 	LLGroupMoneyTabEventHandler* self;
 
-	self = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id);
+	self = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
 	if (!self)
 	{
 		llwarns << "GroupAccountTransactions recieved for non-existent group panel." << llendl;
@@ -1482,7 +1482,7 @@ void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg
 
 	LLGroupMoneyTabEventHandler* self;
 
-	self = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id);
+	self = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id);
 	if (!self)
 	{
 		llwarns << "GroupAccountSummary recieved for non-existent group L$ planning tab." << llendl;
@@ -1494,9 +1494,9 @@ void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg
 
 void LLPanelGroupLandMoney::setGroupID(const LLUUID& id)
 {
-	LLPanelGroupLandMoney::sGroupIDs.removeData(mGroupID);
+	LLPanelGroupLandMoney::sGroupIDs.erase(mGroupID);
 	LLPanelGroupTab::setGroupID(id);
-	LLPanelGroupLandMoney::sGroupIDs.addData(mGroupID, this);
+	LLPanelGroupLandMoney::sGroupIDs.insert(std::make_pair(mGroupID, this));
 
 
 	bool can_view = gAgent.isInGroup(mGroupID);
diff --git a/indra/newview/llpanelgrouplandmoney.h b/indra/newview/llpanelgrouplandmoney.h
index ac3518ee19002ca6a82ba3da3e74f7d49e172aa9..3cec6065e709526b11db000e8e7a5a00d45a4dbe 100755
--- a/indra/newview/llpanelgrouplandmoney.h
+++ b/indra/newview/llpanelgrouplandmoney.h
@@ -28,7 +28,7 @@
 #define LL_PANEL_GROUP_LAND_MONEY_H
 
 #include "llpanelgroup.h"
-#include "llmap.h"
+#include <map>
 #include "lluuid.h"
 
 class LLPanelGroupLandMoney : public LLPanelGroupTab
@@ -47,7 +47,8 @@ class LLPanelGroupLandMoney : public LLPanelGroupTab
 
 	static void processPlacesReply(LLMessageSystem* msg, void**);
 
-	static LLMap<LLUUID, LLPanelGroupLandMoney*> sGroupIDs;
+	typedef std::map<LLUUID, LLPanelGroupLandMoney*> group_id_map_t;
+	static group_id_map_t sGroupIDs;
 
 	static void processGroupAccountDetailsReply(LLMessageSystem* msg,  void** data);
 	static void processGroupAccountTransactionsReply(LLMessageSystem* msg, void** data);
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 5c9b968ac908e3c5b19b0c8af053df0d6b60e712..79815e7be5e6eb9d59392f55afe1a46eb9226fab 100755
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -446,9 +446,9 @@ void LLPanelLandmarkInfo::populateFoldersList()
 	typedef std::vector<folder_pair_t> folder_vec_t;
 	folder_vec_t folders;
 	// Sort the folders by their full name.
-	for (S32 i = 0; i < cats.count(); i++)
+	for (S32 i = 0; i < cats.size(); i++)
 	{
-		const LLViewerInventoryCategory* cat = cats.get(i);
+		const LLViewerInventoryCategory* cat = cats.at(i);
 		std::string cat_full_name = getFullFolderName(cat);
 		folders.push_back(folder_pair_t(cat->getUUID(), cat_full_name));
 	}
@@ -487,6 +487,6 @@ static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats)
 	}
 	else
 	{
-		cats.put(favorites_cat);
+		cats.push_back(favorites_cat);
 	}
 }
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index bcb90bcb56662d219b2453909d61a81588a6437f..c96173f550723bba0a4777b8c462e3cb4685dd39 100755
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -33,7 +33,6 @@
 #include "llfloaterreg.h"
 #include "llfontgl.h"
 #include "llmd5.h"
-#include "llsecondlifeurls.h"
 #include "v4color.h"
 
 #include "llappviewer.h"
@@ -545,13 +544,13 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
 	LLStringUtil::trim(username);
 	std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
 
-	LL_INFOS2("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
+	LL_INFOS("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
 	// determine if the username is a first/last form or not.
 	size_t separator_index = username.find_first_of(' ');
 	if (separator_index == username.npos
 		&& !LLGridManager::getInstance()->isSystemGrid())
 	{
-		LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL;
+		LL_INFOS("Credentials", "Authentication") << "account: " << username << LL_ENDL;
 		// single username, so this is a 'clear' identifier
 		identifier["type"] = CRED_IDENTIFIER_TYPE_ACCOUNT;
 		identifier["account_name"] = username;
@@ -586,7 +585,7 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
 		
 		if (last.find_first_of(' ') == last.npos)
 		{
-			LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
+			LL_INFOS("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
 			// traditional firstname / lastname
 			identifier["type"] = CRED_IDENTIFIER_TYPE_AGENT;
 			identifier["first_name"] = first;
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index a9af56f750b12a9bfbe43d876268136fbe44281d..4a3840c49896582e0efed57433f2ff697788a653 100755
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -30,7 +30,6 @@
 
 // Viewer includes
 #include "llpanelprofile.h"
-#include "llavatarconstants.h"
 #include "llagent.h"
 #include "llagentcamera.h"
 #include "llagentwearables.h"
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index d7130820ab0b6b0bd6e4a1d0905946edccce31fe..94cb90b993864d2708a3d6126bc8c2f0f51234d0 100755
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -1753,7 +1753,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li
 	LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
 
 	// Find all in the first pass
-	LLDynamicArray<obj_folder_pair*> child_categories;
+	std::vector<obj_folder_pair*> child_categories;
 	LLTaskInvFVBridge* bridge;
 	LLFolderViewItem* view;
 
@@ -1780,7 +1780,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li
 				p.font_color = item_color;
 				p.font_highlight_color = item_color;
 				view = LLUICtrlFactory::create<LLFolderViewFolder>(p);
-				child_categories.put(new obj_folder_pair(obj,
+				child_categories.push_back(new obj_folder_pair(obj,
 														 (LLFolderViewFolder*)view));
 			}
 			else
@@ -1802,7 +1802,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li
 	}
 
 	// now, for each category, do the second pass
-	for(S32 i = 0; i < child_categories.count(); i++)
+	for(S32 i = 0; i < child_categories.size(); i++)
 	{
 		createViewsForCategory(inventory, child_categories[i]->first,
 							   child_categories[i]->second );
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index cfbc8f1a94de31af71f925184fb24c8ac0dd78e1..f2ef2ec0036b58ec2e74a9d4dcdaa3021b9afacc 100755
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -30,7 +30,6 @@
 
 #include "llagent.h"
 #include "llagentpicksinfo.h"
-#include "llavatarconstants.h"
 #include "llcommandhandler.h"
 #include "lldispatcher.h"
 #include "llflatlistview.h"
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 0756faf5c0c80e19e36673d5d52c7003b745d609..018efbbc5c10987926f65f9b4a0afb5e4f4ed9ae 100755
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -416,7 +416,7 @@ BOOL LLTeleportHistoryPanel::postBuild()
 				// All accordion tabs are collapsed initially
 				setAccordionCollapsedByUser(tab, true);
 
-				mItemContainers.put(tab);
+				mItemContainers.push_back(tab);
 
 				LLFlatListView* fl = getFlatListViewFromTab(tab);
 				if (fl)
@@ -432,14 +432,14 @@ BOOL LLTeleportHistoryPanel::postBuild()
 		// Open first 2 accordion tabs
 		if (mItemContainers.size() > 1)
 		{
-			LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 1);
+			LLAccordionCtrlTab* tab = mItemContainers.at(mItemContainers.size() - 1);
 			tab->setDisplayChildren(true);
 			setAccordionCollapsedByUser(tab, false);
 		}
 
 		if (mItemContainers.size() > 2)
 		{
-			LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 2);
+			LLAccordionCtrlTab* tab = mItemContainers.at(mItemContainers.size() - 2);
 			tab->setDisplayChildren(true);
 			setAccordionCollapsedByUser(tab, false);
 		}
@@ -683,7 +683,7 @@ void LLTeleportHistoryPanel::refresh()
 			tab_idx = mItemContainers.size() - 1 - tab_idx;
 			if (tab_idx >= 0)
 			{
-				LLAccordionCtrlTab* tab = mItemContainers.get(tab_idx);
+				LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx);
 				tab->setVisible(true);
 
 				// Expand all accordion tabs when filtering
@@ -730,7 +730,7 @@ void LLTeleportHistoryPanel::refresh()
 
 	for (S32 n = mItemContainers.size() - 1; n >= 0; --n)
 	{
-		LLAccordionCtrlTab* tab = mItemContainers.get(n);
+		LLAccordionCtrlTab* tab = mItemContainers.at(n);
 		LLFlatListView* fv = getFlatListViewFromTab(tab);
 		if (fv)
 		{
@@ -792,7 +792,7 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index)
 	// to point to the right item in LLTeleportHistoryStorage
 	for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx)
 	{
-		LLAccordionCtrlTab* tab = mItemContainers.get(tab_idx);
+		LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx);
 		if (!tab->getVisible())
 			continue;
 
@@ -846,7 +846,7 @@ void LLTeleportHistoryPanel::showTeleportHistory()
 
 	for (S32 n = mItemContainers.size() - 1; n >= 0; --n)
 	{
-		LLAccordionCtrlTab* tab = mItemContainers.get(n);
+		LLAccordionCtrlTab* tab = mItemContainers.at(n);
 		if (tab)
 		{
 			tab->setVisible(false);
@@ -873,7 +873,7 @@ void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected)
 
 	for (S32 n = 0; n < tabs_cnt; n++)
 	{
-		LLAccordionCtrlTab* tab = mItemContainers.get(n);
+		LLAccordionCtrlTab* tab = mItemContainers.at(n);
 
 		if (!tab->getVisible())
 			continue;
@@ -958,7 +958,7 @@ void LLTeleportHistoryPanel::onExpandAllFolders()
 
 	for (S32 n = 0; n < tabs_cnt; n++)
 	{
-		mItemContainers.get(n)->setDisplayChildren(true);
+		mItemContainers.at(n)->setDisplayChildren(true);
 	}
 	mHistoryAccordion->arrange();
 }
@@ -969,7 +969,7 @@ void LLTeleportHistoryPanel::onCollapseAllFolders()
 
 	for (S32 n = 0; n < tabs_cnt; n++)
 	{
-		mItemContainers.get(n)->setDisplayChildren(false);
+		mItemContainers.at(n)->setDisplayChildren(false);
 	}
 	mHistoryAccordion->arrange();
 
@@ -1024,7 +1024,7 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const
 
 	for (S32 n = 0; n < tabs_cnt; n++)
 	{
-		LLAccordionCtrlTab* tab = mItemContainers.get(n);
+		LLAccordionCtrlTab* tab = mItemContainers.at(n);
 		if (!tab->getVisible())
 			continue;
 
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index 47b607a2f46c27e89b6de42607d8edd1dcce8d9d..b88861c5c632cb3cd50da65a5cb11015b55a0ec5 100755
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -112,7 +112,7 @@ class LLTeleportHistoryPanel : public LLPanelPlacesTab
 	bool				mDirty;
 	S32				mCurrentItem;
 
-	typedef LLDynamicArray<LLAccordionCtrlTab*> item_containers_t;
+	typedef std::vector<LLAccordionCtrlTab*> item_containers_t;
 	item_containers_t mItemContainers;
 
 	ContextMenu mContextMenu;
diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h
index 7dedfb05e223b774741b658619e3960164eb036d..bd5b7d799cc7994855649f12bb469bd1536782d9 100755
--- a/indra/newview/llphysicsshapebuilderutil.h
+++ b/indra/newview/llphysicsshapebuilderutil.h
@@ -41,6 +41,8 @@
 #define SHAPE_BUILDER_IMPLICIT_THRESHOLD_TWIST 0.09f
 #define SHAPE_BUILDER_IMPLICIT_THRESHOLD_SHEAR 0.05f
 
+const F32 COLLISION_TOLERANCE = 0.1f;
+
 const F32 SHAPE_BUILDER_ENTRY_SNAP_SCALE_BIN_SIZE = 0.15f;
 const F32 SHAPE_BUILDER_ENTRY_SNAP_PARAMETER_BIN_SIZE = 0.010f;
 const F32 SHAPE_BUILDER_CONVEXIFICATION_SIZE = 2.f * COLLISION_TOLERANCE;
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index 04934b13f107569c6ce9f64e4cffef237998eb73..3675d8694dcc875adf8b7e407067e8afa01aa689 100755
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -25,7 +25,6 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-#include "stdenums.h"
 
 #include "llpreview.h"
 
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index bda603262d0c3f277978463b4d372a72fcd046c0..36877696f52d86794cfd58c9a9d4238e2e5bb54e 100755
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -546,10 +546,10 @@ void LLPreviewGesture::addAnimations()
 	// Copy into something we can sort
 	std::vector<LLInventoryItem*> animations;
 
-	S32 count = items.count();
+	S32 count = items.size();
 	for(i = 0; i < count; ++i)
 	{
-		animations.push_back( items.get(i) );
+		animations.push_back( items.at(i) );
 	}
 
 	// Do the sort
@@ -592,10 +592,10 @@ void LLPreviewGesture::addSounds()
 	std::vector<LLInventoryItem*> sounds;
 
 	S32 i;
-	S32 count = items.count();
+	S32 count = items.size();
 	for(i = 0; i < count; ++i)
 	{
-		sounds.push_back( items.get(i) );
+		sounds.push_back( items.at(i) );
 	}
 
 	// Do the sort
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 516ecedbc868772e61b5556dcce9607d6870c5f1..bfc779c05706f80d0c813a422dbc9793f7adc246 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -1069,15 +1069,15 @@ struct LLEntryAndEdCore
 
 void LLScriptEdCore::deleteBridges()
 {
-	S32 count = mBridges.count();
+	S32 count = mBridges.size();
 	LLEntryAndEdCore* eandc;
 	for(S32 i = 0; i < count; i++)
 	{
-		eandc = mBridges.get(i);
+		eandc = mBridges.at(i);
 		delete eandc;
 		mBridges[i] = NULL;
 	}
-	mBridges.reset();
+	mBridges.clear();
 }
 
 // virtual
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 7563cecd9dba8b979f34e405d660d0a1e5500c95..a799f3c167530a4de8b3b950b4cd9d83001dc206 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -27,7 +27,6 @@
 #ifndef LL_LLPREVIEWSCRIPT_H
 #define LL_LLPREVIEWSCRIPT_H
 
-#include "lldarray.h"
 #include "llpreview.h"
 #include "lltabcontainer.h"
 #include "llinventory.h"
@@ -138,7 +137,7 @@ class LLScriptEdCore : public LLPanel
 	BOOL			mForceClose;
 	LLPanel*		mCodePanel;
 	LLScrollListCtrl* mErrorList;
-	LLDynamicArray<LLEntryAndEdCore*> mBridges;
+	std::vector<LLEntryAndEdCore*> mBridges;
 	LLHandle<LLFloater>	mLiveHelpHandle;
 	LLKeywordToken* mLastHelpToken;
 	LLFrameTimer	mLiveHelpTimer;
diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp
index 0e0da6bdc7221d67d06758a617da707d6ff5da4a..b5edeb4a0e21f89d61a5227551f13da7cb21ee49 100755
--- a/indra/newview/llscriptfloater.cpp
+++ b/indra/newview/llscriptfloater.cpp
@@ -234,7 +234,7 @@ void LLScriptFloater::onMouseDown()
 			// Remove new message icon
 			if (NULL == chicletp)
 			{
-				llerror("Dock chiclet for LLScriptFloater doesn't exist", 0);
+				LL_ERRS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL;
 			}
 			else
 			{
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index b47c2de768ca4130a9273b7c7b6fa45005012850..06ad834f3517e1a057c9fb66153fc43c3ef21f2b 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -104,6 +104,9 @@ const F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f;
 const S32 MAX_ACTION_QUEUE_SIZE = 20;
 const S32 MAX_SILS_PER_FRAME = 50;
 const S32 MAX_OBJECTS_PER_PACKET = 254;
+// For linked sets
+const S32 MAX_CHILDREN_PER_TASK = 255;
+const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 32;
 
 //
 // Globals
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index d4b736640c0947cbb2125d60d584dbe8599d8e08..a68328167a3a2cccd2a2679abe13689ad900da6c 100755
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -56,6 +56,33 @@ class LLColor4;
 class LLVector3;
 class LLSelectNode;
 
+const U8 UPD_NONE      		= 0x00;
+const U8 UPD_POSITION  		= 0x01;
+const U8 UPD_ROTATION  		= 0x02;
+const U8 UPD_SCALE     		= 0x04;
+const U8 UPD_LINKED_SETS 	= 0x08;
+const U8 UPD_UNIFORM 		= 0x10;	// used with UPD_SCALE
+
+// This is used by the DeRezObject message to determine where to put
+// derezed tasks.
+enum EDeRezDestination
+{
+	DRD_SAVE_INTO_AGENT_INVENTORY = 0,
+	DRD_ACQUIRE_TO_AGENT_INVENTORY = 1,		// try to leave copy in world
+	DRD_SAVE_INTO_TASK_INVENTORY = 2,
+	DRD_ATTACHMENT = 3,
+	DRD_TAKE_INTO_AGENT_INVENTORY = 4,		// delete from world
+	DRD_FORCE_TO_GOD_INVENTORY = 5,			// force take copy
+	DRD_TRASH = 6,
+	DRD_ATTACHMENT_TO_INV = 7,
+	DRD_ATTACHMENT_EXISTS = 8,
+	DRD_RETURN_TO_OWNER = 9,				// back to owner's inventory
+	DRD_RETURN_TO_LAST_OWNER = 10,			// deeded object back to last owner's inventory
+
+	DRD_COUNT = 11
+};
+
+
 const S32 SELECT_ALL_TES = -1;
 const S32 SELECT_MAX_TES = 32;
 
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index dacea187c3bb657e15c03b342eeb2f914a1d290e..75e6b4f1a5709c51964b620eb0c4b1c37c61cae6 100755
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -1038,7 +1038,7 @@ void LLLocalSpeakerMgr::updateSpeakerList()
 		if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
 		{
 			LLVOAvatar* avatarp = (LLVOAvatar*)gObjectList.findObject(speaker_id);
-			if (!avatarp || dist_vec_squared(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS_SQUARED)
+			if (!avatarp || dist_vec_squared(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS)
 			{
 				setSpeakerNotInChannel(speakerp);
 			}
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 536c030637f6fbba4ef8143055d0a740e970c9f7..e0b96e43a6e70a214df12b265d99c999ad1a778c 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -82,7 +82,6 @@
 #include "llvfs.h"
 #include "llxorcipher.h"	// saved password, MAC address
 #include "llwindow.h"
-#include "imageids.h"
 #include "message.h"
 #include "v3math.h"
 
@@ -241,6 +240,7 @@ static LLVector3 gAgentStartLookAt(1.0f, 0.f, 0.f);
 static std::string gAgentStartLocation = "safe";
 static bool mLoginStatePastUI = false;
 
+const S32 DEFAULT_MAX_AGENT_GROUPS = 25;
 
 boost::scoped_ptr<LLEventPump> LLStartUp::sStateWatcher(new LLEventStream("StartupState"));
 boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener());
@@ -1431,8 +1431,8 @@ bool idle_startup()
 
 		LL_DEBUGS("AppInit") << "Initializing camera..." << LL_ENDL;
 		gFrameTime    = totalTime();
-		F32 last_time = gFrameTimeSeconds;
-		gFrameTimeSeconds = (S64)(gFrameTime - gStartTime)/SEC_TO_MICROSEC;
+		LLUnit<F32, LLUnits::Seconds> last_time = gFrameTimeSeconds;
+		gFrameTimeSeconds = (gFrameTime - gStartTime);
 
 		gFrameIntervalSeconds = gFrameTimeSeconds - last_time;
 		if (gFrameIntervalSeconds < 0.f)
@@ -1933,6 +1933,7 @@ bool idle_startup()
 
 		LL_DEBUGS("AppInit") << "Initialization complete" << LL_ENDL;
 
+		LL_DEBUGS("SceneLoadTiming", "Start") << "Scene Load Started " << LL_ENDL;
 		gRenderStartTime.reset();
 		gForegroundTime.reset();
 
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index 760e38890b6a74985b11f98ab160ed4bf6c0db5b..e39810713a0945951bc2db4a35226dbabd039219 100755
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -45,6 +45,18 @@ bool login_alert_done(const LLSD& notification, const LLSD& response);
 extern std::string SCREEN_HOME_FILENAME;
 extern std::string SCREEN_LAST_FILENAME;
 
+// start location constants
+enum EStartLocation
+{
+	START_LOCATION_ID_LAST,
+	START_LOCATION_ID_HOME,
+	START_LOCATION_ID_DIRECT,
+	START_LOCATION_ID_PARCEL,
+	START_LOCATION_ID_TELEHUB,
+	START_LOCATION_ID_URL,
+	START_LOCATION_ID_COUNT
+};
+
 typedef enum {
 	STATE_FIRST,					// Initial startup
 	STATE_BROWSER_INIT,             // Initialize web browser for login screen
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index b385d5cdfae25f45378e6fa53799a2b8987d59f2..c1d15947de9304419e67022a8eb206c6698ceb3f 100755
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -72,7 +72,6 @@
 #include "lltrans.h"
 
 // library includes
-#include "imageids.h"
 #include "llfloaterreg.h"
 #include "llfontgl.h"
 #include "llrect.h"
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp
index 93c7f54101372724aea6ef9e381aecca56354d08..88eec487037aeb64589e4636465353a83ee42c4d 100755
--- a/indra/newview/llsurface.cpp
+++ b/indra/newview/llsurface.cpp
@@ -34,7 +34,7 @@
 #include "llpatchvertexarray.h"
 #include "patch_dct.h"
 #include "patch_code.h"
-#include "bitpack.h"
+#include "llbitpack.h"
 #include "llviewerobjectlist.h"
 #include "llregionhandle.h"
 #include "llagent.h"
diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp
index a9ba2bce9c4ef2c8429796f0508b719c8545c5f3..af51f9c7deb46e1fc7aabf1baade2ce72f2622b2 100755
--- a/indra/newview/llsurfacepatch.cpp
+++ b/indra/newview/llsurfacepatch.cpp
@@ -33,7 +33,6 @@
 #include "llsurface.h"
 #include "pipeline.h"
 #include "llagent.h"
-#include "timing.h"
 #include "llsky.h"
 #include "llviewercamera.h"
 
@@ -44,11 +43,11 @@
 #include "noise.h"
 
 extern bool gShiftFrame;
-extern U64 gFrameTime;
+extern LLUnitImplicit<U64, LLUnits::Microseconds> gFrameTime;
 extern LLPipeline gPipeline;
 
-LLSurfacePatch::LLSurfacePatch() :
-	mHasReceivedData(FALSE),
+LLSurfacePatch::LLSurfacePatch() 
+:	mHasReceivedData(FALSE),
 	mSTexUpdate(FALSE),
 	mDirty(FALSE),
 	mDirtyZStats(TRUE),
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 3276b2b9e1385b200c7459968bf692e33f3ba5da..c09fe180f1e718e20101fd43f51911216a0d58c7 100755
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -354,7 +354,7 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
 	}
 
 	handled = TRUE;
-	lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << llendl;
+	LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << llendl;
 
 	return handled;
 }
@@ -666,10 +666,10 @@ const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL co
 							LLInventoryModel::INCLUDE_TRASH,
 							asset_id_matches);
 
-	if (items.count())
+	if (items.size())
 	{
 		// search for copyable version first
-		for (S32 i = 0; i < items.count(); i++)
+		for (S32 i = 0; i < items.size(); i++)
 		{
 			LLInventoryItem* itemp = items[i];
 			LLPermissions item_permissions = itemp->getPermissions();
@@ -1436,7 +1436,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
 	}
 
 	handled = TRUE;
-	lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLTextureCtrl " << getName() << llendl;
+	LL_DEBUGS("UserInput") << "dragAndDrop handled by LLTextureCtrl " << getName() << llendl;
 
 	return handled;
 }
diff --git a/indra/newview/lltoastgroupnotifypanel.h b/indra/newview/lltoastgroupnotifypanel.h
index dfdc6ae55981b4e43fba051de007093176db0b79..431fd32da257b230e77da2503297a5537912f64b 100755
--- a/indra/newview/lltoastgroupnotifypanel.h
+++ b/indra/newview/lltoastgroupnotifypanel.h
@@ -29,7 +29,6 @@
 
 #include "llfontgl.h"
 #include "lltoastpanel.h"
-#include "lldarray.h"
 #include "lltimer.h"
 #include "llviewermessage.h"
 #include "llnotificationptr.h"
diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp
index 2d8ce95347657a412485416dbdfe91a45e46f0a7..f4499f2da81db31158ca406b45f1a8e93a6bfc59 100755
--- a/indra/newview/lltool.cpp
+++ b/indra/newview/lltool.cpp
@@ -103,7 +103,7 @@ BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask)
 BOOL LLTool::handleHover(S32 x, S32 y, MASK mask)
 {
 	gViewerWindow->setCursor(UI_CURSOR_ARROW);
-	lldebugst(LLERR_USER_INPUT) << "hover handled by a tool" << llendl;		
+	LL_DEBUGS("UserInput") << "hover handled by a tool" << llendl;		
 	// by default, do nothing, say we handled it
 	return TRUE;
 }
diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp
index 08d82ea9cbce569070dda56f00ffc441bb1cd342..96b742aebce10e784de2cba0e82fe9574dce1756 100755
--- a/indra/newview/lltoolbrush.cpp
+++ b/indra/newview/lltoolbrush.cpp
@@ -401,7 +401,7 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask)
 
 BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask )
 {
-	lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolBrushLand ("
+	LL_DEBUGS("UserInput") << "hover handled by LLToolBrushLand ("
 								<< (hasMouseCapture() ? "active":"inactive")
 								<< ")" << llendl;
 	mMouseX = x;
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index a4dce9efe8e1980a7de7ed2216691897c8ada71f..ca28397d5209c3b7a0305ad2b129fbc49eb29f1e 100755
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -255,7 +255,7 @@ void LLCategoryDropDescendentsObserver::done()
 			LLInventoryModel::EXCLUDE_TRASH);
 	}
 
-	S32 count = items.count();
+	S32 count = items.size();
 	if (count)
 	{
 		std::set<LLUUID> unique_ids;
@@ -407,16 +407,16 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
 				items,
 				LLInventoryModel::EXCLUDE_TRASH,
 				is_not_preferred);
-			S32 count = cats.count();
+			S32 count = cats.size();
 			S32 i;
 			for(i = 0; i < count; ++i)
 			{
-				folder_ids.push_back(cats.get(i)->getUUID());
+				folder_ids.push_back(cats.at(i)->getUUID());
 			}
-			count = items.count();
+			count = items.size();
 			for(i = 0; i < count; ++i)
 			{
-				item_ids.push_back(items.get(i)->getUUID());
+				item_ids.push_back(items.at(i)->getUUID());
 			}
 			if (!folder_ids.empty() || !item_ids.empty())
 			{
@@ -478,7 +478,7 @@ void LLToolDragAndDrop::beginMultiDrag(
 					items,
 					LLInventoryModel::EXCLUDE_TRASH,
 					is_not_preferred);
-				S32 cat_count = cats.count();
+				S32 cat_count = cats.size();
 				for(S32 i = 0; i < cat_count; ++i)
 				{
 					cat_ids.insert(cat->getUUID());
@@ -597,7 +597,7 @@ BOOL LLToolDragAndDrop::handleHover( S32 x, S32 y, MASK mask )
 	ECursorType cursor = acceptanceToCursor(acceptance);
 	gViewerWindow->getWindow()->setCursor( cursor );
 
-	lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolDragAndDrop" << llendl;
+	LL_DEBUGS("UserInput") << "hover handled by LLToolDragAndDrop" << llendl;
 	return TRUE;
 }
 
@@ -2245,7 +2245,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
 					items,
 					LLInventoryModel::EXCLUDE_TRASH,
 					droppable);
-	cats.put(cat);
+	cats.push_back(cat);
  	if (droppable.countNoCopy() > 0)
  	{
  		llwarns << "*** Need to confirm this step" << llendl;
@@ -2487,7 +2487,7 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand(
 									items,
 									LLInventoryModel::EXCLUDE_TRASH,
 									droppable);
-	if(items.count() > 0)
+	if(items.size() > 0)
 	{
 		rv = ACCEPT_YES_SINGLE;
 	}
@@ -2514,14 +2514,14 @@ EAcceptance LLToolDragAndDrop::dad3dAssetOnLand(
 	LLViewerInventoryItem::item_array_t items;
 	LLViewerInventoryItem::item_array_t copyable_items;
 	locateMultipleInventory(items, cats);
-	if(!items.count()) return ACCEPT_NO;
+	if(!items.size()) return ACCEPT_NO;
 	EAcceptance rv = ACCEPT_NO;
-	for (S32 i = 0; i < items.count(); i++)
+	for (S32 i = 0; i < items.size(); i++)
 	{
 		LLInventoryItem* item = items[i];
 		if(item->getPermissions().allowCopyBy(gAgent.getID()))
 		{
-			copyable_items.put(item);
+			copyable_items.push_back(item);
 			rv = ACCEPT_YES_SINGLE;
 		}
 	}
@@ -2593,21 +2593,21 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
 LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryCategory::cat_array_t& cats,
 															  LLViewerInventoryItem::item_array_t& items)
 {
-	if(mCargoIDs.count() == 0) return NULL;
+	if(mCargoIDs.size() == 0) return NULL;
 	if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
 	{
 		// The object should be in user inventory.
-		for (S32 i = 0; i < mCargoIDs.count(); i++)
+		for (S32 i = 0; i < mCargoIDs.size(); i++)
 		{
 			LLInventoryItem* item = gInventory.getItem(mCargoIDs[i]);
 			if (item)
 			{
-				items.put(item);
+				items.push_back(item);
 			}
 			LLInventoryCategory* category = gInventory.getCategory(mCargoIDs[i]);
 			if (category)
 			{
-				cats.put(category);
+				cats.push_back(category);
 			}
 		}
 	}
@@ -2621,23 +2621,23 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC
 			   || (mCargoType == DAD_ROOT_CATEGORY))
 			{
 				// The object should be in user inventory.
-				for (S32 i = 0; i < mCargoIDs.count(); i++)
+				for (S32 i = 0; i < mCargoIDs.size(); i++)
 				{
 					LLInventoryCategory* category = (LLInventoryCategory*)obj->getInventoryObject(mCargoIDs[i]);
 					if (category)
 					{
-						cats.put(category);
+						cats.push_back(category);
 					}
 				}
 			}
 			else
 			{
-				for (S32 i = 0; i < mCargoIDs.count(); i++)
+				for (S32 i = 0; i < mCargoIDs.size(); i++)
 				{
 					LLInventoryItem* item = (LLInventoryItem*)obj->getInventoryObject(mCargoIDs[i]);
 					if (item)
 					{
-						items.put(item);
+						items.push_back(item);
 					}
 				}
 			}
@@ -2649,11 +2649,11 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC
 		card = (LLPreviewNotecard*)LLPreview::find(mSourceID);
 		if(card)
 		{
-			items.put((LLInventoryItem*)card->getDragItem());
+			items.push_back((LLInventoryItem*)card->getDragItem());
 		}
 	}
-	if(items.count()) return items[0];
-	if(cats.count()) return cats[0];
+	if(items.size()) return items[0];
+	if(cats.size()) return cats[0];
 	return NULL;
 }
 */
diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h
index f17300a76ab25d238ca43702260dc4d20635acc1..99b794ce582af8e8e7ccd3e6eaa453d9fc458a16 100755
--- a/indra/newview/lltooldraganddrop.h
+++ b/indra/newview/lltooldraganddrop.h
@@ -31,9 +31,7 @@
 #include "lltool.h"
 #include "llview.h"
 #include "lluuid.h"
-#include "stdenums.h"
 #include "llassetstorage.h"
-#include "lldarray.h"
 #include "llpermissions.h"
 #include "llwindow.h"
 #include "llviewerinventory.h"
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index 857b0f07146555cb123c854d1008be66fa950650..a320d37084cfdafa2484a5c8f77b27b96c2819d2 100755
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -334,7 +334,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
 	{
 		if (!mValidClickPoint)
 		{
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolFocus [invalid point]" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [invalid point]" << llendl;
 			gViewerWindow->setCursor(UI_CURSOR_NO);
 			gViewerWindow->showCursor();
 			return TRUE;
@@ -361,7 +361,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
 
 				gViewerWindow->moveCursorToCenter();
 			}
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolFocus [active]" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [active]" << llendl;
 		}
 		else if (	gCameraBtnPan ||
 					mask == MASK_PAN ||
@@ -389,7 +389,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
 
 				gViewerWindow->moveCursorToCenter();
 			}
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPan" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLToolPan" << llendl;
 		}
 		else if (gCameraBtnZoom)
 		{
@@ -421,7 +421,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
 				gViewerWindow->moveCursorToCenter();
 			}
 
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolZoom" << llendl;		
+			LL_DEBUGS("UserInput") << "hover handled by LLToolZoom" << llendl;		
 		}
 	}
 
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index 9907da0f0e7396604beb71b2d3d7eb08608bf0d2..a9216568c2872b87d4a784ae6f1712e05647a0a3 100755
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -707,7 +707,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
 	// HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover.  This is actually a no-op since the cursor is hidden.
 	gViewerWindow->setCursor(UI_CURSOR_ARROW);  
 
-	lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (active) [cursor hidden]" << llendl;		
+	LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (active) [cursor hidden]" << llendl;		
 }
  
 
@@ -871,7 +871,7 @@ void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
 void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask)
 {
 	// JC - TODO - change cursor based on gGrabBtnVertical, gGrabBtnSpin
-	lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (inactive-not over editable object)" << llendl;		
+	LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (inactive-not over editable object)" << llendl;		
 	gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
 }
 
@@ -881,7 +881,7 @@ void LLToolGrab::handleHoverFailed(S32 x, S32 y, MASK mask)
 	if( GRAB_NOOBJECT == mMode )
 	{
 		gViewerWindow->setCursor(UI_CURSOR_NO);
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (not on object)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (not on object)" << llendl;		
 	}
 	else
 	{
@@ -894,13 +894,13 @@ void LLToolGrab::handleHoverFailed(S32 x, S32 y, MASK mask)
 			{
 			case GRAB_LOCKED:
 				gViewerWindow->setCursor(UI_CURSOR_GRABLOCKED);
-				lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (grab failed, no move permission)" << llendl;		
+				LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed, no move permission)" << llendl;		
 				break;
 
 //  Non physical now handled by handleHoverActive - CRO				
 //			case GRAB_NONPHYSICAL:
 //				gViewerWindow->setCursor(UI_CURSOR_ARROW);
-//				lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (grab failed, nonphysical)" << llendl;		
+//				LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed, nonphysical)" << llendl;		
 //				break;
 			default:
 				llassert(0);
@@ -909,7 +909,7 @@ void LLToolGrab::handleHoverFailed(S32 x, S32 y, MASK mask)
 		else
 		{
 			gViewerWindow->setCursor(UI_CURSOR_ARROW);
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (grab failed but within slop)" << llendl;		
+			LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed but within slop)" << llendl;		
 		}
 	}
 }
diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp
index c1735adc9c799ceb941ad88065c6e1d17f116df9..17795af65da8a89f104c30c531ec59f1fdcae296 100755
--- a/indra/newview/lltoolgun.cpp
+++ b/indra/newview/lltoolgun.cpp
@@ -116,11 +116,11 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask)
 			gViewerWindow->hideCursor();
 		}
 
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGun (mouselook)" << llendl;
+		LL_DEBUGS("UserInput") << "hover handled by LLToolGun (mouselook)" << llendl;
 	}
 	else
 	{
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGun (not mouselook)" << llendl;
+		LL_DEBUGS("UserInput") << "hover handled by LLToolGun (not mouselook)" << llendl;
 	}
 
 	// HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover.  This is actually a no-op since the cursor is hidden.
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index c912d81a0388ae41d80258e8e9141013a904d8d1..fe520b26dfee8f97b28be99d6389c6fe145b0e70 100755
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -558,7 +558,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
 		// could disable it here.
 		show_highlight = true;
 		// cursor set by media object
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
+		LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << llendl;
 	}
 	else if (!mMouseOutsideSlop 
 		&& mMouseButtonDown 
@@ -595,7 +595,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
 			show_highlight = true;
 			ECursorType cursor = cursorFromObject(click_action_object);
 			gViewerWindow->setCursor(cursor);
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << llendl;
 		}
 		
 		else if ((object && !object->isAvatar() && object->flagUsePhysics()) 
@@ -603,19 +603,19 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
 		{
 			show_highlight = true;
 			gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << llendl;
 		}
 		else if ( (object && object->flagHandleTouch()) 
 				  || (parent && parent->flagHandleTouch()))
 		{
 			show_highlight = true;
 			gViewerWindow->setCursor(UI_CURSOR_HAND);
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << llendl;
 		}
 		else
 		{
 			gViewerWindow->setCursor(UI_CURSOR_ARROW);
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << llendl;
 		}
 	}
 
diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp
index b7718847ae59b4c5b74dbbbe22f2981c09fecd47..3b1b40a7f0cabb3b8449a0563eec14da6a665796 100755
--- a/indra/newview/lltoolplacer.cpp
+++ b/indra/newview/lltoolplacer.cpp
@@ -518,7 +518,7 @@ BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask)
 
 BOOL LLToolPlacer::handleHover(S32 x, S32 y, MASK mask)
 {
-	lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPlacer" << llendl;		
+	LL_DEBUGS("UserInput") << "hover handled by LLToolPlacer" << llendl;		
 	gViewerWindow->setCursor(UI_CURSOR_TOOLCREATE);
 	return TRUE;
 }
diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp
index a48388c591533de82b9a9aaabb348cb4c3b249ec..d44ac53db069b953816d9b38350abb48b34719cd 100755
--- a/indra/newview/lltoolselectland.cpp
+++ b/indra/newview/lltoolselectland.cpp
@@ -168,13 +168,13 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask)
 				roundXY(mWestSouthBottom);
 				roundXY(mEastNorthTop);
 
-				lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, land)" << llendl;
+				LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, land)" << llendl;
 				gViewerWindow->setCursor(UI_CURSOR_ARROW);
 			}
 			else
 			{
 				mDragEndValid = FALSE;
-				lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, no land)" << llendl;
+				LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, no land)" << llendl;
 				gViewerWindow->setCursor(UI_CURSOR_NO);
 			}
 
@@ -183,13 +183,13 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask)
 		}
 		else
 		{
-			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, in slop)" << llendl;
+			LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, in slop)" << llendl;
 			gViewerWindow->setCursor(UI_CURSOR_ARROW);
 		}
 	}
 	else
 	{
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (inactive)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (inactive)" << llendl;		
 		gViewerWindow->setCursor(UI_CURSOR_ARROW);
 	}
 
diff --git a/indra/newview/lltoolselectrect.cpp b/indra/newview/lltoolselectrect.cpp
index a3f4e5a18cfdd17c864f3a7aee5aef6e8b23d241..271a417fb90ecbd0f17cf0ca39b008167fe54ab2 100755
--- a/indra/newview/lltoolselectrect.cpp
+++ b/indra/newview/lltoolselectrect.cpp
@@ -32,7 +32,6 @@
 // Library includes
 #include "llgl.h"
 #include "llrender.h"
-#include "lldarray.h"
 
 // Viewer includes
 #include "llviewercontrol.h"
@@ -145,11 +144,11 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask)
 			return LLToolSelect::handleHover(x, y, mask);
 		}
 
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectRect (active)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (active)" << llendl;		
 	}
 	else
 	{
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectRect (inactive)" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (inactive)" << llendl;		
 	}
 
 	gViewerWindow->setCursor(UI_CURSOR_ARROW);
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index cbd16e873d639eba98fd422d44cd69881ae27e31..34cbd25fd879539eaf97df4f39fe82fd4613d911 100755
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -28,7 +28,6 @@
 
 // library includes
 #include "llcoord.h"
-#include "lldarray.h"
 #include "llfontgl.h"
 #include "llgl.h"
 #include "llrender.h"
diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h
index 8e916af31580582017c4771049cfea962c495ffc..e62a7d8407008ee96d187c0e856474fe3383a189 100755
--- a/indra/newview/lltracker.h
+++ b/indra/newview/lltracker.h
@@ -33,7 +33,6 @@
 #ifndef LL_LLTRACKER_H
 #define LL_LLTRACKER_H
 
-#include "lldarray.h"
 #include "llpointer.h"
 #include "llstring.h"
 #include "lluuid.h"
@@ -138,8 +137,8 @@ class LLTracker
 	std::string				mTrackedLandmarkName;
 	LLUUID					mTrackedLandmarkAssetID;
 	LLUUID					mTrackedLandmarkItemID;
-	LLDynamicArray<LLUUID>	mLandmarkAssetIDList;
-	LLDynamicArray<LLUUID>	mLandmarkItemIDList;
+	std::vector<LLUUID>	mLandmarkAssetIDList;
+	std::vector<LLUUID>	mLandmarkItemIDList;
 	BOOL					mHasReachedLandmark;
 	BOOL 					mHasLandmarkPosition;
 	BOOL					mLandmarkHasBeenVisited;
diff --git a/indra/newview/llviewerassettype.h b/indra/newview/llviewerassettype.h
index ec8b8229175a6e0d048f3be32c0d58dce3565ba5..9ad8ea7eebd589681d19fcfca335b1f79be8c524 100755
--- a/indra/newview/llviewerassettype.h
+++ b/indra/newview/llviewerassettype.h
@@ -29,6 +29,7 @@
 
 #include <string>
 #include "llassettype.h"
+#include "llui.h" //EDragAndDropType
 
 // This class is similar to llassettype, but contains methods
 // only used by the viewer.
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 78a0ed3ffa66fb3e7f51571cde25098baaa80c58..557403b914f3f4decd13a9f8ae5c4a5c16c30064 100755
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -98,6 +98,11 @@ BOOL gWindowResized = FALSE;
 BOOL gSnapshot = FALSE;
 BOOL gShaderProfileFrame = FALSE;
 
+// This is how long the sim will try to teleport you before giving up.
+const F32 TELEPORT_EXPIRY = 15.0f;
+// Additional time (in seconds) to wait per attachment
+const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f;
+
 U32 gRecentFrameCount = 0; // number of 'recent' frames
 LLFrameTimer gRecentFPSTime;
 LLFrameTimer gRecentMemoryTime;
diff --git a/indra/newview/llviewergesture.h b/indra/newview/llviewergesture.h
index 8dba10226bb7f1907eec2c38e830a4ec799d355c..8b621850eadbfe1d79b7e00210965e9ce7740db5 100755
--- a/indra/newview/llviewergesture.h
+++ b/indra/newview/llviewergesture.h
@@ -30,7 +30,6 @@
 #include "llanimationstates.h"
 #include "lluuid.h"
 #include "llstring.h"
-#include "lldarray.h"
 #include "llgesture.h"
 
 class LLMessageSystem;
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index ab19a12014f7948484c0c5f298facc4f2e28352f..a10eda947d823e55199db451e16859bf31012329 100755
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -49,7 +49,7 @@ class LLViewerInventoryCategory;
 class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::trackable
 {
 public:
-	typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
+	typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
 	
 protected:
 	~LLViewerInventoryItem( void ); // ref counted
@@ -181,7 +181,7 @@ class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::tr
 class LLViewerInventoryCategory  : public LLInventoryCategory
 {
 public:
-	typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;
+	typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
 	
 protected:
 	~LLViewerInventoryCategory();
diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp
index 3a04bbed4f9d0209113b0ce3adb2a04cc40e00a3..0e99e161c4a9a82d408b5bd479f01a40ee3dd06a 100755
--- a/indra/newview/llviewerjointattachment.cpp
+++ b/indra/newview/llviewerjointattachment.cpp
@@ -28,7 +28,6 @@
 
 #include "llviewerjointattachment.h"
 
-#include "llagentconstants.h"
 #include "llviewercontrol.h"
 #include "lldrawable.h"
 #include "llgl.h"
@@ -46,6 +45,7 @@
 #include "llglheaders.h"
 
 extern LLPipeline gPipeline;
+const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters?
 
 //-----------------------------------------------------------------------------
 // LLViewerJointAttachment()
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 64454a03d1a7e4b5bb92617eb60b0e69a054859c..6cf39d319bf49ae5ba515cfee5be55bad2b38bc9 100755
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -29,7 +29,6 @@
 //-----------------------------------------------------------------------------
 #include "llviewerprecompiledheaders.h"
 
-#include "imageids.h"
 #include "llfasttimer.h"
 #include "llrender.h"
 
@@ -116,7 +115,7 @@ void LLViewerJointMesh::uploadJointMatrices()
 	BOOL hardware_skinning = (poolp && poolp->getVertexShaderLevel() > 0) ? TRUE : FALSE;
 
 	//calculate joint matrices
-	for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++)
+	for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
 	{
 		LLMatrix4 joint_mat = *reference_mesh->mJointRenderData[joint_num]->mWorldMatrix;
 
@@ -132,7 +131,7 @@ void LLViewerJointMesh::uploadJointMatrices()
 	S32 j = 0;
 
 	//upload joint pivots
-	for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++)
+	for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
 	{
 		LLSkinJoint *sj = reference_mesh->mJointRenderData[joint_num]->mSkinJoint;
 		if (sj)
@@ -172,7 +171,7 @@ void LLViewerJointMesh::uploadJointMatrices()
 		GLfloat mat[45*4];
 		memset(mat, 0, sizeof(GLfloat)*45*4);
 
-		for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++)
+		for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++)
 		{
 			gJointMatUnaligned[joint_num].transpose();
 
@@ -193,7 +192,7 @@ void LLViewerJointMesh::uploadJointMatrices()
 	else
 	{
 		//load gJointMatUnaligned into gJointMatAligned
-		for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); ++joint_num)
+		for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); ++joint_num)
 		{
 			gJointMatAligned[joint_num].loadu(gJointMatUnaligned[joint_num]);
 		}
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index 49ac2735ca8c99f9ebb54d6e358e260249eb4414..e05df2389ee1d370989360a9ccda5b20d4abf0a7 100755
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -676,7 +676,7 @@ BOOL LLViewerKeyboard::handleKey(KEY translated_key,  MASK translated_mask, BOOL
 		return FALSE;
 	}
 
-	lldebugst(LLERR_USER_INPUT) << "keydown -" << translated_key << "-" << llendl;
+	LL_DEBUGS("UserInput") << "keydown -" << translated_key << "-" << llendl;
 	// skip skipped keys
 	if(mKeysSkippedByUI.find(translated_key) != mKeysSkippedByUI.end()) 
 	{
@@ -729,7 +729,7 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c
 
 	if (!function)
 	{
-		llerrs << "Can't bind key to function " << function_name << ", no function with this name found" << llendl;
+		LL_ERRS() << "Can't bind key to function " << function_name << ", no function with this name found" << LL_ENDL;
 		return FALSE;
 	}
 
@@ -742,13 +742,13 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c
 
 	if (index >= MAX_KEY_BINDINGS)
 	{
-		llerrs << "LLKeyboard::bindKey() - too many keys for mode " << mode << llendl;
+		LL_ERRS() << "LLKeyboard::bindKey() - too many keys for mode " << mode << LL_ENDL;
 		return FALSE;
 	}
 
 	if (mode >= MODE_COUNT)
 	{
-		llerror("LLKeyboard::bindKey() - unknown mode passed", mode);
+		LL_ERRS() << "LLKeyboard::bindKey() - unknown mode passed" << mode << LL_ENDL;
 		return FALSE;
 	}
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 9f67aad2975c890a6eb17f3141d05cf92e0d26d9..427fd89afb6dc978402703b2e43eca8baec89a3c 100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -123,6 +123,7 @@
 #include "lltoolgrab.h"
 #include "llwindow.h"
 #include "llpathfindingmanager.h"
+#include "llstartup.h"
 #include "boost/unordered_map.hpp"
 
 using namespace LLAvatarAppearanceDefines;
@@ -4159,13 +4160,16 @@ static bool get_derezzable_objects(
 	EDeRezDestination dest,
 	std::string& error,
 	LLViewerRegion*& first_region,
-	LLDynamicArray<LLViewerObjectPtr>* derez_objectsp,
+	std::vector<LLViewerObjectPtr>* derez_objectsp,
 	bool only_check = false)
 {
 	bool found = false;
 
 	LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
-	
+
+	if (derez_objectsp)
+		derez_objectsp->reserve(selection->getRootObjectCount());
+
 	// Check conditions that we can't deal with, building a list of
 	// everything that we'll actually be derezzing.
 	for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin();
@@ -4244,7 +4248,7 @@ static bool get_derezzable_objects(
 				break;
 
 			if (derez_objectsp)
-				derez_objectsp->put(object);
+				derez_objectsp->push_back(object);
 
 		}
 	}
@@ -4264,9 +4268,9 @@ static void derez_objects(
 	const LLUUID& dest_id,
 	LLViewerRegion*& first_region,
 	std::string& error,
-	LLDynamicArray<LLViewerObjectPtr>* objectsp)
+	std::vector<LLViewerObjectPtr>* objectsp)
 {
-	LLDynamicArray<LLViewerObjectPtr> derez_objects;
+	std::vector<LLViewerObjectPtr> derez_objects;
 
 	if (!objectsp) // if objects to derez not specified
 	{
@@ -4293,13 +4297,13 @@ static void derez_objects(
 	// satisfy anybody.
 	const S32 MAX_ROOTS_PER_PACKET = 250;
 	const S32 MAX_PACKET_COUNT = 254;
-	F32 packets = ceil((F32)objectsp->count() / (F32)MAX_ROOTS_PER_PACKET);
+	F32 packets = ceil((F32)objectsp->size() / (F32)MAX_ROOTS_PER_PACKET);
 	if(packets > (F32)MAX_PACKET_COUNT)
 	{
 		error = "AcquireErrorTooManyObjects";
 	}
 
-	if(error.empty() && objectsp->count() > 0)
+	if(error.empty() && objectsp->size() > 0)
 	{
 		U8 d = (U8)dest;
 		LLUUID tid;
@@ -4324,11 +4328,11 @@ static void derez_objects(
 			msg->addU8Fast(_PREHASH_PacketCount, packet_count);
 			msg->addU8Fast(_PREHASH_PacketNumber, packet_number);
 			objects_in_packet = 0;
-			while((object_index < objectsp->count())
+			while((object_index < objectsp->size())
 				  && (objects_in_packet++ < MAX_ROOTS_PER_PACKET))
 
 			{
-				LLViewerObject* object = objectsp->get(object_index++);
+				LLViewerObject* object = objectsp->at(object_index++);
 				msg->nextBlockFast(_PREHASH_ObjectData);
 				msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
 				// VEFFECT: DerezObject
@@ -4408,7 +4412,7 @@ class LLObjectReturn : public view_listener_t
 
 	LLObjectSelectionHandle mObjectSelection;
 
-	LLDynamicArray<LLViewerObjectPtr> mReturnableObjects;
+	std::vector<LLViewerObjectPtr> mReturnableObjects;
 	std::string mError;
 	LLViewerRegion* mFirstRegion;
 };
@@ -5280,7 +5284,7 @@ class LLObjectsReturnPackage
 	};
 
 	LLObjectSelectionHandle mObjectSelection;
-	LLDynamicArray<LLViewerObjectPtr> mReturnableObjects;
+	std::vector<LLViewerObjectPtr> mReturnableObjects;
 	std::string mError;
 	LLViewerRegion *mFirstRegion;
 };
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 970f6913cbe1993957376f30ab9da1f772557edb..864418ad95ac9ce1781872be5a4856e3cdd00308 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -149,6 +149,11 @@ LLFrameTimer gThrottleTimer;
 const U32 OFFER_THROTTLE_MAX_COUNT=5; //number of items per time period
 const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds
 
+// Agent Update Flags (U8)
+const U8 AU_FLAGS_NONE      		= 0x00;
+const U8 AU_FLAGS_HIDETITLE      	= 0x01;
+const U8 AU_FLAGS_CLIENT_AUTOPILOT	= 0x02;
+
 //script permissions
 const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = 
 	{ 
@@ -665,7 +670,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
 		S32 max_groups = gMaxAgentGroups;
 		if(gAgent.isInGroup(group_id)) ++max_groups;
 
-		if(gAgent.mGroups.count() < max_groups)
+		if(gAgent.mGroups.size() < max_groups)
 		{
 			accept_invite = true;
 		}
@@ -3799,15 +3804,15 @@ class LLFetchInWelcomeArea : public LLInventoryFetchDescendentsObserver
 				is_card);
 		}
 		LLSD args;
-		if ( land_items.count() > 0 )
+		if ( land_items.size() > 0 )
 		{	// Show notification that they can now teleport to landmarks.  Use a random landmark from the inventory
-			S32 random_land = ll_rand( land_items.count() - 1 );
+			S32 random_land = ll_rand( land_items.size() - 1 );
 			args["NAME"] = land_items[random_land]->getName();
 			LLNotificationsUtil::add("TeleportToLandmark",args);
 		}
-		if ( card_items.count() > 0 )
+		if ( card_items.size() > 0 )
 		{	// Show notification that they can now contact people.  Use a random calling card from the inventory
-			S32 random_card = ll_rand( card_items.count() - 1 );
+			S32 random_card = ll_rand( card_items.size() - 1 );
 			args["NAME"] = card_items[random_card]->getName();
 			LLNotificationsUtil::add("TeleportToPerson",args);
 		}
@@ -6803,7 +6808,7 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response)
 
 void handle_lure(const LLUUID& invitee)
 {
-	LLDynamicArray<LLUUID> ids;
+	std::vector<LLUUID> ids;
 	ids.push_back(invitee);
 	handle_lure(ids);
 }
@@ -6819,7 +6824,7 @@ void handle_lure(const uuid_vec_t& ids)
 	edit_args["REGION"] = gAgent.getRegion()->getName();
 
 	LLSD payload;
-	for (LLDynamicArray<LLUUID>::const_iterator it = ids.begin();
+	for (std::vector<LLUUID>::const_iterator it = ids.begin();
 		it != ids.end();
 		++it)
 	{
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index 3237f3fbdddca44e8b90c301592aa2cfba8eee67..d8f5c71f8d3bfff2a6b7c30e43832d939a81215d 100755
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -33,7 +33,6 @@
 #include "lltransactiontypes.h"
 #include "lluuid.h"
 #include "message.h"
-#include "stdenums.h"
 #include "llnotifications.h"
 #include "llextendedstatus.h"
 
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index e834febad52e8b046fbef7454f07a7445311c8ca..51328dc80216c63c04011b6c58f408ab73929bc0 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -29,7 +29,6 @@
 #include "llviewerobject.h"
 
 #include "llaudioengine.h"
-#include "imageids.h"
 #include "indra_constants.h"
 #include "llmath.h"
 #include "llflexibleobject.h"
@@ -53,7 +52,6 @@
 #include "llxfermanager.h"
 #include "message.h"
 #include "object_flags.h"
-#include "timing.h"
 
 #include "llaudiosourcevo.h"
 #include "llagent.h"
@@ -126,6 +124,15 @@ F64			LLViewerObject::sPhaseOutUpdateInterpolationTime = 2.0;	// For motion inte
 
 std::map<std::string, U32> LLViewerObject::sObjectDataMap;
 
+// The maximum size of an object extra parameters binary (packed) block
+#define MAX_OBJECT_PARAMS_SIZE 1024
+
+// At 45 Hz collisions seem stable and objects seem
+// to settle down at a reasonable rate.
+// JC 3/18/2003
+
+const F32 PHYSICS_TIMESTEP = 1.f / 45.f;
+
 static LLFastTimer::DeclareTimer FTM_CREATE_OBJECT("Create Object");
 
 // static
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 8299c846638de1f9832eafb8d2f3db81d412f3b1..4072ab524e0a27f2ca44b22baf850290763d95f9 100755
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -29,7 +29,6 @@
 #include "llviewerobjectlist.h"
 
 #include "message.h"
-#include "timing.h"
 #include "llfasttimer.h"
 #include "llrender.h"
 #include "llwindow.h"		// decBusyCount()
@@ -997,14 +996,14 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 
 	// update global timer
 	F32 last_time = gFrameTimeSeconds;
-	U64 time = totalTime();				 // this will become the new gFrameTime when the update is done
+	LLUnit<U64, LLUnits::Microseconds> time = totalTime();				 // this will become the new gFrameTime when the update is done
 	// Time _can_ go backwards, for example if the user changes the system clock.
 	// It doesn't cause any fatal problems (just some oddness with stats), so we shouldn't assert here.
 //	llassert(time > gFrameTime);
-	F64 time_diff = U64_to_F64(time - gFrameTime)/(F64)SEC_TO_MICROSEC;
+	LLUnit<F64, LLUnits::Seconds> time_diff = time - gFrameTime;
 	gFrameTime	= time;
-	F64 time_since_start = U64_to_F64(gFrameTime - gStartTime)/(F64)SEC_TO_MICROSEC;
-	gFrameTimeSeconds = (F32)time_since_start;
+	LLUnit<F64, LLUnits::Seconds> time_since_start = gFrameTime - gStartTime;
+	gFrameTimeSeconds = time_since_start;
 
 	gFrameIntervalSeconds = gFrameTimeSeconds - last_time;
 	if (gFrameIntervalSeconds < 0.f)
@@ -1102,7 +1101,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	/*
 	// Debugging code for viewing orphans, and orphaned parents
 	LLUUID id;
-	for (i = 0; i < mOrphanParents.count(); i++)
+	for (i = 0; i < mOrphanParents.size(); i++)
 	{
 		id = sIndexAndLocalIDToUUID[mOrphanParents[i]];
 		LLViewerObject *objectp = findObject(id);
@@ -1119,7 +1118,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	}
 
 	LLColor4 text_color;
-	for (i = 0; i < mOrphanChildren.count(); i++)
+	for (i = 0; i < mOrphanChildren.size(); i++)
 	{
 		OrphanInfo oi = mOrphanChildren[i];
 		LLViewerObject *objectp = findObject(oi.mChildInfo);
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 4cdb568d17de14beabfd8355f6294ee9b77f66fc..b25d042d28391b56da823f2cc02234f599ef5b37 100755
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -36,7 +36,6 @@
 #include "llnotifications.h"
 #include "llnotificationsutil.h"
 #include "llparcel.h"
-#include "llsecondlifeurls.h"
 #include "message.h"
 #include "llfloaterreg.h"
 
@@ -591,13 +590,13 @@ void LLViewerParcelMgr::deselectLand()
 
 void LLViewerParcelMgr::addObserver(LLParcelObserver* observer)
 {
-	mObservers.put(observer);
+	mObservers.push_back(observer);
 }
 
 
 void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer)
 {
-	mObservers.removeObj(observer);
+	vector_replace_with_last(mObservers, observer);
 }
 
 
@@ -606,16 +605,16 @@ void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer)
 // from the list.
 void LLViewerParcelMgr::notifyObservers()
 {
-	LLDynamicArray<LLParcelObserver*> observers;
-	S32 count = mObservers.count();
+	std::vector<LLParcelObserver*> observers;
+	S32 count = mObservers.size();
 	S32 i;
 	for(i = 0; i < count; ++i)
 	{
-		observers.put(mObservers.get(i));
+		observers.push_back(mObservers.at(i));
 	}
 	for(i = 0; i < count; ++i)
 	{
-		observers.get(i)->changed();
+		observers.at(i)->changed();
 	}
 }
 
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index 6183b7e90ecbe3177af114e828a91b332f53902d..e2c8dc0ff287a9528106030d0c0b127b7eb41b6a 100755
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -28,7 +28,6 @@
 #define LL_LLVIEWERPARCELMGR_H
 
 #include "v3dmath.h"
-#include "lldarray.h"
 #include "llframetimer.h"
 #include "llsingleton.h"
 #include "llparcelselection.h"
@@ -334,7 +333,7 @@ class LLViewerParcelMgr : public LLSingleton<LLViewerParcelMgr>
 	LLVector3d					mHoverWestSouth;
 	LLVector3d					mHoverEastNorth;
 
-	LLDynamicArray<LLParcelObserver*> mObservers;
+	std::vector<LLParcelObserver*> mObservers;
 
 	BOOL						mTeleportInProgress;
 	teleport_finished_signal_t	mTeleportFinishedSignal;
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index a1c12c5cd6ead81bfc950b2fc4ff811ffd13933d..e29eef2dda529dba08c0823078a843597f0ead58 100755
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -432,9 +432,12 @@ void LLViewerParcelOverlay::updatePropertyLines()
 	const LLColor4U auction_coloru = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
 
 	// Build into dynamic arrays, then copy into static arrays.
-	LLDynamicArray<LLVector3, 256> new_vertex_array;
-	LLDynamicArray<LLColor4U, 256> new_color_array;
-	LLDynamicArray<LLVector2, 256> new_coord_array;
+	std::vector<LLVector3> new_vertex_array;
+	new_vertex_array.reserve(256);
+	std::vector<LLColor4U> new_color_array;
+	new_color_array.reserve(256);
+	std::vector<LLVector2> new_coord_array;
+	new_coord_array.reserve(256);
 
 	U8 overlay = 0;
 	BOOL add_edge = FALSE;
@@ -599,7 +602,7 @@ void LLViewerParcelOverlay::updatePropertyLines()
 	// Now copy into static arrays for faster rendering.
 	// Attempt to recycle old arrays if possible to avoid memory
 	// shuffling.
-	S32 new_vertex_count = new_vertex_array.count();
+	S32 new_vertex_count = new_vertex_array.size();
 	
 	if (!(mVertexArray && mColorArray && new_vertex_count == mVertexCount))
 	{
@@ -623,7 +626,7 @@ void LLViewerParcelOverlay::updatePropertyLines()
 	F32* vertex = mVertexArray;
 	for (i = 0; i < mVertexCount; i++)
 	{
-		const LLVector3& point = new_vertex_array.get(i);
+		const LLVector3& point = new_vertex_array.at(i);
 		*vertex = point.mV[VX];
 		vertex++;
 		*vertex = point.mV[VY];
@@ -635,7 +638,7 @@ void LLViewerParcelOverlay::updatePropertyLines()
 	U8* colorp = mColorArray;
 	for (i = 0; i < mVertexCount; i++)
 	{
-		const LLColor4U& color = new_color_array.get(i);
+		const LLColor4U& color = new_color_array.at(i);
 		*colorp = color.mV[VRED];
 		colorp++;
 		*colorp = color.mV[VGREEN];
@@ -652,9 +655,9 @@ void LLViewerParcelOverlay::updatePropertyLines()
 
 
 void LLViewerParcelOverlay::addPropertyLine(
-				LLDynamicArray<LLVector3, 256>& vertex_array,
-				LLDynamicArray<LLColor4U, 256>& color_array,
-				LLDynamicArray<LLVector2, 256>& coord_array,
+				std::vector<LLVector3>& vertex_array,
+				std::vector<LLColor4U>& color_array,
+				std::vector<LLVector2>& coord_array,
 				const F32 start_x, const F32 start_y, 
 				const U32 edge,
 				const LLColor4U& color)
@@ -662,6 +665,10 @@ void LLViewerParcelOverlay::addPropertyLine(
 	LLColor4U underwater( color );
 	underwater.mV[VALPHA] /= 2;
 
+	vertex_array.reserve(16);
+	color_array.reserve(16);
+	coord_array.reserve(16);
+
 	LLSurface& land = mRegion->getLand();
 
 	F32 dx;
@@ -716,11 +723,11 @@ void LLViewerParcelOverlay::addPropertyLine(
 	// First part, only one vertex
 	outside_z = land.resolveHeightRegion( outside_x, outside_y );
 
-	if (outside_z > 20.f) color_array.put( color );
-	else color_array.put( underwater );
+	if (outside_z > 20.f) color_array.push_back( color );
+	else color_array.push_back( underwater );
 
-	vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );
-	coord_array.put(  LLVector2(outside_x - start_x, 0.f) );
+	vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
+	coord_array.push_back(  LLVector2(outside_x - start_x, 0.f) );
 
 	inside_x += dx * LINE_WIDTH;
 	inside_y += dy * LINE_WIDTH;
@@ -732,17 +739,17 @@ void LLViewerParcelOverlay::addPropertyLine(
 	inside_z = land.resolveHeightRegion( inside_x, inside_y );
 	outside_z = land.resolveHeightRegion( outside_x, outside_y );
 
-	if (inside_z > 20.f) color_array.put( color );
-	else color_array.put( underwater );
+	if (inside_z > 20.f) color_array.push_back( color );
+	else color_array.push_back( underwater );
 
-	if (outside_z > 20.f) color_array.put( color );
-	else color_array.put( underwater );
+	if (outside_z > 20.f) color_array.push_back( color );
+	else color_array.push_back( underwater );
 
-	vertex_array.put( LLVector3(inside_x, inside_y, inside_z) );
-	vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );
+	vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
+	vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
 
-	coord_array.put(  LLVector2(outside_x - start_x, 1.f) );
-	coord_array.put(  LLVector2(outside_x - start_x, 0.f) );
+	coord_array.push_back(  LLVector2(outside_x - start_x, 1.f) );
+	coord_array.push_back(  LLVector2(outside_x - start_x, 0.f) );
 
 	inside_x += dx * (dx - LINE_WIDTH);
 	inside_y += dy * (dy - LINE_WIDTH);
@@ -758,17 +765,17 @@ void LLViewerParcelOverlay::addPropertyLine(
 		inside_z = land.resolveHeightRegion( inside_x, inside_y );
 		outside_z = land.resolveHeightRegion( outside_x, outside_y );
 
-		if (inside_z > 20.f) color_array.put( color );
-		else color_array.put( underwater );
+		if (inside_z > 20.f) color_array.push_back( color );
+		else color_array.push_back( underwater );
 
-		if (outside_z > 20.f) color_array.put( color );
-		else color_array.put( underwater );
+		if (outside_z > 20.f) color_array.push_back( color );
+		else color_array.push_back( underwater );
 
-		vertex_array.put( LLVector3(inside_x, inside_y, inside_z) );
-		vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );
+		vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
+		vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
 
-		coord_array.put(  LLVector2(outside_x - start_x, 1.f) );
-		coord_array.put(  LLVector2(outside_x - start_x, 0.f) );
+		coord_array.push_back(  LLVector2(outside_x - start_x, 1.f) );
+		coord_array.push_back(  LLVector2(outside_x - start_x, 0.f) );
 
 		inside_x += dx;
 		inside_y += dy;
@@ -787,17 +794,17 @@ void LLViewerParcelOverlay::addPropertyLine(
 	inside_z = land.resolveHeightRegion( inside_x, inside_y );
 	outside_z = land.resolveHeightRegion( outside_x, outside_y );
 
-	if (inside_z > 20.f) color_array.put( color );
-	else color_array.put( underwater );
+	if (inside_z > 20.f) color_array.push_back( color );
+	else color_array.push_back( underwater );
 
-	if (outside_z > 20.f) color_array.put( color );
-	else color_array.put( underwater );
+	if (outside_z > 20.f) color_array.push_back( color );
+	else color_array.push_back( underwater );
 
-	vertex_array.put( LLVector3(inside_x, inside_y, inside_z) );
-	vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );
+	vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) );
+	vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
 
-	coord_array.put(  LLVector2(outside_x - start_x, 1.f) );
-	coord_array.put(  LLVector2(outside_x - start_x, 0.f) );
+	coord_array.push_back(  LLVector2(outside_x - start_x, 1.f) );
+	coord_array.push_back(  LLVector2(outside_x - start_x, 0.f) );
 
 	inside_x += dx * LINE_WIDTH;
 	inside_y += dy * LINE_WIDTH;
@@ -808,11 +815,11 @@ void LLViewerParcelOverlay::addPropertyLine(
 	// Last edge is not drawn to the edge
 	outside_z = land.resolveHeightRegion( outside_x, outside_y );
 
-	if (outside_z > 20.f) color_array.put( color );
-	else color_array.put( underwater );
+	if (outside_z > 20.f) color_array.push_back( color );
+	else color_array.push_back( underwater );
 
-	vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );
-	coord_array.put(  LLVector2(outside_x - start_x, 0.f) );
+	vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) );
+	coord_array.push_back(  LLVector2(outside_x - start_x, 0.f) );
 }
 
 
diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h
index 7445d5bf1ddbb50ca28ed6c001b13c8880bc194a..14a2af5354764a3fd6cdaf08e0e88710e65f4f08 100755
--- a/indra/newview/llviewerparceloverlay.h
+++ b/indra/newview/llviewerparceloverlay.h
@@ -31,7 +31,6 @@
 // One of these structures per region.
 
 #include "llbbox.h"
-#include "lldarray.h"
 #include "llframetimer.h"
 #include "lluuid.h"
 #include "llviewertexture.h"
@@ -88,9 +87,9 @@ class LLViewerParcelOverlay : public LLGLUpdate
 	U8		ownership(S32 row, S32 col) const	
 				{ return 0x7 & mOwnership[row * mParcelGridsPerEdge + col]; }
 
-	void	addPropertyLine(LLDynamicArray<LLVector3, 256>& vertex_array,
-				LLDynamicArray<LLColor4U, 256>& color_array,
-				LLDynamicArray<LLVector2, 256>& coord_array,
+	void	addPropertyLine(std::vector<LLVector3>& vertex_array,
+				std::vector<LLColor4U>& color_array,
+				std::vector<LLVector2>& coord_array,
 				const F32 start_x, const F32 start_y, 
 				const U32 edge, 
 				const LLColor4U& color);
diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h
index 5df456dab6629655876b92e599b1550d4a11cd02..999d9092bd29944b97ff97d89cc58cd8211fb4f3 100755
--- a/indra/newview/llviewerprecompiledheaders.h
+++ b/indra/newview/llviewerprecompiledheaders.h
@@ -51,8 +51,6 @@
 #endif
 
 // Library headers from llcommon project:
-#include "bitpack.h"
-#include "imageids.h"
 #include "indra_constants.h"
 #include "llinitparam.h"
 #include "llallocator.h"
@@ -74,9 +72,7 @@
 #include "llstring.h"
 #include "llsys.h"
 #include "lltimer.h"
-#include "stdenums.h"
 #include "stdtypes.h"
-#include "timing.h"
 #include "u64.h"
 
 // Library includes from llmath project
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index b80d87ef075d31ba87a08ffbdd76b644d0fe605e..d4de33cc38b055d8400b20a5a14ee595785a568c 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -85,6 +85,7 @@ const S32 MAX_SEED_CAP_ATTEMPTS_BEFORE_LOGIN = 3;
 const F32 CAP_REQUEST_TIMEOUT = 18;
 // Even though we gave up on login, keep trying for caps after we are logged in:
 const S32 MAX_CAP_REQUEST_ATTEMPTS = 30;
+const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000;
 
 BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE;
 
@@ -229,7 +230,7 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder
 
     void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content)
     {
-		LL_WARNS2("AppInit", "Capabilities") << "[status:" << statusNum << ":] " << content << LL_ENDL;
+		LL_WARNS("AppInit", "Capabilities") << "[status:" << statusNum << ":] " << content << LL_ENDL;
 		LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle);
 		if (regionp)
 		{
@@ -242,12 +243,12 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder
 		LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle);
 		if(!regionp) //region was removed
 		{
-			LL_WARNS2("AppInit", "Capabilities") << "Received results for region that no longer exists!" << LL_ENDL;
+			LL_WARNS("AppInit", "Capabilities") << "Received results for region that no longer exists!" << LL_ENDL;
 			return ;
 		}
 		if( mID != regionp->getHttpResponderID() ) // region is no longer referring to this responder
 		{
-			LL_WARNS2("AppInit", "Capabilities") << "Received results for a stale http responder!" << LL_ENDL;
+			LL_WARNS("AppInit", "Capabilities") << "Received results for a stale http responder!" << LL_ENDL;
 			return ;
 		}
 
@@ -256,8 +257,7 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder
 		{
 			regionp->setCapability(iter->first, iter->second);
 			
-			LL_DEBUGS2("AppInit", "Capabilities") << "got capability for " 
-				<< iter->first << LL_ENDL;
+			LL_DEBUGS("AppInit", "Capabilities") << "got capability for " << iter->first << LL_ENDL;
 
 			/* HACK we're waiting for the ServerReleaseNotes */
 			if (iter->first == "ServerReleaseNotes" && regionp->getReleaseNotesRequested())
@@ -1616,10 +1616,10 @@ class CoarseLocationUpdate : public LLHTTPNode
 		S32 target_index = input["body"]["Index"][0]["Prey"].asInteger();
 		S32 you_index    = input["body"]["Index"][0]["You" ].asInteger();
 
-		LLDynamicArray<U32>* avatar_locs = &region->mMapAvatars;
-		LLDynamicArray<LLUUID>* avatar_ids = &region->mMapAvatarIDs;
-		avatar_locs->reset();
-		avatar_ids->reset();
+		std::vector<U32>* avatar_locs = &region->mMapAvatars;
+		std::vector<LLUUID>* avatar_ids = &region->mMapAvatarIDs;
+		avatar_locs->clear();
+		avatar_ids->clear();
 
 		//llinfos << "coarse locations agent[0] " << input["body"]["AgentData"][0]["AgentID"].asUUID() << llendl;
 		//llinfos << "my agent id = " << gAgent.getID() << llendl;
@@ -1659,13 +1659,13 @@ class CoarseLocationUpdate : public LLHTTPNode
 				pos |= y;
 				pos <<= 8;
 				pos |= z;
-				avatar_locs->put(pos);
+				avatar_locs->push_back(pos);
 				//llinfos << "next pos: " << x << "," << y << "," << z << ": " << pos << llendl;
 				if(has_agent_data) // for backwards compatibility with old message format
 				{
 					LLUUID agent_id(agents_it->get("AgentID").asUUID());
 					//llinfos << "next agent: " << agent_id.asString() << llendl;
-					avatar_ids->put(agent_id);
+					avatar_ids->push_back(agent_id);
 				}
 			}
 			if (has_agent_data)
@@ -1686,8 +1686,8 @@ LLHTTPRegistration<CoarseLocationUpdate>
 void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg)
 {
 	//llinfos << "CoarseLocationUpdate" << llendl;
-	mMapAvatars.reset();
-	mMapAvatarIDs.reset(); // only matters in a rare case but it's good to be safe.
+	mMapAvatars.clear();
+	mMapAvatarIDs.clear(); // only matters in a rare case but it's good to be safe.
 
 	U8 x_pos = 0;
 	U8 y_pos = 0;
@@ -1736,10 +1736,10 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg)
 			pos |= y_pos;
 			pos <<= 8;
 			pos |= z_pos;
-			mMapAvatars.put(pos);
+			mMapAvatars.push_back(pos);
 			if(has_agent_data)
 			{
-				mMapAvatarIDs.put(agent_id);
+				mMapAvatarIDs.push_back(agent_id);
 			}
 		}
 	}
@@ -2468,7 +2468,7 @@ void LLViewerRegion::failedSeedCapability()
 	std::string url = getCapability("Seed");
 	if ( url.empty() )
 	{
-		LL_WARNS2("AppInit", "Capabilities") << "Failed to get seed capabilities, and can not determine url for retries!" << LL_ENDL;
+		LL_WARNS("AppInit", "Capabilities") << "Failed to get seed capabilities, and can not determine url for retries!" << LL_ENDL;
 		return;
 	}
 	// After a few attempts, continue login.  We will keep trying once in-world:
@@ -2494,7 +2494,7 @@ void LLViewerRegion::failedSeedCapability()
 	else
 	{
 		// *TODO: Give a user pop-up about this error?
-		LL_WARNS2("AppInit", "Capabilities") << "Failed to get seed capabilities from '" << url << "' after " << mImpl->mSeedCapAttempts << " attempts.  Giving up!" << LL_ENDL;
+		LL_WARNS("AppInit", "Capabilities") << "Failed to get seed capabilities from '" << url << "' after " << mImpl->mSeedCapAttempts << " attempts.  Giving up!" << LL_ENDL;
 	}
 }
 
@@ -2510,7 +2510,7 @@ class SimulatorFeaturesReceived : public LLHTTPClient::Responder
 	
     void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content)
     {
-		LL_WARNS2("AppInit", "SimulatorFeatures") << "[status:" << statusNum << "]: " << content << LL_ENDL;
+		LL_WARNS("AppInit", "SimulatorFeatures") << "[status:" << statusNum << "]: " << content << LL_ENDL;
 		retry();
     }
 
@@ -2519,7 +2519,7 @@ class SimulatorFeaturesReceived : public LLHTTPClient::Responder
 		LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle);
 		if(!regionp) //region is removed or responder is not created.
 		{
-			LL_WARNS2("AppInit", "SimulatorFeatures") << "Received results for region that no longer exists!" << LL_ENDL;
+			LL_WARNS("AppInit", "SimulatorFeatures") << "Received results for region that no longer exists!" << LL_ENDL;
 			return ;
 		}
 		
@@ -2532,7 +2532,7 @@ class SimulatorFeaturesReceived : public LLHTTPClient::Responder
 		if (mAttempt < mMaxAttempts)
 		{
 			mAttempt++;
-			LL_WARNS2("AppInit", "SimulatorFeatures") << "Re-trying '" << mRetryURL << "'.  Retry #" << mAttempt << LL_ENDL;
+			LL_WARNS("AppInit", "SimulatorFeatures") << "Re-trying '" << mRetryURL << "'.  Retry #" << mAttempt << LL_ENDL;
 			LLHTTPClient::get(mRetryURL, new SimulatorFeaturesReceived(*this), LLSD(), CAP_REQUEST_TIMEOUT);
 		}
 	}
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 29483662e87b6b8a0ce8cb2de2881cffa334d53c..cc314dc43bc1f566880381f2fba714c908d9f4a0 100755
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -32,7 +32,6 @@
 #include <string>
 #include <boost/signals2.hpp>
 
-#include "lldarray.h"
 #include "llwind.h"
 #include "v3dmath.h"
 #include "llstring.h"
@@ -407,8 +406,8 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface
 	// messaging system in which the previous message only sends and parses the 
 	// positions stored in the first array so they're maintained separately until 
 	// we stop supporting the old CoarseLocationUpdate message.
-	LLDynamicArray<U32> mMapAvatars;
-	LLDynamicArray<LLUUID> mMapAvatarIDs;
+	std::vector<U32> mMapAvatars;
+	std::vector<LLUUID> mMapAvatarIDs;
 
 	static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not.
 private:
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 69a6c00a8fd3e2f8cfdbf18e5f4cec84ac12db1f..94be8e2a83336a9d69061505e207ceee4b04917a 100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -92,6 +92,9 @@ LLTrace::CountStatHandle<>	FPS("FPS", "Frames rendered"),
 LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > 
 							TRIANGLES_DRAWN("trianglesdrawnstat");
 
+LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Kilotriangles> >
+							TRIANGLES_DRAWN_PER_FRAME("trianglesdrawnperframestat");
+
 LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kibibytes> >	
 							ACTIVE_MESSAGE_DATA_RECEIVED("activemessagedatareceived", "Message system data received on all active regions"),
 							LAYERS_NETWORK_DATA_RECEIVED("layersdatareceived", "Network data received for layer data (terrain)"),
@@ -213,38 +216,37 @@ void LLViewerStats::resetStats()
 	LLViewerStats::instance().mRecording.reset();
 }
 
-void LLViewerStats::updateFrameStats(const F64 time_diff)
+void LLViewerStats::updateFrameStats(const LLUnit<F64, LLUnits::Seconds> time_diff)
 {
-	LLUnit<F64, LLUnits::Seconds> time_diff_seconds(time_diff);
 	if (getRecording().getLastValue(LLStatViewer::PACKETS_LOST_PERCENT) > 5.0)
 	{
-		add(LLStatViewer::LOSS_5_PERCENT_TIME, time_diff_seconds);
+		add(LLStatViewer::LOSS_5_PERCENT_TIME, time_diff);
 	}
 	
 	F32 sim_fps = getRecording().getLastValue(LLStatViewer::SIM_FPS);
 	if (0.f < sim_fps && sim_fps < 20.f)
 	{
-		add(LLStatViewer::SIM_20_FPS_TIME, time_diff_seconds);
+		add(LLStatViewer::SIM_20_FPS_TIME, time_diff);
 	}
 	
 	F32 sim_physics_fps = getRecording().getLastValue(LLStatViewer::SIM_PHYSICS_FPS);
 
 	if (0.f < sim_physics_fps && sim_physics_fps < 20.f)
 	{
-		add(LLStatViewer::SIM_PHYSICS_20_FPS_TIME, time_diff_seconds);
+		add(LLStatViewer::SIM_PHYSICS_20_FPS_TIME, time_diff);
 	}
 		
 	if (time_diff >= 0.5)
 	{
-		record(LLStatViewer::FPS_2_TIME, time_diff_seconds);
+		record(LLStatViewer::FPS_2_TIME, time_diff);
 	}
 	if (time_diff >= 0.125)
 	{
-		record(LLStatViewer::FPS_8_TIME, time_diff_seconds);
+		record(LLStatViewer::FPS_8_TIME, time_diff);
 	}
 	if (time_diff >= 0.1)
 	{
-		record(LLStatViewer::FPS_10_TIME, time_diff_seconds);
+		record(LLStatViewer::FPS_10_TIME, time_diff);
 	}
 
 	if (gFrameCount && mLastTimeDiff > 0.0)
@@ -331,6 +333,8 @@ void update_statistics()
 
 	LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording();
 
+	record(LLStatViewer::TRIANGLES_DRAWN_PER_FRAME, last_frame_recording.getSum(LLStatViewer::TRIANGLES_DRAWN));
+
 	sample(LLStatViewer::ENABLE_VBO,      (F64)gSavedSettings.getBOOL("RenderVBOEnable"));
 	sample(LLStatViewer::LIGHTING_DETAIL, (F64)gPipeline.getLightingDetail());
 	sample(LLStatViewer::DRAW_DISTANCE,   (F64)gSavedSettings.getF32("RenderFarClip"));
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index ee1a73de9f46800e38bd4d0833c5a6ff2065d267..9fed558e0314630191a53a05971b1c1804f7c0b3 100755
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -27,11 +27,56 @@
 #ifndef LL_LLVIEWERSTATS_H
 #define LL_LLVIEWERSTATS_H
 
-#include "llstatenums.h"
 #include "lltextureinfo.h"
 #include "lltracerecording.h"
 #include "lltrace.h"
 
+
+enum ESimStatID
+{
+	LL_SIM_STAT_TIME_DILATION         =  0,
+	LL_SIM_STAT_FPS                   =  1,
+	LL_SIM_STAT_PHYSFPS               =  2,
+	LL_SIM_STAT_AGENTUPS              =  3,
+	LL_SIM_STAT_FRAMEMS               =  4,
+	LL_SIM_STAT_NETMS                 =  5,
+	LL_SIM_STAT_SIMOTHERMS            =  6,
+	LL_SIM_STAT_SIMPHYSICSMS          =  7,
+	LL_SIM_STAT_AGENTMS               =  8,
+	LL_SIM_STAT_IMAGESMS              =  9,
+	LL_SIM_STAT_SCRIPTMS              = 10,
+	LL_SIM_STAT_NUMTASKS              = 11,
+	LL_SIM_STAT_NUMTASKSACTIVE        = 12,
+	LL_SIM_STAT_NUMAGENTMAIN          = 13,
+	LL_SIM_STAT_NUMAGENTCHILD         = 14,
+	LL_SIM_STAT_NUMSCRIPTSACTIVE      = 15,
+	LL_SIM_STAT_LSLIPS                = 16,
+	LL_SIM_STAT_INPPS                 = 17,
+	LL_SIM_STAT_OUTPPS                = 18,
+	LL_SIM_STAT_PENDING_DOWNLOADS     = 19,
+	LL_SIM_STAT_PENDING_UPLOADS       = 20,
+	LL_SIM_STAT_VIRTUAL_SIZE_KB       = 21,
+	LL_SIM_STAT_RESIDENT_SIZE_KB      = 22,
+	LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23,
+	LL_SIM_STAT_TOTAL_UNACKED_BYTES   = 24,
+	LL_SIM_STAT_PHYSICS_PINNED_TASKS  = 25,
+	LL_SIM_STAT_PHYSICS_LOD_TASKS     = 26,
+	LL_SIM_STAT_SIMPHYSICSSTEPMS      = 27,
+	LL_SIM_STAT_SIMPHYSICSSHAPEMS     = 28,
+	LL_SIM_STAT_SIMPHYSICSOTHERMS     = 29,
+	LL_SIM_STAT_SIMPHYSICSMEMORY      = 30,
+	LL_SIM_STAT_SCRIPT_EPS            = 31,
+	LL_SIM_STAT_SIMSPARETIME          = 32,
+	LL_SIM_STAT_SIMSLEEPTIME          = 33,
+	LL_SIM_STAT_IOPUMPTIME            = 34,
+	LL_SIM_STAT_PCTSCRIPTSRUN         = 35,
+	LL_SIM_STAT_REGION_IDLE           = 36, // dataserver only
+	LL_SIM_STAT_REGION_IDLE_POSSIBLE  = 37, // dataserver only
+	LL_SIM_STAT_SIMAISTEPTIMEMS       = 38,
+	LL_SIM_STAT_SKIPPEDAISILSTEPS_PS  = 39,
+	LL_SIM_STAT_PCTSTEPPEDCHARACTERS  = 40
+};
+
 namespace LLStatViewer
 {
 
@@ -207,7 +252,7 @@ class LLViewerStats : public LLSingleton<LLViewerStats>
 	LLViewerStats();
 	~LLViewerStats();
 
-	void updateFrameStats(const F64 time_diff);
+	void updateFrameStats(const LLUnit<F64, LLUnits::Seconds> time_diff);
 	
 	void addToMessage(LLSD &body);
 
@@ -323,7 +368,7 @@ class LLViewerStats : public LLSingleton<LLViewerStats>
 private:
 	LLTrace::Recording				mRecording;
 
-	F64 mLastTimeDiff;  // used for time stat updates
+	LLUnit<F64, LLUnits::Seconds> mLastTimeDiff;  // used for time stat updates
 };
 
 static const F32 SEND_STATS_PERIOD = 300.0f;
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 8036a4e2585996cbbf934b820d73bd40052b65c1..16b51c457af8e4ef7c90dfe08eeada5a1803e0f3 100755
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -920,7 +920,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask,
 	}
 
 	handled = TRUE;
-	lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLViewerTextEditor " << getName() << llendl;
+	LL_DEBUGS("UserInput") << "dragAndDrop handled by LLViewerTextEditor " << getName() << llendl;
 
 	return handled;
 }
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 2872c277b107d034460c44d692f1186edddb86fe..ed74bc744a1d643950129324e9eca8e311666ea4 100755
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -29,7 +29,6 @@
 #include "llviewertexture.h"
 
 // Library includes
-#include "imageids.h"
 #include "llmath.h"
 #include "llerror.h"
 #include "llgl.h"
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index dfd7ac983d41865096887f217a23a89325701a8a..9b89ee2ec9876715dbffba0d7e30a4a3edefe3ac 100755
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -30,7 +30,6 @@
 
 #include "llviewertexturelist.h"
 
-#include "imageids.h"
 #include "llgl.h" // fot gathering stats from GL
 #include "llimagegl.h"
 #include "llimagebmp.h"
@@ -285,18 +284,18 @@ void LLViewerTextureList::shutdown()
 
 void LLViewerTextureList::dump()
 {
-	llinfos << "LLViewerTextureList::dump()" << llendl;
+	LL_INFOS() << "LLViewerTextureList::dump()" << LL_ENDL;
 	for (image_priority_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it)
 	{
 		LLViewerFetchedTexture* image = *it;
 
-		llinfos << "priority " << image->getDecodePriority()
+		LL_INFOS() << "priority " << image->getDecodePriority()
 		<< " boost " << image->getBoostLevel()
 		<< " size " << image->getWidth() << "x" << image->getHeight()
 		<< " discard " << image->getDiscardLevel()
 		<< " desired " << image->getDesiredDiscardLevel()
 		<< " http://asset.siva.lindenlab.com/" << image->getID() << ".texture"
-		<< llendl;
+		<< LL_ENDL;
 	}
 }
 
@@ -337,7 +336,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string&
 	std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename);
 	if (full_path.empty())
 	{
-		llwarns << "Failed to find local image file: " << filename << llendl;
+		llwarns << "Failed to find local image file: " << filename << LL_ENDL;
 		return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
 	}
 
@@ -378,7 +377,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string&
 		LLViewerFetchedTexture *texture = imagep.get();
 		if (texture->getUrl().empty())
 		{
-			llwarns << "Requested texture " << new_id << " already exists but does not have a URL" << llendl;
+			llwarns << "Requested texture " << new_id << " already exists but does not have a URL" << LL_ENDL;
 		}
 		else if (texture->getUrl() != url)
 		{
@@ -386,7 +385,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string&
 			// e.g. could be two avatars wearing the same outfit.
 			LL_DEBUGS("Avatar") << "Requested texture " << new_id
 								<< " already exists with a different url, requested: " << url
-								<< " current: " << texture->getUrl() << llendl;
+								<< " current: " << texture->getUrl() << LL_ENDL;
 		}
 		
 	}
@@ -401,7 +400,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string&
 			imagep = new LLViewerLODTexture(url, f_type, new_id, usemipmaps);
 			break ;
 		default:
-			llerrs << "Invalid texture type " << texture_type << llendl ;
+			LL_ERRS() << "Invalid texture type " << texture_type << LL_ENDL ;
 		}		
 		
 		if (internal_format && primary_format)
@@ -458,18 +457,18 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id,
 		if (request_from_host.isOk() &&
 			!texture->getTargetHost().isOk())
 		{
-			llwarns << "Requested texture " << image_id << " already exists but does not have a host" << llendl;
+			llwarns << "Requested texture " << image_id << " already exists but does not have a host" << LL_ENDL;
 		}
 		else if (request_from_host.isOk() &&
 				 texture->getTargetHost().isOk() &&
 				 request_from_host != texture->getTargetHost())
 		{
 			llwarns << "Requested texture " << image_id << " already exists with a different target host, requested: " 
-					<< request_from_host << " current: " << texture->getTargetHost() << llendl;
+					<< request_from_host << " current: " << texture->getTargetHost() << LL_ENDL;
 		}
 		if (f_type != FTT_DEFAULT && imagep->getFTType() != f_type)
 		{
-			llwarns << "FTType mismatch: requested " << f_type << " image has " << imagep->getFTType() << llendl;
+			llwarns << "FTType mismatch: requested " << f_type << " image has " << imagep->getFTType() << LL_ENDL;
 		}
 		
 	}
@@ -505,7 +504,7 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
 		imagep = new LLViewerLODTexture(image_id, f_type, request_from_host, usemipmaps);
 		break ;
 	default:
-		llerrs << "Invalid texture type " << texture_type << llendl ;
+		LL_ERRS() << "Invalid texture type " << texture_type << LL_ENDL ;
 	}
 	
 	if (internal_format && primary_format)
@@ -555,11 +554,11 @@ void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image)
 	llassert(image);
 	if (image->isInImageList())
 	{
-		llerrs << "LLViewerTextureList::addImageToList - Image already in list" << llendl;
+		LL_ERRS() << "LLViewerTextureList::addImageToList - Image already in list" << LL_ENDL;
 	}
 	if((mImageList.insert(image)).second != true) 
 	{
-		llerrs << "Error happens when insert image to mImageList!" << llendl ;
+		LL_ERRS() << "Error happens when insert image to mImageList!" << LL_ENDL ;
 	}
 	
 	image->setInImageList(TRUE) ;
@@ -572,20 +571,20 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)
 	llassert(image);
 	if (!image->isInImageList())
 	{
-		llinfos << "RefCount: " << image->getNumRefs() << llendl ;
+		LL_INFOS() << "RefCount: " << image->getNumRefs() << LL_ENDL ;
 		uuid_map_t::iterator iter = mUUIDMap.find(image->getID());
 		if(iter == mUUIDMap.end() || iter->second != image)
 		{
-			llinfos << "Image is not in mUUIDMap!" << llendl ;
+			LL_INFOS() << "Image is not in mUUIDMap!" << LL_ENDL ;
 		}
-		llerrs << "LLViewerTextureList::removeImageFromList - Image not in list" << llendl;
+		LL_ERRS() << "LLViewerTextureList::removeImageFromList - Image not in list" << LL_ENDL;
 	}
 
 	S32 count = mImageList.erase(image) ;
 	if(count != 1) 
 	{
-		llinfos << image->getID() << llendl ;
-		llerrs << "Error happens when remove image from mImageList: " << count << llendl ;
+		LL_INFOS() << image->getID() << LL_ENDL ;
+		LL_ERRS() << "Error happens when remove image from mImageList: " << count << LL_ENDL ;
 	}
       
 	image->setInImageList(FALSE) ;
@@ -595,7 +594,7 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image)
 {
 	if (!new_image)
 	{
-		llwarning("No image to add to image list", 0);
+		LL_WARNS() << "No image to add to image list" << LL_ENDL;
 		return;
 	}
 	LLUUID image_id = new_image->getID();
@@ -603,7 +602,7 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image)
 	LLViewerFetchedTexture *image = findImage(image_id);
 	if (image)
 	{
-		llwarns << "Image with ID " << image_id << " already in list" << llendl;
+		LL_WARNS() << "Image with ID " << image_id << " already in list" << LL_ENDL;
 	}
 	sNumImages++;
 	
@@ -901,7 +900,7 @@ void LLViewerTextureList::setDebugFetching(LLViewerFetchedTexture* tex, S32 debu
  << " host " << target_host
  << " boost " << imagep->getBoostLevel()
  << " imageid " << imagep->getID()
- << llendl;
+ << LL_ENDL;
  imagep->dump();
  }
  return type_from_host;
@@ -1175,13 +1174,13 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
 	if (compressedImage.isNull())
 	{
 		image->setLastError("Couldn't convert the image to jpeg2000.");
-		llinfos << "Couldn't convert to j2c, file : " << filename << llendl;
+		LL_INFOS() << "Couldn't convert to j2c, file : " << filename << LL_ENDL;
 		return FALSE;
 	}
 	if (!compressedImage->save(out_filename))
 	{
 		image->setLastError("Couldn't create the jpeg2000 image for upload.");
-		llinfos << "Couldn't create output file : " << out_filename << llendl;
+		LL_INFOS() << "Couldn't create output file : " << out_filename << LL_ENDL;
 		return FALSE;
 	}
 	// Test to see if the encode and save worked
@@ -1189,7 +1188,7 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
 	if (!integrity_test->loadAndValidate( out_filename ))
 	{
 		image->setLastError("The created jpeg2000 image is corrupt.");
-		llinfos << "Image file : " << out_filename << " is corrupt" << llendl;
+		LL_INFOS() << "Image file : " << out_filename << " is corrupt" << LL_ENDL;
 		return FALSE;
 	}
 	return TRUE;
@@ -1214,13 +1213,13 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage
 		// Read the blocks and precincts size settings
 		S32 block_size = gSavedSettings.getS32("Jpeg2000BlocksSize");
 		S32 precinct_size = gSavedSettings.getS32("Jpeg2000PrecinctsSize");
-		llinfos << "Advanced JPEG2000 Compression: precinct = " << precinct_size << ", block = " << block_size << llendl;
+		LL_INFOS() << "Advanced JPEG2000 Compression: precinct = " << precinct_size << ", block = " << block_size << LL_ENDL;
 		compressedImage->initEncode(*raw_image, block_size, precinct_size, 0);
 	}
 	
 	if (!compressedImage->encode(raw_image, 0.0f))
 	{
-		llinfos << "convertToUploadFile : encode returns with error!!" << llendl;
+		LL_INFOS() << "convertToUploadFile : encode returns with error!!" << LL_ENDL;
 		// Clear up the pointer so we don't leak that one
 		compressedImage = NULL;
 	}
@@ -1276,11 +1275,11 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
 			max_texmem = 128;
 		}
 
-		llwarns << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << llendl;
+		llwarns << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << LL_ENDL;
 	}
 
 	S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); // In MB
-	//llinfos << "*** DETECTED " << system_ram << " MB of system memory." << llendl;
+	//LL_INFOS() << "*** DETECTED " << system_ram << " MB of system memory." << LL_ENDL;
 	if (get_recommended)
 		max_texmem = llmin(max_texmem, (S32)(system_ram/2));
 	else
@@ -1344,8 +1343,8 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
 		mMaxTotalTextureMemInMegaBytes = system_ram - min_non_texture_mem ;
 	}
 	
-	llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl;
-	llinfos << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << llendl;
+	LL_INFOS() << "Total Video Memory set to: " << vb_mem << " MB" << LL_ENDL;
+	LL_INFOS() << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << LL_ENDL;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1394,8 +1393,8 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d
 	{
 		// msg->getSizeFast() is probably trying to tell us there
 		// was an error.
-		llerrs << "image header chunk size was negative: "
-		<< data_size << llendl;
+		LL_ERRS() << "image header chunk size was negative: "
+		<< data_size << LL_ENDL;
 		return;
 	}
 	
@@ -1464,13 +1463,13 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d
 	{
 		// msg->getSizeFast() is probably trying to tell us there
 		// was an error.
-		llerrs << "image data chunk size was negative: "
-		<< data_size << llendl;
+		LL_ERRS() << "image data chunk size was negative: "
+		<< data_size << LL_ENDL;
 		return;
 	}
 	if (data_size > MTUBYTES)
 	{
-		llerrs << "image data chunk too large: " << data_size << " bytes" << llendl;
+		LL_ERRS() << "image data chunk too large: " << data_size << " bytes" << LL_ENDL;
 		return;
 	}
 	U8 *data = new U8[data_size];
@@ -1507,7 +1506,7 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **
 	LLViewerFetchedTexture* image = gTextureList.findImage( image_id );
 	if( image )
 	{
-		llwarns << "not in db" << llendl;
+		llwarns << "not in db" << LL_ENDL;
 		image->setIsMissingAsset();
 	}
 }
@@ -1634,7 +1633,7 @@ LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::s
 	if (found_it != mUIImages.end())
 	{
 		// image already loaded!
-		llerrs << "UI Image " << name << " already loaded." << llendl;
+		LL_ERRS() << "UI Image " << name << " already loaded." << LL_ENDL;
 	}
 
 	return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect);
@@ -1737,7 +1736,7 @@ bool LLUIImageList::initFromFile()
 	std::vector<std::string>::const_iterator pi(textures_paths.begin()), pend(textures_paths.end());
 	if (pi == pend)
 	{
-		llwarns << "No textures.xml found in skins directories" << llendl;
+		llwarns << "No textures.xml found in skins directories" << LL_ENDL;
 		return false;
 	}
 
@@ -1745,12 +1744,12 @@ bool LLUIImageList::initFromFile()
 	LLXMLNodePtr root;
 	if (!LLXMLNode::parseFile(*pi, root, NULL))
 	{
-		llwarns << "Unable to parse UI image list file " << *pi << llendl;
+		llwarns << "Unable to parse UI image list file " << *pi << LL_ENDL;
 		return false;
 	}
 	if (!root->hasAttribute("version"))
 	{
-		llwarns << "No valid version number in UI image list file " << *pi << llendl;
+		llwarns << "No valid version number in UI image list file " << *pi << LL_ENDL;
 		return false;
 	}
 
diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h
index 65566f23a5a9981d6b3a5dc7ecac34a5d8d12a6e..8f49e3c4e23872b1839747a9f8e132920e20d345 100644
--- a/indra/newview/llviewerwearable.h
+++ b/indra/newview/llviewerwearable.h
@@ -29,6 +29,7 @@
 
 #include "llwearable.h"
 #include "llavatarappearancedefines.h"
+#include "llextendedstatus.h"
 
 class LLVOAvatar;
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 10e354f2e3b527cf80c1fd3dff3b38c56d39f60d..4ec9485aeecdab73dce0e523ad649df16fc578fb 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -76,7 +76,6 @@
 #include "message.h"
 #include "object_flags.h"
 #include "lltimer.h"
-#include "timing.h"
 #include "llviewermenu.h"
 #include "lltooltip.h"
 #include "llmediaentry.h"
@@ -3025,7 +3024,7 @@ void LLViewerWindow::updateUI()
 
 			if( !handled )
 			{
-				lldebugst(LLERR_USER_INPUT) << "hover not handled by mouse captor" << llendl;
+				LL_DEBUGS("UserInput") << "hover not handled by mouse captor" << llendl;
 			}
 		}
 		else
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp
index 94760e3c8351ce1ec50bb40b707f2f8a0e6c89b6..cd2075b12279bb4b0c92a8459329f9993e44e7ca 100755
--- a/indra/newview/llvlcomposition.cpp
+++ b/indra/newview/llvlcomposition.cpp
@@ -28,7 +28,6 @@
 
 #include "llvlcomposition.h"
 
-#include "imageids.h"
 #include "llerror.h"
 #include "v3math.h"
 #include "llsurface.h"
diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp
index d8de979f56ccfef8a162fee26f955a6fa14cb2bb..b231abc9c56cd7c12e1db0b0894dfcbbba00e093 100755
--- a/indra/newview/llvlmanager.cpp
+++ b/indra/newview/llvlmanager.cpp
@@ -29,23 +29,27 @@
 #include "llvlmanager.h"
 
 #include "indra_constants.h"
-#include "bitpack.h"
 #include "patch_code.h"
 #include "patch_dct.h"
 #include "llviewerregion.h"
 #include "llframetimer.h"
 #include "llsurface.h"
+#include "llbitpack.h"
+
+const	char	LAND_LAYER_CODE					= 'L';
+const	char	WIND_LAYER_CODE					= '7';
+const	char	CLOUD_LAYER_CODE				= '8';
 
 LLVLManager gVLManager;
 
 LLVLManager::~LLVLManager()
 {
 	S32 i;
-	for (i = 0; i < mPacketData.count(); i++)
+	for (i = 0; i < mPacketData.size(); i++)
 	{
 		delete mPacketData[i];
 	}
-	mPacketData.reset();
+	mPacketData.clear();
 }
 
 void LLVLManager::addLayerData(LLVLData *vl_datap, const S32 mesg_size)
@@ -67,7 +71,7 @@ void LLVLManager::addLayerData(LLVLData *vl_datap, const S32 mesg_size)
 		llerrs << "Unknown layer type!" << (S32)vl_datap->mType << llendl;
 	}
 
-	mPacketData.put(vl_datap);
+	mPacketData.push_back(vl_datap);
 }
 
 void LLVLManager::unpackData(const S32 num_packets)
@@ -75,7 +79,7 @@ void LLVLManager::unpackData(const S32 num_packets)
 	static LLFrameTimer decode_timer;
 	
 	S32 i;
-	for (i = 0; i < mPacketData.count(); i++)
+	for (i = 0; i < mPacketData.size(); i++)
 	{
 		LLVLData *datap = mPacketData[i];
 
@@ -98,11 +102,11 @@ void LLVLManager::unpackData(const S32 num_packets)
 		}
 	}
 
-	for (i = 0; i < mPacketData.count(); i++)
+	for (i = 0; i < mPacketData.size(); i++)
 	{
 		delete mPacketData[i];
 	}
-	mPacketData.reset();
+	mPacketData.clear();
 
 }
 
@@ -134,12 +138,12 @@ S32 LLVLManager::getTotalBytes() const
 void LLVLManager::cleanupData(LLViewerRegion *regionp)
 {
 	S32 cur = 0;
-	while (cur < mPacketData.count())
+	while (cur < mPacketData.size())
 	{
 		if (mPacketData[cur]->mRegionp == regionp)
 		{
 			delete mPacketData[cur];
-			mPacketData.remove(cur);
+			mPacketData.erase(mPacketData.begin() + cur);
 		}
 		else
 		{
diff --git a/indra/newview/llvlmanager.h b/indra/newview/llvlmanager.h
index 74b4823a5cf2babb2d0933b4637504bfb8d1e21f..0733aebaae789c7f47a416cc6c4afa32c5ac78a7 100755
--- a/indra/newview/llvlmanager.h
+++ b/indra/newview/llvlmanager.h
@@ -30,7 +30,6 @@
 // This class manages the data coming in for viewer layers from the network.
 
 #include "stdtypes.h"
-#include "lldarray.h"
 
 class LLVLData;
 class LLViewerRegion;
@@ -55,7 +54,7 @@ class LLVLManager
 	void cleanupData(LLViewerRegion *regionp);
 protected:
 
-	LLDynamicArray<LLVLData *> mPacketData;
+	std::vector<LLVLData *> mPacketData;
 	U32 mLandBits;
 	U32 mWindBits;
 	U32 mCloudBits;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 11b027a4173cb7fe4288b019be62170556cb9563..04c1bd3968c22fd5f3e722c0f418f2641957e853 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -66,6 +66,7 @@
 #include "llmutelist.h"
 #include "llmoveview.h"
 #include "llnotificationsutil.h"
+#include "llphysicsshapebuilderutil.h"
 #include "llquantize.h"
 #include "llrand.h"
 #include "llregionhandle.h"
@@ -116,16 +117,16 @@ using namespace LLAvatarAppearanceDefines;
 //-----------------------------------------------------------------------------
 // Global constants
 //-----------------------------------------------------------------------------
-const LLUUID ANIM_AGENT_BODY_NOISE = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise"
-const LLUUID ANIM_AGENT_BREATHE_ROT	= LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8");  //"breathe_rot"
-const LLUUID ANIM_AGENT_EDITING	= LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb");  //"editing"
-const LLUUID ANIM_AGENT_EYE	= LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea");  //"eye"
-const LLUUID ANIM_AGENT_FLY_ADJUST = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e");  //"fly_adjust"
-const LLUUID ANIM_AGENT_HAND_MOTION	= LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578");  //"hand_motion"
-const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d");  //"head_rot"
-const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b");  //"pelvis_fix"
-const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55");  //"target"
-const LLUUID ANIM_AGENT_WALK_ADJUST	= LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d");  //"walk_adjust"
+const LLUUID ANIM_AGENT_BODY_NOISE     = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise"
+const LLUUID ANIM_AGENT_BREATHE_ROT	   = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8");  //"breathe_rot"
+const LLUUID ANIM_AGENT_EDITING	       = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb");  //"editing"
+const LLUUID ANIM_AGENT_EYE	           = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea");  //"eye"
+const LLUUID ANIM_AGENT_FLY_ADJUST     = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e");  //"fly_adjust"
+const LLUUID ANIM_AGENT_HAND_MOTION	   = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578");  //"hand_motion"
+const LLUUID ANIM_AGENT_HEAD_ROT       = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d");  //"head_rot"
+const LLUUID ANIM_AGENT_PELVIS_FIX     = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b");  //"pelvis_fix"
+const LLUUID ANIM_AGENT_TARGET         = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55");  //"target"
+const LLUUID ANIM_AGENT_WALK_ADJUST	   = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d");  //"walk_adjust"
 const LLUUID ANIM_AGENT_PHYSICS_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df440d987");  //"physics_motion"
 
 
@@ -1313,7 +1314,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
 	for (polymesh_map_t::iterator i = mPolyMeshes.begin(); i != mPolyMeshes.end(); ++i)
 	{
 		LLPolyMesh* mesh = i->second;
-		for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++)
+		for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.size(); joint_num++)
 		{
 			LLVector4a trans;
 			trans.load3( mesh->mJointRenderData[joint_num]->mWorldMatrix->getTranslation().mV);
@@ -1638,7 +1639,7 @@ void LLVOAvatar::releaseMeshData()
 		return;
 	}
 
-	//llinfos << "Releasing" << llendl;
+	LL_DEBUGS() << "Releasing mesh data" << LL_ENDL;
 
 	// cleanup mesh data
 	for (avatar_joint_list_t::iterator iter = mMeshLOD.begin();
@@ -7120,30 +7121,32 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 }
 
 // static
-void LLVOAvatar::getAnimLabels( LLDynamicArray<std::string>* labels )
+void LLVOAvatar::getAnimLabels( std::vector<std::string>* labels )
 {
 	S32 i;
+	labels->reserve(gUserAnimStatesCount);
 	for( i = 0; i < gUserAnimStatesCount; i++ )
 	{
-		labels->put( LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName ) );
+		labels->push_back( LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName ) );
 	}
 
 	// Special case to trigger away (AFK) state
-	labels->put( "Away From Keyboard" );
+	labels->push_back( "Away From Keyboard" );
 }
 
 // static 
-void LLVOAvatar::getAnimNames( LLDynamicArray<std::string>* names )
+void LLVOAvatar::getAnimNames( std::vector<std::string>* names )
 {
 	S32 i;
 
+	names->reserve(gUserAnimStatesCount);
 	for( i = 0; i < gUserAnimStatesCount; i++ )
 	{
-		names->put( std::string(gUserAnimStates[i].mName) );
+		names->push_back( std::string(gUserAnimStates[i].mName) );
 	}
 
 	// Special case to trigger away (AFK) state
-	names->put( "enter_away_from_keyboard_state" );
+	names->push_back( "enter_away_from_keyboard_state" );
 }
 
 // static
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 0544d7395da4446293981aa1613381682078d933..2c86ed63d17547b9a370b360c8cb5ae74c53c249 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -35,7 +35,6 @@
 
 #include <boost/signals2/trackable.hpp>
 
-#include "imageids.h"			// IMG_INVISIBLE
 #include "llavatarappearance.h"
 #include "llchat.h"
 #include "lldrawpoolalpha.h"
@@ -853,8 +852,8 @@ class LLVOAvatar :
 	std::string		getFullname() const; // Returns "FirstName LastName"
 	std::string		avString() const; // Frequently used string in log messages "Avatar '<full name'"
 protected:
-	static void		getAnimLabels(LLDynamicArray<std::string>* labels);
-	static void		getAnimNames(LLDynamicArray<std::string>* names);	
+	static void		getAnimLabels(std::vector<std::string>* labels);
+	static void		getAnimNames(std::vector<std::string>* names);	
 private:
     bool            mNameIsSet;
 	std::string  	mTitle;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 67da311c5a65df1ecf4a32496320a3f575fb4a69..117169678e44e14eff49d6b8ad820fa20e882233 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -143,8 +143,7 @@ struct LocalTextureData
 // Static Data
 //-----------------------------------------------------------------------------
 S32 LLVOAvatarSelf::sScratchTexBytes = 0;
-LLMap< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames;
-LLMap< LLGLenum, F32*> LLVOAvatarSelf::sScratchTexLastBindTime;
+std::map< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames;
 
 
 /*********************************************************************************
@@ -2543,11 +2542,11 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
 													asset_id_matches);
 
 					BOOL can_grab = FALSE;
-					lldebugs << "item count for asset " << texture_id << ": " << items.count() << llendl;
-					if (items.count())
+					lldebugs << "item count for asset " << texture_id << ": " << items.size() << llendl;
+					if (items.size())
 					{
 						// search for full permissions version
-						for (S32 i = 0; i < items.count(); i++)
+						for (S32 i = 0; i < items.size(); i++)
 						{
 							LLViewerInventoryItem* itemp = items[i];
 												if (itemp->getIsFullPerm())
@@ -3060,11 +3059,11 @@ BOOL LLVOAvatarSelf::needsRenderBeam()
 // static
 void LLVOAvatarSelf::deleteScratchTextures()
 {
-	for( LLGLuint* namep = sScratchTexNames.getFirstData(); 
-		 namep; 
-		 namep = sScratchTexNames.getNextData() )
+	for(std::map< LLGLenum, LLGLuint*>::iterator it = sScratchTexNames.begin(), end_it = sScratchTexNames.end();
+		it != end_it;
+		++it)
 	{
-		LLImageGL::deleteTextures(LLTexUnit::TT_TEXTURE, 0, -1, 1, (U32 *)namep );
+		LLImageGL::deleteTextures(LLTexUnit::TT_TEXTURE, 0, -1, 1, (U32 *)it->second );
 		stop_glerror();
 	}
 
@@ -3072,8 +3071,7 @@ void LLVOAvatarSelf::deleteScratchTextures()
 	{
 		lldebugs << "Clearing Scratch Textures " << (sScratchTexBytes/1024) << "KB" << llendl;
 
-		sScratchTexNames.deleteAllData();
-		sScratchTexLastBindTime.deleteAllData();
+		delete_and_clear(sScratchTexNames);
 		LLImageGL::sGlobalTextureMemory -= sScratchTexBytes;
 		sScratchTexBytes = 0;
 	}
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 3b7b6bac64a07ed801ef9aa9b4f5905cc687ff02..be98f8dfa9381e3be5fd3df45c0f402bf322555e 100755
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -30,6 +30,7 @@
 
 #include "llviewertexture.h"
 #include "llvoavatar.h"
+#include <map>
 
 struct LocalTextureData;
 
@@ -276,8 +277,7 @@ class LLVOAvatarSelf :
 	static void		deleteScratchTextures();
 private:
 	static S32 		sScratchTexBytes;
-	static LLMap< LLGLenum, LLGLuint*> sScratchTexNames;
-	static LLMap< LLGLenum, F32*> sScratchTexLastBindTime;
+	static std::map< LLGLenum, LLGLuint*> sScratchTexNames;
 
 /**                    Textures
  **                                                                            **
diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp
index 88ce6df916c4b910ee5cbcd78ab9a657b0059e25..62fe6e7b12d02d4a4188fc1dcc5c2d9fda576264 100755
--- a/indra/newview/llvograss.cpp
+++ b/indra/newview/llvograss.cpp
@@ -28,7 +28,6 @@
 
 #include "llvograss.h"
 
-#include "imageids.h"
 #include "llviewercontrol.h"
 
 #include "llagentcamera.h"
diff --git a/indra/newview/llvograss.h b/indra/newview/llvograss.h
index 122806766de78505e5164f00446dd3fb6118bc08..28203c65aeab1d6c6aaf204661cf1d28f243b735 100755
--- a/indra/newview/llvograss.h
+++ b/indra/newview/llvograss.h
@@ -28,7 +28,6 @@
 #define LL_LLVOGRASS_H
 
 #include "llviewerobject.h"
-#include "lldarray.h"
 #include <map>
 
 class LLSurfacePatch;
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 9b5d981aa5ccfc7cf5a62cfd119474a2bfdb5a96..df5d413407e1812a4d8d77b02fe669e067724ed1 100755
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -6547,8 +6547,8 @@ void LLVivoxVoiceClient::expireVoiceFonts()
 	// Give a warning notification if any voice fonts are due to expire.
 	if (will_expire)
 	{
-		S32 seconds = gSavedSettings.getS32("VoiceEffectExpiryWarningTime");
-		args["INTERVAL"] = llformat("%d", seconds / SEC_PER_DAY);
+		LLUnit<S32, LLUnits::Seconds> seconds = gSavedSettings.getS32("VoiceEffectExpiryWarningTime");
+		args["INTERVAL"] = llformat("%d", LLUnit<S32, LLUnits::Days>(seconds).value());
 
 		LLNotificationsUtil::add("VoiceEffectsWillExpire", args);
 	}
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index 87f6f5c4a4f99f9181530b02b7b0c3089d750c08..487227f006d05d6425de5c5efb75b2324375e8d4 100755
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -46,7 +46,7 @@
 
 const F32 MAX_PART_LIFETIME = 120.f;
 
-extern U64 gFrameTime;
+extern LLUnitImplicit<U64, LLUnits::Microseconds> gFrameTime;
 
 LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;
 S32 LLVOPartGroup::sVBSlotFree[];
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 0a119e853a4dbb9490abefceb655e2c1b1e50f66..85e8fd8bf4f86958ca532cfeaaa876b5090e2c36 100755
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -28,11 +28,9 @@
 
 #include "llvosky.h"
 
-#include "imageids.h"
 #include "llfeaturemanager.h"
 #include "llviewercontrol.h"
 #include "llframetimer.h"
-#include "timing.h"
 
 #include "llagent.h"
 #include "llagentcamera.h"
diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h
index 2ecb0303a1bbd082f6df716abfe1dc3d64301877..a6077f4a7a56816aea29ea01eeb6cbb424868529 100755
--- a/indra/newview/llvotree.h
+++ b/indra/newview/llvotree.h
@@ -28,7 +28,6 @@
 #define LL_LLVOTREE_H
 
 #include "llviewerobject.h"
-#include "lldarray.h"
 #include "xform.h"
 
 class LLFace;
diff --git a/indra/newview/llvotreenew.h b/indra/newview/llvotreenew.h
deleted file mode 100755
index 0bb07008caa8c4fcae1f0ae25b5c9e9c00d122d8..0000000000000000000000000000000000000000
--- a/indra/newview/llvotreenew.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/** 
- * @file llvotreenew.h
- * @brief LLVOTreeNew class header file
- *
- * $LicenseInfo:firstyear=2003&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLVOTREENEW_H
-#define LL_LLVOTREENEW_H
-
-#include "llviewerobject.h"
-#include "lldarray.h"
-#include "xform.h"
-
-#include "lltreeparams.h"
-#include "llstrider.h"
-#include "v2math.h"
-#include "v3math.h"
-#include "llviewertexture.h"
-
-class LLFace;
-class LLDrawPool;
-
-// number of static arrays created
-const U8 MAX_SPECIES = 16;	// max species of trees
-const U8 MAX_PARTS = 15;	// trunk, 2 or 3 branches per species?
-const U8 MAX_RES = 6;		// max # cross sections for a branch curve
-const U8 MAX_FLARE = 6;		// max # cross sections for flare of trunk
-const U8 MAX_LEVELS = 3;
-
-// initial vertex array allocations
-const U32 NUM_INIT_VERTS = 5000;			// number of vertices/normals/texcoords
-const U32 NUM_INIT_INDICES = 15000;			// number of indices to vert array (3 vertices per triangle, roughly 3x)
-const U32 NUM_TIMES_TO_DOUBLE = 2;			// if we go over initial allocations, num times to double each step
-
-// for finding the closest parts...
-
-// the parts are searched based on:
-const F32 MAX_LOBES_DIFF = 2;
-const F32 MAX_LOBEDEPTH_DIFF = .3f;
-const F32 MAX_CURVEBACK_DIFF = 20.0f;
-const F32 MAX_CURVE_DIFF = 15.0f;
-const F32 MAX_CURVE_V_DIFF = 20.0f;
-
-const F32 CURVEV_DIVIDER = 10.0f;	// curveV/CURVEV_DIVIDER = # branch variances...
-const U8 MAX_VARS = 3;				// max number of variations of branches
-
-const U8 MAX_RAND_NUMS = 100;		// max number of rand numbers to pregenerate and store
-
-// texture params
-const F32 WIDTH_OF_BARK = .48f;
-
-class LLVOTreeNew : public LLViewerObject
-{
-public:
-
-	// Some random number generators using the pre-generated random numbers
-	// return +- negPos
-	static S32 llrand_signed(S32 negPos)
-	{
-		return (ll_rand((U32)negPos * 2) - negPos);
-	};
-
-	static S32 llrand_signed(S32 negPos, U32 index)
-	{
-		return lltrunc((sRandNums[index % MAX_RAND_NUMS] * (negPos * 2.0f) - negPos));
-	};
-	
-	static S32 llrand_unsigned(S32 pos, U32 index)
-	{
-		return lltrunc((sRandNums[index % MAX_RAND_NUMS] * pos));
-	};
-
-	// return +- negPos
-	static F32 llfrand_signed(F32 negPos)
-	{
-		return (ll_frand(negPos * 2.0f) - negPos);
-	};
-
-	static F32 llfrand_signed(F32 negPos, U32 index)
-	{
-		return (sRandNums[index % MAX_RAND_NUMS] * negPos * 2.0f) - negPos;
-	};
-
-	static F32 llfrand_unsigned(F32 pos, U32 index)
-	{
-		return sRandNums[index % MAX_RAND_NUMS] * pos;
-	};
-
-	// return between 0-pos
-	static F32 llfrand_unsigned(F32 pos)
-	{
-		return ll_frand(pos);
-	};
-
-	static void cleanupTextures() {};	// not needed anymore
-
-	struct TreePart
-	{
-		F32 mRadius;		// scale x/y
-		F32 mLength;		// scale z
-		F32 mCurve;
-		F32 mCurveV;
-		F32 mCurveRes;
-		F32 mCurveBack;
-		U8 mLobes;
-		F32 mLobeDepth;
-		U8 mLevel;
-		U32 mNumTris;
-		U8 mVertsPerSection;
-		U8 mNumVariants;
-
-		// first index into the drawpool arrays for this particular branch
-		U32 mIndiceIndex[MAX_VARS];
-		U32 mOffsets[MAX_VARS][MAX_RES];		// offsets for the partial branch pieces
-		// local section frames for this branch
-		LLMatrix4 mFrames[MAX_VARS][(MAX_RES*(MAX_RES + 1))/2];	// (0...n) + (1...n) + ... + (n-1..n)
-		LLDynamicArray<LLVector3> mFaceNormals;
-
-	};
-
-	LLVOTreeNew(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
-	virtual ~LLVOTreeNew();
-
-	/*virtual*/ 
-	U32 processUpdateMessage(LLMessageSystem *mesgsys,
-											void **user_data,
-											U32 block_num, const EObjectUpdateType update_type,
-											LLDataPacker *dp);
-
-	/*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
-
-	/*virtual*/ void render(LLAgent &agent);
-	/*virtual*/ void updateTextures();
-
-	/*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
-	/*virtual*/ BOOL		updateGeometry(LLDrawable *drawable);
-
-	F32 CalcZStep(TreePart *part, U8 section);
-
-	void createPart(U8 level, F32 length, F32 radius, LLStrider<LLVector3> &vertices, LLStrider<LLVector3> &normals, 
-							LLStrider<LLVector2> &tex_coords, U32 *indices, 
-							U32 &curVertexIndex, U32 &curTexCoordIndex,
-							U32 &curNormalIndex, U32 &curIndiceIndex);
-
-	S32 findSimilarPart(U8 level);
-
-	F32 CalculateSectionRadius(U8 level, F32 y, F32 stemLength, F32 stemRadius);
-	//F32 CalculateVerticalAttraction(U8 level, LLMatrix4 &sectionFrame);
-
-	void createSection(LLMatrix4 &frame, TreePart *part, F32 sectionRadius, F32 stemZ, 
-							  LLStrider<LLVector3> &vertices, LLStrider<LLVector2> &tex_coords, U32 *indices, 
-							  U32 &curVertexIndex, U32 &curTexCoordIndex, U32 &curIndiceIndex, U8 curSection, BOOL firstBranch);
-
-	void genIndicesAndFaceNormalsForLastSection(TreePart *part, U8 numVerts, LLStrider<LLVector3> &vertices, U32 curVertexIndex, U32 *indices, U32 &curIndiceIndex, BOOL firstBranch);
-
-	void genVertexNormals(TreePart *part, LLStrider<LLVector3> &normals, U8 numSections, U32 curNormalOffset);
-
-	void drawTree(LLDrawPool &draw_pool, const LLMatrix4 &frame, U8 level, F32 offsetChild, F32 curLength, F32 parentLength, F32 curRadius, F32 parentRadius, U8 part, U8 variant, U8 startSection);
-	void drawTree(LLDrawPool &draw_pool);
-
-	
-	//LLTreeParams mParams;
-	U8 mSpecies;
-	LLPointer<LLViewerTexture> mTreeImagep;
-	LLMatrix4 mTrunkFlareFrames[MAX_FLARE];
-	F32 mSegSplitsError[3];
-	U32 mRandOffset[MAX_LEVELS];
-
-	U32 mNumTrisDrawn;
-	U32 mTotalIndices;
-	U32 mTotalVerts;
-
-	static void initClass();
-
-	// tree params
-	static LLTreeParams sParameters;
-
-	// next indexes used to drawpool arrays
-	static U32 sNextVertexIndex[MAX_SPECIES];
-	static U32 sNextIndiceIndex[MAX_SPECIES];
-
-	// tree parts
-	static U32 sNextPartIndex[MAX_PARTS];
-	static TreePart sTreeParts[MAX_SPECIES][MAX_PARTS];
-
-	// species images
-	static LLUUID sTreeImageIDs[MAX_SPECIES];
-
-	// random numbers
-	static F32 sRandNums[MAX_RAND_NUMS];
-
-	// usage data
-	static U32 sTreePartsUsed[MAX_SPECIES][MAX_PARTS][MAX_VARS];
-	
-	
-};
-
-#endif
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 006011c2e7207c9f36539bba200517b8ab30b168..632f4d178a145da0d0b6f1d1de40ef43a3259f5a 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -47,7 +47,6 @@
 #include "message.h"
 #include "llpluginclassmedia.h" // for code in the mediaEvent handler
 #include "object_flags.h"
-#include "llagentconstants.h"
 #include "lldrawable.h"
 #include "lldrawpoolavatar.h"
 #include "lldrawpoolbump.h"
diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp
index 50e7ed7bb5ed3dd0cca42d2f6b9352e7633f8d99..fc85a670b5a3657c8833d11db6a12243dfec29d9 100755
--- a/indra/newview/llvowater.cpp
+++ b/indra/newview/llvowater.cpp
@@ -28,7 +28,6 @@
 
 #include "llvowater.h"
 
-#include "imageids.h"
 #include "llviewercontrol.h"
 
 #include "lldrawable.h"
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 4f52ff977829a7132433d046556443121c9fe9f4..ec1f0389ea2831a6ad2d3955bca261a0a31e216c 100755
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -89,7 +89,7 @@ void LLWaterParamManager::loadAllPresets()
 
 void LLWaterParamManager::loadPresetsFromDir(const std::string& dir)
 {
-	LL_INFOS2("AppInit", "Shaders") << "Loading water presets from " << dir << LL_ENDL;
+	LL_INFOS("AppInit", "Shaders") << "Loading water presets from " << dir << LL_ENDL;
 
 	LLDirIterator dir_iter(dir, "*.xml");
 	while (1)
@@ -119,7 +119,7 @@ bool LLWaterParamManager::loadPreset(const std::string& path)
 		return false;
 	}
 
-	LL_DEBUGS2("AppInit", "Shaders") << "Loading water " << name << LL_ENDL;
+	LL_DEBUGS("AppInit", "Shaders") << "Loading water " << name << LL_ENDL;
 
 	LLSD params_data;
 	LLPointer<LLSDParser> parser = new LLSDXMLParser();
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index a8a5ef311781dff230fb936a6a02c5d6f119ffa9..58a00c5be02742927f70f52b5d01ffebb04dbe7d 100755
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -258,7 +258,7 @@ class LLWearableListItemComparator : public LLFlatListView::ItemComparator
 
 		if (!wearable_item1 || !wearable_item2)
 		{
-			llwarning("item1 and item2 cannot be null", 0);
+			LL_WARNS() << "item1 and item2 cannot be null" << LL_ENDL;
 			return true;
 		}
 
diff --git a/indra/newview/llwind.h b/indra/newview/llwind.h
index 3b57f07124d2ad0563c046e8324028b969b56daa..e73d1baa588da75f146607985366fe7991ef4777 100755
--- a/indra/newview/llwind.h
+++ b/indra/newview/llwind.h
@@ -35,6 +35,8 @@ class LLVector3;
 class LLBitPack;
 class LLGroupHeader;
 
+const F32 WIND_SCALE_HACK		= 2.0f;	// hack to make wind speeds more realistic
+
 
 class LLWind  
 {
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 6077208799a654e663a974166b31f0386fcb7b92..c729d6ff4f86644e04475c06c83ed3382c85bb7b 100755
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -272,7 +272,7 @@ void LLWLParamManager::loadAllPresets()
 
 void LLWLParamManager::loadPresetsFromDir(const std::string& dir)
 {
-	LL_INFOS2("AppInit", "Shaders") << "Loading sky presets from " << dir << LL_ENDL;
+	LL_INFOS("AppInit", "Shaders") << "Loading sky presets from " << dir << LL_ENDL;
 
 	LLDirIterator dir_iter(dir, "*.xml");
 	while (1)
@@ -302,7 +302,7 @@ bool LLWLParamManager::loadPreset(const std::string& path)
 		return false;
 	}
 
-	LL_DEBUGS2("AppInit", "Shaders") << "Loading sky " << name << LL_ENDL;
+	LL_DEBUGS("AppInit", "Shaders") << "Loading sky " << name << LL_ENDL;
 
 	LLSD params_data;
 	LLPointer<LLSDParser> parser = new LLSDXMLParser();
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 3dfe4c5e5f96d9ddfd58d015a74047fcbcd785b9..9659da6bf1b6cdaf21927662917c5f6f1716667b 100755
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -971,12 +971,12 @@ LLViewerTexture* LLWorld::getDefaultWaterTexture()
 	return mDefaultWaterTexturep;
 }
 
-void LLWorld::setSpaceTimeUSec(const U64 space_time_usec)
+void LLWorld::setSpaceTimeUSec(const LLUnitImplicit<U64, LLUnits::Microseconds> space_time_usec)
 {
 	mSpaceTimeUSec = space_time_usec;
 }
 
-U64 LLWorld::getSpaceTimeUSec() const
+LLUnitImplicit<U64, LLUnits::Microseconds> LLWorld::getSpaceTimeUSec() const
 {
 	return mSpaceTimeUSec;
 }
@@ -1244,13 +1244,13 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
 	{
 		LLViewerRegion* regionp = *iter;
 		const LLVector3d& origin_global = regionp->getOriginGlobal();
-		S32 count = regionp->mMapAvatars.count();
+		S32 count = regionp->mMapAvatars.size();
 		for (S32 i = 0; i < count; i++)
 		{
-			LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
+			LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global);
 			if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
 			{
-				LLUUID uuid = regionp->mMapAvatarIDs.get(i);
+				LLUUID uuid = regionp->mMapAvatarIDs.at(i);
 				// if this avatar doesn't already exist in the list, add it
 				if(uuid.notNull() && avatar_ids != NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end())
 				{
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index d94c27c428d519658e6cf8e333ead1d29d0d3357..c74ac3fa6f8eb064490c4ac66a284b864b83ee65 100755
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -141,8 +141,8 @@ class LLWorld : public LLSingleton<LLWorld>
 	void waterHeightRegionInfo(std::string const& sim_name, F32 water_height);
 	void shiftRegions(const LLVector3& offset);
 
-	void setSpaceTimeUSec(const U64 space_time_usec);
-	U64 getSpaceTimeUSec() const;
+	void setSpaceTimeUSec(const LLUnitImplicit<U64, LLUnits::Microseconds> space_time_usec);
+	LLUnitImplicit<U64, LLUnits::Microseconds> getSpaceTimeUSec() const;
 
 	void getInfo(LLSD& info);
 	U32  getNumOfActiveCachedObjects() const {return mNumOfActiveCachedObjects;}
@@ -189,7 +189,7 @@ class LLWorld : public LLSingleton<LLWorld>
 	S32 mLastPacketsOut;
 	S32 mLastPacketsLost;
 	U32 mNumOfActiveCachedObjects;
-	U64 mSpaceTimeUSec;
+	LLUnitImplicit<U64, LLUnits::Microseconds> mSpaceTimeUSec;
 
 	BOOL mClassicCloudsEnabled;
 
diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h
index d514b2f14c3eafd5c6291a59f68536f27cac3a52..1a168e4b4d4f76ee6d25499d00d45491e2c5085a 100755
--- a/indra/newview/llworldmap.h
+++ b/indra/newview/llworldmap.h
@@ -38,6 +38,18 @@
 #include "llviewertexture.h"
 #include "llgltexture.h"
 
+// map item types
+const U32 MAP_ITEM_TELEHUB = 0x01;
+const U32 MAP_ITEM_PG_EVENT = 0x02;
+const U32 MAP_ITEM_MATURE_EVENT = 0x03;
+//const U32 MAP_ITEM_POPULAR = 0x04;		// No longer supported, 2009-03-02 KLW
+//const U32 MAP_ITEM_AGENT_COUNT = 0x05;
+const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06;
+const U32 MAP_ITEM_LAND_FOR_SALE = 0x07;
+const U32 MAP_ITEM_CLASSIFIED = 0x08;
+const U32 MAP_ITEM_ADULT_EVENT = 0x09;
+const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a;
+
 // Description of objects like hubs, events, land for sale, people and more (TBD).
 // Note: we don't store a "type" in there so we need to store instances of this class in 
 // well known objects (i.e. list of objects which type is "well known").
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 6759328b84a1096d3cb6179ff764a3e0a882cc44..977d967a761c7c8c820d12a9fa2e2ca55bb3bb58 100755
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1723,7 +1723,7 @@ BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask )
 		{
 			gViewerWindow->setCursor( UI_CURSOR_CROSS );
 		}
-		lldebugst(LLERR_USER_INPUT) << "hover handled by LLWorldMapView" << llendl;		
+		LL_DEBUGS("UserInput") << "hover handled by LLWorldMapView" << llendl;		
 		return TRUE;
 	}
 }
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 870ee6a103fc7cb9e728abe87eea8cd6bc468c10..1d9137c1610da904ebf8749ca710f1e77387cb9c 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -30,7 +30,6 @@
 
 // library includes
 #include "llaudioengine.h" // For debugging.
-#include "imageids.h"
 #include "llerror.h"
 #include "llviewercontrol.h"
 #include "llfasttimer.h"
@@ -40,7 +39,6 @@
 #include "llprimitive.h"
 #include "llvolume.h"
 #include "material_codes.h"
-#include "timing.h"
 #include "v3color.h"
 #include "llui.h" 
 #include "llglheaders.h"
diff --git a/indra/llcommon/roles_constants.h b/indra/newview/roles_constants.h
similarity index 100%
rename from indra/llcommon/roles_constants.h
rename to indra/newview/roles_constants.h
diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml
index ba43c24ad38ebc66adb51b4805f57ea280d1f220..d4dbb487f163ad648bf27b6762ef1557b87ebda8 100755
--- a/indra/newview/skins/default/xui/en/floater_stats.xml
+++ b/indra/newview/skins/default/xui/en/floater_stats.xml
@@ -65,8 +65,7 @@
           <stat_bar name="ktrisframe"
                     label="KTris per Frame"
                     unit_label="ktris/fr"
-                    stat="trianglesdrawnstat"
-                    show_per_sec="false"/>
+                    stat="trianglesdrawnperframestat"/>
           <stat_bar name="ktrissec"
                     label="KTris per Sec"
                     stat="trianglesdrawnstat"/>
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 29393bf7499817b09f7befac3453c8da38e73c26..9f02e90ea303e35e82026f9fe71041918587bb7c 100755
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2402,6 +2402,7 @@ Drag folders to this area and click "Send to Marketplace" to list them for sale
 
 	<!-- compile queue-->
 	<string name="CompileQueueDownloadedCompiling">Downloaded, now compiling</string>
+	<string name="CompileQueueServiceUnavailable">Script compilation service not available</string>
 	<string name="CompileQueueScriptNotFound">Script not found on server.</string>
 	<string name="CompileQueueProblemDownloading">Problem downloading</string>
 	<string name="CompileQueueInsufficientPermDownload">Insufficient permissions to download a script.</string>