Bug 1006307 - Fix -Wuninitialized and -Wunused-variable warnings in widget/xpwidgets/GfxInfoBase.cpp. r=bjacob
authorChris Peterson <cpeterson@mozilla.com>
Mon, 05 May 2014 23:38:24 -0700
changeset 182074 1f5a03f07f9aa5d876690e0c56bb25eb60cb4d35
parent 182073 74112a6891303ac0ff9d2ed2ef235e84bc188edd
child 182075 f1ef4bceb5933df1ea37f6f459b615618af9ce70
push id43199
push usercpeterson@mozilla.com
push dateThu, 08 May 2014 01:08:02 +0000
treeherdermozilla-inbound@d1934e246ff4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs1006307
milestone32.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 1006307 - Fix -Wuninitialized and -Wunused-variable warnings in widget/xpwidgets/GfxInfoBase.cpp. r=bjacob
widget/xpwidgets/GfxDriverInfo.h
widget/xpwidgets/GfxInfoBase.cpp
--- a/widget/xpwidgets/GfxDriverInfo.h
+++ b/widget/xpwidgets/GfxDriverInfo.h
@@ -211,16 +211,18 @@ inline void PadDriverDecimal(char *aStri
     }
   }
   aString[4] = 0;
 }
 
 inline bool
 ParseDriverVersion(const nsAString& aVersion, uint64_t *aNumericVersion)
 {
+  *aNumericVersion = 0;
+
 #if defined(XP_WIN)
   int a, b, c, d;
   char aStr[8], bStr[8], cStr[8], dStr[8];
   /* honestly, why do I even bother */
   if (!SplitDriverVersion(NS_LossyConvertUTF16toASCII(aVersion).get(), aStr, bStr, cStr, dStr))
     return false;
 
   PadDriverDecimal(bStr);
@@ -233,20 +235,23 @@ ParseDriverVersion(const nsAString& aVer
   d = atoi(dStr);
 
   if (a < 0 || a > 0xffff) return false;
   if (b < 0 || b > 0xffff) return false;
   if (c < 0 || c > 0xffff) return false;
   if (d < 0 || d > 0xffff) return false;
 
   *aNumericVersion = GFX_DRIVER_VERSION(a, b, c, d);
+  return true;
 #elif defined(ANDROID)
   // Can't use aVersion.ToInteger() because that's not compiled into our code
   // unless we have XPCOM_GLUE_AVOID_NSPR disabled.
   *aNumericVersion = atoi(NS_LossyConvertUTF16toASCII(aVersion).get());
+  return true;
+#else
+  return false;
 #endif
-  return true;
 }
 
 }
 }
 
 #endif /*__mozilla_widget_GfxDriverInfo_h__ */
--- a/widget/xpwidgets/GfxInfoBase.cpp
+++ b/widget/xpwidgets/GfxInfoBase.cpp
@@ -590,18 +590,20 @@ GfxInfoBase::FindBlocklistedDeviceInList
   nsAutoString adapterDriverVersionString;
   if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
       NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
       NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
   {
     return 0;
   }
 
+#if defined(XP_WIN) || defined(ANDROID)
   uint64_t driverVersion;
   ParseDriverVersion(adapterDriverVersionString, &driverVersion);
+#endif
 
   uint32_t i = 0;
   for (; i < info.Length(); i++) {
     if (info[i].mOperatingSystem != DRIVER_OS_ALL &&
         info[i].mOperatingSystem != os)
     {
       continue;
     }
@@ -742,19 +744,16 @@ GfxInfoBase::GetFeatureStatusImpl(int32_
   nsAutoString adapterDriverVersionString;
   if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
       NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
       NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
   {
     return NS_OK;
   }
 
-  uint64_t driverVersion;
-  ParseDriverVersion(adapterDriverVersionString, &driverVersion);
-
   // Check if the device is blocked from the downloaded blocklist. If not, check
   // the static list after that. This order is used so that we can later escape
   // out of static blocks (i.e. if we were wrong or something was patched, we
   // can back out our static block without doing a release).
   int32_t status;
   if (aDriverInfo.Length()) {
     status = FindBlocklistedDeviceInList(aDriverInfo, aSuggestedVersion, aFeature, os);
   } else {