Kaydet (Commit) a1949a41 authored tarafından Jochen Nitschke's avatar Jochen Nitschke Kaydeden (comit) Noel Grandin

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: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7430dfe2
...@@ -485,9 +485,7 @@ namespace basegfx ...@@ -485,9 +485,7 @@ namespace basegfx
maNewPoints() maNewPoints()
{ {
B2DPolyPolygon aSource(rSourcePolyPolygon); B2DPolyPolygon aSource(rSourcePolyPolygon);
const sal_uInt32 nPolygonCount(rSourcePolyPolygon.count());
TrDeSimpleEdges aTrDeSimpleEdges; TrDeSimpleEdges aTrDeSimpleEdges;
sal_uInt32 a(0), b(0);
sal_uInt32 nAllPointCount(0); sal_uInt32 nAllPointCount(0);
// ensure there are no curves used // ensure there are no curves used
...@@ -496,10 +494,9 @@ namespace basegfx ...@@ -496,10 +494,9 @@ namespace basegfx
aSource = aSource.getDefaultAdaptiveSubdivision(); aSource = aSource.getDefaultAdaptiveSubdivision();
} }
for(a = 0; a < nPolygonCount; a++) for(const auto& aPolygonCandidate : aSource)
{ {
// 1st run: count points // 1st run: count points
const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a));
const sal_uInt32 nCount(aPolygonCandidate.count()); const sal_uInt32 nCount(aPolygonCandidate.count());
if(nCount > 2) if(nCount > 2)
...@@ -514,15 +511,14 @@ namespace basegfx ...@@ -514,15 +511,14 @@ namespace basegfx
// after 2nd loop since pointers to it are used in the edges // after 2nd loop since pointers to it are used in the edges
maPoints.reserve(nAllPointCount); maPoints.reserve(nAllPointCount);
for(a = 0; a < nPolygonCount; a++) for(const auto& aPolygonCandidate : aSource)
{ {
// 2nd run: add points // 2nd run: add points
const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a));
const sal_uInt32 nCount(aPolygonCandidate.count()); const sal_uInt32 nCount(aPolygonCandidate.count());
if(nCount > 2) if(nCount > 2)
{ {
for(b = 0; b < nCount; b++) for(sal_uInt32 b = 0; b < nCount; b++)
{ {
maPoints.push_back(aPolygonCandidate.getB2DPoint(b)); maPoints.push_back(aPolygonCandidate.getB2DPoint(b));
} }
...@@ -535,9 +531,8 @@ namespace basegfx ...@@ -535,9 +531,8 @@ namespace basegfx
// in the edges may be wrong. Security first here. // in the edges may be wrong. Security first here.
sal_uInt32 nStartIndex(0); 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()); const sal_uInt32 nCount(aPolygonCandidate.count());
if(nCount > 2) if(nCount > 2)
...@@ -545,7 +540,7 @@ namespace basegfx ...@@ -545,7 +540,7 @@ namespace basegfx
// get the last point of the current polygon // get the last point of the current polygon
B2DPoint* pPrev(&maPoints[nCount + nStartIndex - 1]); B2DPoint* pPrev(&maPoints[nCount + nStartIndex - 1]);
for(b = 0; b < nCount; b++) for(sal_uInt32 b = 0; b < nCount; b++)
{ {
// get next point // get next point
B2DPoint* pCurr(&maPoints[nStartIndex++]); B2DPoint* pCurr(&maPoints[nStartIndex++]);
......
...@@ -69,7 +69,6 @@ namespace basegfx ...@@ -69,7 +69,6 @@ namespace basegfx
std::vector< RasterConversionLineEntry3D* > aCurrentLine; std::vector< RasterConversionLineEntry3D* > aCurrentLine;
std::vector< RasterConversionLineEntry3D* > aNextLine; std::vector< RasterConversionLineEntry3D* > aNextLine;
std::vector< RasterConversionLineEntry3D* >::iterator aRasterConversionLineEntry3D; std::vector< RasterConversionLineEntry3D* >::iterator aRasterConversionLineEntry3D;
sal_uInt32 nPairCount(0);
// get scanlines first LineNumber as start // get scanlines first LineNumber as start
sal_Int32 nLineNumber(std::max(aCurrentEntry->getY(), nStartLine)); sal_Int32 nLineNumber(std::max(aCurrentEntry->getY(), nStartLine));
...@@ -117,7 +116,7 @@ namespace basegfx ...@@ -117,7 +116,7 @@ namespace basegfx
// process current scanline // process current scanline
aRasterConversionLineEntry3D = aCurrentLine.begin(); aRasterConversionLineEntry3D = aCurrentLine.begin();
aNextLine.clear(); aNextLine.clear();
nPairCount = 0; sal_uInt32 nPairCount(0);
while(aRasterConversionLineEntry3D != aCurrentLine.end()) while(aRasterConversionLineEntry3D != aCurrentLine.end())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment