[Libreoffice-commits] core.git: winaccessibility/source
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 28 13:33:34 UTC 2021
winaccessibility/source/UAccCOM/MAccessible.cxx | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
New commits:
commit 197d9631b3add45d294f1d7f81cee00a695f36c9
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Mon Jun 28 08:42:49 2021 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Jun 28 15:33:01 2021 +0200
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 at posteo.de>
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
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;
More information about the Libreoffice-commits
mailing list