Bug 1529902 - Fix invalid use of NS_ConvertUTF16toUTF8. r=aklotz
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 22 Feb 2019 22:37:48 +0900
changeset 460723 1c74156717f19c20279571e493dac202cf89d4ef
parent 460722 0e0b4b2f297307d8c3178acca10dc3b4a2c55359
child 460724 6924dd16f7b1e2e6ce71a8eb4cbe330d3e4745dc
push id35597
push userrmaries@mozilla.com
push dateSat, 23 Feb 2019 04:15:57 +0000
treeherdermozilla-central@6924dd16f7b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1529902
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1529902 - Fix invalid use of NS_ConvertUTF16toUTF8. r=aklotz
widget/windows/WinUtils.cpp
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -1268,31 +1268,30 @@ NS_IMETHODIMP AsyncEncodeAndWriteIcon::R
   MOZ_ASSERT(!NS_IsMainThread(), "Should not be called on the main thread.");
 
   // Note that since we're off the main thread we can't use
   // gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()
   RefPtr<DataSourceSurface> surface = Factory::CreateWrappingDataSourceSurface(
       mBuffer.get(), mStride, IntSize(mWidth, mHeight),
       SurfaceFormat::B8G8R8A8);
 
-  FILE* file = fopen(NS_ConvertUTF16toUTF8(mIconPath).get(), "wb");
+  FILE* file = _wfopen(mIconPath.get(), L"wb");
   if (!file) {
     // Maybe the directory doesn't exist; try creating it, then fopen again.
     nsresult rv = NS_ERROR_FAILURE;
     nsCOMPtr<nsIFile> comFile = do_CreateInstance("@mozilla.org/file/local;1");
     if (comFile) {
-      // NS_ConvertUTF8toUTF16 utf16path(mIconPath);
       rv = comFile->InitWithPath(mIconPath);
       if (NS_SUCCEEDED(rv)) {
         nsCOMPtr<nsIFile> dirPath;
         comFile->GetParent(getter_AddRefs(dirPath));
         if (dirPath) {
           rv = dirPath->Create(nsIFile::DIRECTORY_TYPE, 0777);
           if (NS_SUCCEEDED(rv) || rv == NS_ERROR_FILE_ALREADY_EXISTS) {
-            file = fopen(NS_ConvertUTF16toUTF8(mIconPath).get(), "wb");
+            file = _wfopen(mIconPath.get(), L"wb");
             if (!file) {
               rv = NS_ERROR_FAILURE;
             }
           }
         }
       }
     }
     if (!file) {