Bug 819280 - Fixed some GCC warnings in accessible module r=trev.saunders
authorJacek Caban <jacek@codeweavers.com>
Thu, 13 Dec 2012 13:04:12 +0100
changeset 115895 0ad2485491af927da3a3a379f7cc2bf78522c056
parent 115894 22807dd4c16c35784e32d1c533e7c82c9c99a7a6
child 115896 1be998d2000717545f3a8757f6a7c08981f0b037
push id24028
push useremorley@mozilla.com
push dateThu, 13 Dec 2012 15:56:02 +0000
treeherderautoland@9db79b97abbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstrev.saunders
bugs819280
milestone20.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 819280 - Fixed some GCC warnings in accessible module r=trev.saunders
accessible/src/msaa/AccessibleWrap.cpp
accessible/src/msaa/DocAccessibleWrap.cpp
accessible/src/msaa/EnumVariant.h
accessible/src/msaa/ImageAccessibleWrap.cpp
accessible/src/windows/ia2/ia2AccessibleRelation.cpp
accessible/src/windows/sdn/sdnAccessible.h
accessible/src/windows/uia/uiaRawElmProvider.cpp
accessible/src/windows/uia/uiaRawElmProvider.h
--- a/accessible/src/msaa/AccessibleWrap.cpp
+++ b/accessible/src/msaa/AccessibleWrap.cpp
@@ -54,28 +54,25 @@ const uint32_t USE_ROLE_STRING = 0;
  */
 
 //#define DEBUG_LEAKS
 
 #ifdef DEBUG_LEAKS
 static gAccessibles = 0;
 #endif
 
-EXTERN_C GUID CDECL CLSID_Accessible =
-{ 0x61044601, 0xa811, 0x4e2b, { 0xbb, 0xba, 0x17, 0xbf, 0xab, 0xd3, 0x29, 0xd7 } };
-
 static const int32_t kIEnumVariantDisconnected = -1;
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 ITypeInfo* AccessibleWrap::gTypeInfo = NULL;
 
-NS_IMPL_ISUPPORTS_INHERITED0(AccessibleWrap, Accessible);
+NS_IMPL_ISUPPORTS_INHERITED0(AccessibleWrap, Accessible)
 
 //-----------------------------------------------------
 // IUnknown interface methods - see iunknown.h for documentation
 //-----------------------------------------------------
 
 // Microsoft COM QueryInterface
 STDMETHODIMP
 AccessibleWrap::QueryInterface(REFIID iid, void** ppv)
@@ -92,17 +89,17 @@ AccessibleWrap::QueryInterface(REFIID ii
       return E_NOINTERFACE;
 
     *ppv = static_cast<IEnumVARIANT*>(new ChildrenEnumVariant(this));
   } else if (IID_IServiceProvider == iid)
     *ppv = static_cast<IServiceProvider*>(this);
   else if (IID_IAccessible2 == iid && !Compatibility::IsIA2Off())
     *ppv = static_cast<IAccessible2*>(this);
   else if (IID_ISimpleDOMNode == iid) {
-    if (IsDefunct() || !HasOwnContent() && !IsDoc())
+    if (IsDefunct() || (!HasOwnContent() && !IsDoc()))
       return E_NOINTERFACE;
 
     *ppv = new sdnAccessible(GetNode());
   }
 
   if (NULL == *ppv) {
     HRESULT hr = ia2AccessibleComponent::QueryInterface(iid, ppv);
     if (SUCCEEDED(hr))
@@ -140,17 +137,17 @@ AccessibleWrap::QueryService(REFGUID aGu
   if (!aInstancePtr)
     return E_INVALIDARG;
 
   *aInstancePtr = NULL;
 
   // UIA IAccessibleEx
   if (aGuidService == IID_IAccessibleEx &&
       Preferences::GetBool("accessibility.uia.enable")) {
-    IAccessibleEx* accEx = new uiaRawElmProvider(this);
+    uiaRawElmProvider* accEx = new uiaRawElmProvider(this);
     HRESULT hr = accEx->QueryInterface(aIID, aInstancePtr);
     if (FAILED(hr))
       delete accEx;
 
     return hr;
   }
 
   return nsAccessNodeWrap::QueryService(aGuidService, aIID, aInstancePtr);
@@ -170,18 +167,18 @@ AccessibleWrap::get_accParent( IDispatch
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   DocAccessible* doc = AsDoc();
   if (doc) {
     // Return window system accessible object for root document and tab document
     // accessibles.
     if (!doc->ParentDocument() ||
-        nsWinUtils::IsWindowEmulationStarted() &&
-        nsCoreUtils::IsTabDocument(doc->DocumentNode())) {
+        (nsWinUtils::IsWindowEmulationStarted() &&
+         nsCoreUtils::IsTabDocument(doc->DocumentNode()))) {
       HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
       if (hwnd && SUCCEEDED(::AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
                                                          IID_IAccessible,
                                                          (void**)ppdispParent))) {
         return S_OK;
       }
     }
   }
@@ -580,17 +577,17 @@ AccessibleWrap::get_accFocus(
 
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
 // This helper class implements IEnumVARIANT for a nsIArray containing nsIAccessible objects.
 
-class AccessibleEnumerator : public IEnumVARIANT
+class AccessibleEnumerator MOZ_FINAL : public IEnumVARIANT
 {
 public:
   AccessibleEnumerator(nsIArray* aArray) : mArray(aArray), mCurIndex(0) { }
   AccessibleEnumerator(const AccessibleEnumerator& toCopy) :
     mArray(toCopy.mArray), mCurIndex(toCopy.mCurIndex) { }
   ~AccessibleEnumerator() { }
 
   // IUnknown
@@ -1097,17 +1094,17 @@ AccessibleWrap::get_relation(long aRelat
   if (!aRelation)
     return E_INVALIDARG;
 
   *aRelation = NULL;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  uint32_t relIdx = 0;
+  long relIdx = 0;
   for (uint32_t relType = nsIAccessibleRelation::RELATION_FIRST;
        relType <= nsIAccessibleRelation::RELATION_LAST; relType++) {
     Relation rel = RelationByType(relType);
     nsRefPtr<ia2AccessibleRelation> ia2Relation =
       new ia2AccessibleRelation(relType, &rel);
     if (ia2Relation->HasTargets()) {
       if (relIdx == aRelationIndex) {
         ia2Relation.forget(aRelation);
@@ -1564,18 +1561,17 @@ nsresult
 AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
 {
   uint32_t eventType = aEvent->GetEventType();
 
   NS_ENSURE_TRUE(eventType > 0 &&
                  eventType < nsIAccessibleEvent::EVENT_LAST_ENTRY,
                  NS_ERROR_FAILURE);
 
-  uint32_t winLastEntry = gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY];
-  NS_ASSERTION(winLastEntry == kEVENT_LAST_ENTRY,
+  NS_ASSERTION(gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY] == kEVENT_LAST_ENTRY,
                "MSAA event map skewed");
 
   uint32_t winEvent = gWinEventMap[eventType];
   if (!winEvent)
     return NS_OK;
 
   // Means we're not active.
   NS_ENSURE_TRUE(!IsDefunct(), NS_ERROR_FAILURE);
@@ -1706,17 +1702,17 @@ AccessibleWrap::ConvertToIA2Attributes(n
     nsCOMPtr<nsIPropertyElement> propElem(do_QueryInterface(propSupports));
     if (!propElem)
       return E_FAIL;
 
     nsAutoCString name;
     if (NS_FAILED(propElem->GetKey(name)))
       return E_FAIL;
 
-    uint32_t offset = 0;
+    int32_t offset = 0;
     while ((offset = name.FindCharInSet(kCharsToEscape, offset)) != kNotFound) {
       name.Insert('\\', offset);
       offset += 2;
     }
 
     nsAutoString value;
     if (NS_FAILED(propElem->GetValue(value)))
       return E_FAIL;
--- a/accessible/src/msaa/DocAccessibleWrap.cpp
+++ b/accessible/src/msaa/DocAccessibleWrap.cpp
@@ -254,17 +254,17 @@ DocAccessibleWrap::DoInitialUpdate()
   if (nsWinUtils::IsWindowEmulationStarted()) {
     // Create window for tab document.
     if (nsCoreUtils::IsTabDocument(mDocumentNode)) {
       mozilla::dom::TabChild* tabChild =
         mozilla::dom::GetTabChildFrom(mDocumentNode->GetShell());
 
       a11y::RootAccessible* rootDocument = RootAccessible();
 
-      mozilla::WindowsHandle nativeData = NULL;
+      mozilla::WindowsHandle nativeData = 0;
       if (tabChild)
         tabChild->SendGetWidgetNativeData(&nativeData);
       else
         nativeData = reinterpret_cast<mozilla::WindowsHandle>(
           rootDocument->GetNativeWindow());
 
       bool isActive = true;
       int32_t x = CW_USEDEFAULT, y = CW_USEDEFAULT, width = 0, height = 0;
--- a/accessible/src/msaa/EnumVariant.h
+++ b/accessible/src/msaa/EnumVariant.h
@@ -13,18 +13,18 @@ namespace mozilla {
 namespace a11y {
 
 /**
  * Used to fetch accessible children.
  */
 class ChildrenEnumVariant MOZ_FINAL : public IEnumVARIANT
 {
 public:
-  ChildrenEnumVariant(AccessibleWrap* aAnchor) : mAnchorAcc(aAnchor),
-    mCurAcc(mAnchorAcc->GetChildAt(0)), mCurIndex(0), mRefCnt(0) { }
+  ChildrenEnumVariant(AccessibleWrap* aAnchor) : mRefCnt(0), mAnchorAcc(aAnchor),
+    mCurAcc(mAnchorAcc->GetChildAt(0)), mCurIndex(0) { }
 
   // IUnknown
   DECL_IUNKNOWN
 
   // IEnumVariant
   virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next(
     /* [in] */ ULONG aCount,
     /* [length_is][size_is][out] */ VARIANT* aItems,
@@ -38,18 +38,18 @@ public:
   virtual HRESULT STDMETHODCALLTYPE Clone(
     /* [out] */ IEnumVARIANT** aEnumVaraint);
 
 private:
   ChildrenEnumVariant() MOZ_DELETE;
   ChildrenEnumVariant& operator =(const ChildrenEnumVariant&) MOZ_DELETE;
 
   ChildrenEnumVariant(const ChildrenEnumVariant& aEnumVariant) :
-    mAnchorAcc(aEnumVariant.mAnchorAcc), mCurAcc(aEnumVariant.mCurAcc),
-    mCurIndex(aEnumVariant.mCurIndex), mRefCnt(0) { }
+    mRefCnt(0), mAnchorAcc(aEnumVariant.mAnchorAcc), mCurAcc(aEnumVariant.mCurAcc),
+    mCurIndex(aEnumVariant.mCurIndex) { }
   virtual ~ChildrenEnumVariant() { }
 
 protected:
   nsRefPtr<AccessibleWrap> mAnchorAcc;
   Accessible* mCurAcc;
   uint32_t mCurIndex;
 };
 
--- a/accessible/src/msaa/ImageAccessibleWrap.cpp
+++ b/accessible/src/msaa/ImageAccessibleWrap.cpp
@@ -10,10 +10,10 @@
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 NS_IMPL_ISUPPORTS_INHERITED0(ImageAccessibleWrap,
                              ImageAccessible)
 
 IMPL_IUNKNOWN_INHERITED1(ImageAccessibleWrap,
                          AccessibleWrap,
-                         ia2AccessibleImage);
+                         ia2AccessibleImage)
 
--- a/accessible/src/windows/ia2/ia2AccessibleRelation.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleRelation.cpp
@@ -155,17 +155,17 @@ ia2AccessibleRelation::get_nTargets(long
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleRelation::get_target(long aTargetIndex, IUnknown **aTarget)
 {
   A11Y_TRYBLOCK_BEGIN
 
-  if (aTargetIndex < 0 || aTargetIndex >= mTargets.Length() || !aTarget)
+  if (aTargetIndex < 0 || (uint32_t)aTargetIndex >= mTargets.Length() || !aTarget)
     return E_INVALIDARG;
 
   mTargets[aTargetIndex]->QueryNativeInterface(IID_IUnknown, (void**) aTarget);
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
@@ -174,21 +174,21 @@ ia2AccessibleRelation::get_targets(long 
                                    long *aNTargets)
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aNTargets || !aTargets)
     return E_INVALIDARG;
 
   *aNTargets = 0;
-  uint32_t maxTargets = mTargets.Length();
+  long maxTargets = mTargets.Length();
   if (maxTargets > aMaxTargets)
     maxTargets = aMaxTargets;
 
-  for (uint32_t idx = 0; idx < maxTargets; idx++)
+  for (long idx = 0; idx < maxTargets; idx++)
     get_target(idx, aTargets + idx);
 
   *aNTargets = maxTargets;
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
--- a/accessible/src/windows/sdn/sdnAccessible.h
+++ b/accessible/src/windows/sdn/sdnAccessible.h
@@ -10,17 +10,17 @@
 #include "ISimpleDOMNode.h"
 #include "AccessibleWrap.h"
 
 #include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace a11y {
 
-class sdnAccessible : public ISimpleDOMNode
+class sdnAccessible MOZ_FINAL : public ISimpleDOMNode
 {
 public:
   sdnAccessible(nsINode* aNode) : mNode(aNode) { }
   ~sdnAccessible() { }
 
   /**
    * Retrun if the object is defunct.
    */
--- a/accessible/src/windows/uia/uiaRawElmProvider.cpp
+++ b/accessible/src/windows/uia/uiaRawElmProvider.cpp
@@ -72,17 +72,17 @@ uiaRawElmProvider::GetRuntimeId(__RPC__d
   if (!aRuntimeIds)
     return E_INVALIDARG;
 
   int ids[] = { UiaAppendRuntimeId, static_cast<int>(reinterpret_cast<intptr_t>(mAcc->UniqueID())) };
   *aRuntimeIds = SafeArrayCreateVector(VT_I4, 0, 2);
   if (!*aRuntimeIds)
     return E_OUTOFMEMORY;
 
-  for (LONG i = 0; i < ArrayLength(ids); i++)
+  for (LONG i = 0; i < (LONG)ArrayLength(ids); i++)
     SafeArrayPutElement(*aRuntimeIds, &i, (void*)&(ids[i]));
 
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
--- a/accessible/src/windows/uia/uiaRawElmProvider.h
+++ b/accessible/src/windows/uia/uiaRawElmProvider.h
@@ -18,17 +18,17 @@ class AccessibleWrap;
 
 /**
  * IRawElementProviderSimple implementation (maintains IAccessibleEx approach).
  */
 class uiaRawElmProvider MOZ_FINAL : public IAccessibleEx,
                                     public IRawElementProviderSimple
 {
 public:
-  uiaRawElmProvider(AccessibleWrap* aAcc) : mAcc(aAcc), mRefCnt(0) { }
+  uiaRawElmProvider(AccessibleWrap* aAcc) : mRefCnt(0), mAcc(aAcc) { }
 
   // IUnknown
   DECL_IUNKNOWN
 
   // IAccessibleEx
   virtual HRESULT STDMETHODCALLTYPE GetObjectForChild(
     /* [in] */ long aIdChild,
     /* [retval][out] */ __RPC__deref_out_opt IAccessibleEx** aAccEx);