From ddaec889b906af67c7028fd12a027f8c43ed1c57 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sun, 18 Apr 2021 00:28:23 -0400
Subject: [PATCH] Fix build errors in macos keyboard code

---
 indra/llwindow/llkeyboardmacosx.cpp  | 7 +++----
 indra/llwindow/llwindowmacosx-objc.h | 4 ++--
 indra/llwindow/llwindowmacosx.cpp    | 4 ++--
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp
index bcc4e761451..bf4aaaa905f 100644
--- a/indra/llwindow/llkeyboardmacosx.cpp
+++ b/indra/llwindow/llkeyboardmacosx.cpp
@@ -133,8 +133,7 @@ LLKeyboardMacOSX::LLKeyboardMacOSX()
 	mTranslateKeyMap[0x7e] = KEY_UP;
 
 	// Build inverse map
-	std::map<U32, KEY>::iterator iter;
-	for (iter = mTranslateKeyMap.begin(); iter != mTranslateKeyMap.end(); iter++)
+	for (auto iter = mTranslateKeyMap.begin(); iter != mTranslateKeyMap.end(); iter++)
 	{
 		mInvTranslateKeyMap[iter->second] = iter->first;
 	}
@@ -154,7 +153,7 @@ LLKeyboardMacOSX::LLKeyboardMacOSX()
 	mTranslateNumpadMap[0x4c] = KEY_PAD_RETURN;	// keypad enter
 	
 	// Build inverse numpad map
-	for (iter = mTranslateNumpadMap.begin(); iter != mTranslateNumpadMap.end(); iter++)
+	for (auto iter = mTranslateNumpadMap.begin(); iter != mTranslateNumpadMap.end(); iter++)
 	{
 		mInvTranslateNumpadMap[iter->second] = iter->first;
 	}
@@ -279,7 +278,7 @@ MASK LLKeyboardMacOSX::currentMask(BOOL for_mouse_event)
 
 void LLKeyboardMacOSX::scanKeyboard()
 {
-	S32 key;
+	U32 key;
 	for (key = 0; key < KEY_COUNT; key++)
 	{
 		// Generate callback if any event has occurred on this key this frame.
diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h
index 84d1858379a..d75d5b9c27d 100644
--- a/indra/llwindow/llwindowmacosx-objc.h
+++ b/indra/llwindow/llwindowmacosx-objc.h
@@ -126,8 +126,8 @@ void setupInputWindow(NSWindowRef window, GLViewRef view);
 
 // These are all implemented in llwindowmacosx.cpp.
 // This is largely for easier interop between Obj-C and C++ (at least in the viewer's case due to the BOOL vs. BOOL conflict)
-bool callKeyUp(NSKeyEventRef event, unsigned short key, unsigned int mask);
-bool callKeyDown(NSKeyEventRef event, unsigned short key, unsigned int mask);
+bool callKeyUp(NSKeyEventRef event, unsigned int key, unsigned int mask);
+bool callKeyDown(NSKeyEventRef event, unsigned int key, unsigned int mask);
 void callResetKeys();
 bool callUnicodeCallback(wchar_t character, unsigned int mask);
 void callRightMouseDown(float *pos, unsigned int mask);
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 5f89bf92b08..4fce441262a 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -197,7 +197,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
 // These functions are used as wrappers for our internal event handling callbacks.
 // It's a good idea to wrap these to avoid reworking more code than we need to within LLWindow.
 
-bool callKeyUp(NSKeyEventRef event, unsigned short key, unsigned int mask)
+bool callKeyUp(NSKeyEventRef event, unsigned int key, unsigned int mask)
 {
     mRawKeyEvent = event;
 	bool retVal = gKeyboard->handleKeyUp(key, mask);
@@ -205,7 +205,7 @@ bool callKeyUp(NSKeyEventRef event, unsigned short key, unsigned int mask)
     return retVal;
 }
 
-bool callKeyDown(NSKeyEventRef event, unsigned short key, unsigned int mask)
+bool callKeyDown(NSKeyEventRef event, unsigned int key, unsigned int mask)
 {
     mRawKeyEvent = event;
 	bool retVal = gKeyboard->handleKeyDown(key, mask);
-- 
GitLab