diff options
| -rw-r--r-- | indra/llcommon/llsdserialize.h | 2 | ||||
| -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 | 
4 files changed, 18 insertions, 18 deletions
| diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index cf6c1ab73a..2f12c6d1ff 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -870,7 +870,7 @@ public:  LL_COMMON_API std::string zip_llsd(LLSD& data); -LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size); +LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, size_t& outsize,std::istream& is, S32 size);  // returns a pointer to the array or past the array if the deprecated header exists  LL_COMMON_API char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size = nullptr); 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; | 
