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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 31 20:56:03 UTC 2018


 basegfx/source/polygon/b2dpolypolygontools.cxx |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

New commits:
commit 079977df3f15bc393abe7541ca0769bc20f73b9d
Author:     Tóth Attila <toth.ata11 at gmail.com>
AuthorDate: Mon Dec 31 20:46:14 2018 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Dec 31 21:55:40 2018 +0100

    cppcheck: Consider using std::count_if algorithm instead of a raw loop.
    
    Change-Id: I994910cfba1d2ec63f48094f1ef5c52226ecf322
    Reviewed-on: https://gerrit.libreoffice.org/65776
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index 20c92eef08bc..305934579ec5 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -174,15 +174,7 @@ namespace basegfx
             }
             else
             {
-                sal_Int32 nInsideCount(0);
-
-                for(auto const& rPolygon : rCandidate)
-                {
-                    if(isInside(rPolygon, rPoint, bWithBorder))
-                    {
-                        nInsideCount++;
-                    }
-                }
+                sal_Int32 nInsideCount = std::count_if(rCandidate.begin(), rCandidate.end(), [rPoint, bWithBorder](B2DPolygon polygon){ return isInside(polygon, rPoint, bWithBorder); });
 
                 return (nInsideCount % 2);
             }


More information about the Libreoffice-commits mailing list