diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2018-09-08 10:41:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-11 15:00:23 +0200 |
commit | a1949a419e2e4bec52906bb163b0cf510fe2aa14 (patch) | |
tree | c3fd3b0f1ba6e57c954a4a39d6de305fe4c999fa /basegfx | |
parent | 7430dfe2a4a3b13ffa248bf14a3a2ca87993f48d (diff) |
cppcheck: variableScope in basegfx
and use range based loops on B2DPolyPolygon
Change-Id: Ic68c236c839766a0c52369ae8487de187d1ad04e
Reviewed-on: https://gerrit.libreoffice.org/60189
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/polygon/b2dtrapezoid.cxx | 15 | ||||
-rw-r--r-- | basegfx/source/raster/rasterconvert3d.cxx | 3 |
2 files changed, 6 insertions, 12 deletions
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index 9a8bcf48aee2..1bba1a9e03a1 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -485,9 +485,7 @@ namespace basegfx maNewPoints() { B2DPolyPolygon aSource(rSourcePolyPolygon); - const sal_uInt32 nPolygonCount(rSourcePolyPolygon.count()); TrDeSimpleEdges aTrDeSimpleEdges; - sal_uInt32 a(0), b(0); sal_uInt32 nAllPointCount(0); // ensure there are no curves used @@ -496,10 +494,9 @@ namespace basegfx aSource = aSource.getDefaultAdaptiveSubdivision(); } - for(a = 0; a < nPolygonCount; a++) + for(const auto& aPolygonCandidate : aSource) { // 1st run: count points - const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); const sal_uInt32 nCount(aPolygonCandidate.count()); if(nCount > 2) @@ -514,15 +511,14 @@ namespace basegfx // after 2nd loop since pointers to it are used in the edges maPoints.reserve(nAllPointCount); - for(a = 0; a < nPolygonCount; a++) + for(const auto& aPolygonCandidate : aSource) { // 2nd run: add points - const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); const sal_uInt32 nCount(aPolygonCandidate.count()); if(nCount > 2) { - for(b = 0; b < nCount; b++) + for(sal_uInt32 b = 0; b < nCount; b++) { maPoints.push_back(aPolygonCandidate.getB2DPoint(b)); } @@ -535,9 +531,8 @@ namespace basegfx // in the edges may be wrong. Security first here. sal_uInt32 nStartIndex(0); - for(a = 0; a < nPolygonCount; a++) + for(const auto& aPolygonCandidate : aSource) { - const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); const sal_uInt32 nCount(aPolygonCandidate.count()); if(nCount > 2) @@ -545,7 +540,7 @@ namespace basegfx // get the last point of the current polygon B2DPoint* pPrev(&maPoints[nCount + nStartIndex - 1]); - for(b = 0; b < nCount; b++) + for(sal_uInt32 b = 0; b < nCount; b++) { // get next point B2DPoint* pCurr(&maPoints[nStartIndex++]); diff --git a/basegfx/source/raster/rasterconvert3d.cxx b/basegfx/source/raster/rasterconvert3d.cxx index 8e1ab3b6d9d8..3ed2a1a250bc 100644 --- a/basegfx/source/raster/rasterconvert3d.cxx +++ b/basegfx/source/raster/rasterconvert3d.cxx @@ -69,7 +69,6 @@ namespace basegfx std::vector< RasterConversionLineEntry3D* > aCurrentLine; std::vector< RasterConversionLineEntry3D* > aNextLine; std::vector< RasterConversionLineEntry3D* >::iterator aRasterConversionLineEntry3D; - sal_uInt32 nPairCount(0); // get scanlines first LineNumber as start sal_Int32 nLineNumber(std::max(aCurrentEntry->getY(), nStartLine)); @@ -117,7 +116,7 @@ namespace basegfx // process current scanline aRasterConversionLineEntry3D = aCurrentLine.begin(); aNextLine.clear(); - nPairCount = 0; + sal_uInt32 nPairCount(0); while(aRasterConversionLineEntry3D != aCurrentLine.end()) { |