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

Adrien Ollier (via logerrit) logerrit at kemper.freedesktop.org
Fri May 3 18:37:33 UTC 2019


 vcl/source/animate/Animation.cxx |   26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

New commits:
commit 69bf59d63d4d2708a7840ff1ffad821a032c90fc
Author:     Adrien Ollier <adr.ollier at hotmail.fr>
AuthorDate: Wed May 1 23:05:53 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri May 3 20:36:20 2019 +0200

    makes implementation of Animation::operator =(const Animation&) concise
    
    Using the logical AND, we can evaluate all the expressions
    from left to right into a single and condensed expression.
    
    Change-Id: I973061dcd34322c29565a478bf9b7ba757965231
    Signed-off-by: Adrien Ollier <adr.ollier at hotmail.fr>
    Reviewed-on: https://gerrit.libreoffice.org/71651
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index c4c15584b050..bb3935a41c78 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -86,25 +86,13 @@ Animation& Animation::operator=(const Animation& rAnimation)
 
 bool Animation::operator==(const Animation& rAnimation) const
 {
-    const size_t nCount = maList.size();
-    bool bRet = false;
-
-    if (rAnimation.maList.size() == nCount && rAnimation.maBitmapEx == maBitmapEx
-        && rAnimation.maGlobalSize == maGlobalSize)
-    {
-        bRet = true;
-
-        for (size_t n = 0; n < nCount; n++)
-        {
-            if ((*maList[n]) != (*rAnimation.maList[n]))
-            {
-                bRet = false;
-                break;
-            }
-        }
-    }
-
-    return bRet;
+    return maList.size() == rAnimation.maList.size() && maBitmapEx == rAnimation.maBitmapEx
+           && maGlobalSize == rAnimation.maGlobalSize
+           && std::equal(maList.begin(), maList.end(), rAnimation.maList.begin(),
+                         [](const std::unique_ptr<AnimationBitmap>& pAnim1,
+                            const std::unique_ptr<AnimationBitmap>& pAnim2) -> bool {
+                             return *pAnim1 == *pAnim2;
+                         });
 }
 
 void Animation::Clear()


More information about the Libreoffice-commits mailing list