extensions/source/activex/SOActionsApproval.cxx | 13 +++---------- extensions/source/activex/SOComWindowPeer.cxx | 13 +++---------- extensions/source/activex/SODispatchInterceptor.cxx | 14 +++----------- odk/examples/OLE/activex/SOComWindowPeer.cpp | 13 +++---------- 4 files changed, 12 insertions(+), 41 deletions(-)
New commits: commit 7a643f40b4c76bc55f17c3137aad90dbf55463ea Author: Hossein <hoss...@libreoffice.org> AuthorDate: Wed Sep 6 22:50:25 2023 +0200 Commit: Hossein <hoss...@libreoffice.org> CommitDate: Thu Sep 7 10:09:14 2023 +0200 Simplify condition in a loop over a single element The loop was over an array which has only one element, so the condition should also work directly with its only element. Change-Id: I5b87cf03d90e9da67ac3ff72b593be0ff5fa322c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129677 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/extensions/source/activex/SOActionsApproval.cxx b/extensions/source/activex/SOActionsApproval.cxx index 833e220ae183..6fd6d0888141 100644 --- a/extensions/source/activex/SOActionsApproval.cxx +++ b/extensions/source/activex/SOActionsApproval.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SOActionsApproval.cpp : Implementation of CHelpApp and DLL registration. +// SOActionsApproval.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> @@ -31,15 +31,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP SOActionsApproval::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = { - &IID_ISOActionsApproval, - }; - - for (std::size_t i = 0; i < SAL_N_ELEMENTS(arr); i++) - { - if (InlineIsEqualGUID(*arr[i], riid)) - return S_OK; - } + if (InlineIsEqualGUID(IID_ISOActionsApproval, riid)) + return S_OK; return S_FALSE; } diff --git a/extensions/source/activex/SOComWindowPeer.cxx b/extensions/source/activex/SOComWindowPeer.cxx index 6973bc173984..59510c24a7a7 100644 --- a/extensions/source/activex/SOComWindowPeer.cxx +++ b/extensions/source/activex/SOComWindowPeer.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SOComWindowPeer.cpp : Implementation of CHelpApp and DLL registration. +// SOComWindowPeer.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> @@ -30,15 +30,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP SOComWindowPeer::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = { - &IID_ISOComWindowPeer, - }; - - for (std::size_t i = 0; i < SAL_N_ELEMENTS(arr); i++) - { - if (InlineIsEqualGUID(*arr[i], riid)) - return S_OK; - } + if (InlineIsEqualGUID(IID_ISOComWindowPeer, riid)) + return S_OK; return S_FALSE; } diff --git a/extensions/source/activex/SODispatchInterceptor.cxx b/extensions/source/activex/SODispatchInterceptor.cxx index af3d69e02ea9..97ea07568fde 100644 --- a/extensions/source/activex/SODispatchInterceptor.cxx +++ b/extensions/source/activex/SODispatchInterceptor.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SODispatchInterceptor.cpp : Implementation of CHelpApp and DLL registration. +// SODispatchInterceptor.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> @@ -33,16 +33,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP SODispatchInterceptor::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = - { - &IID_ISODispatchInterceptor, - }; - - for (auto const &i : arr) - { - if (InlineIsEqualGUID(*i,riid)) - return S_OK; - } + if (InlineIsEqualGUID(IID_ISODispatchInterceptor, riid)) + return S_OK; return S_FALSE; } diff --git a/odk/examples/OLE/activex/SOComWindowPeer.cpp b/odk/examples/OLE/activex/SOComWindowPeer.cpp index 7439593dd138..50c1d7e8b341 100644 --- a/odk/examples/OLE/activex/SOComWindowPeer.cpp +++ b/odk/examples/OLE/activex/SOComWindowPeer.cpp @@ -33,7 +33,7 @@ * *************************************************************************/ -// SOComWindowPeer.cpp : Implementation of CHelpApp and DLL registration. +// SOComWindowPeer.cxx : Implementation of CHelpApp and DLL registration. #include "stdafx2.h" #include "so_activex.h" @@ -42,15 +42,8 @@ STDMETHODIMP SOComWindowPeer::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = { - &IID_ISOComWindowPeer, - }; - - for (int i = 0; i < SAL_N_ELEMENTS(arr); i++) - { - if (InlineIsEqualGUID(*arr[i], riid)) - return S_OK; - } + if (InlineIsEqualGUID(IID_ISOComWindowPeer, riid)) + return S_OK; return S_FALSE; }