Bug 1498151 - part 2: Fix simple warnings r=aklotz,Jamie
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 23 Oct 2018 17:35:35 +0000
changeset 491046 e61ca916da324a49717d173224c8f54e30097bbe
parent 491045 d0d1ccfded5ddefa99bb206ffac2235b457abffe
child 491047 079c7a062b23950449e9ce1ef809ff43026cc259
child 491052 39abbcc4230bd8f4e6a6f54c5b771eff57cbb0df
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersaklotz, Jamie
bugs1498151
milestone65.0a1
Bug 1498151 - part 2: Fix simple warnings r=aklotz,Jamie In AccessibleWrap.cpp, VARIANT instances are initialized with {VT_I4}. However, clang claims they should be initialized with {{{VT_I4}}}. In CompatibilityUIA, the capturing variable is reference to static variable. So, this patch makes it refer the static variable directly. Differential Revision: https://phabricator.services.mozilla.com/D8511
accessible/windows/msaa/AccessibleWrap.cpp
accessible/windows/msaa/CompatibilityUIA.cpp
--- a/accessible/windows/msaa/AccessibleWrap.cpp
+++ b/accessible/windows/msaa/AccessibleWrap.cpp
@@ -63,17 +63,17 @@ const uint32_t USE_ROLE_STRING = 0;
 
 #ifdef DEBUG_LEAKS
 static gAccessibles = 0;
 #endif
 
 MsaaIdGenerator AccessibleWrap::sIDGen;
 StaticAutoPtr<nsTArray<AccessibleWrap::HandlerControllerData>> AccessibleWrap::sHandlerControllers;
 
-static const VARIANT kVarChildIdSelf = {VT_I4};
+static const VARIANT kVarChildIdSelf = {{{VT_I4}}};
 
 static const int32_t kIEnumVariantDisconnected = -1;
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
   Accessible(aContent, aDoc)
@@ -1421,17 +1421,17 @@ GetProxiedAccessibleInSubtree(const DocA
   // their COM proxy.
   if (aDoc->IsTopLevel()) {
     wrapper->GetNativeInterface(getter_AddRefs(comProxy));
   } else {
     auto tab = static_cast<dom::TabParent*>(aDoc->Manager());
     MOZ_ASSERT(tab);
     DocAccessibleParent* topLevelDoc = tab->GetTopLevelDocAccessible();
     MOZ_ASSERT(topLevelDoc && topLevelDoc->IsTopLevel());
-    VARIANT docId = {VT_I4};
+    VARIANT docId = {{{VT_I4}}};
     docId.lVal = docWrapperChildId;
     RefPtr<IDispatch> disp = GetProxiedAccessibleInSubtree(topLevelDoc, docId);
     if (!disp) {
       return nullptr;
     }
 
     DebugOnly<HRESULT> hr = disp->QueryInterface(IID_IAccessible,
                                                  getter_AddRefs(comProxy));
--- a/accessible/windows/msaa/CompatibilityUIA.cpp
+++ b/accessible/windows/msaa/CompatibilityUIA.cpp
@@ -163,19 +163,18 @@ ShouldBlockUIAClient(nsIFile* aClientExe
 namespace mozilla {
 namespace a11y {
 
 Maybe<DWORD> Compatibility::sUiaRemotePid;
 
 Maybe<bool>
 Compatibility::OnUIAMessage(WPARAM aWParam, LPARAM aLParam)
 {
-  Maybe<DWORD>& remotePid = sUiaRemotePid;
-  auto clearUiaRemotePid = MakeScopeExit([&remotePid]() {
-    remotePid = Nothing();
+  auto clearUiaRemotePid = MakeScopeExit([]() {
+    sUiaRemotePid = Nothing();
   });
 
   Telemetry::AutoTimer<Telemetry::A11Y_UIA_DETECTION_TIMING_MS> timer;
 
   // UIA creates a section containing the substring "HOOK_SHMEM_"
   NS_NAMED_LITERAL_STRING(kStrHookShmem, "HOOK_SHMEM_");
 
   // The section name always ends with this suffix, which is derived from the
@@ -296,17 +295,17 @@ Compatibility::OnUIAMessage(WPARAM aWPar
     }
 
     // At this point we know that curHandle references a Section object.
     // Now we can do some actual tests on it.
 
     if (ourPid != curHandle.mPid) {
       if (kernelObject && kernelObject.value() == curHandle.mObject) {
         // The kernel objects match -- we have found the remote pid!
-        remotePid = Some(curHandle.mPid);
+        sUiaRemotePid = Some(curHandle.mPid);
         break;
       }
 
       // An object that is not ours. Since we do not yet know which kernel
       // object we're interested in, we'll save the current object for later.
       objMap.Put(curHandle.mObject, curHandle.mPid);
     } else if (handle == section.get()) {
       // This is the file mapping that we opened above. We save this mObject
@@ -314,30 +313,30 @@ Compatibility::OnUIAMessage(WPARAM aWPar
       kernelObject = Some(curHandle.mObject);
     }
   }
 
   if (!kernelObject) {
     return Nothing();
   }
 
-  if (!remotePid) {
+  if (!sUiaRemotePid) {
     // We found kernelObject *after* we saw the remote process's copy. Now we
     // must look it up in objMap.
     DWORD pid;
     if (objMap.Get(kernelObject.value(), &pid)) {
-      remotePid = Some(pid);
+      sUiaRemotePid = Some(pid);
     }
   }
 
-  if (!remotePid) {
+  if (!sUiaRemotePid) {
     return Nothing();
   }
 
-  a11y::SetInstantiator(remotePid.value());
+  a11y::SetInstantiator(sUiaRemotePid.value());
 
   // Block if necessary
   nsCOMPtr<nsIFile> instantiator;
   if (a11y::GetInstantiator(getter_AddRefs(instantiator)) &&
       ShouldBlockUIAClient(instantiator)) {
     return Some(false);
   }