bug 379651. mac exception handler reads utf8 path into utf16 string. r=ted.mielczarek
authorsayrer@gmail.com
Tue, 24 Jul 2007 18:06:01 -0700
changeset 3880 da8e5fea2d95c63082406f71f430c6f5041b5e0a
parent 3879 c18c348be9079b538234d59990f149941b0f71a4
child 3881 9c0ad941f1aed2dbbe1f749bbbe917758f1da765
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted.mielczarek
bugs379651
milestone1.9a7pre
bug 379651. mac exception handler reads utf8 path into utf16 string. r=ted.mielczarek
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -330,21 +330,22 @@ nsresult SetExceptionHandler(nsILocalFil
   GetTempPath(pathLen, (LPWSTR)tempPath.BeginWriting());
 #elif defined(XP_MACOSX)
   FSRef fsRef;
   OSErr err = FSFindFolder(kUserDomain, kTemporaryFolderType,
                            kCreateFolder, &fsRef);
   if (err != noErr)
     return NS_ERROR_FAILURE;
 
-  tempPath.SetLength(PATH_MAX);
-  OSStatus status = FSRefMakePath(&fsRef,
-                                  (UInt8*)tempPath.BeginWriting(), PATH_MAX);
+  char path[PATH_MAX];
+  OSStatus status = FSRefMakePath(&fsRef, (UInt8*)path, PATH_MAX);
   if (status != noErr)
     return NS_ERROR_FAILURE;
+  tempPath = NS_ConvertUTF8toUTF16(path);
+
 #else
   //XXX: implement get temp path on other platforms
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 
   // finally, set the exception handler
   gExceptionHandler = new google_breakpad::
     ExceptionHandler(CONVERT_UTF16_TO_XP_CHAR(tempPath).get(),