diff --git a/indra/linux_crash_logger/linux_crash_logger.cpp b/indra/linux_crash_logger/linux_crash_logger.cpp
index 54c257b77b0dce6afb6078eeae488f4a0c8fa591..a829944118af55bc9901232437dfb09d01642744 100644
--- a/indra/linux_crash_logger/linux_crash_logger.cpp
+++ b/indra/linux_crash_logger/linux_crash_logger.cpp
@@ -8,9 +8,6 @@
 
 #include "linden_common.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index 1b4c952e8e30735d561f992d24c1d37e576a950a..f2dd75b7ee06005bfff0939e37771c80ef91162e 100644
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -7,11 +7,6 @@
 
 #include "linden_common.h"
 
-#include <vector>
-#include <iterator>
-#include <algorithm>
-#include <stdio.h>
-
 #include "llaudiodecodemgr.h"
 
 #include "vorbisdecode.h"
diff --git a/indra/llcharacter/llanimationstates.cpp b/indra/llcharacter/llanimationstates.cpp
index 58ba252e04ab42668b79e5951d3d0046180e9224..9e21e934c4145e166c24c9be392969c6e72f5a4e 100644
--- a/indra/llcharacter/llanimationstates.cpp
+++ b/indra/llcharacter/llanimationstates.cpp
@@ -12,8 +12,6 @@
 
 #include "linden_common.h"
 
-#include <string.h>
-
 #include "llanimationstates.h"
 #include "llstring.h"
 
diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp
index 3be8e121c6745b2c21ff5fdb5e09467581e68d4f..b1eb05f117c33b2a5885ad97bae4131bf6f3b56d 100644
--- a/indra/llcharacter/llbvhloader.cpp
+++ b/indra/llcharacter/llbvhloader.cpp
@@ -9,6 +9,9 @@
 #include "linden_common.h"
 
 #include "llbvhloader.h"
+
+#include <boost/tokenizer.hpp>
+
 #include "lldatapacker.h"
 #include "lldir.h"
 #include "llkeyframemotion.h"
@@ -16,11 +19,6 @@
 #include "llstl.h"
 #include "llapr.h"
 
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <llquaternion.h>
-#include <boost/tokenizer.hpp>
 
 using namespace std;
 
diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h
index 7e00e1d5f4e1e5a7d5e121f92003584d8b3836a0..8f6de27be1afa0ac43fd3b40acace2722840d956 100644
--- a/indra/llcharacter/llbvhloader.h
+++ b/indra/llcharacter/llbvhloader.h
@@ -9,11 +9,6 @@
 #ifndef LL_LLBVHLOADER_H
 #define LL_LLBVHLOADER_H
 
-#include <string>
-#include <vector>
-#include <map>
-#include <stdtypes.h>
-#include <stdio.h>
 #include "v3math.h"
 #include "m3math.h"
 #include "llmath.h"
diff --git a/indra/llcharacter/lljointsolverrp3.cpp b/indra/llcharacter/lljointsolverrp3.cpp
index 60b836734ac132b10544aaad2edeab4417b6ce09..351b767622197f10dd0dd5f9f38b83fd40fe190e 100644
--- a/indra/llcharacter/lljointsolverrp3.cpp
+++ b/indra/llcharacter/lljointsolverrp3.cpp
@@ -13,8 +13,6 @@
 
 #include "lljointsolverrp3.h"
 
-#include <math.h>
-
 #include "llmath.h"
 
 #define F_EPSILON 0.00001f
diff --git a/indra/llcommon/ctype_workaround.h b/indra/llcommon/ctype_workaround.h
index 8c52b0290c42425aa64e450b8454df6dce38f5f8..5b095c8c1949de92ef7d3e669ab255e5f4a38ab8 100644
--- a/indra/llcommon/ctype_workaround.h
+++ b/indra/llcommon/ctype_workaround.h
@@ -18,7 +18,7 @@
  * -- Leviathan 20060113
 */
 
-#include <ctype.h>
+#include <cctype>
 
 __const unsigned short int *__ctype_b;
 __const __int32_t *__ctype_tolower;
diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h
index 5826bc917d48b0f2657c1d22ae7283d1efb1ce44..73dfc53c613fbdba6227aa31a9563fa0f3258ff6 100644
--- a/indra/llcommon/linden_common.h
+++ b/indra/llcommon/linden_common.h
@@ -11,34 +11,42 @@
 
 #include "llpreprocessor.h"
 
-#include <string.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstring>
+#include <cfloat>
+#include <climits>
+#include <cmath>
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
+#include <iostream>
+#include <fstream>
 
 // Work around stupid Microsoft STL warning
 #ifdef LL_WINDOWS
 #pragma warning (disable : 4702) // warning C4702: unreachable code
 #endif	//	LL_WINDOWS
 
-#include <iostream>
-#include <fstream>
+#include <algorithm>
+#include <list>
+#include <map>
 #include <vector>
 #include <string>
-#include "llfile.h"
 
+#ifdef LL_WINDOWS
+#pragma warning (3 : 4702) // we like level 3, not 4
+#endif	//	LL_WINDOWS
+
+// Linden only libs in alpha-order other than stdtypes.h
 #include "stdtypes.h"
 #include "lldefs.h"
 #include "llerror.h"
 #include "llextendedstatus.h"
+#include "llfasttimer.h"
+#include "llfile.h"
 #include "llformat.h"
 #include "llstring.h"
-#include "lltimer.h"
-#include "llfasttimer.h"
 #include "llsys.h"
-
-#ifdef LL_WINDOWS
-#pragma warning (3 : 4702) // we like level 3, not 4
-#endif	//	LL_WINDOWS
+#include "lltimer.h"
 
 #endif
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index b5378943ca2deca24a9d0d51f415a87728295d9e..4b37f0d188ea4573a0ca3049abd69c022251c076 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -10,8 +10,6 @@
 
 #include "llassettype.h"
 
-#include <time.h>
-
 #include "llstring.h"
 #include "lltimer.h"
 
diff --git a/indra/llcommon/llcriticaldamp.cpp b/indra/llcommon/llcriticaldamp.cpp
index ee7dfecdaae7272e652fcf3cd54b1a31c2d8f010..1757f16c995fc7084e90f3004280ff0e10406197 100644
--- a/indra/llcommon/llcriticaldamp.cpp
+++ b/indra/llcommon/llcriticaldamp.cpp
@@ -7,7 +7,6 @@
  */
 
 #include "linden_common.h"
-#include <math.h>
 
 #include "llcriticaldamp.h"
 
diff --git a/indra/llcommon/lldlinked.h b/indra/llcommon/lldlinked.h
index 54087848d9e1b0e4c7f3d28f3f96556761ce172c..1e5ddfd1a43d56ec2d65ce5074312dfb727d08c1 100644
--- a/indra/llcommon/lldlinked.h
+++ b/indra/llcommon/lldlinked.h
@@ -8,8 +8,6 @@
 #ifndef LL_LLDLINKED_H
 #define LL_LLDLINKED_H
 
-#include <stdlib.h>
-
 template <class Type> class LLDLinked
 {
 	LLDLinked* mNextp;
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 90ea72f24cc194673e205ea00aac58352ce409c2..98972950b76273acba7eb6c35638019d683aa0ab 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -12,33 +12,28 @@
 #include "llerror.h"
 #include "llerrorcontrol.h"
 
-#include "llapp.h"
-#include "llapr.h"
-#include "llfile.h"
-#include "llfixedbuffer.h"
-#include "lllivefile.h"
-#include "llsd.h"
-#include "llsdserialize.h"
-#include "llstl.h"
-
-#include <algorithm>
 #include <cctype>
-#include <map>
+#ifdef __GNUC__
+#include <cxxabi.h>
+#endif
 #include <sstream>
 #if !LL_WINDOWS
-#include <stdio.h>
 #include <syslog.h>
 #endif
-#include <time.h>
 #if LL_WINDOWS
 #include <windows.h>
 #endif
 #include <vector>
 
+#include "llapp.h"
+#include "llapr.h"
+#include "llfile.h"
+#include "llfixedbuffer.h"
+#include "lllivefile.h"
+#include "llsd.h"
+#include "llsdserialize.h"
+#include "llstl.h"
 
-#ifdef __GNUC__
-#include <cxxabi.h>
-#endif
 
 namespace {
 #if !LL_WINDOWS
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index 3e88784d3c0694a06a66dea07680c52e411b99db..648c4bab4ea9a9a991e7091bd5a2f2e7af136ff5 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -9,8 +9,6 @@
 #ifndef LL_LLFASTTIMER_H
 #define LL_LLFASTTIMER_H
 
-#include "lltimer.h"
-
 #define FAST_TIMER_ON 1
 
 U64 get_cpu_clock_count();
diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h
index 605918cd29d2b65334b1392caba7e3ba73a07108..77bd20e274cd77b10dadd0fd8ccbf44943554948 100644
--- a/indra/llcommon/llfile.h
+++ b/indra/llcommon/llfile.h
@@ -17,12 +17,6 @@
  * Attempts to mostly mirror the POSIX style IO functions.
  */
 
-#include <string>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <fstream>
-#include "stdtypes.h"
-
 typedef FILE	LLFILE;
 
 #ifdef LL_WINDOWS
@@ -36,6 +30,7 @@ typedef FILE	LLFILE;
 // windows version of stat function and stat data structure are called _stat
 typedef struct _stat	llstat;
 #else
+#include <sys/stat.h>
 typedef struct stat		llstat;
 #endif
 
diff --git a/indra/llcommon/llformat.cpp b/indra/llcommon/llformat.cpp
index 0c2a6d3b1e27655498e3e399da596d38783f2352..9bfdb14446d38551b6c2972a3570dc0c8f39f2ee 100644
--- a/indra/llcommon/llformat.cpp
+++ b/indra/llcommon/llformat.cpp
@@ -11,7 +11,7 @@
 
 #include "llformat.h"
 
-#include <stdarg.h>
+#include <cstdarg>
 
 std::string llformat(const char *fmt, ...)
 {
diff --git a/indra/llcommon/llformat.h b/indra/llcommon/llformat.h
index 7079656b72ebf60c37621fd639aa4153b9ac3c29..31ee3194d38115777c5f958aee7f2cd7647fa11c 100644
--- a/indra/llcommon/llformat.h
+++ b/indra/llcommon/llformat.h
@@ -10,8 +10,6 @@
 #ifndef LL_LLFORMAT_H
 #define LL_LLFORMAT_H
 
-#include <string>
-
 // Use as follows:
 // llinfos << llformat("Test:%d (%.2f %.2f)", idx, x, y) << llendl;
 //
diff --git a/indra/llcommon/llmap.h b/indra/llcommon/llmap.h
index fc958421daea95e63f137eee02b7a1cae9dbdd8b..97af9f5ec9391d5f4d35a2b1ea73a75749d1aca9 100644
--- a/indra/llcommon/llmap.h
+++ b/indra/llcommon/llmap.h
@@ -9,10 +9,6 @@
 #ifndef LL_LLMAP_H
 #define LL_LLMAP_H
 
-#include <stdio.h>
-#include <utility>
-#include <map>
-
 // llmap uses the fast stl library code in a manner consistant with LLSkipMap, et. al. 
 
 template<class INDEX_TYPE, class MAPPED_TYPE> class LLMap
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index c8c565a05b9369483f49b52d5c94f5c661b8b739..c676a37a5edb024deccf07aca9cf19303149244e 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -28,9 +28,7 @@
 
 #include "processor.h"
 
-#include <stdio.h>
-#include <string.h>
-#include <memory.h>
+#include <memory>
 
 #if LL_WINDOWS
 #	define WIN32_LEAN_AND_MEAN
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 2fb9a0ab9cbb6866399e8b461c729176609d60be..aa522557046c736620a41ed05943a24842240b51 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -9,9 +9,6 @@
 #include "linden_common.h"
 #include "llsd.h"
 
-#include <sstream>
-#include <math.h>
-
 #include "llerror.h"
 #include "../llmath/llmath.h"
 #include "llformat.h"
diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h
index 8a32a04fc2f475af29ca59a02e2d915fb7efbeeb..541f1a9c81b9752c6ddd1a367f0b4fddcd673c03 100644
--- a/indra/llcommon/llstl.h
+++ b/indra/llcommon/llstl.h
@@ -10,15 +10,9 @@
 #define LL_LLSTL_H
 
 #include <functional>
-#include <algorithm>
-#include <map>
-#include <vector>
 #include <set>
 #include <deque>
 
-#include <stdio.h>
-#include <stdarg.h>
-
 // Use to compare the first element only of a pair
 // e.g. typedef std::set<std::pair<int, Data*>, compare_pair<int, Data*> > some_pair_set_t; 
 template <typename T1, typename T2>
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 0b799b94ae37f842425de9d9d6c9c8caacbcc713..2d7c9033412af3a36fc5b4e10627daa79e8e49f3 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -35,6 +35,26 @@ U8 hex_as_nybble(char hex)
 }
 
 
+bool _read_file_into_string(std::string& str, const char* filename)
+{
+	llifstream ifs(filename, llifstream::binary);
+	if (!ifs.is_open())
+	{
+		llinfos << "Unable to open file" << filename << llendl;
+		return false;
+	}
+
+	std::ostringstream oss;
+
+	oss << ifs.rdbuf();
+	str = oss.str();
+	ifs.close();
+	return true;
+}
+
+
+
+
 // See http://www.unicode.org/Public/BETA/CVTUTF-1-2/ConvertUTF.c
 // for the Unicode implementation - this doesn't match because it was written before finding
 // it.
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 3005155b1977a8c7733e6361e9dc8f4f4ff99da6..b922b2f8e59e09cb086d9c43515c584851c525d0 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -9,17 +9,6 @@
 #ifndef LL_LLSTRING_H
 #define LL_LLSTRING_H
 
-#include "stdtypes.h"
-#include "llerror.h"
-#include "llfile.h"
-#include <algorithm>
-#include <map>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <math.h>
-#include <stdarg.h> /* for vsnprintf */
 #if LL_LINUX || LL_SOLARIS
 #include <wctype.h>
 #include <wchar.h>
@@ -260,9 +249,6 @@ class LLStringBase : public std::basic_string<T>
 	 */
 	static void _makeASCII(std::basic_string<T>& string);
 
-	static BOOL	read(std::basic_string<T>& string, const char* filename);	 /*Flawfinder: ignore*/
-	static BOOL	write(std::basic_string<T>& string, const char* filename);
-
 	// Conversion to other data types
 	static BOOL	convertToBOOL(const std::basic_string<T>& string, BOOL& value);
 	static BOOL	convertToU8(const std::basic_string<T>& string, U8& value);
@@ -353,6 +339,16 @@ std::string ll_safe_string(const char* in);
  */
 U8 hex_as_nybble(char hex);
 
+/**
+ * @brief read the contents of a file into a string.
+ *
+ * Since this function has no concept of character encoding, most
+ * anything you do with this method ill-advised. Please avoid.
+ * @param str [out] The string which will have.
+ * @param filename The full name of the file to read.
+ * @return Returns true on success. If false, str is unmodified.
+ */
+bool _read_file_into_string(std::string& str, const char* filename);
 
 /**
  * Unicode support
@@ -913,8 +909,6 @@ void LLStringBase<T>::replaceNonstandardASCII( std::basic_string<T>& string, T r
 template<class T> 
 void LLStringBase<T>::replaceTabsWithSpaces( std::basic_string<T>& str, size_type spaces_per_tab )
 {
-	llassert( spaces_per_tab >= 0 );
-
 	const T TAB = '\t';
 	const T SPACE = ' ';
 
@@ -1017,11 +1011,10 @@ void LLStringBase<T>::copy( T* dst, const T* src, size_type dst_size )
 template<class T> 
 void LLStringBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_string<T>& src, size_type offset)
 {
-	llassert( offset <= dst.length() );
-
-	// special case - append to end of string and avoid expensive (when strings are large) string manipulations
 	if ( offset == dst.length() )
 	{
+		// special case - append to end of string and avoid expensive
+		// (when strings are large) string manipulations
 		dst += src;
 	}
 	else
@@ -1050,48 +1043,6 @@ BOOL LLStringBase<T>::isHead( const std::basic_string<T>& string, const T* s )
 	}
 }
 
-//static
-template<class T> 
-BOOL LLStringBase<T>::read(std::basic_string<T>& string, const char* filename)	 /*Flawfinder: ignore*/
-{
-	llifstream ifs(filename, llifstream::binary);
-	if (!ifs.is_open())
-	{
-		llinfos << "Unable to open file" << filename << llendl;
-		return FALSE;
-	}
-
-	std::basic_ostringstream<T> oss;
-
-	oss << ifs.rdbuf();
-
-	string = oss.str();
-
-	ifs.close();
-	return TRUE;
-}
-
-//static
-template<class T> 
-BOOL LLStringBase<T>::write(std::basic_string<T>& string, const char* filename)
-{
-#if LL_LINUX  || LL_SOLARIS
-    printf("STUBBED: LLStringBase<T>::write at %s:%d\n", __FILE__, __LINE__);
-#else
-	llofstream ofs(filename, llofstream::binary);
-	if (!ofs.is_open())
-	{
-		llinfos << "Unable to open file" << filename << llendl;
-		return FALSE;
-	}
-
-	ofs << string;
-
-	ofs.close();
-#endif
-	return TRUE;
-}
-
 template<class T> 
 BOOL LLStringBase<T>::convertToBOOL(const std::basic_string<T>& string, BOOL& value)
 {
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index b1b92ae2772f1527a78354ff73a78b3a8f541b71..86ec4c0d6168fa74c91a1000dbc7900818372db0 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -24,10 +24,12 @@
 #	include <winsock2.h>
 #	include <windows.h>
 #elif LL_DARWIN
+#	include <errno.h>
 #	include <sys/sysctl.h>
 #	include <sys/utsname.h>
 #	include <stdint.h>
 #elif LL_LINUX
+#	include <errno.h>
 #	include <sys/utsname.h>
 #	include <unistd.h>
 #	include <sys/sysinfo.h>
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 73e73b9c44da4cb328aa4ab4205138eb27931206..013fab096511ba7d6e11a47c35334f94c7516c75 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -16,13 +16,10 @@
 #	define WIN32_LEAN_AND_MEAN
 #	include <winsock2.h>
 #	include <windows.h>
-#	include <time.h>
 #elif LL_LINUX || LL_SOLARIS
-#	include <time.h>
 #	include <sys/time.h>
 #	include <sched.h>
 #elif LL_DARWIN
-#	include <time.h>
 #	include <sys/time.h>
 #else 
 #	error "architecture not supported"
diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h
index 6f67e19c4865d48c3082c6d6c8d22bc8a984f767..e6ea0325147721b29a5c91fa2a49775bf1767167 100644
--- a/indra/llcommon/lltimer.h
+++ b/indra/llcommon/lltimer.h
@@ -10,12 +10,9 @@
 #define LL_TIMER_H
 
 #if LL_LINUX || LL_DARWIN
-#		include <time.h>
-#		include <sys/time.h>
+#include <sys/time.h>
 #endif
 
-#include <list>
-
 // units conversions
 #ifndef USEC_PER_SEC
     const U32	USEC_PER_SEC	= 1000000;
diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h
index ccb843061d6c7707076b0dd1e315de9b549595a1..bc069f009daffaf4f75b961814671ff68b612dd5 100644
--- a/indra/llcommon/stdtypes.h
+++ b/indra/llcommon/stdtypes.h
@@ -8,9 +8,6 @@
 #ifndef LL_STDTYPES_H
 #define LL_STDTYPES_H
 
-#include <limits.h>
-#include <float.h>
-
 typedef signed char			S8;
 typedef unsigned char			U8;
 typedef signed short			S16;
diff --git a/indra/llcommon/timing.h b/indra/llcommon/timing.h
index 8952bc3b525e23ecaca603502f30aa9e1587b8ad..53e7a62a851adb7126a26212a099ce64e6b2e04e 100644
--- a/indra/llcommon/timing.h
+++ b/indra/llcommon/timing.h
@@ -9,10 +9,9 @@
 #ifndef LL_TIMING_H					
 #define LL_TIMING_H
 
-#include <time.h>
 
 #if LL_LINUX || LL_DARWIN || LL_SOLARIS
-#		include <sys/time.h>
+#include <sys/time.h>
 #endif
 
 
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 1ea0ac2714b4b5a6d2c0b73679505ec8acea34d8..ee039aee091c3dd0b5c5d0ef2ff2499b3be6db3b 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -8,18 +8,12 @@
 
 #include "linden_common.h"
 
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <algorithm>
-#include <iostream>
+#include "llimage.h"
 
 #include "llmath.h"
-#include "stdtypes.h"
 #include "v4coloru.h"
 #include "llmemtype.h"
 
-#include "llimage.h"
 #include "llimagebmp.h"
 #include "llimagetga.h"
 #include "llimagej2c.h"
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index 5ffed9fbb1667b0ef3b3e12288f1120fe66c1c5e..8db2e9c610e99d836596f00aff0807dce0a289e6 100644
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -9,7 +9,6 @@
 #ifndef LL_LLIMAGE_H
 #define LL_LLIMAGE_H
 
-#include "stdtypes.h"
 #include "lluuid.h"
 #include "llstring.h"
 #include "llmemory.h"
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 60c1ade38f308292d42f100d5ba0f8d064eecbec..3c32f7b92cca58537499d099ab2e25aeddc3a554 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -8,8 +8,6 @@
 
 #include "linden_common.h"
 
-#include <time.h>
-
 #include "llinventory.h"
 
 #include "lldbstrings.h"
diff --git a/indra/llinventory/lllandmark.cpp b/indra/llinventory/lllandmark.cpp
index 7cb145d3867c5af7613ea89369bf11d26001ccaa..0887d2890304dbab414a886cd5462d80a16e4893 100644
--- a/indra/llinventory/lllandmark.cpp
+++ b/indra/llinventory/lllandmark.cpp
@@ -9,10 +9,7 @@
 #include "linden_common.h"
 #include "lllandmark.h"
 
-#include <stdlib.h>
-#include <string.h>
 #include <errno.h>
-#include <stdio.h>  	// for sscanf() on linux
 
 #include "message.h"
 #include "llregionhandle.h"
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index d50c4f0d3bffe2c3046399baaebbc42a374e623a..b80fa58cd530f4d725be2f075d457abf1bb110f4 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -8,10 +8,6 @@
 #ifndef LL_LLPARCEL_H
 #define LL_LLPARCEL_H
 
-#include <time.h>
-#include <iostream>
-
-#include "lldarray.h"
 #include "lluuid.h"
 #include "llparcelflags.h"
 #include "llpermissions.h"
diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h
index 131db1a635f18d8fbbbf63ee4471fd80c29368dc..8c9064306ecbe88d40b38e11f5407dfc37605288 100644
--- a/indra/llinventory/llpermissions.h
+++ b/indra/llinventory/llpermissions.h
@@ -9,9 +9,6 @@
 #ifndef LL_LLPERMISSIONS_H
 #define LL_LLPERMISSIONS_H
 
-#include <stdio.h>
-#include <iostream>
-
 #include "llpermissionsflags.h"
 #include "llsd.h"
 #include "lluuid.h"
diff --git a/indra/llinventory/llsaleinfo.h b/indra/llinventory/llsaleinfo.h
index 2eceea87ef5e068740b7ab7e4aa39c7bbe39f9bf..30218459d5739f8b512fc3ebcb5869fa49bbd7a8 100644
--- a/indra/llinventory/llsaleinfo.h
+++ b/indra/llinventory/llsaleinfo.h
@@ -9,9 +9,6 @@
 #ifndef LL_LLSALEINFO_H
 #define LL_LLSALEINFO_H
 
-#include <stdio.h>
-#include <iostream>
-
 #include "llpermissionsflags.h"
 #include "llsd.h"
 #include "llxmlnode.h"
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index 5fa74f30f21afbb24c645c14579d38167b14b728..21f9d2aeb8b41647038c12d420978b9606c57525 100644
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -9,12 +9,6 @@
 #ifndef LLMATH_H
 #define LLMATH_H
 
-#include <cmath>
-#include <math.h>
-#include <stdlib.h>
-
-#include "lldefs.h"
-
 // work around for Windows & older gcc non-standard function names.
 #if LL_WINDOWS
 #define llisnan(val)	_isnan(val)
diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h
index 863318551e4f2dba9aa13f94a5bfe73252485e8f..f9af62f8420a64673bf58860edc0f27dc31d1841 100644
--- a/indra/llmath/v2math.h
+++ b/indra/llmath/v2math.h
@@ -9,8 +9,6 @@
 #ifndef LL_V2MATH_H
 #define LL_V2MATH_H
 
-#include <math.h>
-
 #include "llmath.h"
 
 class LLVector4;
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index b5a9e8a7278eae1dffde1a7178bee57d72dec372..b848b6488a2ee0ba3062053422e731ee820b02af 100644
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -9,11 +9,8 @@
 #include "linden_common.h"
 
 // system library includes
-#include <stdlib.h>
-#include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <algorithm>
 
 #include "llassetstorage.h"
 
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index f1d292502602fd25ec9f1a72040d20d15e1ebeab..ba3a927e92d392528f89b0e1699f199d87ed9824 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -10,13 +10,6 @@
 
 #include "llcachename.h"
 
-// system includes
-#include <string.h>		// strcpy
-#include <time.h>
-#include <algorithm>
-#include <functional>
-#include <map>
-
 // linden library includes
 #include "message.h"
 #include "llrand.h"
diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h
index 3c8a6587b13ffbd83cecb04df77fb04bc600f821..5580c314c03f35471da6b4c428638bda61a046a8 100644
--- a/indra/llmessage/llcachename.h
+++ b/indra/llmessage/llcachename.h
@@ -9,9 +9,6 @@
 #ifndef LL_LLCACHENAME_H
 #define LL_LLCACHENAME_H
 
-// Forward declarations
-#include <stdio.h>
-
 class LLMessageSystem;
 class LLHost;
 class LLUUID;
diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp
index 74a6a871c06d6c687659bdd76e893f18b8b9fda2..2d1822a337c9aaebdf8974757be2e33268323c99 100644
--- a/indra/llmessage/lldatapacker.cpp
+++ b/indra/llmessage/lldatapacker.cpp
@@ -6,8 +6,6 @@
  * $License$
  */
 
-#include <string.h>
-
 #include "linden_common.h"
 
 #include "lldatapacker.h"
diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h
index 01c3ebb347ccc8a531669b52738f7f3ea2e383ae..b288ec67ddfb40441144e8a502e3888dc64ac042 100644
--- a/indra/llmessage/lldatapacker.h
+++ b/indra/llmessage/lldatapacker.h
@@ -9,11 +9,6 @@
 #ifndef LL_LLDATAPACKER_H 
 #define LL_LLDATAPACKER_H
 
-#include <stdio.h>
-#include <iostream>
-
-#include "llerror.h"
-
 class LLColor4;
 class LLColor4U;
 class LLVector2;
diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h
index f3d0d0d3387ce0e6a94285b238e5901608e7fd74..82217f700e57a79aca816f6f0a48d4d0906c9183 100644
--- a/indra/llmessage/llnamevalue.h
+++ b/indra/llmessage/llnamevalue.h
@@ -9,13 +9,9 @@
 #ifndef LL_LLNAMEVALUE_H
 #define LL_LLNAMEVALUE_H
 
-#include <iostream>
-#include <string.h>
-
 #include "string_table.h"
 #include "llskipmap.h"
 #include "llmath.h"
-//#include "vmath.h"
 #include "v3math.h"
 #include "lldbstrings.h"
 
diff --git a/indra/llmessage/llpartdata.h b/indra/llmessage/llpartdata.h
index 662d635a088919a33030084f13d6ca552327d99b..18e049ae7a720125c2cc18eb9731f0dcb07cefac 100644
--- a/indra/llmessage/llpartdata.h
+++ b/indra/llmessage/llpartdata.h
@@ -9,8 +9,6 @@
 #ifndef LL_LLPARTDATA_H
 #define LL_LLPARTDATA_H
 
-#include <stdio.h>
-
 #include "lluuid.h"
 #include "v3math.h"
 #include "v3dmath.h"
diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h
index 41d104231c7fb28b8a8aa5e2f48cf073ff65e43e..823857926221e7ccf70ce6051c109d975b5743f2 100644
--- a/indra/llmessage/llregionhandle.h
+++ b/indra/llmessage/llregionhandle.h
@@ -9,8 +9,6 @@
 #ifndef LL_LLREGIONHANDLE_H
 #define LL_LLREGIONHANDLE_H
 
-#include <math.h>
-
 #include "indra_constants.h"
 #include "v3math.h"
 #include "v3dmath.h"
diff --git a/indra/llmessage/lltransfersourcefile.h b/indra/llmessage/lltransfersourcefile.h
index fcb5743fb5b312ad58dcc215190703e2711e5f19..eb0ff6f7774ed580feed94ff3d55e62f9f01da71 100644
--- a/indra/llmessage/lltransfersourcefile.h
+++ b/indra/llmessage/lltransfersourcefile.h
@@ -11,8 +11,6 @@
 
 #include "lltransfermanager.h"
 
-#include <stdio.h>
-
 class LLTransferSourceParamsFile : public LLTransferSourceParams
 {
 public:
diff --git a/indra/llmessage/lltransfertargetfile.h b/indra/llmessage/lltransfertargetfile.h
index eb000e527e81cbf894534e71a6d9b6ad90a80f46..628bce7e3ff05ae5daae511f56c658f37d9c60d9 100644
--- a/indra/llmessage/lltransfertargetfile.h
+++ b/indra/llmessage/lltransfertargetfile.h
@@ -11,8 +11,6 @@
 
 #include "lltransfermanager.h"
 
-#include <stdio.h>
-
 typedef void (*LLTTFCompleteCallback)(const LLTSCode status, void *user_data);
 
 class LLTransferTargetParamsFile : public LLTransferTargetParams
diff --git a/indra/llmessage/llxfer_file.h b/indra/llmessage/llxfer_file.h
index 38c94f6591a6eb0720ebb5c8fc3227fc0c0b962c..80f6526dd7ceffdc41a7ab47a3d39d80094c8eba 100644
--- a/indra/llmessage/llxfer_file.h
+++ b/indra/llmessage/llxfer_file.h
@@ -9,8 +9,6 @@
 #ifndef LL_LLXFER_FILE_H
 #define LL_LLXFER_FILE_H
 
-#include <stdio.h>
-
 #include "llxfer.h"
 #include "lldir.h"
 
diff --git a/indra/llmessage/llxfer_mem.h b/indra/llmessage/llxfer_mem.h
index 6577132c9b892f4b281a17841da97beedc85eb59..05a38af7b71b055545dccdb415de0ed53f0cafd0 100644
--- a/indra/llmessage/llxfer_mem.h
+++ b/indra/llmessage/llxfer_mem.h
@@ -9,8 +9,6 @@
 #ifndef LL_LLXFER_MEM_H
 #define LL_LLXFER_MEM_H
 
-#include <stdio.h>
-
 #include "message.h"
 #include "lltimer.h"
 #include "llxfer.h"
diff --git a/indra/llmessage/llxfer_vfile.h b/indra/llmessage/llxfer_vfile.h
index a5dce0352c7c2b8d672ec42e59ab292f1d99f53d..552f05ce773d9f5ce8d0dc94cbc4cba996573021 100644
--- a/indra/llmessage/llxfer_vfile.h
+++ b/indra/llmessage/llxfer_vfile.h
@@ -9,8 +9,6 @@
 #ifndef LL_LLXFER_VFILE_H
 #define LL_LLXFER_VFILE_H
 
-#include <stdio.h>
-
 #include "llxfer.h"
 #include "llassetstorage.h"
 
diff --git a/indra/llmessage/mean_collision_data.h b/indra/llmessage/mean_collision_data.h
index 7d3f90cde6f5cfed8cbd10d61a7a8be7f584a4fd..48df6995619cbe7b175b41e30aad7ecf1ed6461a 100644
--- a/indra/llmessage/mean_collision_data.h
+++ b/indra/llmessage/mean_collision_data.h
@@ -10,8 +10,8 @@
 #ifndef LL_MEAN_COLLISIONS_DATA_H
 #define LL_MEAN_COLLISIONS_DATA_H
 
-#include <time.h>
 #include "lldbstrings.h"
+#include "lluuid.h"
 
 const F32 MEAN_COLLISION_TIMEOUT = 5.f;
 const S32 MAX_MEAN_COLLISIONS = 5;
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index 5077354533e1ea7148c0d5d98157ead955fdfdef..7f9f440c80d6c4036116d5d25cbf41c6e2d981fc 100644
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -18,10 +18,6 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <cstring>
-#include <time.h>
 #include <iomanip>
 #include <iterator>
 #include <sstream>
@@ -355,8 +351,8 @@ void LLMessageSystem::loadTemplateFile(const char* filename)
 		return;
 	}
 
-	LLString template_body;
-	if(!LLString::read(template_body, filename))
+	std::string template_body;
+	if(!_read_file_into_string(template_body, filename))
 	{
 		llwarns << "Failed to open template: " << filename << llendl;
 		mbError = TRUE;
diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h
index 2f875f2b965be8fdf1402ebd239a1db04cba954c..04bc058cb679f11f5e99b08fcd045255f9cb24cb 100644
--- a/indra/llmessage/message.h
+++ b/indra/llmessage/message.h
@@ -10,8 +10,6 @@
 #define LL_MESSAGE_H
 
 #include <cstring>
-#include <stdio.h>
-#include <map>
 #include <set>
 
 #if LL_LINUX
diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp
index 2d3215f47c4075832c6eb73cb65dba0bab0a6ac5..615af0915a42a0fa9d1ed444ccc5caff87545c5e 100644
--- a/indra/llmessage/net.cpp
+++ b/indra/llmessage/net.cpp
@@ -12,7 +12,6 @@
 
 // system library includes
 #include <stdexcept>
-#include <stdio.h>
 
 #if LL_WINDOWS
 	#define WIN32_LEAN_AND_MEAN
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index b87d82653aaa91a93b97f158f1a112b24b7f4f6b..65e6a4921bac7bc8d3449a003d8d5122c7d61e08 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -11,23 +11,21 @@
 
 #include "llview.h"
 
-#include "llstring.h"
-#include "llrect.h"
-#include "llgl.h"
+#include <cassert>
+#include <boost/tokenizer.hpp>
+
 #include "llevent.h"
 #include "llfontgl.h"
 #include "llfocusmgr.h"
+#include "llgl.h"
 #include "llglheaders.h"
-#include "llwindow.h"
+#include "llrect.h"
 #include "llstl.h"
-#include "lluictrl.h"
 #include "llui.h"	// colors saved settings
+#include "lluictrl.h"
+#include "llwindow.h"
 #include "v3color.h"
-#include "llstl.h"
-
-#include <boost/tokenizer.hpp>
 
-#include <assert.h>
 
 BOOL	LLView::sDebugRects = FALSE;
 BOOL	LLView::sDebugKeys = FALSE;
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 18f453f62171fc6b7459a519a34ba5320fbc61e4..94586bf4fac0b91237c3c8eb2aab31118d931945 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -13,23 +13,19 @@
 // the HUD or a dialog box or a button.  It can also contain sub-views
 // and child widgets
 
-#include <iosfwd>
-#include <list>
-
-#include "lluixmltags.h"
-#include "llrect.h"
+#include "llcoord.h"
+#include "llfontgl.h"
+#include "llmortician.h"
 #include "llmousehandler.h"
-#include "stdenums.h"
+#include "llnametable.h"
 #include "llsd.h"
 #include "llstring.h"
-#include "llnametable.h"
-#include "llcoord.h"
-#include "llmortician.h"
-#include "llxmlnode.h"
-#include "llfontgl.h"
-#include "llviewquery.h"
-
+#include "llrect.h"
 #include "llui.h"
+#include "lluixmltags.h"
+#include "llviewquery.h"
+#include "llxmlnode.h"
+#include "stdenums.h"
 
 class LLColor4;
 class LLWindow;
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 94c1b5de245dc29c6e66d190ae5b5624638c11b7..5203e31ff932b77938eed92b4ea2187b09443e8a 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -11,6 +11,7 @@
 #if !LL_WINDOWS
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <errno.h>
 #else
 #include <direct.h>
 #endif
diff --git a/indra/llvfs/lldir_linux.h b/indra/llvfs/lldir_linux.h
index 3e63e7230355e4a1dada062623095e20f3d0fb3b..767c8b34759ddaa742bf12508310bbfac8d9ad47 100644
--- a/indra/llvfs/lldir_linux.h
+++ b/indra/llvfs/lldir_linux.h
@@ -11,7 +11,6 @@
 
 #include "lldir.h"
 
-#include <stdio.h>
 #include <dirent.h>
 #include <errno.h>
 
diff --git a/indra/llvfs/lldir_mac.h b/indra/llvfs/lldir_mac.h
index 1375f142f4972f2259efca919d960164b4baea8f..9815e3afacd38611d54a7a802393c19066e8fb61 100644
--- a/indra/llvfs/lldir_mac.h
+++ b/indra/llvfs/lldir_mac.h
@@ -11,7 +11,6 @@
 
 #include "lldir.h"
 
-#include <stdio.h>
 #include <dirent.h>
 
 class LLDir_Mac : public LLDir
diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h
index 1ab76230ee28be2b477a980b7dd1689e511b017f..ad3bc4525b79ba12aaf1d122ef70fe6394d436da 100644
--- a/indra/llvfs/lldir_solaris.h
+++ b/indra/llvfs/lldir_solaris.h
@@ -11,7 +11,6 @@
 
 #include "lldir.h"
 
-#include <stdio.h>
 #include <dirent.h>
 #include <errno.h>
 
diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp
index 0054e87755929c00ef48e579e09f1d5f646a3c56..f599ae122b784bb2a243c6287266889fd19af186 100644
--- a/indra/llvfs/llvfs.cpp
+++ b/indra/llvfs/llvfs.cpp
@@ -8,9 +8,7 @@
 
 #include "linden_common.h"
 
-#include <stdio.h>
 #include <sys/stat.h>
-#include <time.h>
 #include <set>
 #include <map>
 #if LL_WINDOWS
diff --git a/indra/llvfs/llvfs.h b/indra/llvfs/llvfs.h
index 5089e059e8af9699adf26caa8af290d371649e09..d18797fe4ecbec95ca944e3e996c0b084f43da75 100644
--- a/indra/llvfs/llvfs.h
+++ b/indra/llvfs/llvfs.h
@@ -9,8 +9,6 @@
 #ifndef LL_LLVFS_H
 #define LL_LLVFS_H
 
-#include <stdio.h>
-#include <map>
 #include <deque>
 #include "lluuid.h"
 #include "linked_lists.h"
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index dc3edadb9c0004a2fe90b130480ea07ba22b4424..35b7384c2f11727776742f6b5aad86b9c9a3d9ed 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -12,7 +12,6 @@
 
 #include "linden_common.h"
 
-#include <assert.h>
 #include <dxdiag.h>
 
 #include <boost/tokenizer.hpp>
diff --git a/indra/lscript/lscript_alloc.h b/indra/lscript/lscript_alloc.h
index c9eca7cd819468a48c21b78911c7500a14c8bf9a..827156a9e375ed248a0c3083df574aa56401f38c 100644
--- a/indra/lscript/lscript_alloc.h
+++ b/indra/lscript/lscript_alloc.h
@@ -12,11 +12,8 @@
 // Under gcc 2.9, the manual is unclear if comments can appear above #ifndef
 // Under gcc 3, the manual explicitly states comments can appear above the #ifndef
 
-#include "stdtypes.h"
 #include "lscript_byteconvert.h"
 #include "lscript_library.h"
-#include "llrand.h"
-#include <stdio.h>
 
 void reset_hp_to_safe_spot(const U8 *buffer);
 
diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l
index a8fbcbe260e2bba5a13206e4e2886e6026014001..ee3492b0714357f507b25a448def6523583abde7 100644
--- a/indra/lscript/lscript_compile/indra.l
+++ b/indra/lscript/lscript_compile/indra.l
@@ -9,13 +9,15 @@ FS			(f|F)
 %p 5000
 
 %{
-#include <stdio.h>
-#include "stdtypes.h"
+#include "linden_common.h"
+// Deal with the fact that lex/yacc generates unreachable code
+#ifdef LL_WINDOWS
+#pragma warning (disable : 4702) // warning C4702: unreachable code
+#endif	//	LL_WINDOWS
 #include "llmath.h"
 #include "lscript_tree.h"
 #include "lscript_typecheck.h"
 #include "lscript_resource.h"
-#include "llfile.h"
 #if LL_WINDOWS
 #include "ytab.h"
 #else
diff --git a/indra/lscript/lscript_compile/indra.y b/indra/lscript/lscript_compile/indra.y
index 56f40c974c912640a8593e309948a1ee8a7ae70c..d10cbfedba2bd0e8753664664fffe87561338021 100644
--- a/indra/lscript/lscript_compile/indra.y
+++ b/indra/lscript/lscript_compile/indra.y
@@ -1,7 +1,7 @@
 %{
-	#include "stdtypes.h"
+	#include "linden_common.h"
 	#include "lscript_tree.h"
-	
+
     #ifdef __cplusplus
     extern "C" {
     #endif
@@ -16,6 +16,7 @@
     #endif
 
     #ifdef LL_WINDOWS
+	#pragma warning (disable : 4702) // warning C4702: unreachable code
 	#pragma warning( disable : 4065 )	// warning: switch statement contains 'default' but no 'case' labels
 	#endif
 
diff --git a/indra/lscript/lscript_compile/lscript_error.h b/indra/lscript/lscript_compile/lscript_error.h
index 4ad7b60dd8d03aa209f08e3e9bf39b690e1e34ae..9e76b9a4d7d2f369990ff7e3623bdabb027cba0b 100644
--- a/indra/lscript/lscript_compile/lscript_error.h
+++ b/indra/lscript/lscript_compile/lscript_error.h
@@ -9,11 +9,8 @@
 #ifndef LL_LSCRIPT_ERROR_H
 #define LL_LSCRIPT_ERROR_H
 
-#include <stdio.h>
-#include "stdtypes.h"
 #include "lscript_scope.h"
 
-
 typedef enum e_lscript_compile_pass
 {
 	LSCP_INVALID,
diff --git a/indra/lscript/lscript_compile/lscript_resource.h b/indra/lscript/lscript_compile/lscript_resource.h
index b0a38b81fb2ada3d99fa4675c4209880183ac79f..36de4786c6da9a855e14ff15d3dc34cf59f1252a 100644
--- a/indra/lscript/lscript_compile/lscript_resource.h
+++ b/indra/lscript/lscript_compile/lscript_resource.h
@@ -9,8 +9,6 @@
 #ifndef LL_LSCRIPT_RESOURCE_H
 #define LL_LSCRIPT_RESOURCE_H
 
-#include <stdio.h>
-#include "stdtypes.h"
 #include "lscript_scope.h"
 
 void init_temp_jumps();
diff --git a/indra/lscript/lscript_compile/lscript_tree.h b/indra/lscript/lscript_compile/lscript_tree.h
index d0e8bcf389b335b04243abe36952da89c03f2105..a1fe4f4d09ced18cafef41884d4aefdf48197dd1 100644
--- a/indra/lscript/lscript_compile/lscript_tree.h
+++ b/indra/lscript/lscript_compile/lscript_tree.h
@@ -9,8 +9,6 @@
 #ifndef LL_LSCRIPT_TREE_H
 #define LL_LSCRIPT_TREE_H
 
-#include <stdio.h>
-#include "stdtypes.h"
 #include "v3math.h"
 #include "llquaternion.h"
 #include "linked_lists.h"
diff --git a/indra/lscript/lscript_execute.h b/indra/lscript/lscript_execute.h
index 1c2952f5ae2dc4d10ad057f686df7c22b618a9ea..fe3784f19fd889bd23b124dba46f8adda881cd50 100644
--- a/indra/lscript/lscript_execute.h
+++ b/indra/lscript/lscript_execute.h
@@ -9,7 +9,6 @@
 #ifndef LL_LSCRIPT_EXECUTE_H
 #define LL_LSCRIPT_EXECUTE_H
 
-#include <stdio.h>
 #include "lscript_byteconvert.h"
 #include "linked_lists.h"
 #include "lscript_library.h"
diff --git a/indra/lscript/lscript_library.h b/indra/lscript/lscript_library.h
index b5fdfc7a22751cd139385709703cf7c703048f93..c7544044cca444bc4c0e3ff40e15698371c75b98 100644
--- a/indra/lscript/lscript_library.h
+++ b/indra/lscript/lscript_library.h
@@ -14,7 +14,6 @@
 #include "llquaternion.h"
 #include "lluuid.h"
 #include "lscript_byteconvert.h"
-#include <stdio.h>
 
 class LLScriptLibData;
 
diff --git a/indra/lscript/lscript_library/lscript_alloc.cpp b/indra/lscript/lscript_library/lscript_alloc.cpp
index d98af1ddf34f4fa6f6e81ea26393aed4a2a2e950..b80f74870bc69ace5f8a9e54c7aded8ced5a53f1 100644
--- a/indra/lscript/lscript_library/lscript_alloc.cpp
+++ b/indra/lscript/lscript_library/lscript_alloc.cpp
@@ -11,8 +11,8 @@
 // Under gcc 3, the manual explicitly states comments can appear above the #ifndef
 
 #include "linden_common.h"
-
 #include "lscript_alloc.h"
+#include "llrand.h"
 
 // supported data types
 
diff --git a/indra/mac_crash_logger/mac_crash_logger.cpp b/indra/mac_crash_logger/mac_crash_logger.cpp
index 4d6e8314b3c5b2b829f0002c58a2d7db1802a39b..f790438eedd64fbabb794745ef27104d2263ed07 100644
--- a/indra/mac_crash_logger/mac_crash_logger.cpp
+++ b/indra/mac_crash_logger/mac_crash_logger.cpp
@@ -8,10 +8,6 @@
 
 #include "linden_common.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-//#include <direct.h>
-#include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp
index ecef6e6b77fb17e7393b8f77d5a3c691febc6b6e..76014a2e1d3e0e908c0f30cdfbf04ab8445ffdf3 100644
--- a/indra/mac_updater/mac_updater.cpp
+++ b/indra/mac_updater/mac_updater.cpp
@@ -8,10 +8,6 @@
 
 #include "linden_common.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-//#include <direct.h>
-#include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index e0ceedf0f714e61ff91d1d51414ca4acaff48a81..be410196c5c4af08128c22f5be38ca96d63ef250 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -9,7 +9,6 @@
 #include "llviewerprecompiledheaders.h"
 
 #include <sstream>
-#include <time.h>
 
 #include "llfloaterland.h"
 
diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp
index 9363b98d120d13108fadb9acf16ef10d78c11551..c16eb83887e13907c22812e3e896e474273e5182 100644
--- a/indra/newview/llpanelland.cpp
+++ b/indra/newview/llpanelland.cpp
@@ -8,8 +8,6 @@
 
 #include "llviewerprecompiledheaders.h"
 
-#include <time.h>
-
 #include "llpanelland.h"
 
 #include "llparcel.h"
diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp
index 73444f611d65c22f768bacb7c501242865be6aa6..19d100a561ca95355e45598f8b7b7eb59ef5cb08 100644
--- a/indra/newview/llurl.cpp
+++ b/indra/newview/llurl.cpp
@@ -7,7 +7,6 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-#include <string.h>
 #include "llurl.h"
 #include "llerror.h"
 
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index c09dd03dd41f8112e7987de607ab8361a2869274..43cf132b57b2e9d1596274728fd94a84dcb1c73d 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -11,8 +11,6 @@
 #include "llviewermessage.h"
 
 #include <deque>
-#include <stdio.h>
-#include <string.h>
 
 #include "audioengine.h" 
 #include "audiosettings.h"
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index d4b87ceba0b5c718966e5965d2ed80b0cd5e4609..afdd762404b29301f9d90ef0406ea01dfe8c7ac6 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -8,11 +8,6 @@
 
 #include "llviewerprecompiledheaders.h"
 
-// system library includes
-#include <stdio.h>
-#include <iostream>
-#include <fstream>
-
 #include "llviewerwindow.h"
 #include "llviewquery.h"
 #include "llxmltree.h"
diff --git a/indra/test/llblowfish_tut.cpp b/indra/test/llblowfish_tut.cpp
index 8f0912d98de6901e4a52440efcd0a06a5c801090..306b66a39d286fd58776f0537d7447dc1b2b3cf5 100644
--- a/indra/test/llblowfish_tut.cpp
+++ b/indra/test/llblowfish_tut.cpp
@@ -16,8 +16,6 @@
 
 #include "llblowfishcipher.h"
 
-#include <string>
-#include <stdio.h>
 #include "lluuid.h"
 
 namespace tut
diff --git a/indra/test/llbuffer_tut.cpp b/indra/test/llbuffer_tut.cpp
index 4ac72d59d35edb183bb175c53f6fc1e32824b5f2..f7737464da759ea42cd3cd8a07c660b4df2e8232 100644
--- a/indra/test/llbuffer_tut.cpp
+++ b/indra/test/llbuffer_tut.cpp
@@ -9,6 +9,7 @@
  */
 
 #include <tut/tut.h>
+#include "linden_common.h"
 #include "lltut.h"
 #include "llbuffer.h"
 #include "llerror.h"
diff --git a/indra/test/llhttpdate_tut.cpp b/indra/test/llhttpdate_tut.cpp
index 2a82155cd1fafefe5c8db1efc35e06c9ae20895a..f491f08e7818b9a762300d4a23acf6300fe6d4ee 100644
--- a/indra/test/llhttpdate_tut.cpp
+++ b/indra/test/llhttpdate_tut.cpp
@@ -13,9 +13,6 @@
 #include "lldate.h"
 #include "llframetimer.h"
 
-#include <string>
-#include <time.h>
-
 namespace tut
 {
     struct httpdate_data
diff --git a/indra/test/llhttpnode_tut.cpp b/indra/test/llhttpnode_tut.cpp
index 30165cb769c5f7cf111864a413ad7c46cbf4cda9..fb94eb3287c8c7cceea5c5033b9fbd54340de47b 100644
--- a/indra/test/llhttpnode_tut.cpp
+++ b/indra/test/llhttpnode_tut.cpp
@@ -7,9 +7,8 @@
  * $License$
  */
 
-#include <tut/tut.h>
+#include "linden_common.h"
 #include "lltut.h"
-
 #include "llhttpnode.h"
 #include "llsdhttpserver.h"
 
diff --git a/indra/test/lliohttpserver_tut.cpp b/indra/test/lliohttpserver_tut.cpp
index e0001438c7b4d5500a918a44dbd8b8c7a6f3a1a9..d5e1d32ffc8d77232e2064c73ee74d6e42f86601 100644
--- a/indra/test/lliohttpserver_tut.cpp
+++ b/indra/test/lliohttpserver_tut.cpp
@@ -7,9 +7,8 @@
  * $License$
  */
 
-#include <tut/tut.h>
+#include "linden_common.h"
 #include "lltut.h"
-
 #include "llbufferstream.h"
 #include "lliohttpserver.h"
 #include "llsdhttpserver.h"
diff --git a/indra/test/llmessageconfig_tut.cpp b/indra/test/llmessageconfig_tut.cpp
index 30a799a1bf83353e27ccc4f2568d0f6dcf059043..6e07671c8d289f655ab36b0f514ed84915723b2d 100644
--- a/indra/test/llmessageconfig_tut.cpp
+++ b/indra/test/llmessageconfig_tut.cpp
@@ -7,9 +7,9 @@
  * $License$
  */
 
-#include <tut/tut.h>
-#include "lltut.h"
+#include "linden_common.h"
 #include "llmessageconfig.h"
+#include "lltut.h"
 #include "llsdserialize.h"
 #include "llfile.h"
 #include "lldir.h"
diff --git a/indra/test/llmessagetemplateparser_tut.cpp b/indra/test/llmessagetemplateparser_tut.cpp
index 1faa4e90cbe19b7b8964bdf2e2dfe4ac16b44f45..8bb23009ced369f87e13b2ddfe3e5a85aaf12c09 100644
--- a/indra/test/llmessagetemplateparser_tut.cpp
+++ b/indra/test/llmessagetemplateparser_tut.cpp
@@ -7,10 +7,9 @@
  * $License$
  */
 
-#include <tut/tut.h>
-#include "lltut.h"
 #include "linden_common.h"
 #include "llmessagetemplateparser.h"
+#include "lltut.h"
 
 namespace tut
 {
diff --git a/indra/test/llsaleinfo_tut.cpp b/indra/test/llsaleinfo_tut.cpp
index ef6e1cc94b4cefb3d7d7e2e59a4906c93baf69e1..16920082c51d686a6e5a1fc373d8b54ba5fc0119 100644
--- a/indra/test/llsaleinfo_tut.cpp
+++ b/indra/test/llsaleinfo_tut.cpp
@@ -9,8 +9,8 @@
  */
 
 #include <tut/tut.h>
-#include "lltut.h"
 #include "linden_common.h"
+#include "lltut.h"
 #include "llsaleinfo.h"
 
 namespace tut
diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp
index 0ceb4302ffc22ad1924c81d40450d6f33880c102..7a1ac9ab49430d691f4efea688ef7257948fb32d 100644
--- a/indra/test/llsd_new_tut.cpp
+++ b/indra/test/llsd_new_tut.cpp
@@ -7,7 +7,6 @@
  * $License$
  */
 
-#include <math.h>
 #include <tut/tut.h>
 #include "linden_common.h"
 #include "lltut.h"
diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp
index 900de1f2ddb0fa6052c628460648cac2be7a012b..938293434e1759f73b0493aa008db664f299b2f9 100755
--- a/indra/test/llsdmessagebuilder_tut.cpp
+++ b/indra/test/llsdmessagebuilder_tut.cpp
@@ -8,8 +8,9 @@
  */
 
 #include <tut/tut.h>
-#include "lltut.h"
 
+#include "linden_common.h"
+#include "lltut.h"
 #include "llsdmessagebuilder.h"
 #include "llsdmessagereader.h"
 #include "llsdtraits.h"
diff --git a/indra/test/llservicebuilder_tut.cpp b/indra/test/llservicebuilder_tut.cpp
index e782cfbb6f1f1c5d8e189224ab34be34ad9c0050..759281e8a600f09de883fbc6e0f29421bf35c40a 100644
--- a/indra/test/llservicebuilder_tut.cpp
+++ b/indra/test/llservicebuilder_tut.cpp
@@ -8,8 +8,9 @@
 */
 
 #include <tut/tut.h>
-#include "lltut.h"
 
+#include "linden_common.h"
+#include "lltut.h"
 #include "llsd.h"
 #include "llservicebuilder.h"
 
diff --git a/indra/test/llstreamtools_tut.cpp b/indra/test/llstreamtools_tut.cpp
index 17e5c7cc2c03c714cac2e830318d5d774657898c..b3d03375fa23bf7abc95c74f97247fca209c7ee9 100644
--- a/indra/test/llstreamtools_tut.cpp
+++ b/indra/test/llstreamtools_tut.cpp
@@ -9,7 +9,8 @@
  */
  
 #include <tut/tut.h>
-#include <fstream>
+
+#include "linden_common.h"
 #include "llstreamtools.h"
 #include "lltut.h"
 
diff --git a/indra/test/llxorcipher_tut.cpp b/indra/test/llxorcipher_tut.cpp
index 6fe5176cb04828a5b8f2364bdf7a8ca510d0d8d3..3fd4e3ad972349bf62fb5ad187572a8127295a01 100644
--- a/indra/test/llxorcipher_tut.cpp
+++ b/indra/test/llxorcipher_tut.cpp
@@ -8,7 +8,7 @@
  * $License$
  */
  
-#include <tut/tut.h>
+#include "linden_common.h"
 #include "lltut.h"
 #include "llxorcipher.h"
 #include "llnullcipher.h"
diff --git a/indra/win_crash_logger/win_crash_logger.cpp b/indra/win_crash_logger/win_crash_logger.cpp
index 8760ae43f82c68f0af6c6ccbb3a42a08427be89f..38f7973748cce2b51d9fcec1751da7adc5d9e62f 100644
--- a/indra/win_crash_logger/win_crash_logger.cpp
+++ b/indra/win_crash_logger/win_crash_logger.cpp
@@ -16,10 +16,7 @@
 #include "llcontrol.h"
 #include "resource.h"
 
-#include <stdio.h>
-#include <stdlib.h>
 #include <direct.h>
-#include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <wininet.h>
diff --git a/indra/win_updater/updater.cpp b/indra/win_updater/updater.cpp
index 536553a4ed918903cfafbd3e5c0e3f0bb4f0710b..a0761b0cc5876a18d7485372daf66921f4190637 100644
--- a/indra/win_updater/updater.cpp
+++ b/indra/win_updater/updater.cpp
@@ -10,14 +10,11 @@
 // Usage: updater -url <url> [-name <window_title>] [-program <program_name>] [-silent]
 //
 
+#include "linden_common.h"
+
 #include <windows.h>
 #include <wininet.h>
 
-#include <stdio.h>
-#include <stdarg.h>
-#include "llpreprocessor.h"
-#include "llfile.h"
-
 #define BUFSIZE 8192
 
 int  gTotalBytesRead = 0;