diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2021-06-28 08:42:49 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2021-06-28 15:33:01 +0200 |
commit | 197d9631b3add45d294f1d7f81cee00a695f36c9 (patch) | |
tree | 6a788f667fb751ed2058ecc5f8d92a19d2279959 /winaccessibility | |
parent | 8a636698795431915ab1f9877a29d6683d3d9f5b (diff) |
wina11y: Use range-based for loop
Use a const reference instead of a pointer for the iteration.
Drop the extra 'g_CMAccessible_AggMap' entry at the
end that was only used to indicate the end of the
array in the iteration previously.
Change-Id: I411e9274d56ce0ed2658dfbe3d03670e485c4b4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118004
Tested-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'winaccessibility')
-rw-r--r-- | winaccessibility/source/UAccCOM/MAccessible.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index bc911953b19d..f3c0dbf09493 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -2584,8 +2584,7 @@ static AggMapEntry g_CMAccessible_AggMap[] = { { &IID_IAccessibleAction, &createAggInstance<CAccAction>, XI_ACTION }, { &IID_IAccessibleValue, &createAggInstance<CAccValue>, XI_VALUE }, { &IID_IAccessibleHypertext, &createAggInstance<CAccHypertext>, XI_HYPERTEXT }, - { &IID_IAccessibleHyperlink, &createAggInstance<CAccHyperLink>, XI_HYPERLINK }, - { nullptr, nullptr, 0 }, + { &IID_IAccessibleHyperlink, &createAggInstance<CAccHyperLink>, XI_HYPERLINK } }; @@ -2603,16 +2602,15 @@ HRESULT WINAPI CMAccessible::SmartQI(void* /*pv*/, REFIID iid, void** ppvObject) return E_FAIL; } - AggMapEntry * pMap = &g_CMAccessible_AggMap[0]; - while(pMap && pMap->piid) + for (const AggMapEntry& rEntry : g_CMAccessible_AggMap) { - if (InlineIsEqualGUID(iid, *pMap->piid)) + if (InlineIsEqualGUID(iid, *rEntry.piid)) { SolarMutexGuard g; XInterface* pXI = nullptr; bool bFound = GetXInterfaceFromXAccessible(m_xAccessible.get(), - &pXI, pMap->XIFIndex); + &pXI, rEntry.XIFIndex); if(!bFound) { return E_FAIL; @@ -2625,11 +2623,11 @@ HRESULT WINAPI CMAccessible::SmartQI(void* /*pv*/, REFIID iid, void** ppvObject) } else { - HRESULT hr = pMap->pfnCreateInstance(*this, ppvObject); + HRESULT hr = rEntry.pfnCreateInstance(*this, ppvObject); assert(hr == S_OK); if(hr == S_OK) { - m_containedObjects.emplace(*pMap->piid, static_cast<IUnknown*>(*ppvObject)); + m_containedObjects.emplace(*rEntry.piid, static_cast<IUnknown*>(*ppvObject)); IUNOXWrapper* wrapper = nullptr; static_cast<IUnknown*>(*ppvObject)->QueryInterface(IID_IUNOXWrapper, reinterpret_cast<void**>(&wrapper)); if(wrapper) @@ -2643,7 +2641,6 @@ HRESULT WINAPI CMAccessible::SmartQI(void* /*pv*/, REFIID iid, void** ppvObject) } return E_FAIL; } - pMap++; } return E_FAIL; |