summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:29:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:29:32 +0100
commita82b177f981f14582d88e819ce8c167f9db0c213 (patch)
treea655f381b94fce2f00bd43ddeb18d57750e099b5 /basegfx
parent6070aaa47d6cede11f8cc0b54ed726fc45cb4a74 (diff)
More loplugin:cstylecast: basegfx
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ifa4a6643b41525c962cd6af5776e1bf10bddb71c
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/curve/b2dbeziertools.cxx2
-rw-r--r--basegfx/source/curve/b2dcubicbezier.cxx4
-rw-r--r--basegfx/source/inc/hommatrixtemplate.hxx2
-rw-r--r--basegfx/source/polygon/b2dpolygoncutandtouch.cxx4
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx18
-rw-r--r--basegfx/source/polygon/b2dpolypolygoncutter.cxx4
-rw-r--r--basegfx/source/polygon/b2dpolypolygontools.cxx8
-rw-r--r--basegfx/source/polygon/b3dpolypolygontools.cxx12
8 files changed, 27 insertions, 27 deletions
diff --git a/basegfx/source/curve/b2dbeziertools.cxx b/basegfx/source/curve/b2dbeziertools.cxx
index f115819ad02f..c24ba4215a2e 100644
--- a/basegfx/source/curve/b2dbeziertools.cxx
+++ b/basegfx/source/curve/b2dbeziertools.cxx
@@ -52,7 +52,7 @@ namespace basegfx
for(sal_uInt32 a(1);;)
{
- const B2DPoint aNext(rBase.interpolatePoint((double)a / (double)mnEdgeCount));
+ const B2DPoint aNext(rBase.interpolatePoint(static_cast<double>(a) / static_cast<double>(mnEdgeCount)));
const B2DVector aEdge(aNext - aCurrent);
fLength += aEdge.getLength();
diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx
index 3f4a100ae2e1..d8f03de46c33 100644
--- a/basegfx/source/curve/b2dcubicbezier.cxx
+++ b/basegfx/source/curve/b2dcubicbezier.cxx
@@ -691,8 +691,8 @@ namespace basegfx
}
// look right and left for even smaller distances
- double fStepValue(1.0 / (double)((nPointCount - 1) * 2)); // half the edge step width
- double fPosition((double)nSmallestIndex / (double)(nPointCount - 1));
+ double fStepValue(1.0 / static_cast<double>((nPointCount - 1) * 2)); // half the edge step width
+ double fPosition(static_cast<double>(nSmallestIndex) / static_cast<double>(nPointCount - 1));
while(true)
{
diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx
index b30ca3b1ba3b..4e00fdf2119c 100644
--- a/basegfx/source/inc/hommatrixtemplate.hxx
+++ b/basegfx/source/inc/hommatrixtemplate.hxx
@@ -423,7 +423,7 @@ namespace basegfx
if(aWork.ludcmp(nIndex, nParity))
{
- fRetval = (double)nParity;
+ fRetval = static_cast<double>(nParity);
// last line needs no multiply if not existing; default value would be 1.
const sal_uInt16 nMaxLine(
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index ea5efa39af39..d99b246b8ad6 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -187,8 +187,8 @@ namespace basegfx
for(sal_uInt32 a(0); a < nTempPointCount; a++)
{
const temporaryPoint& rTempPoint = rPointVector[a];
- const double fCutPosInPolygon((double)rTempPoint.getIndex() + rTempPoint.getCut());
- const double fRelativeCutPos(fCutPosInPolygon / (double)nEdgeCount);
+ const double fCutPosInPolygon(static_cast<double>(rTempPoint.getIndex()) + rTempPoint.getCut());
+ const double fRelativeCutPos(fCutPosInPolygon / static_cast<double>(nEdgeCount));
rTempPoints.emplace_back(rTempPoint.getPoint(), nInd, fRelativeCutPos);
}
}
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index e0a4721505ba..c4499f7d352b 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -573,7 +573,7 @@ namespace basegfx
{
// if fDistance >= fLength decrement with multiple of fLength
sal_uInt32 nCount(sal_uInt32(fDistance / fLength));
- fDistance -= (double)nCount * fLength;
+ fDistance -= static_cast<double>(nCount) * fLength;
}
else
{
@@ -884,7 +884,7 @@ namespace basegfx
CutFlagValue aRetval(CutFlagValue::NONE);
double fCut1(0.0);
double fCut2(0.0);
- bool bFinished(!((bool)(aCutFlags & CutFlagValue::ALL)));
+ bool bFinished(!static_cast<bool>(aCutFlags & CutFlagValue::ALL));
// test for same points?
if(!bFinished
@@ -2765,7 +2765,7 @@ namespace basegfx
for(sal_uInt32 a(0); a < nLoopCount; a++)
{
- const double fRelativePos((double)a / (double)nSegments); // 0.0 .. 1.0
+ const double fRelativePos(static_cast<double>(a) / static_cast<double>(nSegments)); // 0.0 .. 1.0
const B2DPoint aNewPoint(getPositionRelative(rCandidate, fRelativePos, fLength));
aRetval.append(aNewPoint);
}
@@ -3285,8 +3285,8 @@ namespace basegfx
const css::drawing::FlagSequence& rFlagSequenceSource,
bool bCheckClosed)
{
- const sal_uInt32 nCount((sal_uInt32)rPointSequenceSource.getLength());
- OSL_ENSURE(nCount == (sal_uInt32)rFlagSequenceSource.getLength(),
+ const sal_uInt32 nCount(static_cast<sal_uInt32>(rPointSequenceSource.getLength()));
+ OSL_ENSURE(nCount == static_cast<sal_uInt32>(rFlagSequenceSource.getLength()),
"UnoPolygonBezierCoordsToB2DPolygon: Unequal count of Points and Flags (!)");
// prepare new polygon
@@ -3483,8 +3483,8 @@ namespace basegfx
const sal_uInt32 nTargetCount(aCollectPoints.size());
OSL_ENSURE(nTargetCount == aCollectFlags.size(), "Unequal Point and Flag count (!)");
- rPointSequenceRetval.realloc((sal_Int32)nTargetCount);
- rFlagSequenceRetval.realloc((sal_Int32)nTargetCount);
+ rPointSequenceRetval.realloc(static_cast<sal_Int32>(nTargetCount));
+ rFlagSequenceRetval.realloc(static_cast<sal_Int32>(nTargetCount));
css::awt::Point* pPointSequence = rPointSequenceRetval.getArray();
css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceRetval.getArray();
@@ -3502,8 +3502,8 @@ namespace basegfx
// straightforward point list creation
const sal_uInt32 nTargetCount(nPointCount + (bClosed ? 1 : 0));
- rPointSequenceRetval.realloc((sal_Int32)nTargetCount);
- rFlagSequenceRetval.realloc((sal_Int32)nTargetCount);
+ rPointSequenceRetval.realloc(static_cast<sal_Int32>(nTargetCount));
+ rFlagSequenceRetval.realloc(static_cast<sal_Int32>(nTargetCount));
css::awt::Point* pPointSequence = rPointSequenceRetval.getArray();
css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceRetval.getArray();
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index b24f7a37e0a4..4fd7bf369d85 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -861,8 +861,8 @@ namespace basegfx
else
{
// poly and hole. They neutralize, so get rid of both. Move securely below zero.
- rHelperA.mnDepth = -((sal_Int32)nCount);
- rHelperB.mnDepth = -((sal_Int32)nCount);
+ rHelperA.mnDepth = - static_cast<sal_Int32>(nCount);
+ rHelperB.mnDepth = - static_cast<sal_Int32>(nCount);
}
}
else
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index 644e08bb6358..e32101ffc02c 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -637,11 +637,11 @@ namespace basegfx
const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource)
{
B2DPolyPolygon aRetval;
- const sal_uInt32 nSequenceCount((sal_uInt32)rPolyPolygonBezierCoordsSource.Coordinates.getLength());
+ const sal_uInt32 nSequenceCount(static_cast<sal_uInt32>(rPolyPolygonBezierCoordsSource.Coordinates.getLength()));
if(nSequenceCount)
{
- OSL_ENSURE(nSequenceCount == (sal_uInt32)rPolyPolygonBezierCoordsSource.Flags.getLength(),
+ OSL_ENSURE(nSequenceCount == static_cast<sal_uInt32>(rPolyPolygonBezierCoordsSource.Flags.getLength()),
"UnoPolyPolygonBezierCoordsToB2DPolyPolygon: unequal number of Points and Flags (!)");
const css::drawing::PointSequence* pPointSequence = rPolyPolygonBezierCoordsSource.Coordinates.getConstArray();
const css::drawing::FlagSequence* pFlagSequence = rPolyPolygonBezierCoordsSource.Flags.getConstArray();
@@ -671,8 +671,8 @@ namespace basegfx
if(nCount)
{
// prepare return value memory
- rPolyPolygonBezierCoordsRetval.Coordinates.realloc((sal_Int32)nCount);
- rPolyPolygonBezierCoordsRetval.Flags.realloc((sal_Int32)nCount);
+ rPolyPolygonBezierCoordsRetval.Coordinates.realloc(static_cast<sal_Int32>(nCount));
+ rPolyPolygonBezierCoordsRetval.Flags.realloc(static_cast<sal_Int32>(nCount));
// get pointers to arrays
css::drawing::PointSequence* pPointSequence = rPolyPolygonBezierCoordsRetval.Coordinates.getArray();
diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx
index 9c79bc14bc1f..0130dd5d7081 100644
--- a/basegfx/source/polygon/b3dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolypolygontools.cxx
@@ -254,8 +254,8 @@ namespace basegfx
nVerSeg = std::min(nMaxSegments, std::max(nMinSegments, nVerSeg));
// create constants
- const double fVerDiffPerStep((fVerStop - fVerStart) / (double)nVerSeg);
- const double fHorDiffPerStep((fHorStop - fHorStart) / (double)nHorSeg);
+ const double fVerDiffPerStep((fVerStop - fVerStart) / static_cast<double>(nVerSeg));
+ const double fHorDiffPerStep((fHorStop - fHorStart) / static_cast<double>(nHorSeg));
bool bHorClosed(fTools::equal(fHorStop - fHorStart, F_2PI));
bool bVerFromTop(fTools::equal(fVerStart, F_PI2));
bool bVerToBottom(fTools::equal(fVerStop, -F_PI2));
@@ -267,12 +267,12 @@ namespace basegfx
for(a = nLoopVerInit; a < nLoopVerLimit; a++)
{
- const double fVer(fVerStart + ((double)a * fVerDiffPerStep));
+ const double fVer(fVerStart + (static_cast<double>(a) * fVerDiffPerStep));
B3DPolygon aNew;
for(b = 0; b < nLoopHorLimit; b++)
{
- const double fHor(fHorStart + ((double)b * fHorDiffPerStep));
+ const double fHor(fHorStart + (static_cast<double>(b) * fHorDiffPerStep));
aNew.append(getPointFromCartesian(fHor, fVer));
}
@@ -283,7 +283,7 @@ namespace basegfx
// create vertical half-rings
for(a = 0; a < nLoopHorLimit; a++)
{
- const double fHor(fHorStart + ((double)a * fHorDiffPerStep));
+ const double fHor(fHorStart + (static_cast<double>(a) * fHorDiffPerStep));
B3DPolygon aNew;
if(bVerFromTop)
@@ -293,7 +293,7 @@ namespace basegfx
for(b = nLoopVerInit; b < nLoopVerLimit; b++)
{
- const double fVer(fVerStart + ((double)b * fVerDiffPerStep));
+ const double fVer(fVerStart + (static_cast<double>(b) * fVerDiffPerStep));
aNew.append(getPointFromCartesian(fHor, fVer));
}