diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 1f653c159c8a06d4ecc5eb3b3b2102f79ca498b3..3287a894d3f7e4389690b10ec48fd4ad05d2d684 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -134,7 +134,7 @@ S32 wchar_to_utf8chars(llwchar in_char, char* outchars)
 		*outchars++ = 0xF0 | (cur_char >> 18);
 		*outchars++ = 0x80 | ((cur_char >> 12) & 0x3F);
 		*outchars++ = 0x80 | ((cur_char >> 6) & 0x3F);
-		*outchars++ = 0x80 | cur_char & 0x3F;
+		*outchars++ = 0x80 | (cur_char & 0x3F);
 	}
 	else if (cur_char < 0x4000000)
 	{
@@ -142,7 +142,7 @@ S32 wchar_to_utf8chars(llwchar in_char, char* outchars)
 		*outchars++ = 0x80 | ((cur_char >> 18) & 0x3F);
 		*outchars++ = 0x80 | ((cur_char >> 12) & 0x3F);
 		*outchars++ = 0x80 | ((cur_char >> 6) & 0x3F);
-		*outchars++ = 0x80 | cur_char & 0x3F;
+		*outchars++ = 0x80 | (cur_char & 0x3F);
 	}
 	else if (cur_char < 0x80000000)
 	{
@@ -151,7 +151,7 @@ S32 wchar_to_utf8chars(llwchar in_char, char* outchars)
 		*outchars++ = 0x80 | ((cur_char >> 18) & 0x3F);
 		*outchars++ = 0x80 | ((cur_char >> 12) & 0x3F);
 		*outchars++ = 0x80 | ((cur_char >> 6) & 0x3F);
-		*outchars++ = 0x80 | cur_char & 0x3F;
+		*outchars++ = 0x80 | (cur_char & 0x3F);
 	}
 	else
 	{
diff --git a/indra/llcommon/llstringtable.h b/indra/llcommon/llstringtable.h
index 4492063275e64f4d3bc7934802e87dd04bba8f52..2a0c0d8d2967ffef75903080bb1a998617a1af59 100644
--- a/indra/llcommon/llstringtable.h
+++ b/indra/llcommon/llstringtable.h
@@ -48,10 +48,12 @@
 //# define STRING_TABLE_HASH_MAP 1
 #endif
 
-#if LL_WINDOWS
-#include <hash_map>
-#else
-#include <ext/hash_map>
+#if STRING_TABLE_HASH_MAP
+# if LL_WINDOWS
+#  include <hash_map>
+# else
+#  include <ext/hash_map>
+# endif
 #endif
 
 const U32 MAX_STRINGS_LENGTH = 256;
diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h
index 7f96800e210eeb5fbff4e98516dbb7a6eae5d03a..8c65d933025b20a8907058b42e5025eb61088333 100644
--- a/indra/llmath/v3math.h
+++ b/indra/llmath/v3math.h
@@ -411,8 +411,8 @@ inline bool operator<(const LLVector3 &a, const LLVector3 &b)
 	return (a.mV[0] < b.mV[0]
 			|| (a.mV[0] == b.mV[0]
 				&& (a.mV[1] < b.mV[1]
-					|| (a.mV[1] == b.mV[1])
-						&& a.mV[2] < b.mV[2])));
+					|| ((a.mV[1] == b.mV[1])
+						&& a.mV[2] < b.mV[2]))));
 }
 
 inline const LLVector3& operator+=(LLVector3 &a, const LLVector3 &b)
diff --git a/indra/llmessage/lliobuffer.cpp b/indra/llmessage/lliobuffer.cpp
index 71c1df8f9940e741257ad0041735f42592d32fe5..223a23949b5a08722852d8fd6ddb8a13d6952aac 100644
--- a/indra/llmessage/lliobuffer.cpp
+++ b/indra/llmessage/lliobuffer.cpp
@@ -87,7 +87,7 @@ LLIOPipe::EStatus LLIOBuffer::seek(LLIOBuffer::EHead head, S64 delta)
 	{
 	case READ:
 		if(((delta >= 0) && ((mReadHead + delta) <= mWriteHead))
-		   || (delta < 0) && ((mReadHead + delta) >= mBuffer))
+		   || ((delta < 0) && ((mReadHead + delta) >= mBuffer)))
 		{
 			mReadHead += delta;
 			status = STATUS_OK;
@@ -95,7 +95,7 @@ LLIOPipe::EStatus LLIOBuffer::seek(LLIOBuffer::EHead head, S64 delta)
 		break;
 	case WRITE:
 		if(((delta >= 0) && ((mWriteHead + delta) < (mBuffer + mBufferSize)))
-		   || (delta < 0) && ((mWriteHead + delta) > mReadHead))
+		   || ((delta < 0) && ((mWriteHead + delta) > mReadHead)))
 		{
 			mWriteHead += delta;
 			status = STATUS_OK;
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index b7f31779ca0decd5471e378fbb1c6a184d7d7e97..4cf8451dbe752d785ca60b14ae7819a83fee0943 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -139,7 +139,7 @@ void LLRenderTarget::addColorAttachment(U32 color_fmt)
 
 	U32 offset = mTex.size();
 	if (offset >= 4 ||
-		offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers))
+		(offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers)))
 	{
 		llerrs << "Too many color attachments!" << llendl;
 	}
@@ -608,7 +608,7 @@ void LLMultisampleBuffer::addColorAttachment(U32 color_fmt)
 
 	U32 offset = mTex.size();
 	if (offset >= 4 ||
-		offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers))
+		(offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers)))
 	{
 		llerrs << "Too many color attachments!" << llendl;
 	}
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index a8d06643ff16f188c56ce12efc33135a3b157557..9af92af530c60357dbb026bb40f1bee208f481d0 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -2416,8 +2416,8 @@ void LLMenuGL::createJumpKeys()
 				{
 					char jump_key = uppercase_word[i];
 					
-					if (LLStringOps::isDigit(jump_key) || LLStringOps::isUpper(jump_key) &&
-						mJumpKeys.find(jump_key) == mJumpKeys.end())
+					if (LLStringOps::isDigit(jump_key) || (LLStringOps::isUpper(jump_key) &&
+						mJumpKeys.find(jump_key) == mJumpKeys.end()))
 					{
 						mJumpKeys.insert(std::pair<KEY, LLMenuItemGL*>(jump_key, (*item_it)));
 						(*item_it)->setJumpKey(jump_key);
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index b11dcc1608a3645ba8fee8aaa1fe36a009d26ea5..644f1695d4c5343637136a182aa8ba709b0b3e0c 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -309,8 +309,8 @@ void LLDrawPoolBump::endRenderPass(S32 pass)
 void LLDrawPoolBump::beginShiny(bool invisible)
 {
 	LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY);
-	if (!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)|| 
-		invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))
+	if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| 
+		(invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)))
 	{
 		return;
 	}
@@ -384,8 +384,8 @@ void LLDrawPoolBump::beginShiny(bool invisible)
 void LLDrawPoolBump::renderShiny(bool invisible)
 {
 	LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY);
-	if (!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)|| 
-		invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))
+	if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| 
+		(invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)))
 	{
 		return;
 	}
@@ -411,8 +411,8 @@ void LLDrawPoolBump::renderShiny(bool invisible)
 void LLDrawPoolBump::endShiny(bool invisible)
 {
 	LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY);
-	if (!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)|| 
-		invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))
+	if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| 
+		(invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)))
 	{
 		return;
 	}
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 69edccacf04ba66f9aeec3e91b750084378540eb..e179fa866bec86eafe462e01ad993f44a8367734 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -959,7 +959,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 			0.75f
 		};
 
-		if (getPoolType() != LLDrawPool::POOL_ALPHA && (LLPipeline::sRenderDeferred || LLPipeline::sRenderBump && tep->getShiny()))
+		if (getPoolType() != LLDrawPool::POOL_ALPHA && (LLPipeline::sRenderDeferred || (LLPipeline::sRenderBump && tep->getShiny())))
 		{
 			color.mV[3] = U8 (alpha[tep->getShiny()] * 255);
 		}
diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp
index 3a5bec2be0c634497aea267dbbdb50d14198c8c6..77461e8f0d5c378c7cba7ecc32f4c1484c44d9ab 100644
--- a/indra/newview/llhudeffectlookat.cpp
+++ b/indra/newview/llhudeffectlookat.cpp
@@ -421,8 +421,8 @@ BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec
 	BOOL lookAtChanged = (target_type != mTargetType) || (object != mTargetObject);
 
 	// lookat position has moved a certain amount and we haven't just sent an update
-	lookAtChanged = lookAtChanged || (dist_vec(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE) && 
-		((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC));
+	lookAtChanged = lookAtChanged || ((dist_vec(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE) && 
+		((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC)));
 
 	if (lookAtChanged)
 	{
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index f8b824732fee092ca8bb9bda4e709600a26c9fc8..cc3d6a364da1d9ecf99127197fb7bb1c6e32a5d1 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -1671,9 +1671,9 @@ class LLOctreeCullDetectVisible: public LLOctreeCullShadow
 	virtual bool earlyFail(LLSpatialGroup* group)
 	{
 		if (mResult || //already found a node, don't check any more
-			group->mOctreeNode->getParent() &&	//never occlusion cull the root node
+			(group->mOctreeNode->getParent() &&	//never occlusion cull the root node
 			LLPipeline::sUseOcclusion &&			//ignore occlusion if disabled
-			group->isState(LLSpatialGroup::OCCLUDED))
+			group->isState(LLSpatialGroup::OCCLUDED)))
 		{
 			return true;
 		}
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 986555db49e0f8b8cb993d3d34b57ee732aca971..92c9f3f553d814c3a888a8b56a44f796b2be727d 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -189,8 +189,8 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
 			} // else nothing (fall through to touch)
 			
 		case CLICK_ACTION_PAY:
-			if (object && object->flagTakesMoney()
-				|| parent && parent->flagTakesMoney())
+			if ((object && object->flagTakesMoney())
+				|| (parent && parent->flagTakesMoney()))
 			{
 				// pay event goes to object actually clicked on
 				mClickActionObject = object;
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index 72d1494d9632b9bbe2a163db08d6ea6a00591eb5..b7612d901c5ff2bb092fc42c91112533673e850c 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -759,8 +759,8 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts)
 
 			BOOL in_frustum = pointInFrustum(LLVector3(vec)) > 0;
 
-			if ( !in_frustum && all_verts ||
-				 in_frustum && !all_verts)
+			if (( !in_frustum && all_verts) ||
+				 (in_frustum && !all_verts))
 			{
 				return !all_verts;
 			}
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index 15c814829c02c1d7ab20b6ec8567b1f1967cb002..cc3d4ea594dc3a4e39545e37e7c83b22ff7553b7 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -683,7 +683,7 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c
 			if (idx >=2 && idx <= 12)
 			{
 				U32 keyidx = ((mask<<16)|key);
-				(mRemapKeys[mode])[keyidx] = ((0<<16)|KEY_F1+(idx-1));
+				(mRemapKeys[mode])[keyidx] = ((0<<16)|(KEY_F1+(idx-1)));
 				return TRUE;
 			}
 		}
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 6591cd3b19c732fd4032b0b46bc805a637682940..8e8f882d7533ec9442b3953ed7c2e623732739f2 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -637,8 +637,8 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp)
 	
 	BOOL ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL);
 	gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
-	if(	old_parent != parentp &&
-		old_parent || (parentp && parentp->isActive()))
+	if(	(old_parent != parentp && old_parent)
+		|| (parentp && parentp->isActive()))
 	{
 		// *TODO we should not be relying on setDrawable parent to call markMoved
 		gPipeline.markMoved(mDrawable, FALSE);
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 983a580fea2163e2c63aa9e8b432bcdcc611314b..e7f283a11c97db9f997a0199493ed687bc2b6f4a 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1539,7 +1539,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
 		)
 {
 
-	if (mIsSelf && !gAgent.needsRenderAvatar() || !LLPipeline::sPickAvatar)
+	if ((mIsSelf && !gAgent.needsRenderAvatar()) || !LLPipeline::sPickAvatar)
 	{
 		return FALSE;
 	}
@@ -9015,9 +9015,9 @@ BOOL LLVOAvatar::updateLOD()
 
 	LLFace* facep = mDrawable->getFace(0);
 	if (facep->mVertexBuffer.isNull() ||
-		LLVertexBuffer::sEnableVBOs &&
+		(LLVertexBuffer::sEnableVBOs &&
 		((facep->mVertexBuffer->getUsage() == GL_STATIC_DRAW ? TRUE : FALSE) !=
-		(facep->getPool()->getVertexShaderLevel() > 0 ? TRUE : FALSE)))
+		(facep->getPool()->getVertexShaderLevel() > 0 ? TRUE : FALSE))))
 	{
 		mDirtyMesh = TRUE;
 	}
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index d4df1414773e20d17669da41bb972dc6b65b74fa..bbc5daf847fcb9bce900fa191b0c7481fe36bccd 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -1095,10 +1095,10 @@ BOOL LLVOSky::updateSky()
 							   mLastTotalAmbient.mV[2] - mTotalAmbient.mV[2]);
 
 			if ( mForceUpdate 
-				 || ((dot_lighting < LIGHT_DIRECTION_THRESHOLD)
+				 || (((dot_lighting < LIGHT_DIRECTION_THRESHOLD)
 				 || (delta_color.length() > COLOR_CHANGE_THRESHOLD)
 				 || !mInitialized)
-				&& !direction.isExactlyZero())
+				&& !direction.isExactlyZero()))
 			{
 				mLastLightingDirection = direction;
 				mLastTotalAmbient = mTotalAmbient;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index dd68733d98622bf70928dc155092a12c5b9279c4..6079f0214731497bb4f6ff7423f5b88e70f2bcfb 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -470,8 +470,8 @@ void LLVOVolume::updateTextures()
 
 		if (face->mTextureMatrix != NULL)
 		{
-			if (vsize < MIN_TEX_ANIM_SIZE && old_size > MIN_TEX_ANIM_SIZE ||
-				vsize > MIN_TEX_ANIM_SIZE && old_size < MIN_TEX_ANIM_SIZE)
+			if ((vsize < MIN_TEX_ANIM_SIZE && old_size > MIN_TEX_ANIM_SIZE) ||
+				(vsize > MIN_TEX_ANIM_SIZE && old_size < MIN_TEX_ANIM_SIZE))
 			{
 				gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD, FALSE);
 			}
@@ -2387,7 +2387,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 						{ //needs normal + binormal
 							bump_faces.push_back(facep);
 						}
-						else if (te->getShiny() && LLPipeline::sRenderBump ||
+						else if ((te->getShiny() && LLPipeline::sRenderBump) ||
 							!te->getFullbright())
 						{ //needs normal
 							simple_faces.push_back(facep);