diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-11-16 16:07:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-11-16 21:43:09 +0100 |
commit | 50d3ad9127aaf63afcfa299adcea060c9b09faa4 (patch) | |
tree | af3bf48ae8e31e180003c9f998831dd7777d1f5b /svx | |
parent | cd4a239063a77d49fe178255c20f0558e337a82f (diff) |
Instead of labs, use overloaded abs
...more likely to pick an appropriate version for the involved integer types,
esp. after the recent long -> tools::Long changes
Change-Id: Ia91259ca35aaf74b0e907de6831fc926f30057f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105949
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/qa/unit/customshapes.cxx | 8 | ||||
-rw-r--r-- | svx/source/accessibility/AccessibleTextHelper.cxx | 7 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 5 | ||||
-rw-r--r-- | svx/source/engine3d/scene3d.cxx | 7 |
4 files changed, 17 insertions, 10 deletions
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 3007806c61af..737ab5bdf6d0 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <cstdlib> + #include <test/bootstrapfixture.hxx> #include <unotest/macros_test.hxx> #include <rtl/ustring.hxx> @@ -104,7 +108,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testViewBoxLeftTop) awt::Rectangle aBoundRectLR; xShapeLRProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRectLR; // difference should be zero, but allow some rounding errors - CPPUNIT_ASSERT_LESS(3L, labs(aFrameRectLR.X - aBoundRectLR.X)); + CPPUNIT_ASSERT_LESS(sal_Int32(3), std::abs(aFrameRectLR.X - aBoundRectLR.X)); // Get the shape "topbottom". Error was, that the identifier "top" was always set to zero, thus // the path was outside the frame rectangle for a viewBox having a positive "top" value. @@ -116,7 +120,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testViewBoxLeftTop) awt::Rectangle aBoundRectTB; xShapeTBProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRectTB; // difference should be zero, but allow some rounding errors - CPPUNIT_ASSERT_LESS(3L, labs(aFrameRectTB.Y - aBoundRectTB.Y)); + CPPUNIT_ASSERT_LESS(sal_Int32(3), std::abs(aFrameRectTB.Y - aBoundRectTB.Y)); } CPPUNIT_TEST_FIXTURE(CustomshapesTest, testAccuracyCommandX) diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 625a9034831b..f11ce49b3beb 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -17,10 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> -// Global header - - +#include <cstdlib> #include <memory> #include <utility> #include <algorithm> @@ -1043,7 +1042,7 @@ namespace accessibility // repeat that later on, e.g. for PARA_MOVED events) bool bEverythingUpdated( false ); - if( labs( nNewParas - nCurrParas ) == 1 && + if( std::abs( nNewParas - nCurrParas ) == 1 && aFunctor.GetNumberOfParasChanged() == 1 ) { // #103483# Exactly one paragraph added/removed. This is diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 8ef5a6ebec4f..a509520ba08c 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -58,6 +58,7 @@ #include <sal/log.hxx> #include <algorithm> +#include <cstdlib> #include <math.h> #include <unordered_set> @@ -552,8 +553,8 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt { nCoordLeft = aViewBox.X; nCoordTop = aViewBox.Y; - nCoordWidthG = labs( aViewBox.Width ); - nCoordHeightG = labs( aViewBox.Height); + nCoordWidthG = std::abs( aViewBox.Width ); + nCoordHeightG = std::abs( aViewBox.Height); } const OUString sPath( "Path" ); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index abd592d6ce01..5c9989320695 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> #include <svx/strings.hrc> #include <svx/dialmgr.hxx> @@ -529,9 +532,9 @@ void E3dScene::RotateScene (const Point& rRef, double sn, double cs) UpperLeft = aOutRect.TopLeft(); LowerRight = aOutRect.BottomRight(); - tools::Long dxOutRectHalf = labs(UpperLeft.X() - LowerRight.X()); + tools::Long dxOutRectHalf = std::abs(UpperLeft.X() - LowerRight.X()); dxOutRectHalf /= 2; - tools::Long dyOutRectHalf = labs(UpperLeft.Y() - LowerRight.Y()); + tools::Long dyOutRectHalf = std::abs(UpperLeft.Y() - LowerRight.Y()); dyOutRectHalf /= 2; // Only the center is moved. The corners are moved by NbcMove. For the |