Bug 1338086 - Remove useless else blocks in order to reduce complexity in dom/media/gmp* r?cpearce draft
authorSylvestre Ledru <sledru@mozilla.com>
Thu, 09 Feb 2017 10:31:55 +0100
changeset 484398 265ee704ac9f4ef9a202c2cf0942b7ce3a466378
parent 484397 27953f84cb5e5d67f1d8dd8d89959b17e5791b8e
child 484399 6c4a0c614a3e06cfa0724a75cd2988557fff3c22
push id45470
push userbmo:sledru@mozilla.com
push dateWed, 15 Feb 2017 08:57:47 +0000
reviewerscpearce
bugs1338086
milestone54.0a1
Bug 1338086 - Remove useless else blocks in order to reduce complexity in dom/media/gmp* r?cpearce MozReview-Commit-ID: FaKW6Sb721i
dom/media/gmp-plugin-openh264/gmp-fake-openh264.cpp
dom/media/gmp-plugin/gmp-fake.cpp
dom/media/gmp/GMPLoader.cpp
--- a/dom/media/gmp-plugin-openh264/gmp-fake-openh264.cpp
+++ b/dom/media/gmp-plugin-openh264/gmp-fake-openh264.cpp
@@ -400,21 +400,23 @@ extern "C" {
     return GMPNoErr;
   }
 
   PUBLIC_FUNC GMPErr
   GMPGetAPI (const char* aApiName, void* aHostAPI, void** aPluginApi) {
     if (!strcmp (aApiName, GMP_API_VIDEO_DECODER)) {
       *aPluginApi = new FakeVideoDecoder (static_cast<GMPVideoHost*> (aHostAPI));
       return GMPNoErr;
-    } else if (!strcmp (aApiName, GMP_API_VIDEO_ENCODER)) {
+    }
+    if (!strcmp (aApiName, GMP_API_VIDEO_ENCODER)) {
       *aPluginApi = new FakeVideoEncoder (static_cast<GMPVideoHost*> (aHostAPI));
       return GMPNoErr;
 #if defined(GMP_FAKE_SUPPORT_DECRYPT)
-    } else if (!strcmp (aApiName, GMP_API_DECRYPTOR)) {
+    }
+    if (!strcmp (aApiName, GMP_API_DECRYPTOR)) {
       *aPluginApi = new FakeDecryptor();
       return GMPNoErr;
 #endif
     }
     return GMPGenericErr;
   }
 
   PUBLIC_FUNC void
--- a/dom/media/gmp-plugin/gmp-fake.cpp
+++ b/dom/media/gmp-plugin/gmp-fake.cpp
@@ -67,17 +67,18 @@ extern "C" {
   PUBLIC_FUNC GMPErr
   GMPGetAPI (const char* aApiName, void* aHostAPI, void** aPluginApi) {
     if (!strcmp (aApiName, GMP_API_VIDEO_DECODER)) {
       // Note: Deliberately advertise in our .info file that we support
       // video-decode, but we fail the "get" call here to simulate what
       // happens when decoder init fails.
       return GMPGenericErr;
 #if defined(GMP_FAKE_SUPPORT_DECRYPT)
-    } else if (!strcmp (aApiName, GMP_API_DECRYPTOR)) {
+    }
+    if (!strcmp (aApiName, GMP_API_DECRYPTOR)) {
       *aPluginApi = new FakeDecryptor();
       return GMPNoErr;
 #endif
     }
     return GMPGenericErr;
   }
 
   PUBLIC_FUNC void
--- a/dom/media/gmp/GMPLoader.cpp
+++ b/dom/media/gmp/GMPLoader.cpp
@@ -196,21 +196,19 @@ private:
   LinuxSandboxStarter() { }
   friend mozilla::detail::UniqueSelector<LinuxSandboxStarter>::SingleObject mozilla::MakeUnique<LinuxSandboxStarter>();
 
 public:
   static UniquePtr<SandboxStarter> Make()
   {
     if (mozilla::SandboxInfo::Get().CanSandboxMedia()) {
       return MakeUnique<LinuxSandboxStarter>();
-    } else {
-      // Sandboxing isn't possible, but the parent has already
-      // checked that this plugin doesn't require it.  (Bug 1074561)
-      return nullptr;
     }
+    // Sandboxing isn't possible, but the parent has already
+    // checked that this plugin doesn't require it.  (Bug 1074561)
     return nullptr;
   }
   bool Start(const char *aLibPath) override
   {
     mozilla::SetMediaPluginSandbox(aLibPath);
     return true;
   }
 };