diff options
author | Eike Rathke <erack@redhat.com> | 2016-10-06 17:26:44 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-10-06 20:55:28 +0000 |
commit | a5442b696697e4a24566b1f5b7e5c9bc77a9fd03 (patch) | |
tree | 989ed9b2f781fae584a03392b138e4e7dd27fae3 | |
parent | ff085ed8fd6438d855526a8a4d699960e4d3cc73 (diff) |
rtl::math::approxEqual(value,0.0) never yields true for value!=0.0
... so replace with a simple value == 0.0 also in other modules than sc.
Change-Id: Ie7316505a1cf9c15100114b45d300facceb03b7e
Reviewed-on: https://gerrit.libreoffice.org/29575
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | basegfx/source/polygon/b2dlinegeometry.cxx | 2 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygontools.cxx | 14 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolypolygontools.cxx | 4 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dsvgpolypolygon.cxx | 2 | ||||
-rw-r--r-- | basegfx/source/tools/gradienttools.cxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/main/DragMethod_PieSegment.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/axes/VCartesianAxis.cxx | 10 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/NetChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 12 | ||||
-rw-r--r-- | chart2/source/view/main/AbstractShapeFactory.cxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/framelink.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/numehelp.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 2 |
16 files changed, 35 insertions, 35 deletions
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 574c9c1b31d6..1b5b7be6da61 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -715,7 +715,7 @@ namespace basegfx double fCutPos(0.0); tools::findCut(aStartPoint, rTangentPrev, aEndPoint, rTangentEdge, CutFlagValue::ALL, &fCutPos); - if(!rtl::math::approxEqual(0.0, fCutPos)) + if(0.0 != fCutPos) { const B2DPoint aCutPoint(aStartPoint + (rTangentPrev * fCutPos)); aEdgePolygon.append(aCutPoint); diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index dac94db082ef..d47366827296 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -200,7 +200,7 @@ namespace basegfx // add curved edge and generate DistanceBound double fBound(0.0); - if(rtl::math::approxEqual(0.0, fDistanceBound)) + if(0.0 == fDistanceBound) { // If not set, use B2DCubicBezier functionality to guess a rough value const double fRoughLength((aBezier.getEdgeLength() + aBezier.getControlPolygonLength()) / 2.0); @@ -270,7 +270,7 @@ namespace basegfx aRetval.append(aBezier.getStartPoint()); // #i37443# prepare convenient AngleBound if none was given - if(rtl::math::approxEqual(0.0, fAngleBound)) + if(0.0 == fAngleBound) { #ifdef DBG_UTIL fAngleBound = fAngleBoundStartValue; @@ -2187,7 +2187,7 @@ namespace basegfx // tdf#88352 increase numerical correctness and use rtl::math::approxEqual // instead of fTools::equalZero which compares with a fixed small value - if(rtl::math::approxEqual(fCrossA, 0.0)) + if(fCrossA == 0.0) { // one point on the line return bWithLine; @@ -2197,7 +2197,7 @@ namespace basegfx const double fCrossB(aLineVector.cross(aVectorToB)); // increase numerical correctness - if(rtl::math::approxEqual(fCrossB, 0.0)) + if(fCrossB == 0.0) { // one point on the line return bWithLine; @@ -2234,7 +2234,7 @@ namespace basegfx /// return 0 for input of 0, -1 for negative and 1 for positive input inline int lcl_sgn( const double n ) { - return rtl::math::approxEqual(n, 0.0) ? 0 : 1 - 2*int(rtl::math::isSignBitSet(n)); + return n == 0.0 ? 0 : 1 - 2*int(rtl::math::isSignBitSet(n)); } } @@ -2530,7 +2530,7 @@ namespace basegfx { const sal_uInt32 nPointCount(rCandidate.count()); - if(nPointCount && !rtl::math::approxEqual(0.0, rOriginal.getWidth()) && !rtl::math::approxEqual(0.0, rOriginal.getHeight())) + if(nPointCount && 0.0 != rOriginal.getWidth() && 0.0 != rOriginal.getHeight()) { B2DPolygon aRetval; @@ -2769,7 +2769,7 @@ namespace basegfx B2DPolygon growInNormalDirection(const B2DPolygon& rCandidate, double fValue) { - if(!rtl::math::approxEqual(0.0, fValue)) + if(0.0 != fValue) { if(rCandidate.areControlPointsUsed()) { diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index 5afd298d3fa5..0c50e527458c 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -233,7 +233,7 @@ namespace basegfx void applyLineDashing(const B2DPolyPolygon& rCandidate, const ::std::vector<double>& rDotDashArray, B2DPolyPolygon* pLineTarget, B2DPolyPolygon* pGapTarget, double fFullDashDotLen) { - if(rtl::math::approxEqual(0.0, fFullDashDotLen) && rDotDashArray.size()) + if(0.0 == fFullDashDotLen && rDotDashArray.size()) { // calculate fFullDashDotLen from rDotDashArray fFullDashDotLen = ::std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0); @@ -378,7 +378,7 @@ namespace basegfx B2DPolyPolygon growInNormalDirection(const B2DPolyPolygon& rCandidate, double fValue) { - if(!rtl::math::approxEqual(0.0, fValue)) + if(0.0 != fValue) { B2DPolyPolygon aRetval; diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 812cd02a8ada..7504edc9825c 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -473,7 +473,7 @@ namespace basegfx if( rtl::math::approxEqual(nX, nLastX) && rtl::math::approxEqual(nY, nLastY) ) continue; // start==end -> skip according to SVG spec - if( rtl::math::approxEqual(fRX, 0.0) || rtl::math::approxEqual(fRY, 0.0) ) + if( fRX == 0.0 || fRY == 0.0 ) { // straight line segment according to SVG spec aCurrPoly.append(B2DPoint(nX, nY)); diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index e8f2f3091d4f..119c900c767a 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -176,7 +176,7 @@ namespace basegfx aTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); // prepare aspect for texture - const double fAspectRatio(rtl::math::approxEqual(0.0, fTargetSizeY) ? 1.0 : (fTargetSizeX / fTargetSizeY)); + const double fAspectRatio(0.0 == fTargetSizeY ? 1.0 : (fTargetSizeX / fTargetSizeY)); return ODFGradientInfo(aTextureTransform, fAspectRatio, nSteps); } @@ -253,7 +253,7 @@ namespace basegfx aTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); // prepare aspect for texture - const double fAspectRatio(rtl::math::approxEqual(0.0, fTargetSizeY) ? 1.0 : (fTargetSizeX / fTargetSizeY)); + const double fAspectRatio(0.0 == fTargetSizeY ? 1.0 : (fTargetSizeX / fTargetSizeY)); return ODFGradientInfo(aTextureTransform, fAspectRatio, nSteps); } diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx index 3e175ec7056c..d2eaa2b5cebf 100644 --- a/chart2/source/controller/main/DragMethod_PieSegment.cxx +++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx @@ -63,7 +63,7 @@ DragMethod_PieSegment::DragMethod_PieSegment( DrawViewWrapper& rDrawViewWrapper B2DVector aMaxVector( aMaximumPosition.X, aMaximumPosition.Y ); m_aDragDirection = aMaxVector - aMinVector; m_fDragRange = m_aDragDirection.scalar( m_aDragDirection ); - if( ::rtl::math::approxEqual( m_fDragRange, 0.0 ) ) + if( m_fDragRange == 0.0 ) m_fDragRange = 1.0; } DragMethod_PieSegment::~DragMethod_PieSegment() diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index ce0eca35b9c0..ac19d718f1f9 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -167,7 +167,7 @@ void DiagramHelper::setVertical( double fAngleDegree = 0.0; xTitleProps->getPropertyValue("TextRotation") >>= fAngleDegree; - if (!rtl::math::approxEqual(fAngleDegree, 0.0) && + if (fAngleDegree != 0.0 && !rtl::math::approxEqual(fAngleDegree, 90.0)) continue; diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index f58afb729ff0..daccb00c1411 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -492,7 +492,7 @@ bool VCartesianAxis::isBreakOfLabelsAllowed( //no break for value axis if( !m_bUseTextLabels ) return false; - if( !::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 ) ) + if( rAxisLabelProperties.fRotationAngleDegree != 0.0 ) return false; //break only for horizontal axis return bIsHorizontalAxis; @@ -507,7 +507,7 @@ bool canAutoAdjustLabelPlacement( return false; if( rAxisLabelProperties.bLineBreakAllowed ) // auto line break may conflict with... return false; - if( !::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 ) ) + if( rAxisLabelProperties.fRotationAngleDegree != 0.0 ) return false; // automatic adjusting labels only works for // horizontal axis with horizontal text @@ -813,7 +813,7 @@ bool VCartesianAxis::createTextShapes( recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree ); if( nLimitedSpaceForText>0 && !rAxisLabelProperties.bOverlapAllowed - && ::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 ) + && rAxisLabelProperties.fRotationAngleDegree == 0.0 && m_aAxisProperties.m_bComplexCategories && lcl_hasWordBreak( pTickInfo->xTextShape ) ) { @@ -1340,7 +1340,7 @@ void VCartesianAxis::get2DAxisMainLine( ScreenPosAndLogicPos aNotSoGoodPos( aPosList[1] ); //choose most bottom positions - if( !::rtl::math::approxEqual( fDeltaX, 0.0 ) ) // prefer left-right alignments + if( fDeltaX != 0.0 ) // prefer left-right alignments { if( aBestPos.aScreenPos.getX() > aNotSoGoodPos.aScreenPos.getX() ) rAlignment.meAlignment = LABEL_ALIGN_RIGHT; @@ -1596,7 +1596,7 @@ void VCartesianAxis::createLabels() if( m_aAxisProperties.m_bComplexCategories ) { aComplexProps.bLineBreakAllowed = true; - aComplexProps.bOverlapAllowed = !::rtl::math::approxEqual( aComplexProps.fRotationAngleDegree, 0.0 ); + aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0; } AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties; diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 8933429d04f0..6ee585c4581e 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -766,7 +766,7 @@ void AreaChart::createShapes() fLogicY = fabs( fLogicY ); std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex]; - if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( rLogicYSumMap[nAttachedAxisIndex], 0.0 ) ) + if( pPosHelper->isPercentY() && rLogicYSumMap[nAttachedAxisIndex] != 0.0 ) { fLogicY = fabs( fLogicY )/rLogicYSumMap[nAttachedAxisIndex]; } diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index a9e9dabfc111..af4f65227d17 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -255,7 +255,7 @@ void BubbleChart::createShapes() if( !m_bShowNegativeValues && fBubbleSize<0.0 ) continue; - if( ::rtl::math::approxEqual( fBubbleSize, 0.0 ) || ::rtl::math::isNan(fBubbleSize) ) + if( fBubbleSize == 0.0 || ::rtl::math::isNan(fBubbleSize) ) continue; if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX) diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx index b69a4750a467..e62036a048c0 100644 --- a/chart2/source/view/charttypes/NetChart.cxx +++ b/chart2/source/view/charttypes/NetChart.cxx @@ -475,7 +475,7 @@ void NetChart::createShapes() } } - if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( aLogicYSumMap[nAttachedAxisIndex], 0.0 ) ) + if( pPosHelper->isPercentY() && aLogicYSumMap[nAttachedAxisIndex] != 0.0 ) { fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex]; } diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index d2df00070f7d..d91e5a10d3fd 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -230,7 +230,7 @@ uno::Reference< drawing::XShape > PieChart::createDataPoint( { //transform position: drawing::Direction3D aOffset; - if (!::rtl::math::approxEqual(rParam.mfExplodePercentage, 0.0)) + if (rParam.mfExplodePercentage != 0.0) { double fAngle = rParam.mfUnitCircleStartAngleDegree + rParam.mfUnitCircleWidthAngleDegree/2.0; double fRadius = (rParam.mfUnitCircleOuterRadius-rParam.mfUnitCircleInnerRadius)*rParam.mfExplodePercentage; @@ -272,7 +272,7 @@ void PieChart::createTextLabelShape( ///to both normalized radii. (See notes for ///`PolarPlottingPositionHelper::transformToRadius`, especially example 3, ///and related comments). - if (!rtl::math::approxEqual(rParam.mfExplodePercentage, 0.0)) + if (rParam.mfExplodePercentage != 0.0) { double fExplodeOffset = (rParam.mfUnitCircleOuterRadius-rParam.mfUnitCircleInnerRadius)*rParam.mfExplodePercentage; rParam.mfUnitCircleInnerRadius += fExplodeOffset; @@ -1123,7 +1123,7 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi return; double fPageDiagonaleLength = sqrt( double( rPageSize.Width*rPageSize.Width + rPageSize.Height*rPageSize.Height) ); - if( ::rtl::math::approxEqual( fPageDiagonaleLength, 0.0 ) ) + if( fPageDiagonaleLength == 0.0 ) return; ///initialize next and previous member of `PieLabelInfo` objects @@ -1325,7 +1325,7 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab " old anchor point = " << rPieLabelInfo.aFirstPosition ); - if( ::rtl::math::approxEqual( fPieRadius, 0.0 ) ) + if( fPieRadius == 0.0 ) return false; // get label b.b. width and height @@ -1417,7 +1417,7 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab // note that in the former case 0 <= f(alpha, beta) <= 180, // whilst in the latter case 180 <= f(alpha, beta) <= 360; double fAlphaMod90 = fmod( fAlphaDeg + 45, 90.0 ) - 45; - double fSign = ::rtl::math::approxEqual( fAlphaMod90, 0.0 ) + double fSign = fAlphaMod90 == 0.0 ? 0.0 : ( fAlphaMod90 < 0 ) ? -1.0 : 1.0; double fThetaRad = fSign * fAlphaRad + M_PI_2 * (1 - fSign * nNearestEdgeIndex) + fBetaRad; @@ -1430,7 +1430,7 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab // that is the distance between C and P double fDistanceCP; // when the bisector ray intersects the b.b. in F we have theta mod 180 == 0 - if( ::rtl::math::approxEqual( fmod(fThetaRad, M_PI), 0.0 )) + if( fmod(fThetaRad, M_PI) == 0.0 ) { fDistanceCP = fPieRadius - fDistancePF; } diff --git a/chart2/source/view/main/AbstractShapeFactory.cxx b/chart2/source/view/main/AbstractShapeFactory.cxx index 752ff10185dd..56953a9cfcbf 100644 --- a/chart2/source/view/main/AbstractShapeFactory.cxx +++ b/chart2/source/view/main/AbstractShapeFactory.cxx @@ -306,7 +306,7 @@ awt::Size AbstractShapeFactory::getSizeAfterRotation( { const awt::Size aSize( xShape->getSize() ); - if( ::rtl::math::approxEqual( fRotationAngleDegree, 0.0 ) ) + if( fRotationAngleDegree == 0.0 ) aRet = aSize; else { diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index 05d3a4c44860..6bdc0930f0ab 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -1218,7 +1218,7 @@ void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWid // Still too thick? Decrease the line widths. if( GetWidth() > nMaxWidth ) { - if (!rtl::math::approxEqual(mfPrim, 0.0) && rtl::math::approxEqual(mfPrim, mfSecn)) + if (mfPrim != 0.0 && rtl::math::approxEqual(mfPrim, mfSecn)) { // Both lines equal - decrease both to keep symmetry. --mfPrim; @@ -1229,7 +1229,7 @@ void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWid // Decrease each line for itself if (mfPrim) --mfPrim; - if ((GetWidth() > nMaxWidth) && !rtl::math::approxEqual(mfSecn, 0.0)) + if ((GetWidth() > nMaxWidth) && mfSecn != 0.0) --mfSecn; } } diff --git a/xmloff/source/style/numehelp.cxx b/xmloff/source/style/numehelp.cxx index 84288edf105c..9c437ce6f47e 100644 --- a/xmloff/source/style/numehelp.cxx +++ b/xmloff/source/style/numehelp.cxx @@ -185,7 +185,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes(SvXMLExport& rXMLExp } else { - if (::rtl::math::approxEqual( rValue, 0.0 )) + if (rValue == 0.0) { rXMLExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_FALSE); } @@ -454,7 +454,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( } else { - if (::rtl::math::approxEqual( rValue, 0.0 )) + if (rValue == 0.0) { pExport->AddAttribute(sAttrBooleanValue, XML_FALSE); } diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 291b8d21013f..26cea156ca73 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -2616,7 +2616,7 @@ void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName, if (bIsDuration) { // date/time duration handle bOmitDurationIfZero - if (!bOmitDurationIfZero || !::rtl::math::approxEqual(dValue, 0.0)) + if (!bOmitDurationIfZero || dValue != 0.0) { ::sax::Converter::convertDuration(aBuffer, dValue); } |