From 60861faa8653afebb504cfbcaeed633d2373a27d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 16 May 2017 14:06:30 +0200 Subject: loplugin:comparisonwithconstant in basegfx Change-Id: I6953640a1aa2e58fe2ea6555291c4f4a5271770f Reviewed-on: https://gerrit.libreoffice.org/37680 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basegfx/source/curve/b2dbeziertools.cxx | 2 +- basegfx/source/curve/b2dcubicbezier.cxx | 2 +- basegfx/source/polygon/b2dlinegeometry.cxx | 26 ++++++++--------- basegfx/source/polygon/b2dpolygon.cxx | 4 +-- basegfx/source/polygon/b2dpolygonclipper.cxx | 6 ++-- basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 2 +- basegfx/source/polygon/b2dpolygontools.cxx | 34 +++++++++++------------ basegfx/source/polygon/b2dpolygontriangulator.cxx | 6 ++-- basegfx/source/polygon/b2dpolypolygoncutter.cxx | 20 ++++++------- basegfx/source/polygon/b2dpolypolygontools.cxx | 8 +++--- basegfx/source/polygon/b2dsvgpolypolygon.cxx | 10 +++---- basegfx/source/polygon/b2dtrapezoid.cxx | 2 +- basegfx/source/polygon/b3dpolygon.cxx | 8 +++--- basegfx/source/polygon/b3dpolypolygontools.cxx | 2 +- basegfx/source/range/b2drangeclipper.cxx | 6 ++-- basegfx/source/tools/stringconversiontools.cxx | 16 +++++------ basegfx/source/tools/unotools.cxx | 12 ++++---- basegfx/test/boxclipper.cxx | 2 +- 18 files changed, 84 insertions(+), 84 deletions(-) (limited to 'basegfx') diff --git a/basegfx/source/curve/b2dbeziertools.cxx b/basegfx/source/curve/b2dbeziertools.cxx index ec6ef1c63213..f115819ad02f 100644 --- a/basegfx/source/curve/b2dbeziertools.cxx +++ b/basegfx/source/curve/b2dbeziertools.cxx @@ -97,7 +97,7 @@ namespace basegfx // fDistance is in ]0.0 .. fLength[ - if(1 == mnEdgeCount) + if(mnEdgeCount == 1) { // not a bezier, linear edge return fDistance / fLength; diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index a709166263e3..c0f4c6b0cf8e 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -911,7 +911,7 @@ namespace basegfx { return false; } - else if(1 == nCount) + else if(nCount == 1) { rfResult = aAllResults[0]; return true; diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 916d5263a5d6..b6829d68d7f5 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -363,7 +363,7 @@ namespace basegfx rEdge.getStartPoint(), aPerpendStartA, rEdge.getEndPoint(), aPerpendEndA, CutFlagValue::ALL, &fCutA)); - const bool bCutA(CutFlagValue::NONE != aCutA); + const bool bCutA(aCutA != CutFlagValue::NONE); // create lower displacement vectors and check if they cut const B2DVector aPerpendStartB(aNormalizedPerpendicularA * fHalfLineWidth); @@ -373,7 +373,7 @@ namespace basegfx rEdge.getEndPoint(), aPerpendEndB, rEdge.getStartPoint(), aPerpendStartB, CutFlagValue::ALL, &fCutB)); - const bool bCutB(CutFlagValue::NONE != aCutB); + const bool bCutB(aCutB != CutFlagValue::NONE); // check if cut happens const bool bCut(bCutA || bCutB); @@ -688,7 +688,7 @@ namespace basegfx // test if for Miter, the angle is too small and the fallback // to bevel needs to be used - if(B2DLineJoin::Miter == eJoin) + if(eJoin == B2DLineJoin::Miter) { const double fAngle(fabs(rPerpendPrev.angle(rPerpendEdge))); @@ -828,14 +828,14 @@ namespace basegfx B2DPolyPolygon aRetval; const bool bIsClosed(aCandidate.isClosed()); const sal_uInt32 nEdgeCount(bIsClosed ? nPointCount : nPointCount - 1); - const bool bLineCap(!bIsClosed && css::drawing::LineCap_BUTT != eCap); + const bool bLineCap(!bIsClosed && eCap != css::drawing::LineCap_BUTT); if(nEdgeCount) { B2DCubicBezier aEdge; B2DCubicBezier aPrev; - const bool bEventuallyCreateLineJoin(B2DLineJoin::NONE != eJoin); + const bool bEventuallyCreateLineJoin(eJoin != B2DLineJoin::NONE); // prepare edge aEdge.setStartPoint(aCandidate.getB2DPoint(0)); @@ -858,13 +858,13 @@ namespace basegfx aEdge.setEndPoint(aCandidate.getB2DPoint(nNextIndex)); // check and create linejoin - if(bEventuallyCreateLineJoin && (bIsClosed || 0 != a)) + if(bEventuallyCreateLineJoin && (bIsClosed || a != 0)) { B2DVector aTangentPrev(aPrev.getTangent(1.0)); aTangentPrev.normalize(); B2DVector aTangentEdge(aEdge.getTangent(0.0)); aTangentEdge.normalize(); B2VectorOrientation aOrientation(getOrientation(aTangentPrev, aTangentEdge)); - if(B2VectorOrientation::Neutral == aOrientation) + if(aOrientation == B2VectorOrientation::Neutral) { // they are parallel or empty; if they are both not zero and point // in opposite direction, a half-circle is needed @@ -881,7 +881,7 @@ namespace basegfx } } - if(B2VectorOrientation::Positive == aOrientation) + if(aOrientation == B2VectorOrientation::Positive) { const B2DVector aPerpendPrev(getPerpendicular(aTangentPrev) * -fHalfLineWidth); const B2DVector aPerpendEdge(getPerpendicular(aTangentEdge) * -fHalfLineWidth); @@ -897,7 +897,7 @@ namespace basegfx eJoin, fMiterMinimumAngle)); } - else if(B2VectorOrientation::Negative == aOrientation) + else if(aOrientation == B2VectorOrientation::Negative) { const B2DVector aPerpendPrev(getPerpendicular(aTangentPrev) * fHalfLineWidth); const B2DVector aPerpendEdge(getPerpendicular(aTangentEdge) * fHalfLineWidth); @@ -926,10 +926,10 @@ namespace basegfx createAreaGeometryForEdge( aEdge, fHalfLineWidth, - bFirst && css::drawing::LineCap_ROUND == eCap, - bLast && css::drawing::LineCap_ROUND == eCap, - bFirst && css::drawing::LineCap_SQUARE == eCap, - bLast && css::drawing::LineCap_SQUARE == eCap)); + bFirst && eCap == css::drawing::LineCap_ROUND, + bLast && eCap == css::drawing::LineCap_ROUND, + bFirst && eCap == css::drawing::LineCap_SQUARE, + bLast && eCap == css::drawing::LineCap_SQUARE)); } else { diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 8ec8d63104bc..eb30efb838c7 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -285,7 +285,7 @@ public: bool isUsed() const { - return (0 != mnUsedVectors); + return (mnUsedVectors != 0); } const basegfx::B2DVector& getPrevVector(sal_uInt32 nIndex) const @@ -1412,7 +1412,7 @@ namespace basegfx nCount = rPoly.count(); } - if(0 == nIndex && nCount == rPoly.count()) + if(nIndex == 0 && nCount == rPoly.count()) { mpPolygon->insert(mpPolygon->count(), *rPoly.mpPolygon); } diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx index 852189d3a1f9..76b9bf7610fa 100644 --- a/basegfx/source/polygon/b2dpolygonclipper.cxx +++ b/basegfx/source/polygon/b2dpolygonclipper.cxx @@ -246,7 +246,7 @@ namespace basegfx if(aRetval.count()) { // against Y-Axis, lower value - if(1 == aRetval.count()) + if(aRetval.count() == 1) { aRetval = clipPolygonOnParallelAxis(aRetval.getB2DPolygon(0), false, bInside, rRange.getMinX(), bStroke); } @@ -258,7 +258,7 @@ namespace basegfx if(aRetval.count()) { // against X-Axis, higher value - if(1 == aRetval.count()) + if(aRetval.count() == 1) { aRetval = clipPolygonOnParallelAxis(aRetval.getB2DPolygon(0), true, !bInside, rRange.getMaxY(), bStroke); } @@ -270,7 +270,7 @@ namespace basegfx if(aRetval.count()) { // against Y-Axis, higher value - if(1 == aRetval.count()) + if(aRetval.count() == 1) { aRetval = clipPolygonOnParallelAxis(aRetval.getB2DPolygon(0), false, !bInside, rRange.getMaxX(), bStroke); } diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 22c2e9219854..74f60b17a59d 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -869,7 +869,7 @@ namespace basegfx { B2DPolyPolygon aRetval; - if(1 == nCount) + if(nCount == 1) { if(bSelfIntersections) { diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 9a2667a553a8..0b0f1712b54e 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -533,7 +533,7 @@ namespace basegfx B2DPoint aRetval; const sal_uInt32 nPointCount(rCandidate.count()); - if( 1 == nPointCount ) + if( nPointCount == 1 ) { // only one point (i.e. no edge) - simply take that point aRetval = rCandidate.getB2DPoint(0); @@ -1666,7 +1666,7 @@ namespace basegfx B2DPoint aForward(1.0, fScaledKappa); B2DPoint aBackward(1.0, -fScaledKappa); - if(0 != nStartQuadrant) + if(nStartQuadrant != 0) { const B2DHomMatrix aQuadrantMatrix(createRotateB2DHomMatrix(F_PI2 * (nStartQuadrant % 4))); aPoint *= aQuadrantMatrix; @@ -1907,7 +1907,7 @@ namespace basegfx const B2DVector aNextVec(aNextPoint - aCurrPoint); const B2VectorOrientation aOrientation(getOrientation(aNextVec, aPrevVec)); - if(B2VectorOrientation::Neutral == aOrientation) + if(aOrientation == B2VectorOrientation::Neutral) { // current has neutral orientation return true; @@ -1940,7 +1940,7 @@ namespace basegfx const B2DVector aNextVec(aNextPoint - aCurrPoint); const B2VectorOrientation aOrientation(getOrientation(aNextVec, aPrevVec)); - if(B2VectorOrientation::Neutral == aOrientation) + if(aOrientation == B2VectorOrientation::Neutral) { // current has neutral orientation, leave it out and prepare next aCurrPoint = aNextPoint; @@ -1956,7 +1956,7 @@ namespace basegfx } } - while(aRetval.count() && B2VectorOrientation::Neutral == getOrientationForIndex(aRetval, 0)) + while(aRetval.count() && getOrientationForIndex(aRetval, 0) == B2VectorOrientation::Neutral) { aRetval.remove(0); } @@ -1990,14 +1990,14 @@ namespace basegfx const B2DVector aNextVec(aNextPoint - aCurrPoint); const B2VectorOrientation aCurrentOrientation(getOrientation(aNextVec, aCurrVec)); - if(B2VectorOrientation::Neutral == aOrientation) + if(aOrientation == B2VectorOrientation::Neutral) { // set start value, maybe neutral again aOrientation = aCurrentOrientation; } else { - if(B2VectorOrientation::Neutral != aCurrentOrientation && aCurrentOrientation != aOrientation) + if(aCurrentOrientation != B2VectorOrientation::Neutral && aCurrentOrientation != aOrientation) { // different orientations found, that's it return false; @@ -2511,7 +2511,7 @@ namespace basegfx // predecessor if(!rCandidate.isPrevControlPointUsed(nIndex)) { - if(!rCandidate.isClosed() && 0 == nIndex) + if(!rCandidate.isClosed() && nIndex == 0) { // do not create previous vector for start point of open polygon } @@ -2558,7 +2558,7 @@ namespace basegfx { if(rCandidate.isPrevControlPointUsed(nIndex)) { - if(!rCandidate.isClosed() && 0 == nIndex) + if(!rCandidate.isClosed() && nIndex == 0) { // remove existing previous vector for start point of open polygon rCandidate.resetPrevControlPoint(nIndex); @@ -2603,7 +2603,7 @@ namespace basegfx aVectorNext.normalize(); const B2VectorOrientation aOrientation(getOrientation(aVectorPrev, aVectorNext)); - if(B2VectorOrientation::Neutral == aOrientation && aVectorPrev.scalar(aVectorNext) < 0.0) + if(aOrientation == B2VectorOrientation::Neutral && aVectorPrev.scalar(aVectorNext) < 0.0) { // parallel and opposite direction; check length if(fTools::equal(fLenPrev, fLenNext)) @@ -2625,7 +2625,7 @@ namespace basegfx // not parallel or same direction, set vectors and length const B2DVector aNormalizedPerpendicular(getNormalizedPerpendicular(aVectorPrev + aVectorNext)); - if(B2VectorOrientation::Positive == aOrientation) + if(aOrientation == B2VectorOrientation::Positive) { rCandidate.setControlPoints(nIndex, aCurrentPoint - (aNormalizedPerpendicular * fLenPrev), @@ -2655,7 +2655,7 @@ namespace basegfx aVectorNext.normalize(); const B2VectorOrientation aOrientation(getOrientation(aVectorPrev, aVectorNext)); - if(B2VectorOrientation::Neutral == aOrientation && aVectorPrev.scalar(aVectorNext) < 0.0) + if(aOrientation == B2VectorOrientation::Neutral && aVectorPrev.scalar(aVectorNext) < 0.0) { // parallel and opposite direction; set length. Use one direction for better numerical correctness const B2DVector aScaledDirection(aVectorPrev * fCommonLength); @@ -2670,7 +2670,7 @@ namespace basegfx const B2DVector aNormalizedPerpendicular(getNormalizedPerpendicular(aVectorPrev + aVectorNext)); const B2DVector aPerpendicular(aNormalizedPerpendicular * fCommonLength); - if(B2VectorOrientation::Positive == aOrientation) + if(aOrientation == B2VectorOrientation::Positive) { rCandidate.setControlPoints(nIndex, aCurrentPoint - aPerpendicular, @@ -3318,7 +3318,7 @@ namespace basegfx ePolygonFlag = *pFlagSequence; pPointSequence++; pFlagSequence++; b++; - if(b < nCount && css::drawing::PolygonFlags_CONTROL == ePolygonFlag) + if(b < nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL) { aControlA = aNewCoordinatePair; bControlA = true; @@ -3329,7 +3329,7 @@ namespace basegfx pPointSequence++; pFlagSequence++; b++; } - if(b < nCount && css::drawing::PolygonFlags_CONTROL == ePolygonFlag) + if(b < nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL) { aControlB = aNewCoordinatePair; bControlB = true; @@ -3452,11 +3452,11 @@ namespace basegfx { const B2VectorContinuity eCont(rPolygon.getContinuityInPoint(a)); - if(B2VectorContinuity::C1 == eCont) + if(eCont == B2VectorContinuity::C1) { aCollectFlags[nStartPointIndex] = css::drawing::PolygonFlags_SMOOTH; } - else if(B2VectorContinuity::C2 == eCont) + else if(eCont == B2VectorContinuity::C2) { aCollectFlags[nStartPointIndex] = css::drawing::PolygonFlags_SYMMETRIC; } diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx index c2df4c1c8a30..11ed7514c838 100644 --- a/basegfx/source/polygon/b2dpolygontriangulator.cxx +++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx @@ -279,7 +279,7 @@ namespace basegfx const B2DVector aLeft(pEdgeA->getEnd() - pEdgeA->getStart()); const B2DVector aRight(pEdgeB->getEnd() - pEdgeA->getStart()); - if(B2VectorOrientation::Neutral == getOrientation(aLeft, aRight)) + if(getOrientation(aLeft, aRight) == B2VectorOrientation::Neutral) { // edges are parallel and have different length -> neutral triangle, // delete both edges and handle closing edge @@ -391,7 +391,7 @@ namespace basegfx aCandidate.removeDoublePoints(); aCandidate = tools::removeNeutralPoints(aCandidate); - if(2 == aCandidate.count()) + if(aCandidate.count() == 2) { // candidate IS a triangle, just append aRetval.append(aCandidate); @@ -422,7 +422,7 @@ namespace basegfx // subdivide locally (triangulate does not work with beziers) B2DPolyPolygon aCandidate(rCandidate.areControlPointsUsed() ? tools::adaptiveSubdivideByAngle(rCandidate) : rCandidate); - if(1 == aCandidate.count()) + if(aCandidate.count() == 1) { // single polygon -> single polygon triangulation const B2DPolygon aSinglePolygon(aCandidate.getB2DPolygon(0)); diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index dade6dca9a7b..7bd7ce4a365b 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -712,7 +712,7 @@ namespace basegfx { const B2DPolygon aCandidate(rCandidate.getB2DPolygon(a)); - if(B2VectorOrientation::Neutral != tools::getOrientation(aCandidate)) + if(tools::getOrientation(aCandidate) != B2VectorOrientation::Neutral) { aRetval.append(aCandidate); } @@ -755,7 +755,7 @@ namespace basegfx pNewHelper->meOrinetation = tools::getOrientation(aCand); // initialize with own orientation - pNewHelper->mnDepth = (B2VectorOrientation::Negative == pNewHelper->meOrinetation ? -1 : 1); + pNewHelper->mnDepth = (pNewHelper->meOrinetation == B2VectorOrientation::Negative ? -1 : 1); } for(a = 0; a < nCount - 1; a++) @@ -772,7 +772,7 @@ namespace basegfx if(bAInB) { // A is inside B, add orientation of B to A - rHelperA.mnDepth += (B2VectorOrientation::Negative == rHelperB.meOrinetation ? -1 : 1); + rHelperA.mnDepth += (rHelperB.meOrinetation == B2VectorOrientation::Negative ? -1 : 1); } const bool bBInA(rHelperA.maRange.isInside(rHelperB.maRange) && tools::isInside(aCandA, aCandB, true)); @@ -780,7 +780,7 @@ namespace basegfx if(bBInA) { // B is inside A, add orientation of A to B - rHelperB.mnDepth += (B2VectorOrientation::Negative == rHelperA.meOrinetation ? -1 : 1); + rHelperB.mnDepth += (rHelperA.meOrinetation == B2VectorOrientation::Negative ? -1 : 1); } } } @@ -816,7 +816,7 @@ namespace basegfx { if(nCount == 1) { - if(!bKeepAboveZero && B2VectorOrientation::Positive == tools::getOrientation(rCandidate.getB2DPolygon(0))) + if(!bKeepAboveZero && tools::getOrientation(rCandidate.getB2DPolygon(0)) == B2VectorOrientation::Positive) { aRetval = rCandidate; } @@ -833,7 +833,7 @@ namespace basegfx StripHelper* pNewHelper = &(aHelpers[a]); pNewHelper->maRange = tools::getRange(aCandidate); pNewHelper->meOrinetation = tools::getOrientation(aCandidate); - pNewHelper->mnDepth = (B2VectorOrientation::Negative == pNewHelper->meOrinetation ? -1 : 0); + pNewHelper->mnDepth = (pNewHelper->meOrinetation == B2VectorOrientation::Negative ? -1 : 0); } for(a = 0; a < nCount - 1; a++) @@ -869,7 +869,7 @@ namespace basegfx { if(bAInB) { - if(B2VectorOrientation::Negative == rHelperB.meOrinetation) + if(rHelperB.meOrinetation == B2VectorOrientation::Negative) { rHelperA.mnDepth--; } @@ -880,7 +880,7 @@ namespace basegfx } else if(bBInA) { - if(B2VectorOrientation::Negative == rHelperA.meOrinetation) + if(rHelperA.meOrinetation == B2VectorOrientation::Negative) { rHelperB.mnDepth--; } @@ -896,7 +896,7 @@ namespace basegfx for(a = 0; a < nCount; a++) { const StripHelper& rHelper = aHelpers[a]; - bool bAcceptEntry(bKeepAboveZero ? 1 <= rHelper.mnDepth : 0 == rHelper.mnDepth); + bool bAcceptEntry(bKeepAboveZero ? 1 <= rHelper.mnDepth : rHelper.mnDepth == 0); if(bAcceptEntry) { @@ -1098,7 +1098,7 @@ namespace basegfx } // third step: get result - if(1 == aInput.size()) + if(aInput.size() == 1) { return aInput[0]; } diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index 990ec1b331b8..c2c1cb25befc 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -54,10 +54,10 @@ namespace basegfx } } - const bool bShallBeHole(1 == (nDepth & 0x00000001)); - const bool bIsHole(B2VectorOrientation::Negative == aOrientation); + const bool bShallBeHole((nDepth & 0x00000001) == 1); + const bool bIsHole(aOrientation == B2VectorOrientation::Negative); - if(bShallBeHole != bIsHole && B2VectorOrientation::Neutral != aOrientation) + if(bShallBeHole != bIsHole && aOrientation != B2VectorOrientation::Neutral) { B2DPolygon aFlipped(aCandidate); aFlipped.flip(); @@ -174,7 +174,7 @@ namespace basegfx { const sal_uInt32 nPolygonCount(rCandidate.count()); - if(1 == nPolygonCount) + if(nPolygonCount == 1) { return isInside(rCandidate.getB2DPolygon(0), rPoint, bWithBorder); } diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 71b6717e2625..7514abe6e3c8 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -62,7 +62,7 @@ namespace basegfx bool bRelative(false); const sal_Unicode aCurrChar(rSvgDStatement[nPos]); - if(o_rPolyPolygon.count() && !aCurrPoly.count() && !('m' == aCurrChar || 'M' == aCurrChar)) + if(o_rPolyPolygon.count() && !aCurrPoly.count() && !(aCurrChar == 'm' || aCurrChar == 'M')) { // we have a new sub-polygon starting, but without a 'moveto' command. // this requires to add the current point as start point to the polygon @@ -113,7 +113,7 @@ namespace basegfx case 'l' : case 'L' : { - if('m' == aCurrChar || 'l' == aCurrChar) + if(aCurrChar == 'm' || aCurrChar == 'l') { bRelative = true; } @@ -756,8 +756,8 @@ namespace basegfx // That's what is done from our import, so avoid exporting it as first statement // is necessary. const bool bSymmetricAtEdgeStart( - 0 != nIndex - && B2VectorContinuity::C2 == aPolygon.getContinuityInPoint(nIndex)); + nIndex != 0 + && aPolygon.getContinuityInPoint(nIndex) == B2VectorContinuity::C2); if(bDetectQuadraticBeziers) { @@ -849,7 +849,7 @@ namespace basegfx else { // straight edge - if(0 == nNextIndex) + if(nNextIndex == 0) { // it's a closed polygon's last edge and it's not a bezier edge, so there is // no need to write it diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index c707e61b218c..6d2dad568332 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -81,7 +81,7 @@ namespace basegfx // it is not always used sal_uInt32 getSortValue() const { - if(0 != mnSortValue) + if(mnSortValue != 0) return mnSortValue; // get radiant; has to be in the range ]0.0 .. pi[, thus scale to full diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx index acf1ec8c3458..848bd2cf0c51 100644 --- a/basegfx/source/polygon/b3dpolygon.cxx +++ b/basegfx/source/polygon/b3dpolygon.cxx @@ -288,7 +288,7 @@ public: bool isUsed() const { - return (0 != mnUsedEntries); + return (mnUsedEntries != 0); } const ::basegfx::BColor& getBColor(sal_uInt32 nIndex) const @@ -441,7 +441,7 @@ public: bool isUsed() const { - return (0 != mnUsedEntries); + return (mnUsedEntries != 0); } const ::basegfx::B3DVector& getNormal(sal_uInt32 nIndex) const @@ -604,7 +604,7 @@ public: bool isUsed() const { - return (0 != mnUsedEntries); + return (mnUsedEntries != 0); } const ::basegfx::B2DPoint& getTextureCoordinate(sal_uInt32 nIndex) const @@ -1655,7 +1655,7 @@ namespace basegfx nCount = rPoly.count(); } - if(0 == nIndex && nCount == rPoly.count()) + if(nIndex == 0 && nCount == rPoly.count()) { mpPolygon->insert(mpPolygon->count(), *rPoly.mpPolygon); } diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx index b097f1c82886..c147df888ac8 100644 --- a/basegfx/source/polygon/b3dpolypolygontools.cxx +++ b/basegfx/source/polygon/b3dpolypolygontools.cxx @@ -459,7 +459,7 @@ namespace basegfx { const sal_uInt32 nPolygonCount(rCandidate.count()); - if(1 == nPolygonCount) + if(nPolygonCount == 1) { return isInside(rCandidate.getB3DPolygon(0), rPoint, bWithBorder); } diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx index 41dfb46585a0..a8492698ba16 100644 --- a/basegfx/source/range/b2drangeclipper.cxx +++ b/basegfx/source/range/b2drangeclipper.cxx @@ -811,7 +811,7 @@ namespace basegfx rPolygonPool, rCurrEvent ); - if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() ) + if( rCurrEvent.getEdgeDirection() == SweepLineEvent::PROCEED_DOWN ) processActiveEdgesTopDown( rCurrEvent, rActiveEdgeList, rPolygonPool, rRes); else @@ -824,7 +824,7 @@ namespace basegfx VectorOfPolygons& rPolygonPool, B2DPolyPolygon& rRes) { - if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() ) + if( rCurrEvent.getEdgeDirection() == SweepLineEvent::PROCEED_DOWN ) processActiveEdgesTopDown( rCurrEvent, rActiveEdgeList, rPolygonPool, rRes); else @@ -837,7 +837,7 @@ namespace basegfx VectorOfPolygons& rPolygonPool, B2DPolyPolygon& rRes) { - if( SweepLineEvent::STARTING_EDGE == rCurrEvent.getEdgeType() ) + if( rCurrEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE ) handleStartingEdge(rCurrEvent,rActiveEdgeList,rPolygonPool,rRes); else handleFinishingEdge(rCurrEvent,rActiveEdgeList,rPolygonPool,rRes); diff --git a/basegfx/source/tools/stringconversiontools.cxx b/basegfx/source/tools/stringconversiontools.cxx index 6cae400bb3df..569d7d0c50f2 100644 --- a/basegfx/source/tools/stringconversiontools.cxx +++ b/basegfx/source/tools/stringconversiontools.cxx @@ -29,7 +29,7 @@ namespace basegfx const sal_Int32 nLen) { while( io_rPos < nLen && - ' ' == rStr[io_rPos] ) + rStr[io_rPos] == ' ' ) { ++io_rPos; } @@ -40,7 +40,7 @@ namespace basegfx const sal_Int32 nLen) { while(io_rPos < nLen - && (' ' == rStr[io_rPos] || ',' == rStr[io_rPos])) + && (rStr[io_rPos] == ' ' || rStr[io_rPos] == ',')) { ++io_rPos; } @@ -54,7 +54,7 @@ namespace basegfx OUStringBuffer sNumberString; // sign - if('+' == aChar || '-' == aChar) + if(aChar == '+' || aChar == '-') { sNumberString.append(rStr[io_rPos]); aChar = rStr[++io_rPos]; @@ -69,7 +69,7 @@ namespace basegfx } // point - if('.' == aChar) + if(aChar == '.') { sNumberString.append(rStr[io_rPos]); io_rPos++; @@ -85,14 +85,14 @@ namespace basegfx } // 'e' - if('e' == aChar || 'E' == aChar) + if(aChar == 'e' || aChar == 'E') { sNumberString.append(rStr[io_rPos]); io_rPos++; aChar = io_rPos < rStr.getLength() ? rStr[io_rPos] : 0; // sign for 'e' - if('+' == aChar || '-' == aChar) + if(aChar == '+' || aChar == '-') { sNumberString.append(rStr[io_rPos]); io_rPos++; @@ -141,12 +141,12 @@ namespace basegfx { sal_Unicode aChar( rStr[io_rPos] ); - if('0' == aChar) + if(aChar == '0') { o_nRetval = 0; ++io_rPos; } - else if ('1' == aChar) + else if (aChar == '1') { o_nRetval = 1; ++io_rPos; diff --git a/basegfx/source/tools/unotools.cxx b/basegfx/source/tools/unotools.cxx index ab4205ac71f5..6b5b47ca9459 100644 --- a/basegfx/source/tools/unotools.cxx +++ b/basegfx/source/tools/unotools.cxx @@ -70,7 +70,7 @@ namespace unotools basegfx::B2DPoint aControlB; // first point is not allowed to be a control point - if(drawing::PolygonFlags_CONTROL == ePolyFlag) + if(ePolyFlag == drawing::PolygonFlags_CONTROL) throw lang::IllegalArgumentException(); // add first point as start point @@ -86,7 +86,7 @@ namespace unotools ePolyFlag = *pArrayFlags; pArray++; pArrayFlags++; b++; - if(b < nInnerSequenceCount && drawing::PolygonFlags_CONTROL == ePolyFlag) + if(b < nInnerSequenceCount && ePolyFlag == drawing::PolygonFlags_CONTROL) { aControlA = aNewCoordinatePair; bControlA = true; @@ -97,7 +97,7 @@ namespace unotools pArray++; pArrayFlags++; b++; } - if(b < nInnerSequenceCount && drawing::PolygonFlags_CONTROL == ePolyFlag) + if(b < nInnerSequenceCount && ePolyFlag == drawing::PolygonFlags_CONTROL) { aControlB = aNewCoordinatePair; bControlB = true; @@ -110,7 +110,7 @@ namespace unotools // two or no control points are consumed, another one would be an error. // It's also an error if only one control point was read - if(drawing::PolygonFlags_CONTROL == ePolyFlag || bControlA != bControlB) + if(ePolyFlag == drawing::PolygonFlags_CONTROL || bControlA != bControlB) throw lang::IllegalArgumentException(); // the previous writes used the B2DPolyPoygon -> tools::PolyPolygon converter @@ -214,11 +214,11 @@ namespace unotools { const basegfx::B2VectorContinuity eCont(rPoly.getContinuityInPoint(b)); - if(basegfx::B2VectorContinuity::C1 == eCont) + if(eCont == basegfx::B2VectorContinuity::C1) { aFlags[nStartPointIndex] = drawing::PolygonFlags_SMOOTH; } - else if(basegfx::B2VectorContinuity::C2 == eCont) + else if(eCont == basegfx::B2VectorContinuity::C2) { aFlags[nStartPointIndex] = drawing::PolygonFlags_SYMMETRIC; } diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index ba7ed3d25624..5be8ebb1660d 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.cxx @@ -173,7 +173,7 @@ public: for( sal_uInt32 i=0; i