summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRye <rye@alchemyviewer.org>2025-08-18 21:26:20 -0400
committerRye <rye@alchemyviewer.org>2025-08-19 08:58:49 -0400
commit77514ebddd68ca47bc3751f0a6e55a83deec79a9 (patch)
tree301d0e526615552bbcba4f309f20e159a8bfe9e5 /indra/newview
parent52cca995ccc30ac5aa989588a71c0a7f4a9804ae (diff)
Fix macOS deprecation warnings
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappdelegate-objc.mm2
-rw-r--r--indra/newview/llappviewermacosx-objc.h3
-rw-r--r--indra/newview/llappviewermacosx-objc.mm39
-rw-r--r--indra/newview/llfilepicker_mac.mm6
-rw-r--r--indra/newview/llfloateremojipicker.cpp4
-rw-r--r--indra/newview/llfloateruipreview.cpp3
6 files changed, 8 insertions, 49 deletions
diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm
index d4b05dde72..b8fd3dc189 100644
--- a/indra/newview/llappdelegate-objc.mm
+++ b/indra/newview/llappdelegate-objc.mm
@@ -372,7 +372,7 @@ struct AttachmentInfo
- (void)sendEvent:(NSEvent *)event
{
[super sendEvent:event];
- if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask))
+ if ([event type] == NSEventTypeKeyUp && ([event modifierFlags] & NSEventModifierFlagCommand))
{
[[self keyWindow] sendEvent:event];
}
diff --git a/indra/newview/llappviewermacosx-objc.h b/indra/newview/llappviewermacosx-objc.h
index d0ae0a7fc2..3fbf4202f1 100644
--- a/indra/newview/llappviewermacosx-objc.h
+++ b/indra/newview/llappviewermacosx-objc.h
@@ -30,9 +30,6 @@
#include <string>
#include <vector>
-//Why? Because BOOL
-void launchApplication(const std::string* app_name, const std::vector<std::string>* args);
-
void force_ns_sxeption();
#endif // LL_LLAPPVIEWERMACOSX_OBJC_H
diff --git a/indra/newview/llappviewermacosx-objc.mm b/indra/newview/llappviewermacosx-objc.mm
index 9b6bfe621b..2ea3f2f171 100644
--- a/indra/newview/llappviewermacosx-objc.mm
+++ b/indra/newview/llappviewermacosx-objc.mm
@@ -33,45 +33,6 @@
#include "llappviewermacosx-objc.h"
-void launchApplication(const std::string* app_name, const std::vector<std::string>* args)
-{
-
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- if (app_name->empty()) return;
-
- NSMutableString* app_name_ns = [NSMutableString stringWithString:[[NSBundle mainBundle] resourcePath]]; //Path to resource dir
- [app_name_ns appendFormat:@"/%@", [NSString stringWithCString:app_name->c_str()
- encoding:[NSString defaultCStringEncoding]]];
-
- NSMutableArray *args_ns = nil;
- args_ns = [[NSMutableArray alloc] init];
-
- for (int i=0; i < args->size(); ++i)
- {
- NSLog(@"Adding string %s", (*args)[i].c_str());
- [args_ns addObject:
- [NSString stringWithCString:(*args)[i].c_str()
- encoding:[NSString defaultCStringEncoding]]];
- }
-
- NSTask *task = [[NSTask alloc] init];
- NSBundle *bundle = [NSBundle bundleWithPath:[[NSWorkspace sharedWorkspace] fullPathForApplication:app_name_ns]];
- [task setLaunchPath:[bundle executablePath]];
- [task setArguments:args_ns];
- [task launch];
-
-// NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
-// NSURL *url = [NSURL fileURLWithPath:[workspace fullPathForApplication:app_name_ns]];
-//
-// NSError *error = nil;
-// [workspace launchApplicationAtURL:url options:0 configuration:[NSDictionary dictionaryWithObject:args_ns forKey:NSWorkspaceLaunchConfigurationArguments] error:&error];
- //TODO Handle error
-
- [pool release];
- return;
-}
-
void force_ns_sxeption()
{
NSException *exception = [NSException exceptionWithName:@"Forced NSException" reason:nullptr userInfo:nullptr];
diff --git a/indra/newview/llfilepicker_mac.mm b/indra/newview/llfilepicker_mac.mm
index b21bc724fb..978069457c 100644
--- a/indra/newview/llfilepicker_mac.mm
+++ b/indra/newview/llfilepicker_mac.mm
@@ -86,7 +86,7 @@ std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::st
result = [panel runModal];
- if (result == NSOKButton)
+ if (result == NSModalResponseOK)
{
NSArray *filesToOpen = [panel URLs];
int i, count = [filesToOpen count];
@@ -173,7 +173,7 @@ std::unique_ptr<std::string> doSaveDialog(const std::string* file,
[panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url];
if([panel runModal] ==
- NSFileHandlingPanelOKButton)
+ NSModalResponseOK)
{
NSURL* url = [panel URL];
NSString* p = [url path];
@@ -211,7 +211,7 @@ void doSaveDialogModeless(const std::string* file,
[panel beginWithCompletionHandler:^(NSModalResponse result)
{
- if (result == NSOKButton)
+ if (result == NSModalResponseOK)
{
NSURL* url = [panel URL];
NSString* p = [url path];
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp
index 7e13503103..c5f4a2f0cf 100644
--- a/indra/newview/llfloateremojipicker.cpp
+++ b/indra/newview/llfloateremojipicker.cpp
@@ -1284,7 +1284,7 @@ void LLFloaterEmojiPicker::saveState()
if (!recentlyUsed.empty())
recentlyUsed += ",";
char buffer[32];
- sprintf(buffer, "%u", (U32)emoji);
+ snprintf(buffer, sizeof(buffer), "%u", (U32)emoji);
recentlyUsed += buffer;
if (!--maxCount)
break;
@@ -1301,7 +1301,7 @@ void LLFloaterEmojiPicker::saveState()
if (!frequentlyUsed.empty())
frequentlyUsed += ",";
char buffer[32];
- sprintf(buffer, "%u:%u", (U32)it.first, (U32)it.second);
+ snprintf(buffer, sizeof(buffer), "%u:%u", (U32)it.first, (U32)it.second);
frequentlyUsed += buffer;
if (!--maxCount)
break;
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 990a299c50..abffba8ffa 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -1042,7 +1042,7 @@ void LLFloaterUIPreview::getExecutablePath(const std::vector<std::string>& filen
{
CFStringRef executable_cfstr = (CFStringRef)CFDictionaryGetValue(bundleInfoDict, CFSTR("CFBundleExecutable")); // get the name of the actual executable (e.g. TextEdit or firefox-bin)
int max_file_length = 256; // (max file name length is 255 in OSX)
- char executable_buf[max_file_length];
+ char* executable_buf = (char*)malloc(sizeof(char) * max_file_length);
if(CFStringGetCString(executable_cfstr, executable_buf, max_file_length, kCFStringEncodingMacRoman)) // convert CFStringRef to char*
{
executable_path += std::string("/Contents/MacOS/") + std::string(executable_buf); // append path to executable directory and then executable name to exec path
@@ -1052,6 +1052,7 @@ void LLFloaterUIPreview::getExecutablePath(const std::vector<std::string>& filen
std::string warning = "Unable to get CString from CFString for executable path";
popupAndPrintWarning(warning);
}
+ free(executable_buf);
}
else
{