diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-04-07 01:07:59 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-04-07 03:13:55 +0300 |
commit | ff0edab69a1dc4884b7636c2546327901ce8fdde (patch) | |
tree | a327a68d2f1f351275539d65fc7237cbdc29c577 /indra/newview | |
parent | f1095d78315818642e62b7f4af9984557e176b5d (diff) |
post-merge buildfix
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfilepicker.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llfilepicker_mac.h | 2 | ||||
-rw-r--r-- | indra/newview/llfilepicker_mac.mm | 28 |
3 files changed, 17 insertions, 17 deletions
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 51b2f25f8d..b61afcbbc9 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -716,9 +716,9 @@ bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter, return false; } - std::vector<std::string> *allowed_types=navOpenFilterProc(filter); + std::unique_ptr<std::vector<std::string>> allowed_types=navOpenFilterProc(filter); - doLoadDialogModeless(allowed_types, + doLoadDialogModeless(allowed_types.get(), mPickOptions, callback, userdata); diff --git a/indra/newview/llfilepicker_mac.h b/indra/newview/llfilepicker_mac.h index c18643f355..367c792969 100644 --- a/indra/newview/llfilepicker_mac.h +++ b/indra/newview/llfilepicker_mac.h @@ -47,7 +47,7 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types, void (*callback)(bool, std::vector<std::string>&, void*), void *userdata); -std::string* doSaveDialog(const std::string* file, +std::unique_ptr<std::string> doSaveDialog(const std::string* file, const std::string* type, const std::string* creator, const std::string* extension, diff --git a/indra/newview/llfilepicker_mac.mm b/indra/newview/llfilepicker_mac.mm index 7fd9f37e18..bca5b10c8a 100644 --- a/indra/newview/llfilepicker_mac.mm +++ b/indra/newview/llfilepicker_mac.mm @@ -75,27 +75,27 @@ std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::st unsigned int flags) { int result; - + NSOpenPanel *panel = init_panel(allowed_types,flags); result = [panel runModal]; - std::vector<std::string>* outfiles = NULL; - + std::unique_ptr<std::vector<std::string>> outfiles = nullptr; + if (result == NSOKButton) { NSArray *filesToOpen = [panel URLs]; - int i, count = [filesToOpen count]; - + int count = [filesToOpen count]; + if (count > 0) { - outfiles = new std::vector<std::string>; + outfiles = std::make_unique<std::vector<std::string>>(); } - - for (i=0; i<count; i++) { - NSString *aFile = [[filesToOpen objectAtIndex:i] path]; - std::string *afilestr = new std::string([aFile UTF8String]); - outfiles->push_back(*afilestr); + + for (int i=0; i<count; i++) { + NSString *aFile = [filesToOpen objectAtIndex:i]; + std::string afilestr = [[aFile stringByStandardizingPath] UTF8String]; + outfiles->push_back(std::move(afilestr)); } } return outfiles; @@ -140,7 +140,7 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types, }]; } -std::string* doSaveDialog(const std::string* file, +std::unique_ptr<std::string> doSaveDialog(const std::string* file, const std::string* type, const std::string* creator, const std::string* extension, @@ -157,7 +157,7 @@ std::string* doSaveDialog(const std::string* file, [panel setAllowedFileTypes:fileType]; NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]]; - std::string *outfile = NULL; + std::unique_ptr<std::string> outfile = nullptr; NSURL* url = [NSURL fileURLWithPath:fileName]; [panel setNameFieldStringValue: fileName]; [panel setDirectoryURL: url]; @@ -166,7 +166,7 @@ std::string* doSaveDialog(const std::string* file, { NSURL* url = [panel URL]; NSString* p = [url path]; - outfile = new std::string( [p UTF8String] ); + outfile = std::make_unique<std::string>( [p UTF8String] ); // write the file } return outfile; |