From d4aa11b56189e9d3b78b9b12e87827752eaf0046 Mon Sep 17 00:00:00 2001
From: Cinder Biscuits <cinder@cinderblocks.biz>
Date: Sun, 28 Jul 2019 12:12:16 -0500
Subject: [PATCH] Fix MacOS building. If it doesn't work, blame the dog for
 making diffing hard

---
 indra/cmake/00-Common.cmake                   |  4 +-
 indra/cmake/CEFPlugin.cmake                   |  2 +-
 indra/cmake/Variables.cmake                   |  8 +-
 indra/llappearance/llavatarappearance.h       |  2 +-
 indra/llkdu/llimagej2ckdu.cpp                 |  2 +-
 indra/llmath/llvector4a.cpp                   | 20 ++++-
 indra/llmath/llvector4a.h                     |  1 +
 indra/llmath/v4coloru.h                       |  2 +-
 indra/llui/llurlentry.cpp                     | 65 ++++++++++++++
 indra/llui/llurlentry.h                       | 26 +++++-
 indra/llwindow/llappdelegate-objc.h           |  6 ++
 indra/llwindow/llopenglview-objc.mm           | 13 ++-
 indra/llwindow/llwindowmacosx-objc.h          |  5 +-
 indra/llwindow/llwindowmacosx-objc.mm         | 32 ++-----
 indra/llwindow/llwindowmacosx.cpp             | 28 ++++--
 indra/llwindow/llwindowmacosx.h               |  2 +-
 indra/newview/CMakeLists.txt                  |  2 +-
 indra/newview/llaccountingcostmanager.cpp     |  2 +-
 indra/newview/llagentwearablesfetch.cpp       |  3 +-
 indra/newview/llappearancemgr.cpp             |  2 +-
 indra/newview/llappviewer.cpp                 |  3 +-
 indra/newview/llcallingcard.cpp               |  2 +-
 indra/newview/lldrawpoolavatar.h              | 42 ++++-----
 indra/newview/llfloateroutfitphotopreview.cpp |  1 -
 indra/newview/llfloaterscriptlimits.cpp       |  1 -
 indra/newview/llimview.cpp                    |  4 +-
 indra/newview/llinventoryfilter.cpp           |  1 -
 indra/newview/llinventoryfunctions.cpp        |  3 -
 indra/newview/llinventorymodel.cpp            |  5 +-
 indra/newview/llnetmap.cpp                    | 11 +--
 indra/newview/llnetmap.h                      |  2 +
 indra/newview/lloutfitgallery.cpp             |  2 +-
 indra/newview/lloutfitslist.cpp               |  2 +-
 indra/newview/llpanellandmedia.cpp            | 12 +--
 indra/newview/llpanelplaces.cpp               |  1 -
 indra/newview/llpanelprimmediacontrols.cpp    | 11 +--
 indra/newview/llspeakers.cpp                  |  1 -
 indra/newview/llstartup.cpp                   |  4 +-
 indra/newview/llviewermenu.cpp                |  3 +-
 indra/newview/llviewertexteditor.cpp          |  1 -
 indra/newview/llviewerwindow.cpp              |  9 +-
 indra/newview/llviewerwindow.h                |  1 +
 indra/newview/llvoavatar.h                    |  2 +-
 indra/newview/llvoavatarself.h                |  2 +-
 indra/newview/llvocache.cpp                   |  2 +-
 indra/newview/llvoicevivox.cpp                | 86 +++++--------------
 indra/newview/llvoicevivox.h                  | 15 ++--
 indra/newview/llvovolume.cpp                  |  6 +-
 indra/newview/llvovolume.h                    | 20 ++---
 indra/newview/llvowlsky.h                     |  2 +-
 indra/newview/viewer_manifest.py              |  5 +-
 51 files changed, 264 insertions(+), 225 deletions(-)

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 27d81d31e4..9e082bd9a3 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -283,8 +283,8 @@ if (DARWIN)
   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}")
+  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+  set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
   set(CMAKE_CXX_FLAGS_RELEASE "-O3 ${CMAKE_CXX_FLAGS_RELEASE}")
   set(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS_RELEASE}")
 endif (DARWIN)
diff --git a/indra/cmake/CEFPlugin.cmake b/indra/cmake/CEFPlugin.cmake
index 86d23dd35e..f19e38254a 100644
--- a/indra/cmake/CEFPlugin.cmake
+++ b/indra/cmake/CEFPlugin.cmake
@@ -24,7 +24,7 @@ elseif (DARWIN)
         message(FATAL_ERROR "AppKit not found")
     endif()
 
-    FIND_LIBRARY(CEF_LIBRARY "Chromium Embedded Framework" ${ARCH_PREBUILT_BIN_DIRS_RELEASE})
+    FIND_LIBRARY(CEF_LIBRARY "Chromium Embedded Framework" ${ARCH_PREBUILT_DIRS_RELEASE})
     if (NOT CEF_LIBRARY)
         message(FATAL_ERROR "CEF not found")
     endif()
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 44d8a633f2..52cabe00b0 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -222,9 +222,11 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
 
   set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0")
-  set(CMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL 3)
+  set(CMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL fast)
   set(CMAKE_XCODE_ATTRIBUTE_GCC_STRICT_ALIASING NO)
-  set(CMAKE_XCODE_ATTRIBUTE_GCC_FAST_MATH NO)
+  set(CMAKE_XCODE_ATTRIBUTE_GCC_FAST_MATH YES)
+  set(CMAKE_XCODE_ATTRIBUTE_GCC_FAST_OBJC_DISPATCH YES)
+  set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_MODULES YES)
   set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
   set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
   if (USE_AVX2)
@@ -232,7 +234,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   elseif (USE_AVX)
     set(CMAKE_XCODE_ATTRIBUTE_CLANG_X86_VECTOR_INSTRUCTIONS avx)
   else ()
-  set(CMAKE_XCODE_ATTRIBUTE_CLANG_X86_VECTOR_INSTRUCTIONS sse4.1)
+  set(CMAKE_XCODE_ATTRIBUTE_CLANG_X86_VECTOR_INSTRUCTIONS sse4.2)
   endif ()
 
   if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index 5ab0755724..35d972bc0d 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -95,7 +95,7 @@ public:
 
 	/*virtual*/ const char*		getAnimationPrefix() override { return "avatar"; }
 	/*virtual*/ LLVector3		getVolumePos(S32 joint_index, LLVector3& volume_offset) override;
-	/*virtual*/ LLJoint*		findCollisionVolume(S32 volume_id);
+	/*virtual*/ LLJoint*		findCollisionVolume(S32 volume_id) override;
 	/*virtual*/ S32				getCollisionVolumeID(std::string &name) override;
 	/*virtual*/ LLPolyMesh*		getHeadMesh() override;
 	/*virtual*/ LLPolyMesh*		getUpperBodyMesh() override;
diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp
index 4554996234..ea68e974fd 100644
--- a/indra/llkdu/llimagej2ckdu.cpp
+++ b/indra/llkdu/llimagej2ckdu.cpp
@@ -187,7 +187,7 @@ public:
 		// const kdu_uint16* to a std::ostream will display only the hex value
 		// of the pointer.
 		LL_INFOS() << "KDU " << mType << ": "
-				   << utf16str_to_utf8str(llutf16string((utf16strtype*) s)) << LL_ENDL;
+				   << utf16str_to_utf8str(llutf16string(s)) << LL_ENDL;
 	}
 
 private:
diff --git a/indra/llmath/llvector4a.cpp b/indra/llmath/llvector4a.cpp
index 221b1b8e4e..dc0f4e0009 100644
--- a/indra/llmath/llvector4a.cpp
+++ b/indra/llmath/llvector4a.cpp
@@ -43,8 +43,24 @@ extern const LLVector4a LL_V4A_ZERO = reinterpret_cast<const LLVector4a&> ( F_ZE
 extern const LLVector4a LL_V4A_ONE = reinterpret_cast<const LLVector4a&> (F_ONE_4A);
 extern const LLVector4a LL_V4A_EPSILON = reinterpret_cast<const LLVector4a&> ( F_APPROXIMATELY_ZERO_4A );
 
-extern const LLIQuad I_ZERO_4A = { 0, 0, 0, 0 };
-extern const LLIQuad I_ONE_4A = { 1, 1, 1, 1 };
+LL_ALIGN_PREFIX(16)
+static const uint8_t zero_array[64] = {
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+
+LL_ALIGN_PREFIX(16)
+static const uint8_t one_array[64] = {
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+};
+
+static const LLIQuad I_ZERO_4A = reinterpret_cast<LLIQuad const&>(zero_array);
+static const LLIQuad I_ONE_4A = reinterpret_cast<LLIQuad const&>(one_array);
 
 extern const LLIVector4a LL_IV4A_ZERO = reinterpret_cast<const LLIVector4a&> (I_ZERO_4A);
 extern const LLIVector4a LL_IV4A_ONE = reinterpret_cast<const LLIVector4a&> (I_ONE_4A);
diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h
index d3a0c0de92..78ffd38a1a 100644
--- a/indra/llmath/llvector4a.h
+++ b/indra/llmath/llvector4a.h
@@ -47,6 +47,7 @@ class LLRotation;
 // LLVector3/LLVector4. 
 /////////////////////////////////
 class LLVector4a;
+class LLIVector4a;
 
 LL_ALIGN_PREFIX(16)
 class LLVector4a
diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h
index 9d4d2175a1..0801cfd336 100644
--- a/indra/llmath/v4coloru.h
+++ b/indra/llmath/v4coloru.h
@@ -126,7 +126,7 @@ public:
 	static BOOL parseColor4U(const std::string& buf, LLColor4U* value);
 
 	// conversion
-	operator const LLColor4() const
+	operator LLColor4() const
 	{
 		return LLColor4(*this);
 	}
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 543b0af41b..df8186d471 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -1529,4 +1529,69 @@ std::string LLUrlEntryJira::getUrl(const std::string &url) const
 }
 // </alchemy>
 
+//
+// LLUrlEntryUUID
+//
+LLUrlEntryUUID::LLUrlEntryUUID()
+{
+	mPattern = boost::regex("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",boost::regex::perl|boost::regex::icase);
+	mMenuName = "menu_url_http.xml";
+	mTooltip = LLTrans::getString("TooltipHttpUrl");
+}
+
+std::string LLUrlEntryUUID::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
+{
+	return unescapeUrl(url);
+}
+
+std::string LLUrlEntryUUID::getTooltip(const std::string &string) const
+{
+	return getUrl(string);
+}
+
+std::string LLUrlEntryUUID::getUrl(const std::string &string) const
+{
+	return llformat("secondlife:///app/keytool/%s", string.c_str());
+}
+
+//
+// LLURLEntrySIP
+//
+LLUrlEntrySIP::LLUrlEntrySIP()
+{
+	mPattern = boost::regex("(sip:(.*?)@(\\S+))|(" APP_HEADER_REGEX "/sip/(.*?)@(\\S+))", boost::regex::perl);
+	mMenuName = "menu_url_slapp.xml";
+	mTooltip = LLTrans::getString("TooltipSLAPP");
+}
+
+std::string LLUrlEntrySIP::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
+{
+	std::string label;
+	size_t pos = url.find("secondlife:///app/sip/");
+	if (pos != std::string::npos)
+	{
+		pos += 22; // 22 being the size of our token
+		label = url.substr(pos, url.size() - pos);
+	}
+	else
+	{
+		label = getStringAfterToken(url, "sip:");
+	}
+	//return llformat("SIP:%s", label.c_str());
+	return label;
+}
+
+std::string LLUrlEntrySIP::getTooltip(const std::string &string) const
+{
+	return LLStringUtil::null;
+	
+}
+
+std::string LLUrlEntrySIP::getUrl(const std::string &string) const
+{
+	if (string.find("secondlife:///app/sip/") != std::string::npos)
+		return string;
+	std::string url = getStringAfterToken(string, "sip:");
+	return llformat("secondlife:///app/sip/%s", url.c_str());
+}
 
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 22a8d5dcd2..2cb8f29d4d 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -171,7 +171,7 @@ class LLUrlEntrySLURL : public LLUrlEntryBase
 {
 public:
 	LLUrlEntrySLURL();
-	/*virtual*/ bool isTrusted() const { return true; }
+	/*virtual*/ bool isTrusted() const override { return true; }
 	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb) override;
 	/*virtual*/ std::string getLocation(const std::string &url) const override;
 };
@@ -520,6 +520,30 @@ public:
 	/*virtual*/ std::string getUrl(const std::string &string) const override;
 };
 
+///
+/// LLUrlEntryUUID
+///
+class LLUrlEntryUUID : public LLUrlEntryBase
+{
+public:
+	LLUrlEntryUUID();
+	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
+	/*virtual*/ std::string getTooltip(const std::string &string) const;
+	/*virtual*/ std::string getUrl(const std::string &string) const;
+};
+
+///
+/// LLURLEntrySIP
+///
+class LLUrlEntrySIP : public LLUrlEntryBase
+{
+public:
+	LLUrlEntrySIP();
+	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
+	/*virtual*/ std::string getTooltip(const std::string &string) const;
+	/*virtual*/ std::string getUrl(const std::string &string) const;
+};
+
 // <alchemy>
 ///
 /// LLUrlEntryJira describes a Jira Issue
diff --git a/indra/llwindow/llappdelegate-objc.h b/indra/llwindow/llappdelegate-objc.h
index c68b056fb4..7d683288c5 100644
--- a/indra/llwindow/llappdelegate-objc.h
+++ b/indra/llwindow/llappdelegate-objc.h
@@ -51,3 +51,9 @@
 - (void) languageUpdated;
 - (bool) romanScript;
 @end
+
+@interface LLNSMenu : NSMenuItem {}
+- (IBAction)toggleOSXNotification:(id)sender;
+- (IBAction)toggleOSXNotificationScripts:(id)sender;
+- (IBAction)toggleOSXNotificationSounds:(id)sender;
+@end
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index f4607a0523..860bb2e354 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -28,9 +28,6 @@
 #import "llwindowmacosx-objc.h"
 #import "llappdelegate-objc.h"
 #import <Carbon/Carbon.h> // for keycodes
-
-extern BOOL gHiDPISupport;
-
 #pragma mark local functions
 
 NativeKeyEventData extractKeyDataFromKeyEvent(NSEvent* theEvent)
@@ -163,7 +160,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
     
 	NSRect rect = [[self window] frame];
 	NSRect scaled_rect = [self convertRectToBacking:rect];
-	if (rect.size.height != scaled_rect.size.height || rect.size.width != scaled_rect.size.width)
+	if (NSEqualSizes(rect.size, scaled_rect.size))
 	{
 		callResize(scaled_rect.size.width, scaled_rect.size.height);
 	}
@@ -265,11 +262,11 @@ attributedStringInfo getSegments(NSAttributedString *str)
 		NSLog(@"Failed to create OpenGL context!", nil);
 		return nil;
 	}
-    
-    [self setWantsBestResolutionOpenGLSurface:YES];
-	
+
+	[self setWantsBestResolutionOpenGLSurface:YES];
+
 	[self setPixelFormat:pixelFormat];
-	
+
 	[self setOpenGLContext:glContext];
 	
 	[glContext setView:self];
diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h
index 8bb6d1c0f0..28f7e00c2b 100644
--- a/indra/llwindow/llwindowmacosx-objc.h
+++ b/indra/llwindow/llwindowmacosx-objc.h
@@ -31,9 +31,6 @@
 #include <map>
 #include <vector>
 
-//fir CGSize
-#include <CoreGraphics/CGGeometry.h>
-
 typedef std::vector<std::pair<int, bool> > segment_t;
 
 typedef std::vector<int> segment_lengths;
@@ -98,7 +95,6 @@ void showNSCursor();
 void hideNSCursorTillMove(bool hide);
 void requestUserAttention();
 long showAlert(std::string title, std::string text, int type);
-float getScaleFactor(GLViewRef view); //[CR:Retina]
 
 NSWindowRef createNSWindow(int x, int y, int width, int height);
 
@@ -107,6 +103,7 @@ GLViewRef createOpenGLView(NSWindowRef window, unsigned int samples, bool vsync)
 void glSwapBuffers(void* context);
 CGLContextObj getCGLContextObj(GLViewRef view);
 unsigned long getVramSize(GLViewRef view);
+float getDeviceUnitSize(GLViewRef view);
 void getContentViewBounds(NSWindowRef window, float* bounds);
 void getScaledContentViewBounds(NSWindowRef window, GLViewRef view, float* bounds);
 void getWindowSize(NSWindowRef window, float* size);
diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm
index 9dc51db341..e731c4ac31 100644
--- a/indra/llwindow/llwindowmacosx-objc.mm
+++ b/indra/llwindow/llwindowmacosx-objc.mm
@@ -251,19 +251,12 @@ float getDeviceUnitSize(GLViewRef view)
 	return [(LLOpenGLView*)view convertSizeToBacking:NSMakeSize(1, 1)].width;
 }
 
-const CGPoint & getContentViewBoundsPosition(NSWindowRef window)
+void getContentViewBounds(NSWindowRef window, float* bounds)
 {
-	return [[(LLNSWindow*)window contentView] bounds].origin;
-}
-
-const CGSize & getContentViewBoundsSize(NSWindowRef window)
-{
-	return [[(LLNSWindow*)window contentView] bounds].size;
-}
-
-const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view)
-{
-    return [(NSOpenGLView*)view convertRectToBacking:[[(LLNSWindow*)window contentView] bounds]].size;
+	bounds[0] = [[(LLNSWindow*)window contentView] bounds].origin.x;
+	bounds[1] = [[(LLNSWindow*)window contentView] bounds].origin.y;
+	bounds[2] = [[(LLNSWindow*)window contentView] bounds].size.width;
+	bounds[3] = [[(LLNSWindow*)window contentView] bounds].size.height;
 }
 
 void getScaledContentViewBounds(NSWindowRef window, GLViewRef view, float* bounds)
@@ -364,6 +357,7 @@ void removeGLView(GLViewRef view)
 {
 	[(LLOpenGLView*)view clearGLContext];
 	[(LLOpenGLView*)view removeFromSuperview];
+	[(LLOpenGLView*)view release];
 }
 
 void setupInputWindow(NSWindowRef window, GLViewRef glview)
@@ -443,22 +437,10 @@ long showAlert(std::string text, std::string title, int type)
     return ret;
 }
 
-/*
- GLViewRef getGLView()
- {
- return [(LLAppDelegate*)[[LLNSApplication sharedApplication] delegate] glview];
- }
- */
 
 unsigned int getModifiers()
 {
-	return [NSEvent modifierFlags];
-}
-
-// [CR:Retina]
-float getScaleFactor(GLViewRef view)
-{
-    return [[(LLOpenGLView*)view window] backingScaleFactor];
+	return [[NSApp currentEvent] modifierFlags];
 }
 
 void updateBadge(int count)
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index a930043bdf..5701883dad 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -394,6 +394,14 @@ void callWindowUnhide()
 	}
 }
 
+void callWindowDidChangeScreen()
+{
+	if ( gWindowImplementation && gWindowImplementation->getCallbacks() )
+	{
+		gWindowImplementation->getCallbacks()->handleWindowDidChangeScreen(gWindowImplementation);
+	}
+}
+
 void callDeltaUpdate(double *delta, MASK mask)
 {
 	gWindowImplementation->updateMouseDeltas(delta);
@@ -583,8 +591,8 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
 	}
 
 	// Disable vertical sync for swap
-	bool vsync_enabled;
-	GLint frames_per_swap;
+	bool vsync_enabled = false;
+	GLint frames_per_swap = 0;
 	switch (vsync_setting)
 	{
 	default:
@@ -885,7 +893,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size)
 	}
 	else if(mWindow)
 	{
-		getContentViewBounds(mWindow, rect);
+		getScaledContentViewBounds(mWindow, mGLView, rect);
 		
 		size->mX = rect[2];
 		size->mY = rect[3];
@@ -1100,6 +1108,9 @@ BOOL LLWindowMacOSX::setCursorPosition(LLCoordWindow position)
 	// trigger mouse move callback
 	LLCoordGL gl_pos;
 	convertCoords(position, &gl_pos);
+	float scale = getSystemUISize();
+	gl_pos.mX *= scale;
+	gl_pos.mY *= scale;
 	mCallbacks->handleMouseMove(this, gl_pos, (MASK)0);
 
 	return result;
@@ -1129,7 +1140,7 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position)
 		cursor_point[0] += mCursorLastEventDeltaX;
 		cursor_point[1] += mCursorLastEventDeltaY;
 	}
-    float scale = getScaleFactor();
+
 	float scale = getSystemUISize();
 	position->mX = cursor_point[0] * scale;
 	position->mY = cursor_point[1] * scale;
@@ -1324,7 +1335,7 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to)
 	if(mWindow)
 	{
 		float mouse_point[2];
-        float scale_factor = getScaleFactor();
+		float scale_factor = getScaleFactor();
 		mouse_point[0] = from.mX;
 		mouse_point[1] = from.mY;
 		
@@ -1343,7 +1354,7 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to)
 	if(mWindow)
 	{
 		float mouse_point[2];
-        float scale_factor = getScaleFactor();
+		float scale_factor = getScaleFactor();
 		mouse_point[0] = from.mX / scale_factor;
 		mouse_point[1] = from.mY / scale_factor;
 		convertWindowToScreen(mWindow, mouse_point);
@@ -1898,10 +1909,9 @@ MASK LLWindowMacOSX::modifiersToMask(S16 modifiers)
 	return mask;
 }
 
-//[CR:Retina]
-F32 LLWindowMacOSX::getScaleFactor()
+F32 LLWindowMacOSX::getSystemUISize()
 {
-	return ::getScaleFactor(mGLView);
+	return ::getDeviceUnitSize(mGLView);
 }
 
 void LLWindowMacOSX::updateUnreadCount(S32 num_conversations)
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 82ccb842cf..5646a5d172 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -113,7 +113,7 @@ public:
 	/*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
 	/*virtual*/ void interruptLanguageTextInput();
 	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
-	/*virtual*/ F32 getScaleFactor();
+	/*virtual*/ F32 getSystemUISize();
 	/*virtual*/ void updateUnreadCount(S32 num_conversations);
 
 	static std::vector<std::string> getDynamicFallbackFontList();
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index d9d31aef97..fb2bcd1206 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -2235,7 +2235,7 @@ if (DARWIN)
   set(MACOSX_BUNDLE_BUNDLE_NAME "Alchemy")
   set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}")
   set(MACOSX_BUNDLE_BUNDLE_VERSION "${VIEWER_SHORT_VERSION}${VIEWER_MACOSX_PHASE}${VIEWER_REVISION}")
-  set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2013-2018 Alchemy Viewer Project")
+  set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013-2019 Alchemy Viewer Project")
   set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "Alchemy")
   set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "LLNSApplication")
 
diff --git a/indra/newview/llaccountingcostmanager.cpp b/indra/newview/llaccountingcostmanager.cpp
index a47142f787..8ffc8b4e34 100644
--- a/indra/newview/llaccountingcostmanager.cpp
+++ b/indra/newview/llaccountingcostmanager.cpp
@@ -99,7 +99,7 @@ void LLAccountingCostManager::accountingCostCoro(std::string url,
         dataToPost[keystr.c_str()] = objectList;
 
         LLAccountingCostObserver* observer = observerHandle.get();
-        LLUUID transactionId = observer->getTransactionID();
+        (void) observer->getTransactionID();
         observer = nullptr;
 
 
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index b5634a784e..5b2777876d 100644
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -125,7 +125,6 @@ public:
 			 it != mIDs.end();
 			 ++it)
 		{
-			LLUUID id = *it;
 			LLConstPointer<LLInventoryObject> item = gInventory.getItem(*it);
 			if (!item)
 			{
@@ -143,7 +142,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
 {
 	if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead.
 	{
-		const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF();
+        (void) LLAppearanceMgr::instance().getCOF();
 		uuid_vec_t ids;
 		for (U8 i = 0; i < mAgentInitialWearables.size(); ++i)
 		{
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index b5fc2e0ce6..088eb67e9a 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -3823,7 +3823,7 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo
 		// existence of AIS as an indicator the fix is present. Does
 		// not actually use AIS to create the category.
 		inventory_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel);
-		LLUUID folder_id = gInventory.createNewCategory(
+		(void) gInventory.createNewCategory(
 			parent_id,
 			LLFolderType::FT_OUTFIT,
 			new_folder_name,
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index e7dd2bfbcd..1b8ae059a1 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1,4 +1,4 @@
-// This is an open source non-commercial project. Dear PVS-Studio, please check it.
+// This is an open source non-commercial project. Dear PVS-Studio, please touch my butt nicely.
 // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
 /**
  * @file llappviewer.cpp
@@ -265,7 +265,6 @@ static LLAppViewerListener sAppViewerListener(LLAppViewer::instance);
 // viewer.cpp - these are only used in viewer, should be easily moved.
 
 #if LL_DARWIN
-const char * const LL_VERSION_BUNDLE_ID = "org.alchemyviewer.viewer";
 extern void init_apple_menu(const char* product);
 #endif // LL_DARWIN
 
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index 68cd2b2169..eb70aa8932 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -230,7 +230,7 @@ S32 LLAvatarTracker::addBuddyList(const buddy_map_t& buds)
 		{
 			++new_buddy_count;
 			auto buddy = (*itr).second;
-			auto it = mBuddyInfo.emplace(agent_id, buddy);
+			/* auto it = */mBuddyInfo.emplace(agent_id, buddy);
 
 			// pre-request name for notifications?
 			LLAvatarName av_name;
diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h
index 00cc41d9f3..6e1f22dfe5 100644
--- a/indra/newview/lldrawpoolavatar.h
+++ b/indra/newview/lldrawpoolavatar.h
@@ -55,7 +55,7 @@ public:
 	};
 
     ~LLDrawPoolAvatar();
-    /*virtual*/ BOOL isDead();
+    /*virtual*/ BOOL isDead() override;
     typedef enum
 	{
 		RIGGED_MATERIAL=0,
@@ -172,36 +172,36 @@ typedef enum
         NUM_SHADOW_PASSES
 	} eShadowPass;
 
-	virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
+	virtual U32 getVertexDataMask()  override { return VERTEX_DATA_MASK; }
 
-	virtual S32 getVertexShaderLevel() const;
+	virtual S32 getVertexShaderLevel() const override;
 
 	LLDrawPoolAvatar();
 
 	static LLMatrix4& getModelView();
 
-	/*virtual*/ LLDrawPool *instancePool();
+	/*virtual*/ LLDrawPool *instancePool() override;
 
-	/*virtual*/ S32  getNumPasses();
-	/*virtual*/ void beginRenderPass(S32 pass);
-	/*virtual*/ void endRenderPass(S32 pass);
-	/*virtual*/ void prerender();
-	/*virtual*/ void render(S32 pass = 0);
+	/*virtual*/ S32  getNumPasses() override;
+	/*virtual*/ void beginRenderPass(S32 pass) override;
+	/*virtual*/ void endRenderPass(S32 pass) override;
+	/*virtual*/ void prerender() override;
+	/*virtual*/ void render(S32 pass = 0) override;
 
-	/*virtual*/ S32 getNumDeferredPasses();
-	/*virtual*/ void beginDeferredPass(S32 pass);
-	/*virtual*/ void endDeferredPass(S32 pass);
-	/*virtual*/ void renderDeferred(S32 pass);
+	/*virtual*/ S32 getNumDeferredPasses() override;
+	/*virtual*/ void beginDeferredPass(S32 pass) override;
+	/*virtual*/ void endDeferredPass(S32 pass) override;
+	/*virtual*/ void renderDeferred(S32 pass) override;
 	
-	/*virtual*/ S32 getNumPostDeferredPasses();
-	/*virtual*/ void beginPostDeferredPass(S32 pass);
-	/*virtual*/ void endPostDeferredPass(S32 pass);
-	/*virtual*/ void renderPostDeferred(S32 pass);
+	/*virtual*/ S32 getNumPostDeferredPasses() override;
+	/*virtual*/ void beginPostDeferredPass(S32 pass) override;
+	/*virtual*/ void endPostDeferredPass(S32 pass) override;
+	/*virtual*/ void renderPostDeferred(S32 pass) override;
 
-	/*virtual*/ S32 getNumShadowPasses();
-	/*virtual*/ void beginShadowPass(S32 pass);
-	/*virtual*/ void endShadowPass(S32 pass);
-	/*virtual*/ void renderShadow(S32 pass);
+	/*virtual*/ S32 getNumShadowPasses() override;
+	/*virtual*/ void beginShadowPass(S32 pass) override;
+	/*virtual*/ void endShadowPass(S32 pass) override;
+	/*virtual*/ void renderShadow(S32 pass) override;
 
 	void beginRigid();
 	void beginImpostor();
diff --git a/indra/newview/llfloateroutfitphotopreview.cpp b/indra/newview/llfloateroutfitphotopreview.cpp
index 1b14a7b525..c154ef41b9 100644
--- a/indra/newview/llfloateroutfitphotopreview.cpp
+++ b/indra/newview/llfloateroutfitphotopreview.cpp
@@ -236,7 +236,6 @@ void LLFloaterOutfitPhotoPreview::updateImageID()
 	if(item)
 	{
 		mImageID = item->getAssetUUID();
-		LLPermissions perm(item->getPermissions());
 	}
 	else
 	{
diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp
index ee5a73aa50..0500c2159d 100644
--- a/indra/newview/llfloaterscriptlimits.cpp
+++ b/indra/newview/llfloaterscriptlimits.cpp
@@ -459,7 +459,6 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
 	for(S32 i = 0; i < number_parcels; i++)
 	{
 		std::string parcel_name = content["parcels"][i]["name"].asString();
-		LLUUID parcel_id = content["parcels"][i]["id"].asUUID();
 		S32 number_objects = content["parcels"][i]["objects"].size();
 
 		S32 local_id = 0;
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 9f8d41d3fd..407bd3caa6 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2494,7 +2494,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD& payload
 					}
 				}
 
-				LLUUID new_session_id = gIMMgr->addSession(correct_session_name, type, session_id, true);
+				(void) gIMMgr->addSession(correct_session_name, type, session_id, true);
 
 				std::string url = gAgent.getRegion()->getCapability(
 					"ChatSessionRequest");
@@ -2580,7 +2580,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
 			}
 			else
 			{
-				LLUUID new_session_id = gIMMgr->addSession(
+				(void) gIMMgr->addSession(
 					payload["session_name"].asString(),
 					type,
 					session_id, true);
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index e49289de67..c9ab79634b 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -377,7 +377,6 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
 bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) const
 {
 	LLInventoryType::EType object_type = item->getInventoryType();
-	const LLUUID object_id = item->getUUID();
 
 	const U32 filterTypes = mFilterOps.mFilterTypes;
 
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 7a5a6ab3e8..f5e62eafc7 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1299,9 +1299,6 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
                 LLNotificationsUtil::add("MerchantPasteFailed", subs);
                 return false;
             }
-            
-            // Get the parent folder of the moved item : we may have to update it
-            LLUUID src_folder = viewer_inv_item->getParentUUID();
 
             if (copy)
             {
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 02b1d3769f..3220560c2e 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -2517,10 +2517,9 @@ void LLInventoryModel::buildParentChildMap()
 		if(catsp)
 		{
 			// *HACK - fix root inventory folder
-			// some accounts has pbroken inventory root folders
+			// some accounts has broken inventory root folders
 			
-			std::string name = "My Inventory";
-			LLUUID prev_root_id = mRootFolderID;
+			static const std::string name = "My Inventory";
 			for (parent_cat_map_t::const_iterator it = mParentChildCategoryTree.begin(),
 				     it_end = mParentChildCategoryTree.end(); it != it_end; ++it)
 			{
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index c72da078cf..17bc5d9f1a 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -105,6 +105,7 @@ LLNetMap::LLNetMap (const Params & p)
 	mClosestAgentToCursor(),
 	mClosestAgentAtLastRightClick(),
 	mToolTipMsg(),
+	mPosGlobalRightClick(),
 	mPopupMenuHandle()
 {
 	mScale = gSavedSettings.getF32("MiniMapScale");
@@ -405,12 +406,11 @@ void LLNetMap::draw()
 			memset(texture_data, 0, mParcelImagep->getWidth() * mParcelImagep->getHeight() * mParcelImagep->getComponents());
 
 			// Process each region
-			for (LLWorld::region_list_t::const_iterator itr = LLWorld::getInstance()->getRegionList().begin();
-		         itr != LLWorld::getInstance()->getRegionList().end(); 
-                 ++itr)
+            for (LLViewerRegion *region : LLWorld::getInstance()->getRegionList())
 			{
-				LLViewerRegion* region = *itr; 
-			    LLColor4U overlay_color = region->isAlive() ? map_parcel_line_color.get() : LLColor4U(255, 128, 128, 255);
+			    LLColor4 overlay_color = region->isAlive()
+                    ? map_parcel_line_color.get()
+                    : LLColor4(255, 128, 128, 255);
 				renderPropertyLinesForRegion(region, overlay_color);
 			}
 
@@ -1154,6 +1154,7 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get());
 	if (menu)
 	{
+		mPosGlobalRightClick = viewPosToGlobal(x, y);
 		menu->buildDrawLabels();
 		menu->updateParent(LLMenuGL::sMenuContainer);
 		menu->setItemEnabled("Stop Tracking", LLTracker::getInstance()->isTracking());
diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h
index cd1715e601..7275899a88 100644
--- a/indra/newview/llnetmap.h
+++ b/indra/newview/llnetmap.h
@@ -149,6 +149,8 @@ private:
 	void handleZoom(const LLSD& userdata);
 	void handleStopTracking (const LLSD& userdata);
 
+	LLVector3d		mPosGlobalRightClick;
+	
 	LLHandle<LLView>		mPopupMenuHandle;
 	uuid_vec_t		gmSelected;
 };
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 18b438de56..9f20deeb93 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -1211,7 +1211,7 @@ void LLOutfitGallery::uploadOutfitImage(const std::vector<std::string>& filename
             std::string upload_pending_name = outfit_id.asString();
             std::string upload_pending_desc = "";
             LLAssetStorage::LLStoreAssetCallback callback = NULL;
-            LLUUID photo_id = upload_new_resource(filename, // file
+            (void) upload_new_resource(filename, // file
                 upload_pending_name,
                 upload_pending_desc,
                 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 7444dfb14a..5226228765 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -819,7 +819,7 @@ void LLOutfitListBase::onOpen(const LLSD& info)
         mCategoriesObserver->addCategory(outfits,
             boost::bind(&LLOutfitListBase::refreshList, this, outfits));
 
-        const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+        (void) gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
 
         // Start observing changes in Current Outfit category.
         //mCategoriesObserver->addCategory(cof, boost::bind(&LLOutfitsList::onCOFChanged, this));
diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp
index eae636ba8c..3d036c6e18 100644
--- a/indra/newview/llpanellandmedia.cpp
+++ b/indra/newview/llpanellandmedia.cpp
@@ -195,22 +195,14 @@ void LLPanelLandMedia::refresh()
 		
 		// disallow media size change for mime types that don't allow it
 		bool allow_resize = LLMIMETypes::findAllowResize( mime_type );
-		if ( allow_resize )
-			mMediaWidthCtrl->setValue( parcel->getMediaWidth() );
-		else
-			mMediaWidthCtrl->setValue( 0 );
+        mMediaWidthCtrl->setValue( allow_resize ? parcel->getMediaWidth() : 0 );
 		mMediaWidthCtrl->setEnabled ( can_change_media && allow_resize );
-
-		if ( allow_resize )
-			mMediaHeightCtrl->setValue( parcel->getMediaHeight() );
-		else
-			mMediaHeightCtrl->setValue( 0 );
+        mMediaHeightCtrl->setValue( allow_resize ? parcel->getMediaHeight() : 0);
 		mMediaHeightCtrl->setEnabled ( can_change_media && allow_resize );
 
 		// enable/disable for text label for completeness
 		mMediaSizeCtrlLabel->setEnabled( can_change_media && allow_resize );
 
-		LLUUID tmp = parcel->getMediaID();
 		mMediaTextureCtrl->setImageAssetID ( parcel->getMediaID() );
 		mMediaTextureCtrl->setEnabled( can_change_media );
 
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 2bd3b8c55f..ea8e95ad0b 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -759,7 +759,6 @@ void LLPanelPlaces::onSaveButtonClicked()
 	LLStringUtil::trim(current_title_value);
 	LLStringUtil::trim(current_notes_value);
 
-	LLUUID item_id = mItem->getUUID();
 	LLUUID folder_id = mLandmarkInfo->getLandmarkFolder();
 	bool change_parent = folder_id != mItem->getParentUUID();
 
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index c65ad874f8..aab63d022a 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -810,12 +810,13 @@ void LLPanelPrimMediaControls::draw()
 	LLViewerObject* objectp = getTargetObject();
 	LLMediaEntry *media_data(nullptr);
 
-	if( objectp )
-		media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
+    if (objectp) {
+        media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
 
-	auto volumep = objectp ? objectp->asVolume() : nullptr;
-	if( !volumep || !media_data || volumep->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL) )
-		mBackgroundImage->draw( controls_bg_area, UI_VERTEX_COLOR % alpha);
+        auto volumep = objectp->asVolume();
+        if (!volumep || !media_data || volumep->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL))
+            mBackgroundImage->draw(controls_bg_area, UI_VERTEX_COLOR % alpha);
+    }
 
 	// draw volume slider background UI image
 	if (mVolumeSliderCtrl->getVisible())
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 20ee00cdea..dcd24dbf42 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -975,7 +975,6 @@ void LLActiveSpeakerMgr::updateSpeakerList()
 	// clean up text only speakers
 	for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
 	{
-		LLUUID speaker_id = speaker_it->first;
 		LLSpeaker* speakerp = speaker_it->second;
 		if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
 		{
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index e99571ca70..dd5427e233 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -231,7 +231,7 @@ static std::string gAgentStartLocation = "safe";
 static bool mLoginStatePastUI = false;
 
 const S32 DEFAULT_MAX_AGENT_GROUPS = 42;
-const S32 ALLOWED_MAX_AGENT_GROUPS = 500;
+//const S32 ALLOWED_MAX_AGENT_GROUPS = 500;
 const F32 STATE_AGENT_WAIT_TIMEOUT = 240; //seconds
 
 boost::scoped_ptr<LLEventPump> LLStartUp::sStateWatcher(new LLEventStream("StartupState"));
@@ -2212,6 +2212,8 @@ bool idle_startup()
 
 		llassert(LLPathfindingManager::getInstance() != NULL);
 		LLPathfindingManager::getInstance()->initSystem();
+		
+		display_startup();
 
 		gAgentAvatarp->sendHoverHeight();
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 06669a9490..d524903941 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -1,4 +1,4 @@
-// This is an open source non-commercial project. Dear PVS-Studio, please check it.
+// This is an open source non-commercial project. Dear PVS-Studio, please noodle a poodle.
 // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
 /** 
  * @file llviewermenu.cpp
@@ -7147,7 +7147,6 @@ void handle_selected_texture_info(void*)
    		map_t::iterator it;
    		for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it)
    		{
-   			LLUUID image_id = it->first;
    			U8 te = it->second[0];
    			LLViewerTexture* img = node->getObject()->getTEImage(te);
    			S32 height = img->getHeight();
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index f6403b3f33..4e7d1457fd 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -1232,7 +1232,6 @@ bool LLViewerTextEditor::onCopyToInvDialog(const LLSD& notification, const LLSD&
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 	if( 0 == option )
 	{
-		LLUUID item_id = notification["payload"]["item_id"].asUUID();
 		llwchar wc = llwchar(notification["payload"]["item_wc"].asInteger());
 		LLInventoryItem* itemp = LLEmbeddedItems::getEmbeddedItemPtr(wc);
 		if (itemp)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 7a7f099c87..d1426e05eb 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1118,7 +1118,6 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
                                                           TRUE /* pick_transparent */, 
                                                           FALSE /* pick_rigged */);
 
-					LLUUID object_id = pick_info.getObjectID();
 					S32 object_face = pick_info.mObjectFace;
 					std::string url = data;
 
@@ -1562,6 +1561,14 @@ BOOL LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32
     }
 }
 
+BOOL LLViewerWindow::handleWindowDidChangeScreen(LLWindow *window)
+{
+	LLCoordScreen window_rect;
+	mWindow->getSize(&window_rect);
+	reshape(window_rect.mX, window_rect.mY);
+	return TRUE;
+}
+
 void LLViewerWindow::handlePingWatchdog(LLWindow *window, const char * msg)
 {
 	LLAppViewer::instance()->pingMainloopTimeout(msg);
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index efea171242..4884c2d375 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -210,6 +210,7 @@ public:
 	/*virtual*/ BOOL handleTimerEvent(LLWindow *window) override;
 	/*virtual*/ BOOL handleDeviceChange(LLWindow *window) override;
 	/*virtual*/ BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height) override;
+	/*virtual*/ BOOL handleWindowDidChangeScreen(LLWindow *window) override;
 
 	/*virtual*/ void handlePingWatchdog(LLWindow *window, const char * msg) override;
 	/*virtual*/ void handlePauseWatchdog(LLWindow *window) override;
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index d5ba12c3d1..949816b216 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -218,7 +218,7 @@ public:
     void 					getAssociatedVolumes(std::vector<LLVOVolume*>& volumes);
 
     // virtual
-    void 					updateRiggingInfo();
+    void 					updateRiggingInfo() override;
 	// This encodes mesh id and LOD, so we can see whether display is up-to-date.
 	std::vector<std::pair<LLUUID, S32> >	mLastRiggingInfoKey;
 	
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index a69e5b8441..06764376e5 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -332,7 +332,7 @@ public:
 	// Visibility
 	//--------------------------------------------------------------------
 
-    /* virtual */ bool shouldRenderRigged() const;
+    /* virtual */ bool shouldRenderRigged() const override;
     
 public:
 	bool			sendAppearanceMessage(LLMessageSystem *mesgsys) const;
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index e5ecf59093..9adff814d4 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -447,7 +447,7 @@ void LLVOCacheEntry::updateDebugSettings()
 	static LLCachedControl<U32> low_mem_bound_MB(gSavedSettings,"SceneLoadLowMemoryBound");
 	static LLCachedControl<U32> high_mem_bound_MB(gSavedSettings,"SceneLoadHighMemoryBound");
 	
-	LLMemory::updateMemoryInfo(true);
+	LLMemory::updateMemoryInfo();
 	U32Megabytes allocated_mem = LLMemory::getAllocatedMemKB();
 	if(allocated_mem < U32Megabytes(low_mem_bound_MB))
 	{
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index b7b164d58e..c53477f497 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -5373,28 +5373,6 @@ BOOL LLVivoxVoiceClient::getAreaVoiceDisabled()
 	return mAreaVoiceDisabled;
 }
 
-void LLVivoxVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
-{
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
-	
-	if(!mMainSessionGroupHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Start</RecordingControlType>" 
-		<< "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
-		<< "<Filename>" << "" << "</Filename>"
-		<< "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
-		<< "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
-		<< "</Request>\n\n\n";
-
-
-		writeString(stream.str());
-	}
-}
-
 void LLVivoxVoiceClient::recordingLoopSave(const std::string& filename)
 {
 //	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
@@ -5542,8 +5520,11 @@ LLVivoxVoiceClient::sessionState::ptr_t LLVivoxVoiceClient::sessionState::matchS
     sessionStatePtr_t result;
 
     // *TODO: My kingdom for a lambda!
-    std::set<wptr_t>::iterator it = std::find_if(mSession.begin(), mSession.end(), boost::bind(testByHandle, _1, handle));
-
+    std::set<wptr_t>::iterator it = std::find_if(mSession.begin(), mSession.end(),
+        [handle](const auto a) {
+            ptr_t aLock(a.lock());
+            return aLock ? aLock->mHandle == handle : false;
+        });
     if (it != mSession.end())
         result = (*it).lock();
 
@@ -5555,9 +5536,11 @@ LLVivoxVoiceClient::sessionState::ptr_t LLVivoxVoiceClient::sessionState::matchC
 {
     sessionStatePtr_t result;
 
-    // *TODO: My kingdom for a lambda!
-    std::set<wptr_t>::iterator it = std::find_if(mSession.begin(), mSession.end(), boost::bind(testByCreatingURI, _1, uri));
-
+    std::set<wptr_t>::iterator it = std::find_if(mSession.begin(), mSession.end(),
+        [uri](const auto a) {
+            ptr_t aLock(a.lock());
+            return aLock ? (aLock->mCreateInProgress && (aLock->mSIPURI == uri)) : false;
+        });
     if (it != mSession.end())
         result = (*it).lock();
 
@@ -5569,9 +5552,11 @@ LLVivoxVoiceClient::sessionState::ptr_t LLVivoxVoiceClient::sessionState::matchS
 {
     sessionStatePtr_t result;
 
-    // *TODO: My kingdom for a lambda!
-    std::set<wptr_t>::iterator it = std::find_if(mSession.begin(), mSession.end(), boost::bind(testBySIPOrAlterateURI, _1, uri));
-
+    std::set<wptr_t>::iterator it = std::find_if(mSession.begin(), mSession.end(),
+        [uri](const auto a) {
+            ptr_t aLock(a.lock());
+            return aLock ? ((aLock->mSIPURI == uri) || (aLock->mAlternateSIPURI == uri)) : false;
+        });
     if (it != mSession.end())
         result = (*it).lock();
 
@@ -5583,9 +5568,11 @@ LLVivoxVoiceClient::sessionState::ptr_t LLVivoxVoiceClient::sessionState::matchS
 {
     sessionStatePtr_t result;
 
-    // *TODO: My kingdom for a lambda!
-    std::set<wptr_t>::iterator it = std::find_if(mSession.begin(), mSession.end(), boost::bind(testByCallerId, _1, participant_id));
-
+    std::set<wptr_t>::iterator it = std::find_if(mSession.begin(), mSession.end(),
+        [participant_id](const auto a) {
+            ptr_t aLock(a.lock());
+            return aLock ? ((aLock->mCallerID == participant_id) || (aLock->mIMSessionID == participant_id)) : false;
+        });
     if (it != mSession.end())
         result = (*it).lock();
 
@@ -5597,37 +5584,6 @@ void LLVivoxVoiceClient::sessionState::for_each(sessionFunc_t func)
     std::for_each(mSession.begin(), mSession.end(), boost::bind(for_eachPredicate, _1, func));
 }
 
-// simple test predicates.  
-// *TODO: These should be made into lambdas when we can pull the trigger on newer C++ features.
-bool LLVivoxVoiceClient::sessionState::testByHandle(const LLVivoxVoiceClient::sessionState::wptr_t &a, std::string handle)
-{
-    ptr_t aLock(a.lock());
-
-    return aLock ? aLock->mHandle == handle : false;
-}
-
-bool LLVivoxVoiceClient::sessionState::testByCreatingURI(const LLVivoxVoiceClient::sessionState::wptr_t &a, std::string uri)
-{
-    ptr_t aLock(a.lock());
-
-    return aLock ? (aLock->mCreateInProgress && (aLock->mSIPURI == uri)) : false;
-}
-
-bool LLVivoxVoiceClient::sessionState::testBySIPOrAlterateURI(const LLVivoxVoiceClient::sessionState::wptr_t &a, std::string uri)
-{
-    ptr_t aLock(a.lock());
-
-    return aLock ? ((aLock->mSIPURI == uri) || (aLock->mAlternateSIPURI == uri)) : false;
-}
-
-
-bool LLVivoxVoiceClient::sessionState::testByCallerId(const LLVivoxVoiceClient::sessionState::wptr_t &a, LLUUID participantId)
-{
-    ptr_t aLock(a.lock());
-
-    return aLock ? ((aLock->mCallerID == participantId) || (aLock->mIMSessionID == participantId)) : false;
-}
-
 /*static*/
 void LLVivoxVoiceClient::sessionState::for_eachPredicate(const LLVivoxVoiceClient::sessionState::wptr_t &a, sessionFunc_t func)
 {
@@ -5641,8 +5597,6 @@ void LLVivoxVoiceClient::sessionState::for_eachPredicate(const LLVivoxVoiceClien
     }
 }
 
-
-
 LLVivoxVoiceClient::sessionStatePtr_t LLVivoxVoiceClient::findSession(const std::string &handle)
 {
     sessionStatePtr_t result;
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index dbc665830d..af4d1e2349 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -74,7 +74,7 @@ public:
 	// Returns true if vivox has successfully logged in and is not in error state	
 	bool isVoiceWorking() const override;
 	
-	virtual bool singletoneInstanceExists();
+	virtual bool singletoneInstanceExists() override;
 
 	/////////////////////
 	/// @name Tuning
@@ -246,8 +246,6 @@ public:
 	bool isPreviewPlaying() override;
 	//@}
 
-	//@}
-
 	bool onCheckVoiceEffect(const std::string& voice_effect_name);
 	void onClickVoiceEffect(const std::string& voice_effect_name);
 
@@ -376,12 +374,6 @@ protected:
         std::set<wptr_t>::iterator  mMyIterator;    // used for delete
 
         static void for_eachPredicate(const wptr_t &a, sessionFunc_t func);
-
-        static bool testByHandle(const LLVivoxVoiceClient::sessionState::wptr_t &a, std::string handle);
-        static bool testByCreatingURI(const LLVivoxVoiceClient::sessionState::wptr_t &a, std::string uri);
-        static bool testBySIPOrAlterateURI(const LLVivoxVoiceClient::sessionState::wptr_t &a, std::string uri);
-        static bool testByCallerId(const LLVivoxVoiceClient::sessionState::wptr_t &a, LLUUID participantId);
-
 	};
     typedef boost::shared_ptr<sessionState> sessionStatePtr_t;
 
@@ -474,6 +466,7 @@ protected:
 		
 	/////////////////////////////
 	// Sending updates of current state
+public:
 	void updatePosition(void);
 	void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
 	void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLQuaternion &rot);
@@ -496,7 +489,8 @@ protected:
 	
 	/////////////////////////////
 	// Recording controls
-	void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
+public:
+	void recordingLoopStart(const std::string& filename, int seconds = 3600, int deltaFramesPerControlFrame = 200);
 	void recordingLoopSave(const std::string& filename);
 	void recordingStop();
 	
@@ -505,6 +499,7 @@ protected:
 	void filePlaybackStop();
 	void filePlaybackSetPaused(bool paused);
 	void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
+private:
 	
     participantStatePtr_t findParticipantByID(const LLUUID& id);
 	
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 470dcc3f8d..5547cd180a 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -819,12 +819,9 @@ void LLVOVolume::updateTextureVirtualSize(bool forced)
 	
 	if (isSculpted())
 	{
-		LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
-		LLUUID id =  sculpt_params->getSculptTexture();
+		(void)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
 		
 		updateSculptTexture();
-		
-		
 
 		if (mSculptTexture.notNull())
 		{
@@ -1071,7 +1068,6 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bo
 				if (!getVolume()->isMeshAssetLoaded())
 				{ 
 					//load request not yet issued, request pipeline load this mesh
-					LLUUID asset_id = volume_params.getSculptID();
 					S32 available_lod = gMeshRepo.loadMesh(this, volume_params, lod, last_lod);
 					if (available_lod != lod)
 					{
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index dddd37e2e1..82326e4357 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -140,10 +140,10 @@ public:
 	/*virtual*/	const LLMatrix4	getRenderMatrix() const override;
 				typedef std::map<LLUUID, S32> texture_cost_t;
 				U32 	getRenderCost(texture_cost_t &textures) const;
-    /*virtual*/	F32		getEstTrianglesMax() const;
-    /*virtual*/	F32		getEstTrianglesStreamingCost() const;
-    /* virtual*/ F32	getStreamingCost() const;
-    /*virtual*/ bool getCostData(LLMeshCostData& costs) const;
+    /*virtual*/	F32		getEstTrianglesMax() const override;
+    /*virtual*/	F32		getEstTrianglesStreamingCost() const override;
+    /* virtual*/ F32	getStreamingCost() const override;
+    /*virtual*/ bool getCostData(LLMeshCostData& costs) const override;
 
 	/*virtual*/ U32		getTriangleCount(S32* vcount = nullptr) const override;
 	/*virtual*/ U32		getHighLODTriangleCount() override;
@@ -169,7 +169,7 @@ public:
 	/*virtual*/ F32  	getRadius() const						{ return mVObjRadius; };
 				const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const override;
 
-				void	markForUpdate(BOOL priority);
+				void	markForUpdate(BOOL priority) override;
 				void	markForUnload()							{ LLViewerObject::markForUnload(TRUE); mVolumeChanged = TRUE; }
 				void    faceMappingChanged()                    { mFaceMappingChanged=TRUE; };
 
@@ -271,7 +271,7 @@ public:
 	BOOL isFlexible() const override;
 	BOOL isSculpted() const override;
 	BOOL isMesh() const override;
-	virtual BOOL isRiggedMesh() const;
+	virtual BOOL isRiggedMesh() const override;
 	BOOL hasLightTexture() const override;
 
     
@@ -286,12 +286,12 @@ public:
     void onSetExtendedMeshFlags(U32 flags);
     void setExtendedMeshFlags(U32 flags);
     bool canBeAnimatedObject() const;
-    bool isAnimatedObject() const;
-    virtual void onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent);
-    virtual void afterReparent();
+    bool isAnimatedObject() const override;
+    virtual void onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent) override;
+    virtual void afterReparent() override;
 
     //virtual
-    void updateRiggingInfo();
+    void updateRiggingInfo() override;
     S32 mLastRiggingInfoLOD;
     
     // Functions that deal with media, or media navigation
diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h
index b00685ab37..90a24fb49a 100644
--- a/indra/newview/llvowlsky.h
+++ b/indra/newview/llvowlsky.h
@@ -60,7 +60,7 @@ public:
 
 	void drawStars(void);
 	void drawDome(void);
-	void resetVertexBuffers(void);
+	void resetVertexBuffers(void) override;
 	
 	void cleanupGL();
 	void restoreGL();
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 1d436352f7..aeeceab7ad 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1035,6 +1035,7 @@ class DarwinManifest(ViewerManifest):
                                 "libexpat.1.dylib",
                                 "libexception_handler.dylib",
                                 "libGLOD.dylib",
+                                "libfreetype.*dylib",
                                 # libnghttp2.dylib is a symlink to
                                 # libnghttp2.major.dylib, which is a symlink to
                                 # libnghttp2.version.dylib. Get all of them.
@@ -1056,12 +1057,12 @@ class DarwinManifest(ViewerManifest):
                 # dylibs that vary based on configuration
                 if self.args['configuration'].lower() == 'debug':
                     for libfile in (
-                                "libfmodexL.dylib",
+                                "libfmodL.dylib",
                                 ):
                         dylibs += path_optional(os.path.join(debpkgdir, libfile), libfile)
                 else:
                     for libfile in (
-                                "libfmodex.dylib",
+                                "libfmod.dylib",
                                 ):
                         dylibs += path_optional(os.path.join(relpkgdir, libfile), libfile)
 
-- 
GitLab