[Libreoffice-commits] core.git: writerfilter/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 15 17:33:50 UTC 2020


 writerfilter/source/dmapper/SdtHelper.cxx      |    8 +++-----
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    9 +++------
 2 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit e542b622aeb70230365971cab4838dbe0b6e0a93
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jun 15 15:31:14 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jun 15 19:33:16 2020 +0200

    writerfilter: use std::any_of()
    
    Change-Id: I21d5059beee737c286d85f559c767f43962a63ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96355
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index d31bfe4db00c..2e36709db3d9 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -200,11 +200,9 @@ sal_Int32 SdtHelper::getInteropGrabBagSize() const { return m_aGrabBag.size(); }
 
 bool SdtHelper::containedInInteropGrabBag(const OUString& rValueName)
 {
-    for (const beans::PropertyValue& i : m_aGrabBag)
-        if (i.Name == rValueName)
-            return true;
-
-    return false;
+    return std::any_of(
+        m_aGrabBag.begin(), m_aGrabBag.end(),
+        [&rValueName](const beans::PropertyValue& i) { return i.Name == rValueName; });
 }
 
 } // namespace writerfilter::dmapper
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3c7de5226a1d..6ad3ddaf5a29 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1709,12 +1709,9 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms,
 
 bool findPropertyName(const std::vector<beans::PropertyValue>& rProperties, const OUString& rName)
 {
-    for (auto& rProperty : rProperties)
-    {
-        if (rProperty.Name == rName)
-            return true;
-    }
-    return false;
+    return std::any_of(
+        rProperties.begin(), rProperties.end(),
+        [&rName](const beans::PropertyValue& rProperty) { return rProperty.Name == rName; });
 }
 
 void RTFDocumentImpl::backupTableRowProperties()


More information about the Libreoffice-commits mailing list