diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 111f5897ddef4fea017be6c5e57cf6055da3d517..10a23ea068f91945d0071edf1a6b9bf349ea913e 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -24,7 +24,6 @@ set(cmake_SOURCE_FILES
     DragDrop.cmake
     EXPAT.cmake
     ExamplePlugin.cmake
-    FMOD.cmake
     FindAPR.cmake
     FindAutobuild.cmake
     FindBerkeleyDB.cmake
diff --git a/indra/cmake/FMOD.cmake b/indra/cmake/FMOD.cmake
deleted file mode 100644
index 3586c1160aa9e72cdfdc65f08acf659beb509d6f..0000000000000000000000000000000000000000
--- a/indra/cmake/FMOD.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- cmake -*-
-
-# FMOD can be set when launching the make using the argument -DFMOD:BOOL=ON
-# When building using proprietary binaries though (i.e. having access to LL private servers),
-# we always build with FMOD.
-# Open source devs should use the -DFMOD:BOOL=ON then if they want to build with FMOD, whether
-# they are using STANDALONE or not.
-if (INSTALL_PROPRIETARY)
-  set(FMOD ON CACHE BOOL "Use FMOD sound library.")
-endif (INSTALL_PROPRIETARY)
-
-if (FMOD)
-  if (STANDALONE)
-    # In that case, we use the version of the library installed on the system
-    set(FMOD_FIND_REQUIRED ON)
-    include(FindFMOD)
-  else (STANDALONE)
-    if (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-      # If the path have been specified in the arguments, use that
-      set(FMOD_LIBRARIES ${FMOD_LIBRARY})
-      MESSAGE(STATUS "Using FMOD path: ${FMOD_LIBRARIES}, ${FMOD_INCLUDE_DIR}")
-    else (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-      # If not, we're going to try to get the package listed in autobuild.xml
-      # Note: if you're not using INSTALL_PROPRIETARY, the package URL should be local (file:/// URL) 
-      # as accessing the private LL location will fail if you don't have the credential
-      include(Prebuilt)
-      use_prebuilt_binary(fmod)    
-      if (WINDOWS)
-        set(FMOD_LIBRARY fmod)
-      elseif (DARWIN)
-        set(FMOD_LIBRARY fmod)
-      elseif (LINUX)
-        set(FMOD_LIBRARY fmod-3.75)
-      endif (WINDOWS)
-      set(FMOD_LIBRARIES ${FMOD_LIBRARY})
-      set(FMOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
-    endif (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-  endif (STANDALONE)
-endif (FMOD)
diff --git a/indra/cmake/FindFMOD.cmake b/indra/cmake/FindFMOD.cmake
deleted file mode 100644
index 1ebbc8c96e5e3627f2de7d434ff2e73e5add235c..0000000000000000000000000000000000000000
--- a/indra/cmake/FindFMOD.cmake
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- cmake -*-
-
-# - Find FMOD
-# Find the FMOD includes and library
-# This module defines
-#  FMOD_INCLUDE_DIR, where to find fmod.h and fmod_errors.h
-#  FMOD_LIBRARIES, the libraries needed to use FMOD.
-#  FMOD, If false, do not try to use FMOD.
-# also defined, but not for general use are
-#  FMOD_LIBRARY, where to find the FMOD library.
-
-FIND_PATH(FMOD_INCLUDE_DIR fmod.h PATH_SUFFIXES fmod)
-
-SET(FMOD_NAMES ${FMOD_NAMES} fmod fmodvc fmodex fmod-3.75)
-FIND_LIBRARY(FMOD_LIBRARY
-  NAMES ${FMOD_NAMES}
-  PATH_SUFFIXES fmod
-  )
-
-IF (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-  SET(FMOD_LIBRARIES ${FMOD_LIBRARY})
-  SET(FMOD_FOUND "YES")
-ELSE (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-  SET(FMOD_FOUND "NO")
-ENDIF (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-
-IF (FMOD_FOUND)
-  IF (NOT FMOD_FIND_QUIETLY)
-    MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARIES}")
-  ENDIF (NOT FMOD_FIND_QUIETLY)
-ELSE (FMOD_FOUND)
-  IF (FMOD_FIND_REQUIRED)
-    MESSAGE(FATAL_ERROR "Could not find FMOD library")
-  ENDIF (FMOD_FIND_REQUIRED)
-ENDIF (FMOD_FOUND)
-
-# Deprecated declarations.
-SET (NATIVE_FMOD_INCLUDE_PATH ${FMOD_INCLUDE_DIR} )
-GET_FILENAME_COMPONENT (NATIVE_FMOD_LIB_PATH ${FMOD_LIBRARY} PATH)
-
-MARK_AS_ADVANCED(
-  FMOD_LIBRARY
-  FMOD_INCLUDE_DIR
-  )
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index e0fe9e783d0ec1d370ee6f72c35d71fa349f6443..bcbd155423c994f2bba005ed51337d28cd8a0955 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -773,7 +773,10 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
 					{
 						S32 bytes = w * h * mComponents;
 #ifdef SHOW_ASSERT
+						llassert(prev_mip_data);
+						llassert(cur_mip_size == bytes*4);
 #endif
+
 						U8* new_data = new U8[bytes];
 
 #ifdef SHOW_ASSERT
diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l
index 9132d5d52899a20721254bf720c615a7878a2726..1bb38bbf655f5c3313db95b81055e6cb52b2a2eb 100644
--- a/indra/lscript/lscript_compile/indra.l
+++ b/indra/lscript/lscript_compile/indra.l
@@ -79,17 +79,9 @@ void parse_string();
 #define yyfree indra_free
 
 
-#if LL_WINDOWS
-#if defined(__cplusplus)
-extern "C" { int yylex( void ); }
-extern "C" { int yyparse( void ); }
-extern "C" { int yyerror(const char *fmt, ...); }
-#endif
-#else
 int yylex( void );
 int yyparse( void );
 int yyerror(const char *fmt, ...);
-#endif
 
 %}
 
diff --git a/indra/lscript/lscript_compile/indra.y b/indra/lscript/lscript_compile/indra.y
index 9c2ed02f7285daec93b22d45b66d587227427173..a0a034d21c2251a9035825f72e2781c80ced719c 100644
--- a/indra/lscript/lscript_compile/indra.y
+++ b/indra/lscript/lscript_compile/indra.y
@@ -2,12 +2,6 @@
 	#include "linden_common.h"
 	#include "lscript_tree.h"
 
-    #if LL_WINDOWS
-    #ifdef __cplusplus
-    extern "C" {
-    #endif
-    #endif
-
 	int yylex(void);
 	int yyparse( void );
 	int yyerror(const char *fmt, ...);
@@ -22,12 +16,6 @@
 	#pragma warning( disable : 4065 )	// warning: switch statement contains 'default' but no 'case' labels
 	#endif
 
-    #if LL_WINDOWS
-    #ifdef __cplusplus
-    }
-    #endif
-    #endif
-
 %}
 
 %union
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 96e701a6cb3933742eb157254dd7311cb489f4f1..2965d968a3319eab4fe78203261c847f803d52bd 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -201,6 +201,8 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 	mTotalCRC(0),
 	mListIndex(-1),
 	mTEImages(NULL),
+	mTENormalMaps(NULL),
+	mTESpecularMaps(NULL),
 	mGLName(0),
 	mbCanSelect(TRUE),
 	mFlags(0),
@@ -321,6 +323,18 @@ void LLViewerObject::deleteTEImages()
 {
 	delete[] mTEImages;
 	mTEImages = NULL;
+	
+	if (mTENormalMaps != NULL)
+	{
+		delete[] mTENormalMaps;
+		mTENormalMaps = NULL;
+	}
+	
+	if (mTESpecularMaps != NULL)
+	{
+		delete[] mTESpecularMaps;
+		mTESpecularMaps = NULL;
+	}	
 }
 
 void LLViewerObject::markDead()