diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index de3e482613197a325df08a552a956dec3f80598a..d9b6495883f09244699db68498b7486df890a733 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -2081,7 +2081,7 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
 					{
 						// Don't change model's name if possible, it will play havoc with scenes that already use said model.
 						size_t ext_pos = getSuffixPosition(model->mLabel);
-						if (ext_pos != -1)
+						if (ext_pos != std::string::npos)
 						{
 							label = model->mLabel.substr(0, ext_pos);
 						}
@@ -2323,7 +2323,7 @@ std::string LLDAELoader::getElementLabel(daeElement *element)
 			// make sure that index won't mix up with pre-named lod extensions
 			size_t ext_pos = getSuffixPosition(name);
 
-			if (ext_pos == -1)
+			if (ext_pos == std::string::npos)
 			{
 				return name + index_string;
 			}
@@ -2348,11 +2348,11 @@ std::string LLDAELoader::getElementLabel(daeElement *element)
 // static
 size_t LLDAELoader::getSuffixPosition(std::string label)
 {
-	if ((label.find("_LOD") != -1) || (label.find("_PHYS") != -1))
+	if ((label.find("_LOD") != std::string::npos) || (label.find("_PHYS") != std::string::npos))
 	{
 		return label.rfind('_');
 	}
-	return -1;
+	return std::string::npos;
 }
 
 // static
@@ -2360,7 +2360,7 @@ std::string LLDAELoader::getLodlessLabel(daeElement *element)
 {
 	std::string label = getElementLabel(element);
 	size_t ext_pos = getSuffixPosition(label);
-	if (ext_pos != -1)
+	if (ext_pos != std::string::npos)
 	{
 		return label.substr(0, ext_pos);
 	}
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index aa6a793720dc0b43313962454a31395fb8240978..6d6b172a9806946a2ce2120230b74a5646f64cba 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -187,7 +187,7 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p)
 	{
 		mAcceleratorMask |= MASK_SHIFT;
 	}
-	S32 pipe_pos = shortcut.rfind("|");
+	size_t pipe_pos = shortcut.rfind("|");
 	std::string key_str = shortcut.substr(pipe_pos+1);
 
 	LLKeyboard::keyFromString(key_str, &mAcceleratorKey);
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 0c7a420e05602379cfbc86da69f6b823d51566d6..ad3323426247ec9212653c63f011ba34b289a37c 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -2530,7 +2530,7 @@ void LLTextBase::appendAndHighlightText(const std::string &new_text, S32 highlig
 	std::string::size_type start = 0;
 	std::string::size_type pos = new_text.find("\n",start);
 	
-	while(pos!=-1)
+	while(pos != std::string::npos)
 	{
 		if(pos!=start)
 		{
diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp
index 0b36241da0775d7ffca17ab0b869a00598bc9def..5b66fd1af7c72369db72a1c4bf5d6abd148f4158 100644
--- a/indra/llui/lltextparser.cpp
+++ b/indra/llui/lltextparser.cpp
@@ -73,8 +73,8 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight)
 			found = (! ltext.find(pattern) ? 0 : std::string::npos);
 			break;
 		case ENDS_WITH:
-			S32 pos = ltext.rfind(pattern); 
-			if (pos >= 0 && (ltext.length()-pattern.length()==pos)) found = pos;
+			size_t pos = ltext.rfind(pattern); 
+			if (pos != std::string::npos && pos >= 0 && (ltext.length()-pattern.length()==pos)) found = pos;
 			break;
 	}
 	return found;
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp
index fb3701245e81ec941ab256fe50a8d520e070f60c..afd95b1afa94da904d3cc0c4bdebe661688e461f 100644
--- a/indra/llvfs/lldir_win32.cpp
+++ b/indra/llvfs/lldir_win32.cpp
@@ -232,7 +232,7 @@ LLDir_Win32::LLDir_Win32()
 	{
 		w_str[size] = '\0';
 		mExecutablePathAndName = ll_convert_wide_to_string(w_str);
-		S32 path_end = mExecutablePathAndName.find_last_of('\\');
+		std::string::size_type path_end = mExecutablePathAndName.find_last_of('\\');
 		if (path_end != std::string::npos)
 		{
 			mExecutableDir = mExecutablePathAndName.substr(0, path_end);
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 28f783f8758143bb7e5c0bc00450947564467843..0ba11c439d77ad94bf79256c1a80b2d4fe13682b 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -696,8 +696,8 @@ class LLChatHistoryHeader: public LLPanel
 				 mSourceType == CHAT_SOURCE_AGENT)
 		{
 			//if it's an avatar name with a username add formatting
-			S32 username_start = chat.mFromName.rfind(" (");
-			S32 username_end = chat.mFromName.rfind(')');
+			std::string::size_type username_start = chat.mFromName.rfind(" (");
+			std::string::size_type username_end = chat.mFromName.rfind(')');
 			
 			if (username_start != std::string::npos &&
 				username_end == (chat.mFromName.length() - 1))
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index af41c1c18ad83e28df09903a766da3b77ef94231..ed5779a06fdd853cb7c8a98995aa39c72ea85837 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -766,8 +766,8 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType
 bool LLFloaterIMNearbyChat::isWordsName(const std::string& name)
 {
 	// checking to see if it's display name plus username in parentheses
-	S32 open_paren = name.find(" (", 0);
-	S32 close_paren = name.find(')', 0);
+	std::string::size_type open_paren = name.find(" (", 0);
+	std::string::size_type close_paren = name.find(')', 0);
 
 	if (open_paren != std::string::npos &&
 		close_paren == name.length()-1)
@@ -777,7 +777,7 @@ bool LLFloaterIMNearbyChat::isWordsName(const std::string& name)
 	else
 	{
 		//checking for a single space
-		S32 pos = name.find(' ', 0);
+		std::string::size_type pos = name.find(' ', 0);
 		return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos;
 	}
 }
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 6b09362acd6c29f968486c17562bda69ba4d280a..0d79ff4aace3dd7abd6a40b21ce2357d13f53706 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -622,7 +622,7 @@ void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name)
 
 	if (!av_name.isValidName())
 	{
-		S32 separator_index = mName.rfind(" ");
+		std::string::size_type separator_index = mName.rfind(" ");
 		std::string name = mName.substr(0, separator_index);
 		++separator_index;
 		std::string conference_word = mName.substr(separator_index, mName.length());
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index d8f8be55156a67f395054667a8ccee9454ecc88b..d8073d93bf14d7ba155988aae34ce4e676011800 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -120,7 +120,7 @@ LLViewerFetchedTexture* bindMaterialDiffuseTexture(const LLImportMaterial& mater
 
 std::string stripSuffix(std::string name)
 {
-    if ((name.find("_LOD") != -1) || (name.find("_PHYS") != -1))
+    if ((name.find("_LOD") != std::string::npos) || (name.find("_PHYS") != std::string::npos))
     {
         return name.substr(0, name.rfind('_'));
     }
@@ -445,7 +445,7 @@ void LLModelPreview::rebuildUploadData()
 
                     std::string toAdd = getLodSuffix(extensionLOD);
 
-                    if (name_to_match.find(toAdd) == -1)
+                    if (name_to_match.find(toAdd) == std::string::npos)
                     {
                         name_to_match += toAdd;
                     }
@@ -472,7 +472,7 @@ void LLModelPreview::rebuildUploadData()
 
                             std::string toAdd = getLodSuffix(searchLOD);
 
-                            if (name_to_match.find(toAdd) == -1)
+                            if (name_to_match.find(toAdd) == std::string::npos)
                             {
                                 name_to_match += toAdd;
                             }
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 9fc5c74d1eb744cc22d164ff0c8b1fc264260b00..5a8a00a70dcb17fea97bdd26157bedf3f997f21e 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -747,7 +747,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain,
 {
 	// split wildcard into the portion before the *, and the portion after
 
-	int wildcard_pos = wildcard.find_first_of('*');	
+	std::string::size_type wildcard_pos = wildcard.find_first_of('*');	
 	// check the case where there is no wildcard.
 	if(wildcard_pos == wildcard.npos)
 	{
@@ -779,7 +779,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain,
 	std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos);
 	
 	// iterate through the current subdomain, finding instances of the match string.
-	int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string);
+	std::string::size_type sub_pos = new_subdomain.find_first_of(new_wildcard_match_string);
 	while(sub_pos != std::string::npos)
 	{
 		new_subdomain = new_subdomain.substr(sub_pos, std::string::npos);
@@ -811,8 +811,8 @@ bool _cert_hostname_wildcard_match(const std::string& hostname, const std::strin
 	std::string new_cn = common_name;
 	
 	// find the last '.' in the hostname and the match name.
-	int subdomain_pos = new_hostname.find_last_of('.');
-	int subcn_pos = new_cn.find_last_of('.');
+	std::string::size_type subdomain_pos = new_hostname.find_last_of('.');
+	std::string::size_type subcn_pos = new_cn.find_last_of('.');
 	
 	// if the last char is a '.', strip it
 	if(subdomain_pos == (new_hostname.length()-1))
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 3f1fa4be6d1ae57c6dba828037465cc428e169d2..3f8726cc406db0a40e905793cbf88585000aea9e 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -358,7 +358,7 @@ bool idle_startup()
 
 	const std::string delims (" ");
 	std::string system;
-	int begIdx, endIdx;
+	std::string::size_type begIdx, endIdx;
 	std::string osString = LLOSInfo::instance().getOSStringSimple();
 
 	begIdx = osString.find_first_not_of (delims);