Bug 1296078 - Avoid passing nsCString objects to %s format string codes. r=gerald, a=lizzard
authorNathan Froyd <froydnj@gmail.com>
Thu, 18 Aug 2016 23:44:51 -0400
changeset 347862 45689e52b2e6d1a0988cb3eeafe2b6e2f4654b38
parent 347861 fa1adee0fb582bc6ae5542047d09b02a37e2a6f9
child 347863 c2aa582a598090ba22e6fd0a6550a06bdc316161
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, lizzard
bugs1296078
milestone50.0a2
Bug 1296078 - Avoid passing nsCString objects to %s format string codes. r=gerald, a=lizzard
dom/media/platforms/wmf/WMFVideoMFTManager.cpp
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -160,17 +160,17 @@ struct D3DDLLBlacklistingCache
   nsCString mBlacklistPref;
   // Non-empty if a blacklisted DLL was found.
   nsCString mBlacklistedDLL;
 };
 StaticAutoPtr<D3DDLLBlacklistingCache> sD3D11BlacklistingCache;
 StaticAutoPtr<D3DDLLBlacklistingCache> sD3D9BlacklistingCache;
 
 // If a blacklisted DLL is found, return its information, otherwise "".
-static const nsACString&
+static const nsCString&
 FindDXVABlacklistedDLL(StaticAutoPtr<D3DDLLBlacklistingCache>& aDLLBlacklistingCache,
                        const char* aDLLBlacklistPrefName)
 {
   NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
 
   if (!aDLLBlacklistingCache) {
     // First time here, create persistent data that will be reused in all
     // D3D11-blacklisting checks.
@@ -274,23 +274,23 @@ FindDXVABlacklistedDLL(StaticAutoPtr<D3D
     }
   }
 
   // No blacklisted DLL.
   aDLLBlacklistingCache->mBlacklistedDLL.SetLength(0);
   return aDLLBlacklistingCache->mBlacklistedDLL;
 }
 
-static const nsACString&
+static const nsCString&
 FindD3D11BlacklistedDLL() {
   return FindDXVABlacklistedDLL(sD3D11BlacklistingCache,
                                 "media.wmf.disable-d3d11-for-dlls");
 }
 
-static const nsACString&
+static const nsCString&
 FindD3D9BlacklistedDLL() {
   return FindDXVABlacklistedDLL(sD3D9BlacklistingCache,
                                 "media.wmf.disable-d3d9-for-dlls");
 }
 
 class CreateDXVAManagerEvent : public Runnable {
 public:
   CreateDXVAManagerEvent(LayersBackend aBackend, nsCString& aFailureReason)
@@ -299,36 +299,36 @@ public:
   {}
 
   NS_IMETHOD Run() {
     NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
     nsACString* failureReason = &mFailureReason;
     nsCString secondFailureReason;
     if (mBackend == LayersBackend::LAYERS_D3D11 &&
         MediaPrefs::PDMWMFAllowD3D11() && IsWin8OrLater()) {
-      const nsACString& blacklistedDLL = FindD3D11BlacklistedDLL();
+      const nsCString& blacklistedDLL = FindD3D11BlacklistedDLL();
       if (!blacklistedDLL.IsEmpty()) {
         failureReason->AppendPrintf("D3D11 blacklisted with DLL %s",
-                                    blacklistedDLL);
+                                    blacklistedDLL.get());
       } else {
         mDXVA2Manager = DXVA2Manager::CreateD3D11DXVA(*failureReason);
         if (mDXVA2Manager) {
           return NS_OK;
         }
       }
       // Try again with d3d9, but record the failure reason
       // into a new var to avoid overwriting the d3d11 failure.
       failureReason = &secondFailureReason;
       mFailureReason.Append(NS_LITERAL_CSTRING("; "));
     }
 
-    const nsACString& blacklistedDLL = FindD3D9BlacklistedDLL();
+    const nsCString& blacklistedDLL = FindD3D9BlacklistedDLL();
     if (!blacklistedDLL.IsEmpty()) {
       mFailureReason.AppendPrintf("D3D9 blacklisted with DLL %s",
-                                  blacklistedDLL);
+                                  blacklistedDLL.get());
     } else {
       mDXVA2Manager = DXVA2Manager::CreateD3D9DXVA(*failureReason);
       // Make sure we include the messages from both attempts (if applicable).
       mFailureReason.Append(secondFailureReason);
     }
     return NS_OK;
   }
   nsAutoPtr<DXVA2Manager> mDXVA2Manager;