summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-08-15 21:32:27 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-20 17:12:11 +0200
commit0787ce8814e37972a0c968f60008d4e8722b6e27 (patch)
tree9d2803ebda8813e6b3f2bc2e6f8a74953b2931c1 /extensions
parentd2c9c60fefb9687adbde4be61ed66a5123a2587f (diff)
Simplify containers iterations, tdf#96099 follow-up
Use range-based loop or replace with std::any_of, std::find and std::find_if where applicable. Change-Id: I2f80788c49d56094c29b102eb96a7a7c079567c6 Reviewed-on: https://gerrit.libreoffice.org/59143 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/ole/unoobjw.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index f45b9b5b0000..40c97ddac4f6 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -1440,14 +1440,10 @@ bool InterfaceOleWrapper::getInvocationInfoForCall( DISPID id, InvocationInfo&
// there's only one entry in the map.
OUString sMemberName;
- for(auto ci1= m_nameToDispIdMap.cbegin(); ci1 != m_nameToDispIdMap.cend(); ++ci1)
- {
- if( (*ci1).second == id) // iterator is a pair< OUString, DISPID>
- {
- sMemberName= (*ci1).first;
- break;
- }
- }
+ auto ci1 = std::find_if(m_nameToDispIdMap.cbegin(), m_nameToDispIdMap.cend(),
+ [&id](const NameToIdMap::value_type& nameToDispId) { return nameToDispId.second == id; }); // item is a pair<OUString, DISPID>
+ if (ci1 != m_nameToDispIdMap.cend())
+ sMemberName= (*ci1).first;
// Get information for the current call ( property or method).
// There could be similar names which only differ in the cases
// of letters. First we assume that the name which was passed into