diff --git a/autobuild.xml b/autobuild.xml
index 07a015e76f7d20ceda8f1df0eda00148998bafdd..6933fe704d194f556a8f8a25a43349890c5d49e5 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -968,9 +968,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>047ce52d5fe3e9ac70763de0098cf530</string>
+              <string>017ef34ddf14293099a90c6eaa3615ca</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/719/1462/glod-1.0pre3.500710-darwin64-500710.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1626/3627/glod-1.0pre3.501614-darwin64-501614.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin64</string>
@@ -994,9 +994,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>8cb665230ec24048aa3b733f2b1c3b00</string>
+              <string>9aef5cd576ace19568da01d9bc3db29c</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-glod/rev/314201/arch/Linux/installer/glod-1.0pre4.314201-linux64-314201.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1625/3628/glod-1.0pre3.501614-linux64-501614.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux64</string>
@@ -1006,11 +1006,11 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>511d066e35bbc14dd512c831b53a2fad</string>
+              <string>573e68f46f825a1c040daa4994ee2a61</string>
               <key>hash_algorithm</key>
               <string>md5</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/720/1465/glod-1.0pre3.500710-windows-500710.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1627/3633/glod-1.0pre3.501614-windows-501614.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
@@ -1020,16 +1020,16 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>7fa6f187fc5e4175a13d3e0d4b6658a4</string>
+              <string>f8362e1a2f4d03d99c6231101d3d472e</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/721/1468/glod-1.0pre3.500710-windows64-500710.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1628/3638/glod-1.0pre3.501614-windows64-501614.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows64</string>
           </map>
         </map>
         <key>version</key>
-        <string>1.0pre3.500710</string>
+        <string>1.0pre3.501614</string>
       </map>
       <key>google_breakpad</key>
       <map>
@@ -2092,9 +2092,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>9fb85eff4118913543acde89bcb9a9c1</string>
+              <string>3af1210d90aeb9f4d5deea6020ee0d55</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1512/3413/llceflib-1.6.0.501501-darwin64-501501.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1611/3591/llceflib-1.6.0.501600-darwin64-501600.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin64</string>
@@ -2127,7 +2127,7 @@
           </map>
         </map>
         <key>version</key>
-        <string>1.6.0.501501</string>
+        <string>1.6.0.501600</string>
       </map>
       <key>llphysicsextensions_source</key>
       <map>
@@ -2146,9 +2146,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>7b82d09b4104eabd67e2df859e6d605d</string>
+              <string>e2b519ee7538b25877e34ede6864a250</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1447/3223/llphysicsextensions_source-1.0.501434-darwin64-501434.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1691/3748/llphysicsextensions_source-1.0.501678-darwin64-501678.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin64</string>
@@ -2158,9 +2158,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>be50e58459c3e334715b108646b8712b</string>
+              <string>9b2c1f53f7f1add01af1e7cfa737e20e</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1445/3211/llphysicsextensions_source-1.0.501434-linux64-501434.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1689/3734/llphysicsextensions_source-1.0.501678-linux64-501678.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux64</string>
@@ -2170,16 +2170,16 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>83a0328f6ab88b0960ea5d905bd2e7a2</string>
+              <string>5e8cb92ae79c9435b98e444322ec5798</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1448/3226/llphysicsextensions_source-1.0.501434-windows-501434.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1696/3763/llphysicsextensions_source-1.0.501678-windows-501678.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
           </map>
         </map>
         <key>version</key>
-        <string>1.0.501434</string>
+        <string>1.0.501678</string>
       </map>
       <key>llphysicsextensions_stub</key>
       <map>
@@ -2198,9 +2198,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>bc5989dee9d9be95d63178ce2f735385</string>
+              <string>32309a20161f54f42d08f7bc1e7fcf01</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1446/3218/llphysicsextensions_stub-1.0.501433-darwin64-501433.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1692/3749/llphysicsextensions_stub-1.0.501679-darwin64-501679.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin64</string>
@@ -2210,9 +2210,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>352e71a8fcfc854e6c2fd477fa08ac14</string>
+              <string>58af530891721f3690a4dce9a8c73190</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1444/3210/llphysicsextensions_stub-1.0.501433-linux64-501433.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1690/3739/llphysicsextensions_stub-1.0.501679-linux64-501679.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux64</string>
@@ -2222,16 +2222,16 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>e5a7e4793ffa0cc9b73ae962fb697a49</string>
+              <string>c59cb5d1dd96ab51f87cd0cf202304dd</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1449/3227/llphysicsextensions_stub-1.0.501433-windows-501433.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1695/3757/llphysicsextensions_stub-1.0.501679-windows-501679.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
           </map>
         </map>
         <key>version</key>
-        <string>1.0.501433</string>
+        <string>1.0.501679</string>
       </map>
       <key>mesa</key>
       <map>
diff --git a/build.sh b/build.sh
index 5c48b902d40cd58251e421e7de03da3ac81662b3..7d0a96148637c2972887d06bf69dd51aacb02023 100755
--- a/build.sh
+++ b/build.sh
@@ -47,8 +47,8 @@ viewer_channel_suffix()
 installer_Darwin()
 {
   local package_name="$1"
-  local package_dir="$(build_dir_Darwin ${last_built_variant:-Release})/newview/"
-  local pattern=".*$(viewer_channel_suffix ${package_name})_[0-9]+_[0-9]+_[0-9]+_[0-9]+_i386\\.dmg\$"
+  local package_dir="newview/$(build_dir_Darwin ${last_built_variant:-Release})/"
+  local pattern=".*$(viewer_channel_suffix ${package_name})_[0-9]+_[0-9]+_[0-9]+_[0-9]+_x86_64\\.dmg\$"
   # since the additional packages are built after the base package,
   # sorting oldest first ensures that the unqualified package is returned
   # even if someone makes a qualified name that duplicates the last word of the base name
@@ -59,7 +59,7 @@ installer_Darwin()
 installer_Linux()
 {
   local package_name="$1"
-  local package_dir="$(build_dir_Linux ${last_built_variant:-Release})/newview/"
+  local package_dir="newview/$(build_dir_Linux ${last_built_variant:-Release})/"
   local pattern=".*$(viewer_channel_suffix ${package_name})_[0-9]+_[0-9]+_[0-9]+_[0-9]+_i686\\.tar\\.bz2\$"
   # since the additional packages are built after the base package,
   # sorting oldest first ensures that the unqualified package is returned
@@ -95,10 +95,21 @@ pre_build()
     && [ -r "$master_message_template_checkout/message_template.msg" ] \
     && template_verifier_master_url="-DTEMPLATE_VERIFIER_MASTER_URL=file://$master_message_template_checkout/message_template.msg"
 
+    # nat 2016-12-20: disable HAVOK on Mac until we get a 64-bit Mac build.
+    # nat 2016-12-21: disable generate_breakpad_symbols.py on Mac until we
+    # figure out why it's breaking.
+    if [ "$arch" == "Darwin" ]
+    then HAVOK=OFF
+         RELEASE_CRASH_REPORTING=OFF
+    else HAVOK=ON
+         RELEASE_CRASH_REPORTING=ON
+    fi
+
     "$autobuild" configure --quiet -c $variant -- \
      -DPACKAGE:BOOL=ON \
      -DUNATTENDED:BOOL=ON \
-     -DRELEASE_CRASH_REPORTING:BOOL=ON \
+     -DHAVOK:BOOL="$HAVOK" \
+     -DRELEASE_CRASH_REPORTING:BOOL="$RELEASE_CRASH_REPORTING" \
      -DVIEWER_CHANNEL:STRING="\"$viewer_channel\"" \
      -DGRID:STRING="\"$viewer_grid\"" \
      -DLL_TESTS:BOOL="$run_tests" \
@@ -112,7 +123,8 @@ package_llphysicsextensions_tpv()
 {
   begin_section "PhysicsExtensions_TPV"
   tpv_status=0
-  if [ "$variant" = "Release" ]
+  # nat 2016-12-21: without HAVOK, can't build PhysicsExtensions_TPV.
+  if [ "$variant" = "Release" -a "${HAVOK:-}" != "OFF" ]
   then 
       test -r  "$build_dir/packages/llphysicsextensions/autobuild-tpv.xml" || fatal "No llphysicsextensions_tpv autobuild configuration found"
       tpvconfig=$(native_path "$build_dir/packages/llphysicsextensions/autobuild-tpv.xml")
@@ -369,7 +381,7 @@ then
     package=$(installer_$arch)
     if [ x"$package" = x ] || test -d "$package"
     then
-      record_event "??? mystery event $package // $build_coverity"
+      fatal "No installer found at '$package'"
       succeeded=$build_coverity
     else
       # Upload base package.
diff --git a/indra/cmake/00-COMPILE-LINK-RUN.txt b/indra/cmake/00-COMPILE-LINK-RUN.txt
index 162b22865ca4b9723ded9fc868601a3f8be2be24..1933072a6d3ea3bb0b0e16d0b51f6f9313591d48 100644
--- a/indra/cmake/00-COMPILE-LINK-RUN.txt
+++ b/indra/cmake/00-COMPILE-LINK-RUN.txt
@@ -48,8 +48,8 @@ Compilation
                    LL_WINDOWS=1                  "                   "
                    UNICODE                       "                   "
                    _UNICODE                      "                   "
-                   WINVER=0x0501                 "                   "
-                   _WIN32_WINNT=0x0501           "                   "
+                   WINVER=0x0600                 "                   "
+                   _WIN32_WINNT=0x0600           "                   "
                    LL_OS_DRAGDROP_ENABLED=1      "                   "
                    LIB_NDOF=1                    "                   "
 
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 46dd8739bcfc1ebb350af0e5645ac7a2ac992e6a..f925fdda5de7c2875cdc617784ba4287effe3c52 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -18,15 +18,17 @@ set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
 
 include(Variables)
 
+# We go to some trouble to set LL_BUILD to the set of relevant compiler flags.
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}")
+# Given that, all the flags you see added below are flags NOT present in
+# https://bitbucket.org/lindenlab/viewer-build-variables/src/tip/variables.
+# Before adding new ones here, it's important to ask: can this flag really be
+# applied to the viewer only, or should/must it be applied to all 3p libraries
+# as well?
+
 # Portable compilation flags.
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DADDRESS_SIZE=${ADDRESS_SIZE}")
 
-set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1")
-set(CMAKE_CXX_FLAGS_RELEASE
-    "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -DNDEBUG") 
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO 
-    "-DLL_RELEASE=1 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1")
-
 # Configure crash reporting
 set(RELEASE_CRASH_REPORTING OFF CACHE BOOL "Enable use of crash reporting in release builds")
 set(NON_RELEASE_CRASH_REPORTING OFF CACHE BOOL "Enable use of crash reporting in developer builds")
@@ -58,13 +60,13 @@ if (WINDOWS)
   # http://www.cmake.org/pipermail/cmake/2009-September/032143.html
   string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
 
-  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP -D_SCL_SECURE_NO_WARNINGS=1"
-      CACHE STRING "C++ compiler debug options" FORCE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+
   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO 
-      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /Zo /MD /MP /Ob0 -D_SECURE_STL=0"
+      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Zo"
       CACHE STRING "C++ compiler release-with-debug options" FORCE)
   set(CMAKE_CXX_FLAGS_RELEASE
-      "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /Zo /MD /MP /Ob2 -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0"
+      "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /Zo"
       CACHE STRING "C++ compiler release options" FORCE)
   # zlib has assembly-language object files incompatible with SAFESEH
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE /SAFESEH:NO /NODEFAULTLIB:LIBCMT /IGNORE:4099")
@@ -73,11 +75,10 @@ if (WINDOWS)
   set(CMAKE_C_STANDARD_LIBRARIES "")
 
   add_definitions(
-      /DLL_WINDOWS=1
       /DNOMINMAX
 #      /DDOM_DYNAMIC            # For shared library colladadom
-      /DUNICODE
-      /D_UNICODE 
+      )
+  add_compile_options(
       /GS
       /TP
       /W3
@@ -85,7 +86,6 @@ if (WINDOWS)
       /Zc:forScope
       /nologo
       /Oy-
-      /Zc:wchar_t-
 #      /arch:SSE2
       /fp:fast
       )
@@ -99,78 +99,28 @@ if (WINDOWS)
   if (NOT VS_DISABLE_FATAL_WARNINGS)
     add_definitions(/WX)
   endif (NOT VS_DISABLE_FATAL_WARNINGS)
-
-  # configure Win32 API for Windows Vista+ compatibility
-  set(WINVER "0x0600" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)")
-  add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}")
 endif (WINDOWS)
 
 
 if (LINUX)
   set(CMAKE_SKIP_RPATH TRUE)
 
-  # Here's a giant hack for Fedora 8, where we can't use
-  # _FORTIFY_SOURCE if we're using a compiler older than gcc 4.1.
-
-  find_program(GXX g++)
-  mark_as_advanced(GXX)
-
-  if (GXX)
-    execute_process(
-        COMMAND ${GXX} --version
-        COMMAND sed "s/^[gc+ ]*//"
-        COMMAND head -1
-        OUTPUT_VARIABLE GXX_VERSION
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-  else (GXX)
-    set(GXX_VERSION x)
-  endif (GXX)
-
-  # The quoting hack here is necessary in case we're using distcc or
-  # ccache as our compiler.  CMake doesn't pass the command line
-  # through the shell by default, so we end up trying to run "distcc"
-  # " g++" - notice the leading space.  Ugh.
-
-  execute_process(
-      COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version"
-      COMMAND sed "s/^[gc+ ]*//"
-      COMMAND head -1
-      OUTPUT_VARIABLE CXX_VERSION
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-  if (${GXX_VERSION} STREQUAL ${CXX_VERSION})
-    add_definitions(-D_FORTIFY_SOURCE=2)
-  else (${GXX_VERSION} STREQUAL ${CXX_VERSION})
-    if (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat")
-      add_definitions(-D_FORTIFY_SOURCE=2)
-    endif (NOT ${GXX_VERSION} MATCHES " 4.1.*Red Hat")
-  endif (${GXX_VERSION} STREQUAL ${CXX_VERSION})
-
-  # Let's actually get a numerical version of gxx's version
-  STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1\\2\\3" CXX_VERSION_NUMBER ${CXX_VERSION})
-
-  if(${CXX_VERSION_NUMBER} GREATER 459)
-    set(CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-unused-but-set-variable -Wno-unused-variable ${CMAKE_CXX_FLAGS}")
-  endif (${CXX_VERSION_NUMBER} GREATER 459)
+  add_definitions(-D_FORTIFY_SOURCE=2)
+
+  set(CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-unused-but-set-variable -Wno-unused-variable ${CMAKE_CXX_FLAGS}")
 
   # gcc 4.3 and above don't like the LL boost and also
   # cause warnings due to our use of deprecated headers
-  if(${CXX_VERSION_NUMBER} GREATER 429)
-    add_definitions(-Wno-parentheses)
-    set(CMAKE_CXX_FLAGS "-Wno-deprecated ${CMAKE_CXX_FLAGS}")
-  endif (${CXX_VERSION_NUMBER} GREATER 429)
-
-  # End of hacks.
+  add_definitions(-Wno-parentheses)
 
   add_definitions(
-      -DLL_LINUX=1
       -D_REENTRANT
+      )
+  add_compile_options(
       -fexceptions
       -fno-math-errno
       -fno-strict-aliasing
       -fsigned-char
-      -g
       -msse2
       -mfpmath=sse
       -pthread
@@ -180,37 +130,34 @@ if (LINUX)
   add_definitions(-DEXTERNAL_TOS)
 
   add_definitions(-DAPPID=secondlife)
-  add_definitions(-fvisibility=hidden)
-  # don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work.  Sigh!  The viewer doesn't need to catch SIGCHLD anyway.
+  add_compile_options(-fvisibility=hidden)
+  # don't catch SIGCHLD in our base application class for the viewer - some of
+  # our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The
+  # viewer doesn't need to catch SIGCHLD anyway.
   add_definitions(-DLL_IGNORE_SIGCHLD)
   if (ADDRESS_SIZE EQUAL 32)
-    add_definitions(-march=pentium4)
+    add_compile_options(-march=pentium4)
   endif (ADDRESS_SIZE EQUAL 32)
-  add_definitions(-mfpmath=sse)
-  #add_definitions(-ftree-vectorize) # THIS CRASHES GCC 3.1-3.2
+  #add_compile_options(-ftree-vectorize) # THIS CRASHES GCC 3.1-3.2
   if (NOT USESYSTEMLIBS)
     # this stops us requiring a really recent glibc at runtime
-    add_definitions(-fno-stack-protector)
+    add_compile_options(-fno-stack-protector)
     # linking can be very memory-hungry, especially the final viewer link
     set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory")
   endif (NOT USESYSTEMLIBS)
 
   set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
-  set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}")
 endif (LINUX)
 
 
 if (DARWIN)
-  add_definitions(-DLL_DARWIN=1)
   set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
   set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
-  set(DARWIN_extra_cstar_flags "-g -Wno-unused-local-typedef -Wno-deprecated-declarations")
+  set(DARWIN_extra_cstar_flags "-Wno-unused-local-typedef -Wno-deprecated-declarations")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  ${DARWIN_extra_cstar_flags}")
   # NOTE: it's critical that the optimization flag is put in front.
   # NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
-  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
-  set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
 ## Really?? On developer machines too?
 ##set(ENABLE_SIGNING TRUE)
 ##set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.")
diff --git a/indra/cmake/FindHUNSPELL.cmake b/indra/cmake/FindHUNSPELL.cmake
index 6faf22959c65ab189f5c10e3b3afdfaba00bd973..d411bdb9e5eba98c57ecca9f96c0cefc7f11a7f1 100644
--- a/indra/cmake/FindHUNSPELL.cmake
+++ b/indra/cmake/FindHUNSPELL.cmake
@@ -10,7 +10,7 @@ find_path(HUNSPELL_INCLUDE_DIR hunspell.h
   PATH_SUFFIXES hunspell
   )
 
-set(HUNSPELL_NAMES ${HUNSPELL_NAMES} libhunspell-1.3.0 libhunspell)
+set(HUNSPELL_NAMES ${HUNSPELL_NAMES} libhunspell-1.3 libhunspell)
 find_library(HUNSPELL_LIBRARY
   NAMES ${HUNSPELL_NAMES}
   )
diff --git a/indra/cmake/Hunspell.cmake b/indra/cmake/Hunspell.cmake
index ef74d95b2a6711f9e2fc20eba393a58242389bda..06227b3fe2336190d3277444c9b1623ac95d1d34 100644
--- a/indra/cmake/Hunspell.cmake
+++ b/indra/cmake/Hunspell.cmake
@@ -11,7 +11,7 @@ else (USESYSTEMLIBS)
   if (WINDOWS)
     set(HUNSPELL_LIBRARY libhunspell)
   elseif(DARWIN)
-    set(HUNSPELL_LIBRARY hunspell-1.3.0)
+    set(HUNSPELL_LIBRARY hunspell-1.3)
   elseif(LINUX)
     set(HUNSPELL_LIBRARY hunspell-1.3)
   else()
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 94c431feb4a30e9634350d41de4ac9c5fe340bba..2f0b583ed2ee588a0324afda9f96ab8635d8580c 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -2127,4 +2127,3 @@ LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BO
 }
 
 
-
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index a40db0f8cc786473daff03886aa1a19a78f8be27..2fdb8be84feeaf85b5154751710b5b44dc57ec30 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -443,7 +443,7 @@ class LLStringExplicit : public std::string
 struct LLDictionaryLess
 {
 public:
-	bool operator()(const std::string& a, const std::string& b)
+	bool operator()(const std::string& a, const std::string& b) const
 	{
 		return (LLStringUtil::precedesDict(a, b) ? true : false);
 	}
diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp
index c423047bb08fa6756461e69b5bdbec41f1bafb41..1829062af6426b1137323214aec283a8ecb9a475 100644
--- a/indra/llcorehttp/httpcommon.cpp
+++ b/indra/llcorehttp/httpcommon.cpp
@@ -50,11 +50,12 @@ HttpStatus::type_enum_t EXT_CURL_EASY;
 HttpStatus::type_enum_t EXT_CURL_MULTI;
 HttpStatus::type_enum_t LLCORE;
 
-HttpStatus::operator unsigned long() const
+HttpStatus::operator U32() const
 {
-	static const int shift(sizeof(unsigned long) * 4);
+	// Effectively, concatenate mType (high) with mStatus (low).
+	static const int shift(sizeof(mDetails->mStatus) * 8);
 
-	unsigned long result(((unsigned long)mDetails->mType) << shift | (unsigned long)(int)mDetails->mStatus);
+	U32 result(U32(mDetails->mType) << shift | U32((int)mDetails->mStatus));
 	return result;
 }
 
@@ -64,7 +65,7 @@ std::string HttpStatus::toHex() const
 	std::ostringstream result;
 	result.width(8);
 	result.fill('0');
-	result << std::hex << operator unsigned long();
+	result << std::hex << operator U32();
 	return result.str();
 }
 
diff --git a/indra/llcorehttp/httpcommon.h b/indra/llcorehttp/httpcommon.h
index b2db01d0387a6432b0d7fdc2906282b565480b7b..ea0c38abd7a09ea568f42b8c982bfd7cc20f7d7f 100644
--- a/indra/llcorehttp/httpcommon.h
+++ b/indra/llcorehttp/httpcommon.h
@@ -382,10 +382,10 @@ struct HttpStatus
 	/// creates an ambiguous second path to integer conversion
 	/// which tends to find programming errors such as formatting
 	/// the status to a stream (operator<<).
-	operator unsigned long() const;
-	unsigned long toULong() const
+	operator U32() const;
+	U32 toULong() const
 	{
-		return operator unsigned long();
+		return operator U32();
 	}
 
 	/// And to convert to a hex string.
diff --git a/indra/llcorehttp/tests/test_httpstatus.hpp b/indra/llcorehttp/tests/test_httpstatus.hpp
index 10cda799e76f49bcd89e25486e6a04002f033f93..cbe3f574d41670541f0f2185963b8fa33325b2ea 100644
--- a/indra/llcorehttp/tests/test_httpstatus.hpp
+++ b/indra/llcorehttp/tests/test_httpstatus.hpp
@@ -244,11 +244,7 @@ void HttpStatusTestObjectType::test<7>()
 	HttpStatus status(404);
 	std::string msg = status.toHex();
 	// std::cout << "Result:  " << msg << std::endl;
-#if ADDRESS_SIZE == 32
 	ensure_equals(msg, "01940001");
-#else
-	ensure_equals(msg, "19400000001");
-#endif
 }
 
 
diff --git a/indra/llmath/tests/v4math_test.cpp b/indra/llmath/tests/v4math_test.cpp
index 191ac864dfcf315123a7c7619d4e442478db25aa..9779dfded383f57e3272f10b0844d55127b037d9 100644
--- a/indra/llmath/tests/v4math_test.cpp
+++ b/indra/llmath/tests/v4math_test.cpp
@@ -355,7 +355,8 @@ namespace tut
 		val3 = z1 + (z2 - z1)* val;
 		val4 = w1 + (w2 - w1)* val;
 		LLVector4 vec4b = lerp(vec4,vec4a,val);
-		ensure("lerp failed", ((val1 ==vec4b.mV[VX])&& (val2 ==vec4b.mV[VY]) && (val3 ==vec4b.mV[VZ])&& (val4 ==vec4b.mV[VW])));	
+		LLVector4 check(val1, val2, val3, val4);
+		ensure_equals("lerp failed", check, vec4b);
 	}
 
 	template<> template<>
diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp
index 30a1ac975e76ab05779d9fec81d4d4cfa18ddb47..e776b84a12da93e280ff530c0f99650d1110b36a 100644
--- a/indra/llvfs/lldir_mac.cpp
+++ b/indra/llvfs/lldir_mac.cpp
@@ -94,7 +94,7 @@ LLDir_Mac::LLDir_Mac()
 		// MBW -- This keeps the mac application from finding other things.
 		// If this is really for skins, it should JUST apply to skins.
         
-		std::size_t build_dir_pos = mExecutableDir.rfind("/build-darwin-");
+		std::string::size_type build_dir_pos = mExecutableDir.rfind("/build-darwin-");
 		if (build_dir_pos != std::string::npos)
 		{
 			// ...we're in a dev checkout
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 4fe1e31668b127316ebafb33292f2c4e455cdd9c..bb3bcf2886e2f59312332d717edb2a900aa5c1d7 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -260,7 +260,7 @@ bool LLAppViewerMacOSX::restoreErrorTrap()
 	unsigned int reset_count = 0;
 	
 #define SET_SIG(S) 	sigaction(SIGABRT, &act, &old_act); \
-					if((unsigned int)act.sa_sigaction != (unsigned int) old_act.sa_sigaction) \
+					if(act.sa_sigaction != old_act.sa_sigaction) \
 						++reset_count;
 	// Synchronous signals
 	SET_SIG(SIGABRT)
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp
index a626ad1bffa7b9220cb290ce369c7d806a86d8bb..4cbeba083b94e0473816e5714faa30f8048bdca2 100644
--- a/indra/newview/llenvmanager.cpp
+++ b/indra/newview/llenvmanager.cpp
@@ -35,6 +35,22 @@
 #include "llwaterparammanager.h"
 #include "llwlhandlers.h"
 #include "llwlparammanager.h"
+#include "lltrans.h"
+
+std::string LLWLParamKey::toString() const
+{
+	switch (scope)
+	{
+	case SCOPE_LOCAL:
+		return name + std::string(" (") + LLTrans::getString("Local") + std::string(")");
+		break;
+	case SCOPE_REGION:
+		return name + std::string(" (") + LLTrans::getString("Region") + std::string(")");
+		break;
+	default:
+		return name + " (?)";
+	}
+}
 
 std::string LLEnvPrefs::getWaterPresetName() const
 {
diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h
index c7877303fc1a507ed2b234b781d950b5706edade..2e1b06dceb7f49c566b80244c842f4a7dd9072ea 100644
--- a/indra/newview/llenvmanager.h
+++ b/indra/newview/llenvmanager.h
@@ -48,6 +48,87 @@ struct LLEnvKey
 	} EScope;
 };
 
+struct LLWLParamKey : LLEnvKey
+{
+public:
+	// scope and source of a param set (WL sky preset)
+	std::string name;
+	EScope scope;
+
+	// for conversion from LLSD
+	static const int NAME_IDX = 0;
+	static const int SCOPE_IDX = 1;
+
+	inline LLWLParamKey(const std::string& n, EScope s)
+		: name(n), scope(s)
+	{
+	}
+
+	inline LLWLParamKey(LLSD llsd)
+		: name(llsd[NAME_IDX].asString()), scope(EScope(llsd[SCOPE_IDX].asInteger()))
+	{
+	}
+
+	inline LLWLParamKey() // NOT really valid, just so std::maps can return a default of some sort
+		: name(""), scope(SCOPE_LOCAL)
+	{
+	}
+
+	inline LLWLParamKey(std::string& stringVal)
+	{
+		size_t len = stringVal.length();
+		if (len > 0)
+		{
+			name = stringVal.substr(0, len - 1);
+			scope = (EScope) atoi(stringVal.substr(len - 1, len).c_str());
+		}
+	}
+
+	inline std::string toStringVal() const
+	{
+		std::stringstream str;
+		str << name << scope;
+		return str.str();
+	}
+
+	inline LLSD toLLSD() const
+	{
+		LLSD llsd = LLSD::emptyArray();
+		llsd.append(LLSD(name));
+		llsd.append(LLSD(scope));
+		return llsd;
+	}
+
+	inline void fromLLSD(const LLSD& llsd)
+	{
+		name = llsd[NAME_IDX].asString();
+		scope = EScope(llsd[SCOPE_IDX].asInteger());
+	}
+
+	inline bool operator <(const LLWLParamKey other) const
+	{
+		if (name < other.name)
+		{	
+			return true;
+		}
+		else if (name > other.name)
+		{
+			return false;
+		}
+		else
+		{
+			return scope < other.scope;
+		}
+	}
+
+	inline bool operator ==(const LLWLParamKey other) const
+	{
+		return (name == other.name) && (scope == other.scope);
+	}
+
+	std::string toString() const;
+};
+
 class LLEnvironmentSettings
 {
 public:
diff --git a/indra/newview/llfloaterbeacons.cpp b/indra/newview/llfloaterbeacons.cpp
index 316294a477408d700e5019d709b79232e7327aa0..cf38a004994bda5bf1b3eecf4ccc8726fa9e3f98 100644
--- a/indra/newview/llfloaterbeacons.cpp
+++ b/indra/newview/llfloaterbeacons.cpp
@@ -66,13 +66,13 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl)
 	std::string name = check->getName();
 	if(name == "touch_only")
 	{
-		LLPipeline::toggleRenderScriptedTouchBeacons(NULL);
+		LLPipeline::toggleRenderScriptedTouchBeacons();
 		// Don't allow both to be ON at the same time. Toggle the other one off if both now on.
 		if (
-			LLPipeline::getRenderScriptedTouchBeacons(NULL) &&
-			LLPipeline::getRenderScriptedBeacons(NULL) )
+			LLPipeline::getRenderScriptedTouchBeacons() &&
+			LLPipeline::getRenderScriptedBeacons() )
 		{
-			LLPipeline::setRenderScriptedBeacons(FALSE);
+			LLPipeline::setRenderScriptedBeacons(false);
 			getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(FALSE));
 			getChild<LLCheckBoxCtrl>("scripted")->setValue(FALSE);
 			getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline
@@ -81,13 +81,13 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl)
 	}
 	else if(name == "scripted")
 	{
-		LLPipeline::toggleRenderScriptedBeacons(NULL);
+		LLPipeline::toggleRenderScriptedBeacons();
 		// Don't allow both to be ON at the same time. Toggle the other one off if both now on.
 		if (
-			LLPipeline::getRenderScriptedTouchBeacons(NULL) &&
-			LLPipeline::getRenderScriptedBeacons(NULL) )
+			LLPipeline::getRenderScriptedTouchBeacons() &&
+			LLPipeline::getRenderScriptedBeacons() )
 		{
-			LLPipeline::setRenderScriptedTouchBeacons(FALSE);
+			LLPipeline::setRenderScriptedTouchBeacons(false);
 			getChild<LLCheckBoxCtrl>("touch_only")->setControlValue(LLSD(FALSE));
 			getChild<LLCheckBoxCtrl>("touch_only")->setValue(FALSE);
 			getChild<LLCheckBoxCtrl>("scripted")->setControlValue(LLSD(TRUE)); // just to be sure it's in sync with llpipeline
@@ -100,13 +100,13 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl)
 	else if(name == "moapbeacon")     LLPipeline::setRenderMOAPBeacons(check->get());
 	else if(name == "highlights")
 	{
-		LLPipeline::toggleRenderHighlights(NULL);
+		LLPipeline::toggleRenderHighlights();
 		// Don't allow both to be OFF at the same time. Toggle the other one on if both now off.
 		if (
-			!LLPipeline::getRenderBeacons(NULL) &&
-			!LLPipeline::getRenderHighlights(NULL) )
+			!LLPipeline::getRenderBeacons() &&
+			!LLPipeline::getRenderHighlights() )
 		{
-			LLPipeline::setRenderBeacons(TRUE);
+			LLPipeline::setRenderBeacons(true);
 			getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(TRUE));
 			getChild<LLCheckBoxCtrl>("beacons")->setValue(TRUE);
 			getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline
@@ -115,13 +115,13 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl)
 	}
 	else if(name == "beacons")
 	{
-		LLPipeline::toggleRenderBeacons(NULL);
+		LLPipeline::toggleRenderBeacons();
 		// Don't allow both to be OFF at the same time. Toggle the other one on if both now off.
 		if (
-			!LLPipeline::getRenderBeacons(NULL) &&
-			!LLPipeline::getRenderHighlights(NULL) )
+			!LLPipeline::getRenderBeacons() &&
+			!LLPipeline::getRenderHighlights() )
 		{
-			LLPipeline::setRenderHighlights(TRUE);
+			LLPipeline::setRenderHighlights(true);
 			getChild<LLCheckBoxCtrl>("highlights")->setControlValue(LLSD(TRUE));
 			getChild<LLCheckBoxCtrl>("highlights")->setValue(TRUE);
 			getChild<LLCheckBoxCtrl>("beacons")->setControlValue(LLSD(FALSE)); // just to be sure it's in sync with llpipeline
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp
index 957c91b2263eb4f16e74ccfc2197671711158d4c..33e4c7cd5fded23519bdd09ae71354cab3e104c0 100644
--- a/indra/newview/llfloaterbump.cpp
+++ b/indra/newview/llfloaterbump.cpp
@@ -184,7 +184,7 @@ void LLFloaterBump::onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y)
 
 			std::string mute_msg = (LLMuteList::getInstance()->isMuted(mItemUUID, mNames[mItemUUID])) ? "UnmuteAvatar" : "MuteAvatar";
 			mPopupMenu->getChild<LLUICtrl>("Avatar Mute")->setValue(LLTrans::getString(mute_msg));
-			mPopupMenu->setItemEnabled(std::string("Zoom In"), (BOOL)gObjectList.findObject(mItemUUID));
+			mPopupMenu->setItemEnabled(std::string("Zoom In"), bool(gObjectList.findObject(mItemUUID)));
 
 			((LLContextMenu*)mPopupMenu)->show(x, y);
 			LLMenuGL::showPopup(ctrl, mPopupMenu, x, y);
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index 257b39a7dda1f4cafa3153fd6c153411f83ec597..e9af22d3364bbe1e6bddcd92cc2b4a123e20ee84 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -282,7 +282,7 @@ void LLFloaterIMNearbyChat::onTearOffClicked()
 	LLFloaterIMSessionTab::onTearOffClicked();
 
 	// see CHUI-170: Save torn-off state of the nearby chat between sessions
-	BOOL in_the_multifloater = (BOOL)getHost();
+	bool in_the_multifloater(getHost());
 	gSavedPerAccountSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater);
 }
 
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index 333ff863e591ba9325d3b88cd7c503b32a35b036..fc2da772f347700277e6045c01f3226733f21b43 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -119,7 +119,7 @@ BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask)
 
 	LLVector3d pos_global = mMap->viewPosToGlobal(x, y);
 	
-	LLTracker::stopTracking(NULL);
+	LLTracker::stopTracking(false);
 	LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance();
 	if (world_map)
 	{
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index c67feb8158ba72f95199cd4d157278911a6dd5fd..d89fa03c1aad0689ff745bcc8a6b1ce082a039c9 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -558,7 +558,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string&
 	}
 	else
 	{
-		LLTracker::stopTracking(NULL);
+		LLTracker::stopTracking(false);
 	}
 	setDefaultBtn("Teleport");
 }
@@ -602,7 +602,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
 	}
 	else
 	{
-		LLTracker::stopTracking(NULL);
+		LLTracker::stopTracking(false);
 	}
 	setDefaultBtn("Teleport");
 }
@@ -628,7 +628,7 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
 	if (!sim_info)
 	{
 		// We haven't found a region for that point yet, leave the tracking to the world map
-		LLTracker::stopTracking(NULL);
+		LLTracker::stopTracking(false);
 		LLWorldMap::getInstance()->setTracking(pos_global);
 		S32 world_x = S32(pos_global.mdV[0] / 256);
 		S32 world_y = S32(pos_global.mdV[1] / 256);
@@ -644,7 +644,7 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
 	{
 		// Down region. Show the blue circle of death!
 		// i.e. let the world map that this and tell it it's invalid
-		LLTracker::stopTracking(NULL);
+		LLTracker::stopTracking(false);
 		LLWorldMap::getInstance()->setTracking(pos_global);
 		LLWorldMap::getInstance()->setTrackingInvalid();
 		setDefaultBtn("");
@@ -863,7 +863,7 @@ void LLFloaterWorldMap::friendsChanged()
 		   (buddy_info && !buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) ||
 		   gAgent.isGodlike())
 		{
-			LLTracker::stopTracking(NULL);
+			LLTracker::stopTracking(false);
 		}
 	}
 }
@@ -1070,7 +1070,7 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( )
 	
 	if( current_choice.isNull() || !list->setCurrentByID( current_choice ) )
 	{
-		LLTracker::stopTracking(NULL);
+		LLTracker::stopTracking(false);
 	}
 	
 }
@@ -1080,7 +1080,7 @@ void LLFloaterWorldMap::onComboTextEntry()
 	// Reset the tracking whenever we start typing into any of the search fields,
 	// so that hitting <enter> does an auto-complete versus teleporting us to the
 	// previously selected landmark/friend.
-	LLTracker::stopTracking(NULL);
+	LLTracker::stopTracking(false);
 }
 
 void LLFloaterWorldMap::onSearchTextEntry( )
@@ -1103,7 +1103,7 @@ void LLFloaterWorldMap::onLandmarkComboCommit()
 	LLUUID asset_id;
 	LLUUID item_id = list->getCurrentID();
 	
-	LLTracker::stopTracking(NULL);
+	LLTracker::stopTracking(false);
 	
 	//RN: stopTracking() clears current combobox selection, need to reassert it here
 	list->setCurrentByID(item_id);
@@ -1158,7 +1158,7 @@ void LLFloaterWorldMap::onAvatarComboPrearrange( )
 	
 	if( !list->setCurrentByID( current_choice ) || current_choice.isNull() )
 	{
-		LLTracker::stopTracking(NULL);
+		LLTracker::stopTracking(false);
 	}
 }
 
@@ -1271,7 +1271,7 @@ void LLFloaterWorldMap::onCoordinatesCommit()
 void LLFloaterWorldMap::onClearBtn()
 {
 	mTrackedStatus = LLTracker::TRACKING_NOTHING;
-	LLTracker::stopTracking((void *)(intptr_t)TRUE);
+	LLTracker::stopTracking(true);
 	LLWorldMap::getInstance()->cancelTracking();
 	mSLURL = LLSLURL();					// Clear the SLURL since it's invalid
 	mSetToUserPosition = TRUE;	// Revert back to the current user position
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 485d4677b1ca7ee702490b1e9d255d213771e97a..0218a45b8ef3150f9556789bcac0b2140c4eab0f 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -927,7 +927,7 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im, const LLSD& parse_params
 	//possibly a case of complex object names consisting of 3+ words
 	if (!has_name)
 	{
-		U32 divider_pos = stuff.find(NAME_TEXT_DIVIDER);
+		std::string::size_type divider_pos = stuff.find(NAME_TEXT_DIVIDER);
 		if (divider_pos != std::string::npos && divider_pos < (stuff.length() - NAME_TEXT_DIVIDER.length()))
 		{
 			im[LL_IM_FROM] = stuff.substr(0, divider_pos);
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index f996557c17a01cb15e5593094b32befd0e00da58..ccbe13fb50c7ebf30eeead15561cdbe818d877e3 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -531,7 +531,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)
 		LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
 		for (LLSD::array_const_iterator faceIter = response_data.beginArray(); faceIter != response_data.endArray(); ++faceIter)
 		{
-#           ifndef LL_RELEASE_FOR_DOWNLOAD
+#           ifdef SHOW_ASSERT                  // same condition that controls llassert()
 			const LLSD& face_data = *faceIter; // conditional to avoid unused variable warning
 #           endif
 			llassert(face_data.isMap());
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 72faa5a9e747342ce2381b8e39961c7b31fee66b..248c361ca40eb084f039b0854c5eff292e9d525e 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -988,6 +988,6 @@ void LLNetMap::handleStopTracking (const LLSD& userdata)
 	if (mPopupMenu)
 	{
 		mPopupMenu->setItemEnabled ("Stop Tracking", false);
-		LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL));
+		LLTracker::stopTracking (LLTracker::isTracking(NULL));
 	}
 }
diff --git a/indra/newview/llpipelinelistener.cpp b/indra/newview/llpipelinelistener.cpp
index 20759239bf5f66663c8b77385d6bc56135b426da..dfbe689f56f4e444b444ce18391da219c223ee19 100644
--- a/indra/newview/llpipelinelistener.cpp
+++ b/indra/newview/llpipelinelistener.cpp
@@ -48,7 +48,7 @@ namespace {
 			U32 render_type = render_type_from_string( iter->asString() );
 			if ( render_type != 0 )
 			{
-				LLPipeline::toggleRenderTypeControl( (void*) render_type );
+				LLPipeline::toggleRenderTypeControl( render_type );
 			}
 		}
 	}
@@ -59,7 +59,7 @@ namespace {
 		U32 render_type = render_type_from_string( request["type"].asString() );
 		if ( render_type != 0 )
 		{
-			response["value"] = LLPipeline::hasRenderTypeControl( (void*) render_type );
+			response["value"] = LLPipeline::hasRenderTypeControl( render_type );
 		}
 		else
 		{
@@ -87,7 +87,7 @@ namespace {
 			U32 render_feature = feature_from_string( iter->asString() );
 			if ( render_feature != 0 )
 			{
-				LLPipeline::toggleRenderDebugControl( (void*) render_feature );
+				LLPipeline::toggleRenderDebugControl( render_feature );
 			}
 		}
 	}
@@ -126,7 +126,7 @@ namespace {
 			U32 info_display = info_display_from_string( iter->asString() );
 			if ( info_display != 0 )
 			{
-				LLPipeline::toggleRenderDebug( (void*) info_display );
+				LLPipeline::toggleRenderDebug( info_display );
 			}
 		}
 	}
diff --git a/indra/newview/llsearchhistory.cpp b/indra/newview/llsearchhistory.cpp
index 0ea05a03d6775bf1aa6effa9eaf5c0f68c756dff..449e0080f0e52eea772ec4ea4a36cf4227b4368c 100644
--- a/indra/newview/llsearchhistory.cpp
+++ b/indra/newview/llsearchhistory.cpp
@@ -116,26 +116,26 @@ void LLSearchHistory::addEntry(const std::string& search_query)
 	mSearchHistory.push_front(item);
 }
 
-bool LLSearchHistory::LLSearchHistoryItem::operator < (const LLSearchHistory::LLSearchHistoryItem& right)
+bool LLSearchHistory::LLSearchHistoryItem::operator < (const LLSearchHistory::LLSearchHistoryItem& right) const
 {
 	S32 result = LLStringUtil::compareInsensitive(search_query, right.search_query);
 
 	return result < 0;
 }
 
-bool LLSearchHistory::LLSearchHistoryItem::operator > (const LLSearchHistory::LLSearchHistoryItem& right)
+bool LLSearchHistory::LLSearchHistoryItem::operator > (const LLSearchHistory::LLSearchHistoryItem& right) const
 {
 	S32 result = LLStringUtil::compareInsensitive(search_query, right.search_query);
 
 	return result > 0;
 }
 
-bool LLSearchHistory::LLSearchHistoryItem::operator==(const LLSearchHistory::LLSearchHistoryItem& right)
+bool LLSearchHistory::LLSearchHistoryItem::operator==(const LLSearchHistory::LLSearchHistoryItem& right) const
 {
 	return 0 == LLStringUtil::compareInsensitive(search_query, right.search_query);
 }
 
-bool LLSearchHistory::LLSearchHistoryItem::operator==(const std::string& right)
+bool LLSearchHistory::LLSearchHistoryItem::operator==(const std::string& right) const
 {
 	return 0 == LLStringUtil::compareInsensitive(search_query, right);
 }
diff --git a/indra/newview/llsearchhistory.h b/indra/newview/llsearchhistory.h
index 3309a8fcac0d2a0447e4dd88220fe932fc3b461a..7fe2aa273781829705124a905d676f7c96b52630 100644
--- a/indra/newview/llsearchhistory.h
+++ b/indra/newview/llsearchhistory.h
@@ -98,16 +98,16 @@ class LLSearchHistory : public LLSingleton<LLSearchHistory>, private LLDestroyCl
 		/**
 		 * Allows std::list sorting
 		 */
-		bool operator < (const LLSearchHistory::LLSearchHistoryItem& right);
+		bool operator < (const LLSearchHistory::LLSearchHistoryItem& right) const;
 
 		/**
 		 * Allows std::list sorting
 		 */
-		bool operator > (const LLSearchHistory::LLSearchHistoryItem& right);
+		bool operator > (const LLSearchHistory::LLSearchHistoryItem& right) const;
 
-		bool operator==(const LLSearchHistoryItem& right);
+		bool operator==(const LLSearchHistoryItem& right) const;
 
-		bool operator==(const std::string& right);
+		bool operator==(const std::string& right) const;
 
 		/**
 		 * Serializes search history item to LLSD
diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp
index cf09f6f9785a0c086b9aaf3c56cda128011e54da..dba690242ad2eea020e924b5d009936282535352 100644
--- a/indra/newview/llskinningutil.cpp
+++ b/indra/newview/llskinningutil.cpp
@@ -122,7 +122,7 @@ void LLSkinningUtil::initSkinningMatrixPalette(
 // static
 void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin)
 {
-#ifndef LL_RELEASE_FOR_DOWNLOAD
+#ifdef SHOW_ASSERT                  // same condition that controls llassert()
 	const S32 max_joints = skin->mJointNames.size();
     for (U32 j=0; j<num_vertices; j++)
     {
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index b015cde45d699f75d62f78d4ea4dfefc7909181d..2ec5c41b8862ca77dc0841edc9f8eeb80d5ab771 100644
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -100,9 +100,8 @@ LLTracker::~LLTracker()
 
 
 // static
-void LLTracker::stopTracking(void* userdata)
+void LLTracker::stopTracking(bool clear_ui)
 {
-	BOOL clear_ui = ((BOOL)(intptr_t)userdata);
 	instance()->stopTrackingAll(clear_ui);
 }
 
@@ -183,7 +182,7 @@ void LLTracker::render3D()
 		F32 dist = gFloaterWorldMap->getDistanceToDestination(pos_global, 0.5f);
 		if (dist < DESTINATION_REACHED_RADIUS)
 		{
-			instance()->stopTrackingLocation(FALSE,TRUE);
+			instance()->stopTrackingLocation(false,true);
 		}
 		else
 		{
@@ -606,7 +605,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
 }
 
 
-void LLTracker::stopTrackingAll(BOOL clear_ui)
+void LLTracker::stopTrackingAll(bool clear_ui)
 {
 	switch (mTrackingStatus)
 	{
@@ -626,7 +625,7 @@ void LLTracker::stopTrackingAll(BOOL clear_ui)
 }
 
 
-void LLTracker::stopTrackingAvatar(BOOL clear_ui)
+void LLTracker::stopTrackingAvatar(bool clear_ui)
 {
 	LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
 	if( !av_tracker.getAvatarID().isNull() )
@@ -640,7 +639,7 @@ void LLTracker::stopTrackingAvatar(BOOL clear_ui)
 }
 
 
-void LLTracker::stopTrackingLandmark(BOOL clear_ui)
+void LLTracker::stopTrackingLandmark(bool clear_ui)
 {
 	purgeBeaconText();
 	mTrackedLandmarkAssetID.setNull();
@@ -655,7 +654,7 @@ void LLTracker::stopTrackingLandmark(BOOL clear_ui)
 }
 
 
-void LLTracker::stopTrackingLocation(BOOL clear_ui, BOOL dest_reached)
+void LLTracker::stopTrackingLocation(bool clear_ui, bool dest_reached)
 {
 	purgeBeaconText();
 	mTrackedLocationName.assign("");
diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h
index a1c5052c1b85a157c8b8a32e6bd456ba0833719f..4a6f10b767dda24893c8d494501227fec2f9137b 100644
--- a/indra/newview/lltracker.h
+++ b/indra/newview/lltracker.h
@@ -74,8 +74,8 @@ class LLTracker
 	// these are static so that they can be used a callbacks
 	static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
 	static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; }
-	static BOOL isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; }
-	static void stopTracking(void*);
+	static bool isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; }
+	static void stopTracking(bool);
 	static void clearFocus();
 	
 	static const LLUUID& getTrackedLandmarkAssetID() { return instance()->mTrackedLandmarkAssetID; }
@@ -114,10 +114,10 @@ class LLTracker
 							 LLHUDText* hud_textp, 
 							 const std::string& label );
 
-	void stopTrackingAll(BOOL clear_ui = FALSE);
-	void stopTrackingAvatar(BOOL clear_ui = FALSE);
-	void stopTrackingLocation(BOOL clear_ui = FALSE, BOOL dest_reached = FALSE);
-	void stopTrackingLandmark(BOOL clear_ui = FALSE);
+	void stopTrackingAll(bool clear_ui = false);
+	void stopTrackingAvatar(bool clear_ui = false);
+	void stopTrackingLocation(bool clear_ui = false, bool dest_reached = false);
+	void stopTrackingLandmark(bool clear_ui = false);
 
 	void drawMarker(const LLVector3d& pos_global, const LLColor4& color);
 	void setLandmarkVisited();
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index afa00e3e6e54dd6c68fe34250eda3c5536381e7b..13eccaefc1c422044624fb10307e74a9941e7fd9 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1107,7 +1107,7 @@ void render_hud_attachments()
 		bool has_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
 		if (has_ui)
 		{
-			gPipeline.toggleRenderDebugFeature((void*) LLPipeline::RENDER_DEBUG_FEATURE_UI);
+			gPipeline.toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
 		}
 
 		S32 use_occlusion = LLPipeline::sUseOcclusion;
@@ -1152,7 +1152,7 @@ void render_hud_attachments()
 
 		if (has_ui)
 		{
-			gPipeline.toggleRenderDebugFeature((void*) LLPipeline::RENDER_DEBUG_FEATURE_UI);
+			gPipeline.toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
 		}
 		LLPipeline::sUseOcclusion = use_occlusion;
 		LLPipeline::sRenderingHUDs = FALSE;
@@ -1230,13 +1230,13 @@ bool get_hud_matrices(glh::matrix4f &proj, glh::matrix4f &model)
 	return get_hud_matrices(whole_screen, proj, model);
 }
 
-BOOL setup_hud_matrices()
+bool setup_hud_matrices()
 {
 	LLRect whole_screen = get_whole_screen_region();
 	return setup_hud_matrices(whole_screen);
 }
 
-BOOL setup_hud_matrices(const LLRect& screen_region)
+bool setup_hud_matrices(const LLRect& screen_region)
 {
 	glh::matrix4f proj, model;
 	bool result = get_hud_matrices(screen_region, proj, model);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 72579d4d7a429cac24f462ce676e190c6f4e0168..52dae4c0acc7e3bc386d5ae2399c48b347cb6371 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -792,7 +792,7 @@ class LLAdvancedToggleRenderType : public view_listener_t
 		U32 render_type = render_type_from_string( userdata.asString() );
 		if ( render_type != 0 )
 		{
-			LLPipeline::toggleRenderTypeControl( (void*)render_type );
+			LLPipeline::toggleRenderTypeControl( render_type );
 		}
 		return true;
 	}
@@ -808,7 +808,7 @@ class LLAdvancedCheckRenderType : public view_listener_t
 
 		if ( render_type != 0 )
 		{
-			new_value = LLPipeline::hasRenderTypeControl( (void*)render_type );
+			new_value = LLPipeline::hasRenderTypeControl( render_type );
 		}
 
 		return new_value;
@@ -867,7 +867,7 @@ class LLAdvancedToggleFeature : public view_listener_t
 		U32 feature = feature_from_string( userdata.asString() );
 		if ( feature != 0 )
 		{
-			LLPipeline::toggleRenderDebugFeature( (void*)feature );
+			LLPipeline::toggleRenderDebugFeature( feature );
 		}
 		return true;
 	}
@@ -882,7 +882,7 @@ class LLAdvancedCheckFeature : public view_listener_t
 
 	if ( feature != 0 )
 	{
-		new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature );
+		new_value = LLPipeline::toggleRenderDebugFeatureControl( feature );
 	}
 
 	return new_value;
@@ -923,7 +923,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t
 		{
 			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == TRUE) 
 			{
-				gPipeline.toggleRenderDebug((void*)LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
+				gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
 			}
 			LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF;
 		}
@@ -931,7 +931,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t
 		{
 			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) 
 			{
-				gPipeline.toggleRenderDebug((void*)LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
+				gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
 			}
 			LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_CURRENT;
 		}
@@ -939,7 +939,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t
 		{
 			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) 
 			{
-				gPipeline.toggleRenderDebug((void*)LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
+				gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
 			}
 			gPipeline.setRenderDebugFeatureControl(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY, true);
 			LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_DESIRED;
@@ -948,7 +948,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t
 		{
 			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) 
 			{
-				gPipeline.toggleRenderDebug((void*)LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
+				gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
 			}
 			LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_FULL;
 		}
@@ -1091,7 +1091,7 @@ class LLAdvancedToggleInfoDisplay : public view_listener_t
 		
 		if ( info_display != 0 )
 		{
-			LLPipeline::toggleRenderDebug( (void*)info_display );
+			LLPipeline::toggleRenderDebug( info_display );
 		}
 
 		return true;
@@ -1108,7 +1108,7 @@ class LLAdvancedCheckInfoDisplay : public view_listener_t
 
 		if ( info_display != 0 )
 		{
-			new_value = LLPipeline::toggleRenderDebugControl( (void*)info_display );
+			new_value = LLPipeline::toggleRenderDebugControl( info_display );
 		}
 
 		return new_value;
@@ -1221,7 +1221,7 @@ class LLAdvancedToggleWireframe : public view_listener_t
 		LLPipeline::updateRenderDeferred();
 		gPipeline.resetVertexBuffers();
 
-		if (!gUseWireframe && !gInitialDeferredModeForWireframe && LLPipeline::sRenderDeferred != gInitialDeferredModeForWireframe && gPipeline.isInit())
+		if (!gUseWireframe && !gInitialDeferredModeForWireframe && LLPipeline::sRenderDeferred != bool(gInitialDeferredModeForWireframe) && gPipeline.isInit())
 		{
 			LLPipeline::refreshCachedSettings();
 			gPipeline.releaseGLBuffers();
@@ -8080,66 +8080,66 @@ class LLViewToggleBeacon : public view_listener_t
 		std::string beacon = userdata.asString();
 		if (beacon == "scriptsbeacon")
 		{
-			LLPipeline::toggleRenderScriptedBeacons(NULL);
-			gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons(NULL) );
+			LLPipeline::toggleRenderScriptedBeacons();
+			gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() );
 			// toggle the other one off if it's on
-			if (LLPipeline::getRenderScriptedBeacons(NULL) && LLPipeline::getRenderScriptedTouchBeacons(NULL))
+			if (LLPipeline::getRenderScriptedBeacons() && LLPipeline::getRenderScriptedTouchBeacons())
 			{
-				LLPipeline::toggleRenderScriptedTouchBeacons(NULL);
-				gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons(NULL) );
+				LLPipeline::toggleRenderScriptedTouchBeacons();
+				gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons() );
 			}
 		}
 		else if (beacon == "physicalbeacon")
 		{
-			LLPipeline::toggleRenderPhysicalBeacons(NULL);
-			gSavedSettings.setBOOL( "physicalbeacon", LLPipeline::getRenderPhysicalBeacons(NULL) );
+			LLPipeline::toggleRenderPhysicalBeacons();
+			gSavedSettings.setBOOL( "physicalbeacon", LLPipeline::getRenderPhysicalBeacons() );
 		}
 		else if (beacon == "moapbeacon")
 		{
-			LLPipeline::toggleRenderMOAPBeacons(NULL);
-			gSavedSettings.setBOOL( "moapbeacon", LLPipeline::getRenderMOAPBeacons(NULL) );
+			LLPipeline::toggleRenderMOAPBeacons();
+			gSavedSettings.setBOOL( "moapbeacon", LLPipeline::getRenderMOAPBeacons() );
 		}
 		else if (beacon == "soundsbeacon")
 		{
-			LLPipeline::toggleRenderSoundBeacons(NULL);
-			gSavedSettings.setBOOL( "soundsbeacon", LLPipeline::getRenderSoundBeacons(NULL) );
+			LLPipeline::toggleRenderSoundBeacons();
+			gSavedSettings.setBOOL( "soundsbeacon", LLPipeline::getRenderSoundBeacons() );
 		}
 		else if (beacon == "particlesbeacon")
 		{
-			LLPipeline::toggleRenderParticleBeacons(NULL);
-			gSavedSettings.setBOOL( "particlesbeacon", LLPipeline::getRenderParticleBeacons(NULL) );
+			LLPipeline::toggleRenderParticleBeacons();
+			gSavedSettings.setBOOL( "particlesbeacon", LLPipeline::getRenderParticleBeacons() );
 		}
 		else if (beacon == "scripttouchbeacon")
 		{
-			LLPipeline::toggleRenderScriptedTouchBeacons(NULL);
-			gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons(NULL) );
+			LLPipeline::toggleRenderScriptedTouchBeacons();
+			gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons() );
 			// toggle the other one off if it's on
-			if (LLPipeline::getRenderScriptedBeacons(NULL) && LLPipeline::getRenderScriptedTouchBeacons(NULL))
+			if (LLPipeline::getRenderScriptedBeacons() && LLPipeline::getRenderScriptedTouchBeacons())
 			{
-				LLPipeline::toggleRenderScriptedBeacons(NULL);
-				gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons(NULL) );
+				LLPipeline::toggleRenderScriptedBeacons();
+				gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() );
 			}
 		}
 		else if (beacon == "renderbeacons")
 		{
-			LLPipeline::toggleRenderBeacons(NULL);
-			gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons(NULL) );
+			LLPipeline::toggleRenderBeacons();
+			gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons() );
 			// toggle the other one on if it's not
-			if (!LLPipeline::getRenderBeacons(NULL) && !LLPipeline::getRenderHighlights(NULL))
+			if (!LLPipeline::getRenderBeacons() && !LLPipeline::getRenderHighlights())
 			{
-				LLPipeline::toggleRenderHighlights(NULL);
-				gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights(NULL) );
+				LLPipeline::toggleRenderHighlights();
+				gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights() );
 			}
 		}
 		else if (beacon == "renderhighlights")
 		{
-			LLPipeline::toggleRenderHighlights(NULL);
-			gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights(NULL) );
+			LLPipeline::toggleRenderHighlights();
+			gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights() );
 			// toggle the other one on if it's not
-			if (!LLPipeline::getRenderBeacons(NULL) && !LLPipeline::getRenderHighlights(NULL))
+			if (!LLPipeline::getRenderBeacons() && !LLPipeline::getRenderHighlights())
 			{
-				LLPipeline::toggleRenderBeacons(NULL);
-				gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons(NULL) );
+				LLPipeline::toggleRenderBeacons();
+				gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons() );
 			}
 		}
 
@@ -8218,7 +8218,7 @@ class LLViewCheckRenderType : public view_listener_t
 		bool new_value = false;
 		if (type == "hideparticles")
 		{
-			new_value = LLPipeline::toggleRenderTypeControlNegated((void *)LLPipeline::RENDER_TYPE_PARTICLES);
+			new_value = LLPipeline::toggleRenderTypeControlNegated(LLPipeline::RENDER_TYPE_PARTICLES);
 		}
 		return new_value;
 	}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index f472db080fad536d046201bd9e05cdd125d818cc..333b6703fe38d3f5abaae6bd1029057e84afd74e 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2596,7 +2596,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 
 			// The group notice packet does not have an AgentID.  Obtain one from the name cache.
 			// If last name is "Resident" strip it out so the cache name lookup works.
-			U32 index = original_name.find(" Resident");
+			std::string::size_type index = original_name.find(" Resident");
 			if (index != std::string::npos)
 			{
 				original_name = original_name.substr(0, index);
@@ -4196,7 +4196,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 		LLVector3 beacon_dir(agent_pos.mV[VX] - (F32)fmod(beacon_pos.mdV[VX], 256.0), agent_pos.mV[VY] - (F32)fmod(beacon_pos.mdV[VY], 256.0), 0);
 		if (beacon_dir.magVecSquared() < 25.f)
 		{
-			LLTracker::stopTracking(NULL);
+			LLTracker::stopTracking(false);
 		}
 		else if ( is_teleport && !gAgent.getTeleportKeepsLookAt() && look_at.isExactlyZero())
 		{
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 9e68bb78e0900f3bee15c7b2ba474857134a121a..44b297a1284435371380efe31e89b3fcedf2e030 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -747,45 +747,45 @@ class LLDebugText
 		}
 
 		// only display these messages if we are actually rendering beacons at this moment
-		if (LLPipeline::getRenderBeacons(NULL) && LLFloaterReg::instanceVisible("beacons"))
+		if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons"))
 		{
-			if (LLPipeline::getRenderMOAPBeacons(NULL))
+			if (LLPipeline::getRenderMOAPBeacons())
 			{
 				addText(xpos, ypos, "Viewing media beacons (white)");
 				ypos += y_inc;
 			}
 
-			if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES))
+			if (LLPipeline::toggleRenderTypeControlNegated(LLPipeline::RENDER_TYPE_PARTICLES))
 			{
 				addText(xpos, ypos, particle_hiding);
 				ypos += y_inc;
 			}
 
-			if (LLPipeline::getRenderParticleBeacons(NULL))
+			if (LLPipeline::getRenderParticleBeacons())
 			{
 				addText(xpos, ypos, "Viewing particle beacons (blue)");
 				ypos += y_inc;
 			}
 
-			if (LLPipeline::getRenderSoundBeacons(NULL))
+			if (LLPipeline::getRenderSoundBeacons())
 			{
 				addText(xpos, ypos, "Viewing sound beacons (yellow)");
 				ypos += y_inc;
 			}
 
-			if (LLPipeline::getRenderScriptedBeacons(NULL))
+			if (LLPipeline::getRenderScriptedBeacons())
 			{
 				addText(xpos, ypos, beacon_scripted);
 				ypos += y_inc;
 			}
 			else
-				if (LLPipeline::getRenderScriptedTouchBeacons(NULL))
+				if (LLPipeline::getRenderScriptedTouchBeacons())
 				{
 					addText(xpos, ypos, beacon_scripted_touch);
 					ypos += y_inc;
 				}
 
-			if (LLPipeline::getRenderPhysicalBeacons(NULL))
+			if (LLPipeline::getRenderPhysicalBeacons())
 			{
 				addText(xpos, ypos, "Viewing physical object beacons (green)");
 				ypos += y_inc;
@@ -4500,7 +4500,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 
 	if ( prev_draw_ui != show_ui)
 	{
-		LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI);
+		LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
 	}
 
 	BOOL hide_hud = !gSavedSettings.getBOOL("RenderHUDInSnapshot") && LLPipeline::sShowHUDAttachments;
@@ -4723,7 +4723,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 	// POST SNAPSHOT
 	if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
 	{
-		LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI);
+		LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI);
 	}
 
 	if (hide_hud)
diff --git a/indra/newview/llwlanimator.h b/indra/newview/llwlanimator.h
index 810f4cf7e59f3d5ea928a5485835f4255b4d34d3..e2e49c73051555cddda76bfa33a6431b42b979e1 100644
--- a/indra/newview/llwlanimator.h
+++ b/indra/newview/llwlanimator.h
@@ -28,12 +28,11 @@
 #define LL_WL_ANIMATOR_H
 
 #include "llwlparamset.h"
+#include "llenvmanager.h"
 #include "llwaterparamset.h"
 #include <string>
 #include <map>
 
-struct LLWLParamKey;
-
 class LLWLAnimator {
 public:
 	typedef enum e_time
diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
index e13aed98edfc507d5bec39592e9fdc8493cc67a1..29826e32ba0e5a9db8f106fb5025b3efb421b74f 100644
--- a/indra/newview/llwlparammanager.h
+++ b/indra/newview/llwlparammanager.h
@@ -116,100 +116,6 @@ struct WLFloatControl {
 	}
 };
 
-struct LLWLParamKey : LLEnvKey
-{
-public:
-	// scope and source of a param set (WL sky preset)
-	std::string name;
-	EScope scope;
-
-	// for conversion from LLSD
-	static const int NAME_IDX = 0;
-	static const int SCOPE_IDX = 1;
-
-	inline LLWLParamKey(const std::string& n, EScope s)
-		: name(n), scope(s)
-	{
-	}
-
-	inline LLWLParamKey(LLSD llsd)
-		: name(llsd[NAME_IDX].asString()), scope(EScope(llsd[SCOPE_IDX].asInteger()))
-	{
-	}
-
-	inline LLWLParamKey() // NOT really valid, just so std::maps can return a default of some sort
-		: name(""), scope(SCOPE_LOCAL)
-	{
-	}
-
-	inline LLWLParamKey(std::string& stringVal)
-	{
-		size_t len = stringVal.length();
-		if (len > 0)
-		{
-			name = stringVal.substr(0, len - 1);
-			scope = (EScope) atoi(stringVal.substr(len - 1, len).c_str());
-		}
-	}
-
-	inline std::string toStringVal() const
-	{
-		std::stringstream str;
-		str << name << scope;
-		return str.str();
-	}
-
-	inline LLSD toLLSD() const
-	{
-		LLSD llsd = LLSD::emptyArray();
-		llsd.append(LLSD(name));
-		llsd.append(LLSD(scope));
-		return llsd;
-	}
-
-	inline void fromLLSD(const LLSD& llsd)
-	{
-		name = llsd[NAME_IDX].asString();
-		scope = EScope(llsd[SCOPE_IDX].asInteger());
-	}
-
-	inline bool operator <(const LLWLParamKey other) const
-	{
-		if (name < other.name)
-		{	
-			return true;
-		}
-		else if (name > other.name)
-		{
-			return false;
-		}
-		else
-		{
-			return scope < other.scope;
-		}
-	}
-
-	inline bool operator ==(const LLWLParamKey other) const
-	{
-		return (name == other.name) && (scope == other.scope);
-	}
-
-	inline std::string toString() const
-	{
-		switch (scope)
-		{
-		case SCOPE_LOCAL:
-			return name + std::string(" (") + LLTrans::getString("Local") + std::string(")");
-			break;
-		case SCOPE_REGION:
-			return name + std::string(" (") + LLTrans::getString("Region") + std::string(")");
-			break;
-		default:
-			return name + " (?)";
-		}
-	}
-};
-
 /// WindLight parameter manager class - what controls all the wind light shaders
 class LLWLParamManager : public LLSingleton<LLWLParamManager>
 {
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index c6bbfb1c8ffd975cd57f9642b4319dec6a68927c..7553ddff639b7587c54e3fe4dcb24a79a40bdc64 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -129,26 +129,26 @@
 bool gShiftFrame = false;
 
 //cached settings
-BOOL LLPipeline::RenderAvatarVP;
-BOOL LLPipeline::VertexShaderEnable;
-BOOL LLPipeline::WindLightUseAtmosShaders;
-BOOL LLPipeline::RenderDeferred;
+bool LLPipeline::RenderAvatarVP;
+bool LLPipeline::VertexShaderEnable;
+bool LLPipeline::WindLightUseAtmosShaders;
+bool LLPipeline::RenderDeferred;
 F32 LLPipeline::RenderDeferredSunWash;
 U32 LLPipeline::RenderFSAASamples;
 U32 LLPipeline::RenderResolutionDivisor;
-BOOL LLPipeline::RenderUIBuffer;
+bool LLPipeline::RenderUIBuffer;
 S32 LLPipeline::RenderShadowDetail;
-BOOL LLPipeline::RenderDeferredSSAO;
+bool LLPipeline::RenderDeferredSSAO;
 F32 LLPipeline::RenderShadowResolutionScale;
-BOOL LLPipeline::RenderLocalLights;
-BOOL LLPipeline::RenderDelayCreation;
-BOOL LLPipeline::RenderAnimateRes;
-BOOL LLPipeline::FreezeTime;
+bool LLPipeline::RenderLocalLights;
+bool LLPipeline::RenderDelayCreation;
+bool LLPipeline::RenderAnimateRes;
+bool LLPipeline::FreezeTime;
 S32 LLPipeline::DebugBeaconLineWidth;
 F32 LLPipeline::RenderHighlightBrightness;
 LLColor4 LLPipeline::RenderHighlightColor;
 F32 LLPipeline::RenderHighlightThickness;
-BOOL LLPipeline::RenderSpotLightsInNondeferred;
+bool LLPipeline::RenderSpotLightsInNondeferred;
 LLColor4 LLPipeline::PreviewAmbientColor;
 LLColor4 LLPipeline::PreviewDiffuse0;
 LLColor4 LLPipeline::PreviewSpecular0;
@@ -168,8 +168,8 @@ S32 LLPipeline::RenderGlowResolutionPow;
 S32 LLPipeline::RenderGlowIterations;
 F32 LLPipeline::RenderGlowWidth;
 F32 LLPipeline::RenderGlowStrength;
-BOOL LLPipeline::RenderDepthOfField;
-BOOL LLPipeline::RenderDepthOfFieldInEditMode;
+bool LLPipeline::RenderDepthOfField;
+bool LLPipeline::RenderDepthOfFieldInEditMode;
 F32 LLPipeline::CameraFocusTransitionTime;
 F32 LLPipeline::CameraFNumber;
 F32 LLPipeline::CameraFocalLength;
@@ -190,7 +190,7 @@ F32 LLPipeline::RenderEdgeDepthCutoff;
 F32 LLPipeline::RenderEdgeNormCutoff;
 LLVector3 LLPipeline::RenderShadowGaussian;
 F32 LLPipeline::RenderShadowBlurDistFactor;
-BOOL LLPipeline::RenderDeferredAtmospheric;
+bool LLPipeline::RenderDeferredAtmospheric;
 S32 LLPipeline::RenderReflectionDetail;
 F32 LLPipeline::RenderHighlightFadeTime;
 LLVector3 LLPipeline::RenderShadowClipPlanes;
@@ -200,7 +200,7 @@ F32 LLPipeline::RenderFarClip;
 LLVector3 LLPipeline::RenderShadowSplitExponent;
 F32 LLPipeline::RenderShadowErrorCutoff;
 F32 LLPipeline::RenderShadowFOVCutoff;
-BOOL LLPipeline::CameraOffset;
+bool LLPipeline::CameraOffset;
 F32 LLPipeline::CameraMaxCoF;
 F32 LLPipeline::CameraDoFResScale;
 F32 LLPipeline::RenderAutoHideSurfaceAreaLimit;
@@ -215,9 +215,9 @@ extern S32 gBoxFrame;
 extern BOOL gDisplaySwapBuffers;
 extern BOOL gDebugGL;
 
-BOOL	gAvatarBacklight = FALSE;
+bool	gAvatarBacklight = false;
 
-BOOL	gDebugPipeline = FALSE;
+bool	gDebugPipeline = false;
 LLPipeline gPipeline;
 const LLMatrix4* gGLLastMatrix = NULL;
 
@@ -358,45 +358,45 @@ void display_update_camera();
 
 S32		LLPipeline::sCompiles = 0;
 
-BOOL	LLPipeline::sPickAvatar = TRUE;
-BOOL	LLPipeline::sDynamicLOD = TRUE;
-BOOL	LLPipeline::sShowHUDAttachments = TRUE;
-BOOL	LLPipeline::sRenderMOAPBeacons = FALSE;
-BOOL	LLPipeline::sRenderPhysicalBeacons = TRUE;
-BOOL	LLPipeline::sRenderScriptedBeacons = FALSE;
-BOOL	LLPipeline::sRenderScriptedTouchBeacons = TRUE;
-BOOL	LLPipeline::sRenderParticleBeacons = FALSE;
-BOOL	LLPipeline::sRenderSoundBeacons = FALSE;
-BOOL	LLPipeline::sRenderBeacons = FALSE;
-BOOL	LLPipeline::sRenderHighlight = TRUE;
+bool	LLPipeline::sPickAvatar = true;
+bool	LLPipeline::sDynamicLOD = true;
+bool	LLPipeline::sShowHUDAttachments = true;
+bool	LLPipeline::sRenderMOAPBeacons = false;
+bool	LLPipeline::sRenderPhysicalBeacons = true;
+bool	LLPipeline::sRenderScriptedBeacons = false;
+bool	LLPipeline::sRenderScriptedTouchBeacons = true;
+bool	LLPipeline::sRenderParticleBeacons = false;
+bool	LLPipeline::sRenderSoundBeacons = false;
+bool	LLPipeline::sRenderBeacons = false;
+bool	LLPipeline::sRenderHighlight = true;
 LLRender::eTexIndex LLPipeline::sRenderHighlightTextureChannel = LLRender::DIFFUSE_MAP;
-BOOL	LLPipeline::sForceOldBakedUpload = FALSE;
+bool	LLPipeline::sForceOldBakedUpload = false;
 S32		LLPipeline::sUseOcclusion = 0;
-BOOL	LLPipeline::sDelayVBUpdate = TRUE;
-BOOL	LLPipeline::sAutoMaskAlphaDeferred = TRUE;
-BOOL	LLPipeline::sAutoMaskAlphaNonDeferred = FALSE;
-BOOL	LLPipeline::sDisableShaders = FALSE;
-BOOL	LLPipeline::sRenderBump = TRUE;
-BOOL	LLPipeline::sBakeSunlight = FALSE;
-BOOL	LLPipeline::sNoAlpha = FALSE;
-BOOL	LLPipeline::sUseTriStrips = TRUE;
-BOOL	LLPipeline::sUseFarClip = TRUE;
-BOOL	LLPipeline::sShadowRender = FALSE;
-BOOL	LLPipeline::sWaterReflections = FALSE;
-BOOL	LLPipeline::sRenderGlow = FALSE;
-BOOL	LLPipeline::sReflectionRender = FALSE;
-BOOL	LLPipeline::sImpostorRender = FALSE;
-BOOL	LLPipeline::sImpostorRenderAlphaDepthPass = FALSE;
-BOOL	LLPipeline::sUnderWaterRender = FALSE;
-BOOL	LLPipeline::sTextureBindTest = FALSE;
-BOOL	LLPipeline::sRenderFrameTest = FALSE;
-BOOL	LLPipeline::sRenderAttachedLights = TRUE;
-BOOL	LLPipeline::sRenderAttachedParticles = TRUE;
-BOOL	LLPipeline::sRenderDeferred = FALSE;
-BOOL    LLPipeline::sMemAllocationThrottled = FALSE;
+bool	LLPipeline::sDelayVBUpdate = true;
+bool	LLPipeline::sAutoMaskAlphaDeferred = true;
+bool	LLPipeline::sAutoMaskAlphaNonDeferred = false;
+bool	LLPipeline::sDisableShaders = false;
+bool	LLPipeline::sRenderBump = true;
+bool	LLPipeline::sBakeSunlight = false;
+bool	LLPipeline::sNoAlpha = false;
+bool	LLPipeline::sUseTriStrips = true;
+bool	LLPipeline::sUseFarClip = true;
+bool	LLPipeline::sShadowRender = false;
+bool	LLPipeline::sWaterReflections = false;
+bool	LLPipeline::sRenderGlow = false;
+bool	LLPipeline::sReflectionRender = false;
+bool	LLPipeline::sImpostorRender = false;
+bool	LLPipeline::sImpostorRenderAlphaDepthPass = false;
+bool	LLPipeline::sUnderWaterRender = false;
+bool	LLPipeline::sTextureBindTest = false;
+bool	LLPipeline::sRenderFrameTest = false;
+bool	LLPipeline::sRenderAttachedLights = true;
+bool	LLPipeline::sRenderAttachedParticles = true;
+bool	LLPipeline::sRenderDeferred = false;
+bool    LLPipeline::sMemAllocationThrottled = false;
 S32		LLPipeline::sVisibleLightCount = 0;
 F32		LLPipeline::sMinRenderSize = 0.f;
-BOOL	LLPipeline::sRenderingHUDs;
+bool	LLPipeline::sRenderingHUDs;
 
 // EventHost API LLPipeline listener.
 static LLPipelineListener sPipelineListener;
@@ -413,14 +413,14 @@ bool addDeferredAttachments(LLRenderTarget& target)
 }
 
 LLPipeline::LLPipeline() :
-	mBackfaceCull(FALSE),
+	mBackfaceCull(false),
 	mMatrixOpCount(0),
 	mTextureMatrixOps(0),
 	mNumVisibleNodes(0),
 	mNumVisibleFaces(0),
 
-	mInitialized(FALSE),
-	mVertexShadersEnabled(FALSE),
+	mInitialized(false),
+	mVertexShadersEnabled(false),
 	mVertexShadersLoaded(0),
 	mTransformFeedbackPrimitives(0),
 	mRenderDebugFeatureMask(0),
@@ -485,7 +485,7 @@ void LLPipeline::init()
 	sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
 	sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
 
-	mInitialized = TRUE;
+	mInitialized = true;
 	
 	stop_glerror();
 
@@ -538,7 +538,7 @@ void LLPipeline::init()
 
 	mOldRenderDebugMask = mRenderDebugMask;
 
-	mBackfaceCull = TRUE;
+	mBackfaceCull = true;
 
 	stop_glerror();
 	
@@ -723,7 +723,7 @@ void LLPipeline::cleanup()
 
 	mMovedBridge.clear();
 
-	mInitialized = FALSE;
+	mInitialized = false;
 
 	mDeferredVB = NULL;
 
@@ -759,7 +759,7 @@ void LLPipeline::destroyGL()
 static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture");
 
 //static
-void LLPipeline::throttleNewMemoryAllocation(BOOL disable)
+void LLPipeline::throttleNewMemoryAllocation(bool disable)
 {
 	if(sMemAllocationThrottled != disable)
 	{
@@ -932,7 +932,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 	if (LLPipeline::sRenderDeferred)
 	{
 		S32 shadow_detail = RenderShadowDetail;
-		BOOL ssao = RenderDeferredSSAO;
+		bool ssao = RenderDeferredSSAO;
 		
 		const U32 occlusion_divisor = 3;
 
@@ -1058,19 +1058,19 @@ void LLPipeline::updateRenderBump()
 //static
 void LLPipeline::updateRenderDeferred()
 {
-	BOOL deferred = ((RenderDeferred && 
+	bool deferred = (bool(RenderDeferred && 
 					 LLRenderTarget::sUseFBO &&
 					 LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&	 
 					 LLPipeline::sRenderBump &&
 					 VertexShaderEnable && 
 					 RenderAvatarVP &&
-					 WindLightUseAtmosShaders) ? TRUE : FALSE) &&
+					 WindLightUseAtmosShaders)) &&
 					!gUseWireframe;
 
 	sRenderDeferred = deferred;	
 	if (deferred)
 	{ //must render glow when rendering deferred since post effect pass is needed to present any lighting at all
-		sRenderGlow = TRUE;
+		sRenderGlow = true;
 	}
 }
 
@@ -1413,7 +1413,7 @@ void LLPipeline::restoreGL()
 }
 
 
-BOOL LLPipeline::canUseVertexShaders()
+bool LLPipeline::canUseVertexShaders()
 {
 	static const std::string vertex_shader_enable_feature_string = "VertexShaderEnable";
 
@@ -1423,30 +1423,30 @@ BOOL LLPipeline::canUseVertexShaders()
 		!LLFeatureManager::getInstance()->isFeatureAvailable(vertex_shader_enable_feature_string) ||
 		(assertInitialized() && mVertexShadersLoaded != 1) )
 	{
-		return FALSE;
+		return false;
 	}
 	else
 	{
-		return TRUE;
+		return true;
 	}
 }
 
-BOOL LLPipeline::canUseWindLightShaders() const
+bool LLPipeline::canUseWindLightShaders() const
 {
 	return (!LLPipeline::sDisableShaders &&
 			gWLSkyProgram.mProgramObject != 0 &&
 			LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1);
 }
 
-BOOL LLPipeline::canUseWindLightShadersOnObjects() const
+bool LLPipeline::canUseWindLightShadersOnObjects() const
 {
 	return (canUseWindLightShaders() 
 		&& LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0);
 }
 
-BOOL LLPipeline::canUseAntiAliasing() const
+bool LLPipeline::canUseAntiAliasing() const
 {
-	return TRUE;
+	return true;
 }
 
 void LLPipeline::unloadShaders()
@@ -1463,7 +1463,7 @@ void LLPipeline::assertInitializedDoError()
 
 //============================================================================
 
-void LLPipeline::enableShadows(const BOOL enable_shadows)
+void LLPipeline::enableShadows(const bool enable_shadows)
 {
 	//should probably do something here to wrangle shadows....	
 }
@@ -2001,7 +2001,7 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list)
 	{
 		LLDrawable::drawable_vector_t::iterator curiter = iter++;
 		LLDrawable *drawablep = *curiter;
-		BOOL done = TRUE;
+		bool done = true;
 		if (!drawablep->isDead() && (!drawablep->isState(LLDrawable::EARLY_MOVE)))
 		{
 			done = drawablep->updateMove();
@@ -2329,7 +2329,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)
 }
 
 
-BOOL LLPipeline::visibleObjectsInFrustum(LLCamera& camera)
+bool LLPipeline::visibleObjectsInFrustum(LLCamera& camera)
 {
 	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -2345,17 +2345,17 @@ BOOL LLPipeline::visibleObjectsInFrustum(LLCamera& camera)
 				{
 					if (part->visibleObjectsInFrustum(camera))
 					{
-						return TRUE;
+						return true;
 					}
 				}
 			}
 		}
 	}
 
-	return FALSE;
+	return false;
 }
 
-BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& max)
+bool LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& max)
 {
 	const F32 X = 65536.f;
 
@@ -2365,7 +2365,7 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3&
 	LLViewerCamera::eCameraID saved_camera_id = LLViewerCamera::sCurCameraID;
 	LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
 
-	BOOL res = TRUE;
+	bool res = true;
 
 	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -2381,7 +2381,7 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3&
 				{
 					if (!part->getVisibleExtents(camera, min, max))
 					{
-						res = FALSE;
+						res = false;
 					}
 				}
 			}
@@ -2408,7 +2408,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
 
 	sCull->clear();
 
-	BOOL to_texture =	LLPipeline::sUseOcclusion > 1 &&
+	bool to_texture =	LLPipeline::sUseOcclusion > 1 &&
 						!hasRenderType(LLPipeline::RENDER_TYPE_HUD) && 
 						LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD &&
 						gPipeline.canUseVertexShaders() &&
@@ -2788,9 +2788,9 @@ void LLPipeline::doOcclusion(LLCamera& camera)
 	}
 }
 	
-BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority)
+bool LLPipeline::updateDrawableGeom(LLDrawable* drawablep, bool priority)
 {
-	BOOL update_complete = drawablep->updateGeometry(priority);
+	bool update_complete = drawablep->updateGeometry(priority);
 	if (update_complete && assertInitialized())
 	{
 		drawablep->setState(LLDrawable::BUILT);
@@ -3077,7 +3077,7 @@ void LLPipeline::updateGeom(F32 max_dtime)
 		last_group = drawablep->getSpatialGroup();
 		last_bridge = bridge;
 
-		BOOL update_complete = TRUE;
+		bool update_complete = true;
 		if (!drawablep->isDead())
 		{
 			update_complete = updateDrawableGeom(drawablep, FALSE);
@@ -3134,7 +3134,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
 	}
 }
 
-void LLPipeline::markMoved(LLDrawable *drawablep, BOOL damped_motion)
+void LLPipeline::markMoved(LLDrawable *drawablep, bool damped_motion)
 {
 	if (!drawablep)
 	{
@@ -3168,7 +3168,7 @@ void LLPipeline::markMoved(LLDrawable *drawablep, BOOL damped_motion)
 		}
 		drawablep->setState(LLDrawable::ON_MOVE_LIST);
 	}
-	if (damped_motion == FALSE)
+	if (! damped_motion)
 	{
 		drawablep->setState(LLDrawable::MOVE_UNDAMPED); // UNDAMPED trumps DAMPED
 	}
@@ -3208,7 +3208,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
 	assertInitialized();
 
 	glClear(GL_DEPTH_BUFFER_BIT);
-	gDepthDirty = TRUE;
+	gDepthDirty = true;
 		
 	LLVector4a offseta;
 	offseta.load3(offset.mV);
@@ -3306,13 +3306,13 @@ void LLPipeline::markMeshDirty(LLSpatialGroup* group)
 	mMeshDirtyGroup.push_back(group);
 }
 
-void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority)
+void LLPipeline::markRebuild(LLSpatialGroup* group, bool priority)
 {
 	if (group && !group->isDead() && group->getSpatialPartition())
 	{
 		if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD)
 		{
-			priority = TRUE;
+			priority = true;
 		}
 
 		if (priority)
@@ -3345,13 +3345,13 @@ void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority)
 	}
 }
 
-void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag, BOOL priority)
+void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag, bool priority)
 {
 	if (drawablep && !drawablep->isDead() && assertInitialized())
 	{
 		if (!drawablep->isState(LLDrawable::BUILT))
 		{
-			priority = TRUE;
+			priority = true;
 		}
 		if (priority)
 		{
@@ -3720,17 +3720,17 @@ void renderMOAPBeacons(LLDrawable* drawablep)
 	if(!vobj || vobj->isAvatar())
 		return;
 
-	BOOL beacon=FALSE;
+	bool beacon=false;
 	U8 tecount=vobj->getNumTEs();
 	for(int x=0;x<tecount;x++)
 	{
 		if(vobj->getTE(x)->hasMedia())
 		{
-			beacon=TRUE;
+			beacon=true;
 			break;
 		}
 	}
-	if(beacon==TRUE)
+	if(beacon)
 	{
 		if (gPipeline.sRenderBeacons)
 		{
@@ -4309,7 +4309,7 @@ void LLPipeline::renderHighlights()
 //debug use
 U32 LLPipeline::sCurRenderPoolType = 0 ;
 
-void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
+void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
 {
 	LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY);
 
@@ -4366,13 +4366,13 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 	// Toggle backface culling for debugging
 	LLGLEnable cull_face(mBackfaceCull ? GL_CULL_FACE : 0);
 	// Set fog
-	BOOL use_fog = hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG);
+	bool use_fog = hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG);
 	LLGLEnable fog_enable(use_fog &&
 						  !gPipeline.canUseWindLightShadersOnObjects() ? GL_FOG : 0);
 	gSky.updateFog(camera.getFar());
 	if (!use_fog)
 	{
-		sUnderWaterRender = FALSE;
+		sUnderWaterRender = false;
 	}
 
 	gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep);
@@ -4409,7 +4409,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 			setupHWLights(NULL);
 		}
 
-		BOOL occlude = sUseOcclusion > 1;
+		bool occlude = sUseOcclusion > 1;
 		U32 cur_type = 0;
 
 		pool_set_t::iterator iter1 = mPools.begin();
@@ -4424,7 +4424,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 
 			if (occlude && cur_type >= LLDrawPool::POOL_GRASS)
 			{
-				occlude = FALSE;
+				occlude = false;
 				gGLLastMatrix = NULL;
 				gGL.loadMatrix(gGLModelView);
 				LLGLSLShader::bindNoShader();
@@ -4489,7 +4489,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 
 		if (occlude)
 		{
-			occlude = FALSE;
+			occlude = false;
 			gGLLastMatrix = NULL;
 			gGL.loadMatrix(gGLModelView);
 			LLGLSLShader::bindNoShader();
@@ -4672,7 +4672,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
 	gGL.setColorMask(true, false);
 
 	pool_set_t::iterator iter1 = mPools.begin();
-	BOOL occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion;
+	bool occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion;
 
 	while ( iter1 != mPools.end() )
 	{
@@ -4682,7 +4682,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
 
 		if (occlude && cur_type >= LLDrawPool::POOL_GRASS)
 		{
-			occlude = FALSE;
+			occlude = false;
 			gGLLastMatrix = NULL;
 			gGL.loadMatrix(gGLModelView);
 			LLGLSLShader::bindNoShader();
@@ -4742,7 +4742,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
 
 	if (occlude)
 	{
-		occlude = FALSE;
+		occlude = false;
 		gGLLastMatrix = NULL;
 		gGL.loadMatrix(gGLModelView);
 		LLGLSLShader::bindNoShader();
@@ -5884,7 +5884,7 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp )
 	case LLDrawPool::POOL_TREE:
 		#ifdef _DEBUG
 			{
-				BOOL found = mTreePools.erase( (uintptr_t)poolp->getTexture() );
+				bool found = mTreePools.erase( (uintptr_t)poolp->getTexture() );
 				llassert( found );
 			}
 		#else
@@ -5895,7 +5895,7 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp )
 	case LLDrawPool::POOL_TERRAIN:
 		#ifdef _DEBUG
 			{
-				BOOL found = mTerrainPools.erase( (uintptr_t)poolp->getTexture() );
+				bool found = mTerrainPools.erase( (uintptr_t)poolp->getTexture() );
 				llassert( found );
 			}
 		#else
@@ -5958,7 +5958,7 @@ void LLPipeline::resetDrawOrders()
 // Once-per-frame setup of hardware lights,
 // including sun/moon, avatar backlight, and up to 6 local lights
 
-void LLPipeline::setupAvatarLights(BOOL for_edit)
+void LLPipeline::setupAvatarLights(bool for_edit)
 {
 	assertInitialized();
 
@@ -6063,7 +6063,7 @@ static F32 calc_light_dist(LLVOVolume* light, const LLVector3& cam_pos, F32 max_
 		return max_dist;
 	}
 	F32 radius = light->getLightRadius();
-	BOOL selected = light->isSelected();
+	bool selected = light->isSelected();
 	LLVector3 dpos = light->getRenderPosition() - cam_pos;
 	F32 dist2 = dpos.lengthSquared();
 	if (!selected && dist2 > (max_dist + radius)*(max_dist + radius))
@@ -6658,9 +6658,9 @@ void LLPipeline::findReferences(LLDrawable *drawablep)
 	}
 }
 
-BOOL LLPipeline::verify()
+bool LLPipeline::verify()
 {
-	BOOL ok = assertInitialized();
+	bool ok = assertInitialized();
 	if (ok) 
 	{
 		for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
@@ -6668,7 +6668,7 @@ BOOL LLPipeline::verify()
 			LLDrawPool *poolp = *iter;
 			if (!poolp->verify())
 			{
-				ok = FALSE;
+				ok = false;
 			}
 		}
 	}
@@ -6713,7 +6713,7 @@ BOOL LLPipeline::verify()
 
 bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon)
 {
-	BOOL Inside = TRUE;
+	bool Inside = true;
 	LLVector3 MinB = center - size;
 	LLVector3 MaxB = center + size;
 	LLVector3 MaxT;
@@ -6725,7 +6725,7 @@ bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3&
 		if(origin.mV[i] < MinB.mV[i])
 		{
 			coord.mV[i]	= MinB.mV[i];
-			Inside		= FALSE;
+			Inside		= false;
 
 			// Calculate T distances to candidate planes
 			if(IR(dir.mV[i]))	MaxT.mV[i] = (MinB.mV[i] - origin.mV[i]) / dir.mV[i];
@@ -6733,7 +6733,7 @@ bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3&
 		else if(origin.mV[i] > MaxB.mV[i])
 		{
 			coord.mV[i]	= MaxB.mV[i];
-			Inside		= FALSE;
+			Inside		= false;
 
 			// Calculate T distances to candidate planes
 			if(IR(dir.mV[i]))	MaxT.mV[i] = (MaxB.mV[i] - origin.mV[i]) / dir.mV[i];
@@ -6779,7 +6779,7 @@ bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3&
 //
 //
 
-void LLPipeline::setLight(LLDrawable *drawablep, BOOL is_light)
+void LLPipeline::setLight(LLDrawable *drawablep, bool is_light)
 {
 	if (drawablep && assertInitialized())
 	{
@@ -6807,9 +6807,8 @@ void LLPipeline::toggleRenderType(U32 type)
 }
 
 //static
-void LLPipeline::toggleRenderTypeControl(void* data)
+void LLPipeline::toggleRenderTypeControl(U32 type)
 {
-	U32 type = (U32)(intptr_t)data;
 	U32 bit = (1<<type);
 	if (gPipeline.hasRenderType(type))
 	{
@@ -6823,24 +6822,21 @@ void LLPipeline::toggleRenderTypeControl(void* data)
 }
 
 //static
-BOOL LLPipeline::hasRenderTypeControl(void* data)
+bool LLPipeline::hasRenderTypeControl(U32 type)
 {
-	U32 type = (U32)(intptr_t)data;
 	return gPipeline.hasRenderType(type);
 }
 
 // Allows UI items labeled "Hide foo" instead of "Show foo"
 //static
-BOOL LLPipeline::toggleRenderTypeControlNegated(void* data)
+bool LLPipeline::toggleRenderTypeControlNegated(S32 type)
 {
-	S32 type = (S32)(intptr_t)data;
 	return !gPipeline.hasRenderType(type);
 }
 
 //static
-void LLPipeline::toggleRenderDebug(void* data)
+void LLPipeline::toggleRenderDebug(U32 bit)
 {
-	U32 bit = (U32)(intptr_t)data;
 	if (gPipeline.hasRenderDebugMask(bit))
 	{
 		LL_INFOS() << "Toggling render debug mask " << std::hex << bit << " off" << std::dec << LL_ENDL;
@@ -6854,24 +6850,21 @@ void LLPipeline::toggleRenderDebug(void* data)
 
 
 //static
-BOOL LLPipeline::toggleRenderDebugControl(void* data)
+bool LLPipeline::toggleRenderDebugControl(U32 bit)
 {
-	U32 bit = (U32)(intptr_t)data;
 	return gPipeline.hasRenderDebugMask(bit);
 }
 
 //static
-void LLPipeline::toggleRenderDebugFeature(void* data)
+void LLPipeline::toggleRenderDebugFeature(U32 bit)
 {
-	U32 bit = (U32)(intptr_t)data;
 	gPipeline.mRenderDebugFeatureMask ^= bit;
 }
 
 
 //static
-BOOL LLPipeline::toggleRenderDebugFeatureControl(void* data)
+bool LLPipeline::toggleRenderDebugFeatureControl(U32 bit)
 {
-	U32 bit = (U32)(intptr_t)data;
 	return gPipeline.hasRenderDebugFeatureMask(bit);
 }
 
@@ -6904,145 +6897,145 @@ void LLPipeline::popRenderDebugFeatureMask()
 }
 
 // static
-void LLPipeline::setRenderScriptedBeacons(BOOL val)
+void LLPipeline::setRenderScriptedBeacons(bool val)
 {
 	sRenderScriptedBeacons = val;
 }
 
 // static
-void LLPipeline::toggleRenderScriptedBeacons(void*)
+void LLPipeline::toggleRenderScriptedBeacons()
 {
 	sRenderScriptedBeacons = !sRenderScriptedBeacons;
 }
 
 // static
-BOOL LLPipeline::getRenderScriptedBeacons(void*)
+bool LLPipeline::getRenderScriptedBeacons()
 {
 	return sRenderScriptedBeacons;
 }
 
 // static
-void LLPipeline::setRenderScriptedTouchBeacons(BOOL val)
+void LLPipeline::setRenderScriptedTouchBeacons(bool val)
 {
 	sRenderScriptedTouchBeacons = val;
 }
 
 // static
-void LLPipeline::toggleRenderScriptedTouchBeacons(void*)
+void LLPipeline::toggleRenderScriptedTouchBeacons()
 {
 	sRenderScriptedTouchBeacons = !sRenderScriptedTouchBeacons;
 }
 
 // static
-BOOL LLPipeline::getRenderScriptedTouchBeacons(void*)
+bool LLPipeline::getRenderScriptedTouchBeacons()
 {
 	return sRenderScriptedTouchBeacons;
 }
 
 // static
-void LLPipeline::setRenderMOAPBeacons(BOOL val)
+void LLPipeline::setRenderMOAPBeacons(bool val)
 {
 	sRenderMOAPBeacons = val;
 }
 
 // static
-void LLPipeline::toggleRenderMOAPBeacons(void*)
+void LLPipeline::toggleRenderMOAPBeacons()
 {
 	sRenderMOAPBeacons = !sRenderMOAPBeacons;
 }
 
 // static
-BOOL LLPipeline::getRenderMOAPBeacons(void*)
+bool LLPipeline::getRenderMOAPBeacons()
 {
 	return sRenderMOAPBeacons;
 }
 
 // static
-void LLPipeline::setRenderPhysicalBeacons(BOOL val)
+void LLPipeline::setRenderPhysicalBeacons(bool val)
 {
 	sRenderPhysicalBeacons = val;
 }
 
 // static
-void LLPipeline::toggleRenderPhysicalBeacons(void*)
+void LLPipeline::toggleRenderPhysicalBeacons()
 {
 	sRenderPhysicalBeacons = !sRenderPhysicalBeacons;
 }
 
 // static
-BOOL LLPipeline::getRenderPhysicalBeacons(void*)
+bool LLPipeline::getRenderPhysicalBeacons()
 {
 	return sRenderPhysicalBeacons;
 }
 
 // static
-void LLPipeline::setRenderParticleBeacons(BOOL val)
+void LLPipeline::setRenderParticleBeacons(bool val)
 {
 	sRenderParticleBeacons = val;
 }
 
 // static
-void LLPipeline::toggleRenderParticleBeacons(void*)
+void LLPipeline::toggleRenderParticleBeacons()
 {
 	sRenderParticleBeacons = !sRenderParticleBeacons;
 }
 
 // static
-BOOL LLPipeline::getRenderParticleBeacons(void*)
+bool LLPipeline::getRenderParticleBeacons()
 {
 	return sRenderParticleBeacons;
 }
 
 // static
-void LLPipeline::setRenderSoundBeacons(BOOL val)
+void LLPipeline::setRenderSoundBeacons(bool val)
 {
 	sRenderSoundBeacons = val;
 }
 
 // static
-void LLPipeline::toggleRenderSoundBeacons(void*)
+void LLPipeline::toggleRenderSoundBeacons()
 {
 	sRenderSoundBeacons = !sRenderSoundBeacons;
 }
 
 // static
-BOOL LLPipeline::getRenderSoundBeacons(void*)
+bool LLPipeline::getRenderSoundBeacons()
 {
 	return sRenderSoundBeacons;
 }
 
 // static
-void LLPipeline::setRenderBeacons(BOOL val)
+void LLPipeline::setRenderBeacons(bool val)
 {
 	sRenderBeacons = val;
 }
 
 // static
-void LLPipeline::toggleRenderBeacons(void*)
+void LLPipeline::toggleRenderBeacons()
 {
 	sRenderBeacons = !sRenderBeacons;
 }
 
 // static
-BOOL LLPipeline::getRenderBeacons(void*)
+bool LLPipeline::getRenderBeacons()
 {
 	return sRenderBeacons;
 }
 
 // static
-void LLPipeline::setRenderHighlights(BOOL val)
+void LLPipeline::setRenderHighlights(bool val)
 {
 	sRenderHighlight = val;
 }
 
 // static
-void LLPipeline::toggleRenderHighlights(void*)
+void LLPipeline::toggleRenderHighlights()
 {
 	sRenderHighlight = !sRenderHighlight;
 }
 
 // static
-BOOL LLPipeline::getRenderHighlights(void*)
+bool LLPipeline::getRenderHighlights()
 {
 	return sRenderHighlight;
 }
@@ -7096,8 +7089,8 @@ LLVOPartGroup* LLPipeline::lineSegmentIntersectParticle(const LLVector4a& start,
 }
 
 LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start, const LLVector4a& end,
-														BOOL pick_transparent,
-														BOOL pick_rigged,
+														bool pick_transparent,
+														bool pick_rigged,
 														S32* face_hit,
 														LLVector4a* intersection,         // return the intersection point
 														LLVector2* tex_coord,            // return the texture coordinates of the intersection point
@@ -7111,7 +7104,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
 
 	LLVector4a position;
 
-	sPickAvatar = FALSE; //LLToolMgr::getInstance()->inBuildMode() ? FALSE : TRUE;
+	sPickAvatar = false; //! LLToolMgr::getInstance()->inBuildMode();
 	
 	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -7177,7 +7170,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
 		const F32 ATTACHMENT_OVERRIDE_DIST = 0.1f;
 
 		//check against avatars
-		sPickAvatar = TRUE;
+		sPickAvatar = true;
 		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 				iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 		{
@@ -7249,7 +7242,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
 }
 
 LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector4a& start, const LLVector4a& end,
-													  BOOL pick_transparent,													
+													  bool pick_transparent,													
 													  S32* face_hit,
 													  LLVector4a* intersection,         // return the intersection point
 													  LLVector2* tex_coord,            // return the texture coordinates of the intersection point
@@ -7264,11 +7257,11 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector4a& start, c
 	{
 		LLViewerRegion* region = *iter;
 
-		BOOL toggle = FALSE;
+		bool toggle = false;
 		if (!hasRenderType(LLPipeline::RENDER_TYPE_HUD))
 		{
 			toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
-			toggle = TRUE;
+			toggle = true;
 		}
 
 		LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_HUD);
@@ -7417,7 +7410,7 @@ void LLPipeline::doResetVertexBuffers(bool forced)
 	LLVOPartGroup::restoreGL();
 }
 
-void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture)
+void LLPipeline::renderObjects(U32 type, U32 mask, bool texture, bool batch_texture)
 {
 	assertInitialized();
 	gGL.loadMatrix(gGLModelView);
@@ -7427,7 +7420,7 @@ void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_text
 	gGLLastMatrix = NULL;		
 }
 
-void LLPipeline::renderMaskedObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture)
+void LLPipeline::renderMaskedObjects(U32 type, U32 mask, bool texture, bool batch_texture)
 {
 	assertInitialized();
 	gGL.loadMatrix(gGLModelView);
@@ -7500,7 +7493,7 @@ void LLPipeline::bindScreenToTexture()
 
 static LLTrace::BlockTimerStatHandle FTM_RENDER_BLOOM("Bloom");
 
-void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
+void LLPipeline::renderBloom(bool for_snapshot, F32 zoom_factor, int subfield)
 {
 	if (!(gPipeline.canUseVertexShaders() &&
 		sRenderGlow))
@@ -8618,7 +8611,7 @@ void LLPipeline::renderDeferredLighting()
 			gPipeline.popRenderTypeMask();
 		}
 
-		BOOL render_local = RenderLocalLights;
+		bool render_local = RenderLocalLights;
 				
 		if (render_local)
 		{
@@ -9171,7 +9164,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
 			gPipeline.popRenderTypeMask();
 		}
 
-		BOOL render_local = RenderLocalLights;
+		bool render_local = RenderLocalLights;
 				
 		if (render_local)
 		{
@@ -9730,10 +9723,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 {	
 	if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
 	{
-		BOOL skip_avatar_update = FALSE;
+		bool skip_avatar_update = false;
 		if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
 		{
-			skip_avatar_update = TRUE;
+			skip_avatar_update = true;
 		}
 		
 		if (!skip_avatar_update)
@@ -9748,7 +9741,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 
 		LLCamera camera = camera_in;
 		camera.setFar(camera.getFar()*0.87654321f);
-		LLPipeline::sReflectionRender = TRUE;
+		LLPipeline::sReflectionRender = true;
 		
 		gPipeline.pushRenderTypeMask();
 
@@ -9934,7 +9927,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 
 		camera.setOrigin(camera_in.getOrigin());
 		//render distortion map
-		static BOOL last_update = TRUE;
+		static bool last_update = true;
 		if (last_update)
 		{
 			camera.setFar(camera_in.getFar());
@@ -9944,7 +9937,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 								END_RENDER_TYPES);	
 			stop_glerror();
 
-			LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? FALSE : TRUE;
+			LLPipeline::sUnderWaterRender = ! LLViewerCamera::getInstance()->cameraUnderWater();
 
 			if (LLPipeline::sUnderWaterRender)
 			{
@@ -10006,12 +9999,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 			}
 
 			mWaterDis.flush();
-			LLPipeline::sUnderWaterRender = FALSE;
+			LLPipeline::sUnderWaterRender = false;
 			
 		}
 		last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate;
 
-		LLPipeline::sReflectionRender = FALSE;
+		LLPipeline::sReflectionRender = false;
 
 		if (!LLRenderTarget::sUseFBO)
 		{
@@ -10106,7 +10099,7 @@ static LLTrace::BlockTimerStatHandle FTM_SHADOW_RENDER("Render Shadows");
 static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA("Alpha Shadow");
 static LLTrace::BlockTimerStatHandle FTM_SHADOW_SIMPLE("Simple Shadow");
 
-void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, LLCullResult &result, BOOL use_shader, BOOL use_occlusion, U32 target_width)
+void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, LLCullResult &result, bool use_shader, bool use_occlusion, U32 target_width)
 {
 	LL_RECORD_BLOCK_TIME(FTM_SHADOW_RENDER);
 
@@ -10116,7 +10109,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 	{
 		LLPipeline::sUseOcclusion = 0;
 	}
-	LLPipeline::sShadowRender = TRUE;
+	LLPipeline::sShadowRender = true;
 	
 	U32 types[] = { 
 		LLRenderPass::PASS_SIMPLE, 
@@ -10259,18 +10252,18 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 	gGLLastMatrix = NULL;
 
 	LLPipeline::sUseOcclusion = occlude;
-	LLPipeline::sShadowRender = FALSE;
+	LLPipeline::sShadowRender = false;
 }
 
 static LLTrace::BlockTimerStatHandle FTM_VISIBLE_CLOUD("Visible Cloud");
-BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir)
+bool LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir)
 {
 	LL_RECORD_BLOCK_TIME(FTM_VISIBLE_CLOUD);
 	//get point cloud of intersection of frust and min, max
 
 	if (getVisibleExtents(camera, min, max))
 	{
-		return FALSE;
+		return false;
 	}
 
 	//get set of planes on bounding box
@@ -10428,10 +10421,10 @@ BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector
 	
 	if (fp.empty())
 	{
-		return FALSE;
+		return false;
 	}
 	
-	return TRUE;
+	return true;
 }
 
 void LLPipeline::renderHighlight(const LLViewerObject* obj, F32 fade)
@@ -10523,11 +10516,11 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 
 	LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW);
 
-	BOOL skip_avatar_update = FALSE;
+	bool skip_avatar_update = false;
 	if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
 	{
 
-		skip_avatar_update = TRUE;
+		skip_avatar_update = true;
 	}
 
 	if (!skip_avatar_update)
@@ -11287,7 +11280,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 	}
 }
 
-void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture)
+void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, bool texture)
 {
 	for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
 	{
@@ -11373,10 +11366,10 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 	S32 occlusion = sUseOcclusion;
 	sUseOcclusion = 0;
 
-	sReflectionRender = sRenderDeferred ? FALSE : TRUE;
+	sReflectionRender = ! sRenderDeferred;
 
-	sShadowRender = TRUE;
-	sImpostorRender = TRUE;
+	sShadowRender = true;
+	sImpostorRender = true;
 
 	LLViewerCamera* viewer_camera = LLViewerCamera::getInstance();
 
@@ -11625,9 +11618,9 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 
 	LLVOAvatar::sUseImpostors = true; // @TODO ???
 	sUseOcclusion = occlusion;
-	sReflectionRender = FALSE;
-	sImpostorRender = FALSE;
-	sShadowRender = FALSE;
+	sReflectionRender = false;
+	sImpostorRender = false;
+	sShadowRender = false;
 	popRenderTypeMask();
 
 	gGL.matrixMode(LLRender::MM_PROJECTION);
@@ -11644,7 +11637,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 	LLGLState::checkClientArrays();
 }
 
-BOOL LLPipeline::hasRenderBatches(const U32 type) const
+bool LLPipeline::hasRenderBatches(const U32 type) const
 {
 	return sCull->getRenderMapSize(type) > 0;
 }
@@ -11669,12 +11662,12 @@ LLCullResult::sg_iterator LLPipeline::endAlphaGroups()
 	return sCull->endAlphaGroups();
 }
 
-BOOL LLPipeline::hasRenderType(const U32 type) const
+bool LLPipeline::hasRenderType(const U32 type) const
 {
     // STORM-365 : LLViewerJointAttachment::setAttachmentVisibility() is setting type to 0 to actually mean "do not render"
-    // We then need to test that value here and return FALSE to prevent attachment to render (in mouselook for instance)
-    // TODO: reintroduce RENDER_TYPE_NONE in LLRenderTypeMask and initialize its mRenderTypeEnabled[RENDER_TYPE_NONE] to FALSE explicitely
-	return (type == 0 ? FALSE : mRenderTypeEnabled[type]);
+    // We then need to test that value here and return false to prevent attachment to render (in mouselook for instance)
+    // TODO: reintroduce RENDER_TYPE_NONE in LLRenderTypeMask and initialize its mRenderTypeEnabled[RENDER_TYPE_NONE] to false explicitely
+	return (type == 0 ? false : mRenderTypeEnabled[type]);
 }
 
 void LLPipeline::setRenderTypeMask(U32 type, ...)
@@ -11684,7 +11677,7 @@ void LLPipeline::setRenderTypeMask(U32 type, ...)
 	va_start(args, type);
 	while (type < END_RENDER_TYPES)
 	{
-		mRenderTypeEnabled[type] = TRUE;
+		mRenderTypeEnabled[type] = true;
 		type = va_arg(args, U32);
 	}
 	va_end(args);
@@ -11695,7 +11688,7 @@ void LLPipeline::setRenderTypeMask(U32 type, ...)
 	}
 }
 
-BOOL LLPipeline::hasAnyRenderType(U32 type, ...) const
+bool LLPipeline::hasAnyRenderType(U32 type, ...) const
 {
 	va_list args;
 
@@ -11704,7 +11697,7 @@ BOOL LLPipeline::hasAnyRenderType(U32 type, ...) const
 	{
 		if (mRenderTypeEnabled[type])
 		{
-			return TRUE;
+			return true;
 		}
 		type = va_arg(args, U32);
 	}
@@ -11715,7 +11708,7 @@ BOOL LLPipeline::hasAnyRenderType(U32 type, ...) const
 		LL_ERRS() << "Invalid render type." << LL_ENDL;
 	}
 
-	return FALSE;
+	return false;
 }
 
 void LLPipeline::pushRenderTypeMask()
@@ -11740,10 +11733,10 @@ void LLPipeline::andRenderTypeMask(U32 type, ...)
 {
 	va_list args;
 
-	BOOL tmp[NUM_RENDER_TYPES];
+	bool tmp[NUM_RENDER_TYPES];
 	for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
 	{
-		tmp[i] = FALSE;
+		tmp[i] = false;
 	}
 
 	va_start(args, type);
@@ -11751,7 +11744,7 @@ void LLPipeline::andRenderTypeMask(U32 type, ...)
 	{
 		if (mRenderTypeEnabled[type]) 
 		{
-			tmp[type] = TRUE;
+			tmp[type] = true;
 		}
 
 		type = va_arg(args, U32);
@@ -11777,7 +11770,7 @@ void LLPipeline::clearRenderTypeMask(U32 type, ...)
 	va_start(args, type);
 	while (type < END_RENDER_TYPES)
 	{
-		mRenderTypeEnabled[type] = FALSE;
+		mRenderTypeEnabled[type] = false;
 		
 		type = va_arg(args, U32);
 	}
@@ -11793,7 +11786,7 @@ void LLPipeline::setAllRenderTypes()
 {
 	for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
 	{
-		mRenderTypeEnabled[i] = TRUE;
+		mRenderTypeEnabled[i] = true;
 	}
 }
 
@@ -11801,7 +11794,7 @@ void LLPipeline::clearAllRenderTypes()
 {
 	for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
 	{
-		mRenderTypeEnabled[i] = FALSE;
+		mRenderTypeEnabled[i] = false;
 	}
 }
 
@@ -11868,7 +11861,7 @@ void LLPipeline::restorePermanentObjects( const std::vector<U32>& restoreList )
 	skipRenderingOfTerrain( false );
 }
 
-void LLPipeline::skipRenderingOfTerrain( BOOL flag )
+void LLPipeline::skipRenderingOfTerrain( bool flag )
 {
 	pool_set_t::iterator iter = mPools.begin();
 	while ( iter != mPools.end() )
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index bba36351d9f374e9d18fd4f82a0fcd2f78493ac5..c9670a60f26cdcf265e3e5d810ceb02ffe2cf5d9 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -57,10 +57,10 @@ typedef enum e_avatar_skinning_method
 	SKIN_METHOD_VERTEX_PROGRAM
 } EAvatarSkinningMethod;
 
-BOOL compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn't be defined here!
+bool compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn't be defined here!
 bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0);
-BOOL setup_hud_matrices(); // use whole screen to render hud
-BOOL setup_hud_matrices(const LLRect& screen_region); // specify portion of screen (in pixels) to render hud attachments from (for picking)
+bool setup_hud_matrices(); // use whole screen to render hud
+bool setup_hud_matrices(const LLRect& screen_region); // specify portion of screen (in pixels) to render hud attachments from (for picking)
 glh::matrix4f glh_copy_matrix(F32* src);
 glh::matrix4f glh_get_current_modelview();
 void glh_set_current_modelview(const glh::matrix4f& mat);
@@ -133,11 +133,11 @@ class LLPipeline
 	void resetVertexBuffers(LLDrawable* drawable);
 	void generateImpostor(LLVOAvatar* avatar);
 	void bindScreenToTexture();
-	void renderBloom(BOOL for_snapshot, F32 zoom_factor = 1.f, int subfield = 0);
+	void renderBloom(bool for_snapshot, F32 zoom_factor = 1.f, int subfield = 0);
 
 	void init();
 	void cleanup();
-	BOOL isInit() { return mInitialized; };
+	bool isInit() { return mInitialized; };
 
 	/// @brief Get a draw pool from pool type (POOL_SIMPLE, POOL_MEDIA) and texture.
 	/// @return Draw pool, or NULL if not found.
@@ -171,19 +171,19 @@ class LLPipeline
 	void		doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL);
 	void		doOcclusion(LLCamera& camera);
 	void		markNotCulled(LLSpatialGroup* group, LLCamera &camera);
-	void        markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE);
+	void        markMoved(LLDrawable *drawablep, bool damped_motion = false);
 	void        markShift(LLDrawable *drawablep);
 	void        markTextured(LLDrawable *drawablep);
 	void		markGLRebuild(LLGLUpdate* glu);
-	void		markRebuild(LLSpatialGroup* group, BOOL priority = FALSE);
-	void        markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, BOOL priority = FALSE);
+	void		markRebuild(LLSpatialGroup* group, bool priority = false);
+	void        markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, bool priority = false);
 	void		markPartitionMove(LLDrawable* drawablep);
 	void		markMeshDirty(LLSpatialGroup* group);
 
 	//get the object between start and end that's closest to start.
 	LLViewerObject* lineSegmentIntersectInWorld(const LLVector4a& start, const LLVector4a& end,
-												BOOL pick_transparent,
-												BOOL pick_rigged,
+												bool pick_transparent,
+												bool pick_rigged,
 												S32* face_hit,                          // return the face hit
 												LLVector4a* intersection = NULL,         // return the intersection point
 												LLVector2* tex_coord = NULL,            // return the texture coordinates of the intersection point
@@ -197,7 +197,7 @@ class LLPipeline
 
 
 	LLViewerObject* lineSegmentIntersectInHUD(const LLVector4a& start, const LLVector4a& end,
-											  BOOL pick_transparent,
+											  bool pick_transparent,
 											  S32* face_hit,                          // return the face hit
 											  LLVector4a* intersection = NULL,         // return the intersection point
 											  LLVector2* tex_coord = NULL,            // return the texture coordinates of the intersection point
@@ -212,20 +212,20 @@ class LLPipeline
 
 	U32         addObject(LLViewerObject *obj);
 
-	void		enableShadows(const BOOL enable_shadows);
+	void		enableShadows(const bool enable_shadows);
 
-// 	void		setLocalLighting(const BOOL local_lighting);
-// 	BOOL		isLocalLightingEnabled() const;
+// 	void		setLocalLighting(const bool local_lighting);
+// 	bool		isLocalLightingEnabled() const;
 	S32			setLightingDetail(S32 level);
 	S32			getLightingDetail() const { return mLightingDetail; }
 	S32			getMaxLightingDetail() const;
 		
-	void		setUseVertexShaders(BOOL use_shaders);
-	BOOL		getUseVertexShaders() const { return mVertexShadersEnabled; }
-	BOOL		canUseVertexShaders();
-	BOOL		canUseWindLightShaders() const;
-	BOOL		canUseWindLightShadersOnObjects() const;
-	BOOL		canUseAntiAliasing() const;
+	void		setUseVertexShaders(bool use_shaders);
+	bool		getUseVertexShaders() const { return mVertexShadersEnabled; }
+	bool		canUseVertexShaders();
+	bool		canUseWindLightShaders() const;
+	bool		canUseWindLightShadersOnObjects() const;
+	bool		canUseAntiAliasing() const;
 
 	// phases
 	void resetFrameStats();
@@ -234,9 +234,9 @@ class LLPipeline
 	void updateMoveNormalAsync(LLDrawable* drawablep);
 	void updateMovedList(LLDrawable::drawable_vector_t& move_list);
 	void updateMove();
-	BOOL visibleObjectsInFrustum(LLCamera& camera);
-	BOOL getVisibleExtents(LLCamera& camera, LLVector3 &min, LLVector3& max);
-	BOOL getVisiblePointCloud(LLCamera& camera, LLVector3 &min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir = LLVector3(0,0,0));
+	bool visibleObjectsInFrustum(LLCamera& camera);
+	bool getVisibleExtents(LLCamera& camera, LLVector3 &min, LLVector3& max);
+	bool getVisiblePointCloud(LLCamera& camera, LLVector3 &min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir = LLVector3(0,0,0));
 	void updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip = 0, LLPlane* plane = NULL);  //if water_clip is 0, ignore water plane, 1, cull to above plane, -1, cull to below plane
 	void createObjects(F32 max_dtime);
 	void createObject(LLViewerObject* vobj);
@@ -259,10 +259,10 @@ class LLPipeline
 	void postSort(LLCamera& camera);
 	void forAllVisibleDrawables(void (*func)(LLDrawable*));
 
-	void renderObjects(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_texture = FALSE);
-	void renderMaskedObjects(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_texture = FALSE);
+	void renderObjects(U32 type, U32 mask, bool texture = true, bool batch_texture = false);
+	void renderMaskedObjects(U32 type, U32 mask, bool texture = true, bool batch_texture = false);
 
-	void renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture);
+	void renderGroups(LLRenderPass* pass, U32 type, U32 mask, bool texture);
 
 	void grabReferences(LLCullResult& result);
 	void clearReferences();
@@ -274,7 +274,7 @@ class LLPipeline
 	void checkReferences(LLSpatialGroup* group);
 
 
-	void renderGeom(LLCamera& camera, BOOL forceVBOUpdate = FALSE);
+	void renderGeom(LLCamera& camera, bool forceVBOUpdate = false);
 	void renderGeomDeferred(LLCamera& camera);
 	void renderGeomPostDeferred(LLCamera& camera, bool do_occlusion=true);
 	void renderGeomShadow(LLCamera& camera);
@@ -292,7 +292,7 @@ class LLPipeline
 	void setHighlightObject(LLDrawable* obj) { mHighlightObject = obj; }
 
 
-	void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, BOOL use_shader, BOOL use_occlusion, U32 target_width);
+	void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, bool use_shader, bool use_occlusion, U32 target_width);
 	void renderHighlights();
 	void renderDebug();
 	void renderPhysicsDisplay();
@@ -300,13 +300,13 @@ class LLPipeline
 	void rebuildPools(); // Rebuild pools
 
 	void findReferences(LLDrawable *drawablep);	// Find the lists which have references to this object
-	BOOL verify();						// Verify that all data in the pipeline is "correct"
+	bool verify();						// Verify that all data in the pipeline is "correct"
 
 	S32  getLightCount() const { return mLights.size(); }
 
 	void calcNearbyLights(LLCamera& camera);
 	void setupHWLights(LLDrawPool* pool);
-	void setupAvatarLights(BOOL for_edit = FALSE);
+	void setupAvatarLights(bool for_edit = false);
 	void enableLights(U32 mask);
 	void enableLightsStatic();
 	void enableLightsDynamic();
@@ -318,9 +318,9 @@ class LLPipeline
 
 	void shiftObjects(const LLVector3 &offset);
 
-	void setLight(LLDrawable *drawablep, BOOL is_light);
+	void setLight(LLDrawable *drawablep, bool is_light);
 	
-	BOOL hasRenderBatches(const U32 type) const;
+	bool hasRenderBatches(const U32 type) const;
 	LLCullResult::drawinfo_iterator beginRenderMap(U32 type);
 	LLCullResult::drawinfo_iterator endRenderMap(U32 type);
 	LLCullResult::sg_iterator beginAlphaGroups();
@@ -329,15 +329,15 @@ class LLPipeline
 
 	void addTrianglesDrawn(S32 index_count, U32 render_type = LLRender::TRIANGLES);
 
-	BOOL hasRenderDebugFeatureMask(const U32 mask) const	{ return (mRenderDebugFeatureMask & mask) ? TRUE : FALSE; }
-	BOOL hasRenderDebugMask(const U32 mask) const			{ return (mRenderDebugMask & mask) ? TRUE : FALSE; }
+	bool hasRenderDebugFeatureMask(const U32 mask) const	{ return bool(mRenderDebugFeatureMask & mask); }
+	bool hasRenderDebugMask(const U32 mask) const			{ return bool(mRenderDebugMask & mask); }
 	void setAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0xffffffff; }
 	void clearAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0x0; }
 	void setAllRenderDebugDisplays() { mRenderDebugMask = 0xffffffff; }
 	void clearAllRenderDebugDisplays() { mRenderDebugMask = 0x0; }
 
-	BOOL hasRenderType(const U32 type) const;
-	BOOL hasAnyRenderType(const U32 type, ...) const;
+	bool hasRenderType(const U32 type) const;
+	bool hasAnyRenderType(const U32 type, ...) const;
 
 	void setRenderTypeMask(U32 type, ...);
 	// This is equivalent to 'setRenderTypeMask'
@@ -356,53 +356,53 @@ class LLPipeline
 	static void toggleRenderType(U32 type);
 
 	// For UI control of render features
-	static BOOL hasRenderTypeControl(void* data);
-	static void toggleRenderDebug(void* data);
-	static void toggleRenderDebugFeature(void* data);
-	static void toggleRenderTypeControl(void* data);
-	static BOOL toggleRenderTypeControlNegated(void* data);
-	static BOOL toggleRenderDebugControl(void* data);
-	static BOOL toggleRenderDebugFeatureControl(void* data);
+	static bool hasRenderTypeControl(U32 data);
+	static void toggleRenderDebug(U32 data);
+	static void toggleRenderDebugFeature(U32 data);
+	static void toggleRenderTypeControl(U32 data);
+	static bool toggleRenderTypeControlNegated(S32 data);
+	static bool toggleRenderDebugControl(U32 data);
+	static bool toggleRenderDebugFeatureControl(U32 data);
 	static void setRenderDebugFeatureControl(U32 bit, bool value);
 
-	static void setRenderParticleBeacons(BOOL val);
-	static void toggleRenderParticleBeacons(void* data);
-	static BOOL getRenderParticleBeacons(void* data);
+	static void setRenderParticleBeacons(bool val);
+	static void toggleRenderParticleBeacons();
+	static bool getRenderParticleBeacons();
 
-	static void setRenderSoundBeacons(BOOL val);
-	static void toggleRenderSoundBeacons(void* data);
-	static BOOL getRenderSoundBeacons(void* data);
+	static void setRenderSoundBeacons(bool val);
+	static void toggleRenderSoundBeacons();
+	static bool getRenderSoundBeacons();
 
-	static void setRenderMOAPBeacons(BOOL val);
-	static void toggleRenderMOAPBeacons(void * data);
-	static BOOL getRenderMOAPBeacons(void * data);
+	static void setRenderMOAPBeacons(bool val);
+	static void toggleRenderMOAPBeacons();
+	static bool getRenderMOAPBeacons();
 
-	static void setRenderPhysicalBeacons(BOOL val);
-	static void toggleRenderPhysicalBeacons(void* data);
-	static BOOL getRenderPhysicalBeacons(void* data);
+	static void setRenderPhysicalBeacons(bool val);
+	static void toggleRenderPhysicalBeacons();
+	static bool getRenderPhysicalBeacons();
 
-	static void setRenderScriptedBeacons(BOOL val);
-	static void toggleRenderScriptedBeacons(void* data);
-	static BOOL getRenderScriptedBeacons(void* data);
+	static void setRenderScriptedBeacons(bool val);
+	static void toggleRenderScriptedBeacons();
+	static bool getRenderScriptedBeacons();
 
-	static void setRenderScriptedTouchBeacons(BOOL val);
-	static void toggleRenderScriptedTouchBeacons(void* data);
-	static BOOL getRenderScriptedTouchBeacons(void* data);
+	static void setRenderScriptedTouchBeacons(bool val);
+	static void toggleRenderScriptedTouchBeacons();
+	static bool getRenderScriptedTouchBeacons();
 
-	static void setRenderBeacons(BOOL val);
-	static void toggleRenderBeacons(void* data);
-	static BOOL getRenderBeacons(void* data);
+	static void setRenderBeacons(bool val);
+	static void toggleRenderBeacons();
+	static bool getRenderBeacons();
 
-	static void setRenderHighlights(BOOL val);
-	static void toggleRenderHighlights(void* data);
-	static BOOL getRenderHighlights(void* data);
+	static void setRenderHighlights(bool val);
+	static void toggleRenderHighlights();
+	static bool getRenderHighlights();
 	static void setRenderHighlightTextureChannel(LLRender::eTexIndex channel); // sets which UV setup to display in highlight overlay
 
 	static void updateRenderBump();
 	static void updateRenderDeferred();
 	static void refreshCachedSettings();
 
-	static void throttleNewMemoryAllocation(BOOL disable);
+	static void throttleNewMemoryAllocation(bool disable);
 
 	
 
@@ -410,7 +410,7 @@ class LLPipeline
 
 	void hidePermanentObjects( std::vector<U32>& restoreList );
 	void restorePermanentObjects( const std::vector<U32>& restoreList );
-	void skipRenderingOfTerrain( BOOL flag );
+	void skipRenderingOfTerrain( bool flag );
 	void hideObject( const LLUUID& id );
 	void restoreHiddenObject( const LLUUID& id );
 
@@ -418,7 +418,7 @@ class LLPipeline
 	void unloadShaders();
 	void addToQuickLookup( LLDrawPool* new_poolp );
 	void removeFromQuickLookup( LLDrawPool* poolp );
-	BOOL updateDrawableGeom(LLDrawable* drawable, BOOL priority);
+	bool updateDrawableGeom(LLDrawable* drawable, bool priority);
 	void assertInitializedDoError();
 	bool assertInitialized() { const bool is_init = isInit(); if (!is_init) assertInitializedDoError(); return is_init; };
 	void connectRefreshCachedSettingsSafe(const std::string name);
@@ -539,12 +539,12 @@ class LLPipeline
 	
 	LLSpatialPartition* getSpatialPartition(LLViewerObject* vobj);
 
-	void updateCamera(BOOL reset = FALSE);
+	void updateCamera(bool reset = false);
 	
 	LLVector3				mFlyCamPosition;
 	LLQuaternion			mFlyCamRotation;
 
-	BOOL					 mBackfaceCull;
+	bool					 mBackfaceCull;
 	S32						 mMatrixOpCount;
 	S32						 mTextureMatrixOps;
 	S32						 mNumVisibleNodes;
@@ -557,36 +557,36 @@ class LLPipeline
 
 	static S32				sCompiles;
 
-	static BOOL				sShowHUDAttachments;
-	static BOOL				sForceOldBakedUpload; // If true will not use capabilities to upload baked textures.
+	static bool				sShowHUDAttachments;
+	static bool				sForceOldBakedUpload; // If true will not use capabilities to upload baked textures.
 	static S32				sUseOcclusion;  // 0 = no occlusion, 1 = read only, 2 = read/write
-	static BOOL				sDelayVBUpdate;
-	static BOOL				sAutoMaskAlphaDeferred;
-	static BOOL				sAutoMaskAlphaNonDeferred;
-	static BOOL				sDisableShaders; // if TRUE, rendering will be done without shaders
-	static BOOL				sRenderBump;
-	static BOOL				sBakeSunlight;
-	static BOOL				sNoAlpha;
-	static BOOL				sUseTriStrips;
-	static BOOL				sUseFarClip;
-	static BOOL				sShadowRender;
-	static BOOL				sWaterReflections;
-	static BOOL				sDynamicLOD;
-	static BOOL				sPickAvatar;
-	static BOOL				sReflectionRender;
-	static BOOL				sImpostorRender;
-	static BOOL				sImpostorRenderAlphaDepthPass;
-	static BOOL				sUnderWaterRender;
-	static BOOL				sRenderGlow;
-	static BOOL				sTextureBindTest;
-	static BOOL				sRenderFrameTest;
-	static BOOL				sRenderAttachedLights;
-	static BOOL				sRenderAttachedParticles;
-	static BOOL				sRenderDeferred;
-	static BOOL             sMemAllocationThrottled;
+	static bool				sDelayVBUpdate;
+	static bool				sAutoMaskAlphaDeferred;
+	static bool				sAutoMaskAlphaNonDeferred;
+	static bool				sDisableShaders; // if true, rendering will be done without shaders
+	static bool				sRenderBump;
+	static bool				sBakeSunlight;
+	static bool				sNoAlpha;
+	static bool				sUseTriStrips;
+	static bool				sUseFarClip;
+	static bool				sShadowRender;
+	static bool				sWaterReflections;
+	static bool				sDynamicLOD;
+	static bool				sPickAvatar;
+	static bool				sReflectionRender;
+	static bool				sImpostorRender;
+	static bool				sImpostorRenderAlphaDepthPass;
+	static bool				sUnderWaterRender;
+	static bool				sRenderGlow;
+	static bool				sTextureBindTest;
+	static bool				sRenderFrameTest;
+	static bool				sRenderAttachedLights;
+	static bool				sRenderAttachedParticles;
+	static bool				sRenderDeferred;
+	static bool             sMemAllocationThrottled;
 	static S32				sVisibleLightCount;
 	static F32				sMinRenderSize;
-	static BOOL				sRenderingHUDs;
+	static bool				sRenderingHUDs;
 
 	static LLTrace::EventStatHandle<S64> sStatBatchSize;
 
@@ -659,13 +659,13 @@ class LLPipeline
 	LLVector3				mSunDir;
 	LLVector3				mTransformedSunDir;
 
-	BOOL					mInitialized;
-	BOOL					mVertexShadersEnabled;
+	bool					mInitialized;
+	bool					mVertexShadersEnabled;
 	S32						mVertexShadersLoaded; // 0 = no, 1 = yes, -1 = failed
 
 	U32						mTransformFeedbackPrimitives; //number of primitives expected to be generated by transform feedback
 protected:
-	BOOL					mRenderTypeEnabled[NUM_RENDER_TYPES];
+	bool					mRenderTypeEnabled[NUM_RENDER_TYPES];
 	std::stack<std::string> mRenderTypeEnableStack;
 
 	U32						mRenderDebugFeatureMask;
@@ -843,15 +843,15 @@ class LLPipeline
 	U32						mLightMovingMask;
 	S32						mLightingDetail;
 		
-	static BOOL				sRenderPhysicalBeacons;
-	static BOOL				sRenderMOAPBeacons;
-	static BOOL				sRenderScriptedTouchBeacons;
-	static BOOL				sRenderScriptedBeacons;
-	static BOOL				sRenderParticleBeacons;
-	static BOOL				sRenderSoundBeacons;
+	static bool				sRenderPhysicalBeacons;
+	static bool				sRenderMOAPBeacons;
+	static bool				sRenderScriptedTouchBeacons;
+	static bool				sRenderScriptedBeacons;
+	static bool				sRenderParticleBeacons;
+	static bool				sRenderSoundBeacons;
 public:
-	static BOOL				sRenderBeacons;
-	static BOOL				sRenderHighlight;
+	static bool				sRenderBeacons;
+	static bool				sRenderHighlight;
 
 	// Determines which set of UVs to use in highlight display
 	//
@@ -861,26 +861,26 @@ class LLPipeline
 	static U32              sCurRenderPoolType ;
 
 	//cached settings
-	static BOOL WindLightUseAtmosShaders;
-	static BOOL VertexShaderEnable;
-	static BOOL RenderAvatarVP;
-	static BOOL RenderDeferred;
+	static bool WindLightUseAtmosShaders;
+	static bool VertexShaderEnable;
+	static bool RenderAvatarVP;
+	static bool RenderDeferred;
 	static F32 RenderDeferredSunWash;
 	static U32 RenderFSAASamples;
 	static U32 RenderResolutionDivisor;
-	static BOOL RenderUIBuffer;
+	static bool RenderUIBuffer;
 	static S32 RenderShadowDetail;
-	static BOOL RenderDeferredSSAO;
+	static bool RenderDeferredSSAO;
 	static F32 RenderShadowResolutionScale;
-	static BOOL RenderLocalLights;
-	static BOOL RenderDelayCreation;
-	static BOOL RenderAnimateRes;
-	static BOOL FreezeTime;
+	static bool RenderLocalLights;
+	static bool RenderDelayCreation;
+	static bool RenderAnimateRes;
+	static bool FreezeTime;
 	static S32 DebugBeaconLineWidth;
 	static F32 RenderHighlightBrightness;
 	static LLColor4 RenderHighlightColor;
 	static F32 RenderHighlightThickness;
-	static BOOL RenderSpotLightsInNondeferred;
+	static bool RenderSpotLightsInNondeferred;
 	static LLColor4 PreviewAmbientColor;
 	static LLColor4 PreviewDiffuse0;
 	static LLColor4 PreviewSpecular0;
@@ -900,8 +900,8 @@ class LLPipeline
 	static S32 RenderGlowIterations;
 	static F32 RenderGlowWidth;
 	static F32 RenderGlowStrength;
-	static BOOL RenderDepthOfField;
-	static BOOL RenderDepthOfFieldInEditMode;
+	static bool RenderDepthOfField;
+	static bool RenderDepthOfFieldInEditMode;
 	static F32 CameraFocusTransitionTime;
 	static F32 CameraFNumber;
 	static F32 CameraFocalLength;
@@ -922,7 +922,7 @@ class LLPipeline
 	static F32 RenderEdgeNormCutoff;
 	static LLVector3 RenderShadowGaussian;
 	static F32 RenderShadowBlurDistFactor;
-	static BOOL RenderDeferredAtmospheric;
+	static bool RenderDeferredAtmospheric;
 	static S32 RenderReflectionDetail;
 	static F32 RenderHighlightFadeTime;
 	static LLVector3 RenderShadowClipPlanes;
@@ -932,7 +932,7 @@ class LLPipeline
 	static LLVector3 RenderShadowSplitExponent;
 	static F32 RenderShadowErrorCutoff;
 	static F32 RenderShadowFOVCutoff;
-	static BOOL CameraOffset;
+	static bool CameraOffset;
 	static F32 CameraMaxCoF;
 	static F32 CameraDoFResScale;
 	static F32 RenderAutoHideSurfaceAreaLimit;
@@ -942,7 +942,7 @@ void render_bbox(const LLVector3 &min, const LLVector3 &max);
 void render_hud_elements();
 
 extern LLPipeline gPipeline;
-extern BOOL gDebugPipeline;
+extern bool gDebugPipeline;
 extern const LLMatrix4* gGLLastMatrix;
 
 #endif
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index a8049d874d586e4d6ccb58d0179a8750020b1ff5..89c98a1cb39d50ebd6b314b18e0c46bee5d0ae1f 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -788,7 +788,7 @@ def path_optional(src, dst):
                                 "libapr-1.0.dylib",
                                 "libaprutil-1.0.dylib",
                                 "libcollada14dom.dylib",
-                                "libexpat.1.5.2.dylib",
+                                "libexpat.1.dylib",
                                 "libexception_handler.dylib",
                                 "libGLOD.dylib",
                                 ):
@@ -846,6 +846,16 @@ def path_optional(src, dst):
                         self.path2basename(relpkgdir, helperappfile)
 
                     pluginframeworkpath = self.dst_path_of('Chromium Embedded Framework.framework');
+                    # Putting a Frameworks directory under Contents/MacOS
+                    # isn't canonical, but the path baked into LLCefLib
+                    # Helper.app/Contents/MacOS/LLCefLib Helper is:
+                    # @executable_path/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework
+                    # (notice, not @executable_path/../Frameworks/etc.)
+                    # So we'll create a symlink (below) from there back to the
+                    # Frameworks directory nested under SLPlugin.app.
+                    helperframeworkpath = \
+                        self.dst_path_of('LLCefLib Helper.app/Contents/MacOS/'
+                                         'Frameworks/Chromium Embedded Framework.framework')
 
                     self.end_prefix()
 
@@ -874,16 +884,36 @@ def path_optional(src, dst):
                 # this symlink, Second Life web media can't possibly work.
                 # Real Framework folder:
                 #   Second Life.app/Contents/Frameworks/Chromium Embedded Framework.framework/
-                # Location of symlink and why it'ds relative 
+                # Location of symlink and why it's relative 
                 #   Second Life.app/Contents/Resources/SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework/
                 # Real Frameworks folder, with the symlink inside the bundled SLPlugin.app (and why it's relative)
                 #   <top level>.app/Contents/Frameworks/Chromium Embedded Framework.framework/
                 #   <top level>.app/Contents/Resources/SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework ->
-                frameworkpath = os.path.join(os.pardir, os.pardir, os.pardir, os.pardir, "Frameworks", "Chromium Embedded Framework.framework")
+                # It might seem simpler just to create a symlink Frameworks to
+                # the parent of Chromimum Embedded Framework.framework. But
+                # that would create a symlink cycle, which breaks our
+                # packaging step. So make a symlink from Chromium Embedded
+                # Framework.framework to the directory of the same name, which
+                # is NOT an ancestor of the symlink.
+                frameworkpath = os.path.join(os.pardir, os.pardir, os.pardir,
+                                             os.pardir, "Frameworks",
+                                             "Chromium Embedded Framework.framework")
                 try:
-                    symlinkf(frameworkpath, pluginframeworkpath)
+                    # from SLPlugin.app/Contents/Frameworks/Chromium Embedded
+                    # Framework.framework back to Second
+                    # Life.app/Contents/Frameworks/Chromium Embedded Framework.framework
+                    origin, target = pluginframeworkpath, frameworkpath
+                    symlinkf(target, origin)
+                    # from SLPlugin.app/Contents/Frameworks/LLCefLib
+                    # Helper.app/Contents/MacOS/Frameworks/Chromium Embedded
+                    # Framework.framework back to
+                    # SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework
+                    self.cmakedirs(os.path.dirname(helperframeworkpath))
+                    origin = helperframeworkpath
+                    target = os.path.join(os.pardir, frameworkpath)
+                    symlinkf(target, origin)
                 except OSError as err:
-                    print "Can't symlink %s -> %s: %s" % (frameworkpath, pluginframeworkpath, err)
+                    print "Can't symlink %s -> %s: %s" % (origin, target, err)
                     raise
 
             self.end_prefix("Contents")
diff --git a/indra/test/llstreamtools_tut.cpp b/indra/test/llstreamtools_tut.cpp
index 0f6436f0f4a8b51e5d517ff85d2840c4895126da..2f027b688f35a231e39e8c08ca5eed74dafe69c1 100644
--- a/indra/test/llstreamtools_tut.cpp
+++ b/indra/test/llstreamtools_tut.cpp
@@ -149,10 +149,9 @@ namespace tut
 
 		is.clear();
 		is.str(str = "#    \r\n  #  SecondLife is a 3D World. ##");
-		skip_comments_and_emptyspace(is);
-		is.get(arr, 255, '\0');
-		expected_result = "";
-		ensure_equals("skip_comments_and_emptyspace: skip comment - 2", arr, expected_result);
+		ensure("should not be good()", ! skip_comments_and_emptyspace(is));
+		ensure("should be at eof()", is.eof());
+		// don't get(): given bad state, we can't rely on results
 
 		is.clear();
 		is.str(str = " \r\n  SecondLife is a 3D World. ##");
@@ -164,14 +163,12 @@ namespace tut
 		is.clear();
 		is.str(str = "");
 		ret = skip_comments_and_emptyspace(is);
-		is.get(arr, 255, '\0');
-		ensure("skip_comments_and_emptyspace: empty string", ret == false);
+		ensure("skip_comments_and_emptyspace: empty string", ! ret);
 
 		is.clear();
 		is.str(str = "  \r\n  \t # SecondLife is a 3D World");
 		ret = skip_comments_and_emptyspace(is);
-		is.get(arr, 255, '\0');
-		ensure("skip_comments_and_emptyspace: space newline comment empty", ret == false);
+		ensure("skip_comments_and_emptyspace: space newline comment empty", ! ret);
 	}
 	
 	//testcases for skip_line()