summaryrefslogtreecommitdiffstats
path: root/reportdesign
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-03 18:27:00 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-03 18:36:55 +0100
commitb2371492dfd5c8003f89ed8acf3dbc690d6af8d0 (patch)
tree876a32c415fa06d41a51a2a4a9cc16b1e97bdf76 /reportdesign
parentinstall:module <value>s must be mutually exclusive (diff)
downloadcore-b2371492dfd5c8003f89ed8acf3dbc690d6af8d0.tar.gz
core-b2371492dfd5c8003f89ed8acf3dbc690d6af8d0.zip
Use cstdlib std::abs instead of stdlib.h abs
...because the latter lacks the abs(long) overload in some popular environments, cf. <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60401> "stdlib.h does not provide abs(long) overload." Similarly, stdlib.h lacks the abs(float), abs(double), abs(long double) overloads compared to cmath there, whose use was apparently intended in sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx. Rewrote that to use CPPUNIT_ASSERT_DOUBLES_EQUAL instead, which revealed that the comparisons need rather large deltas of .1 resp. .2 (which the original code hid with an implicit conversion to integral type, thus using an effective delta of 1). Discovered with -Wabsolute-value ("absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value") recently introduced on Clang trunk towards 3.5. Change-Id: I4c41575ffdccb2944498b662bd3a53fd510cb0c0
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/ui/inc/ViewsWindow.hxx4
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx5
2 files changed, 5 insertions, 4 deletions
diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx
index b62c0f042cd1..c63728a42aa5 100644
--- a/reportdesign/source/ui/inc/ViewsWindow.hxx
+++ b/reportdesign/source/ui/inc/ViewsWindow.hxx
@@ -65,9 +65,9 @@ namespace rptui
case POS_DOWN:
return lhs.Bottom() >= rhs.Bottom();
case POS_CENTER_HORIZONTAL:
- return abs(m_aRefPoint.X() - lhs.Center().X()) < abs(m_aRefPoint.X() - rhs.Center().X());
+ return std::abs(m_aRefPoint.X() - lhs.Center().X()) < std::abs(m_aRefPoint.X() - rhs.Center().X());
case POS_CENTER_VERTICAL:
- return abs(lhs.Center().Y() - m_aRefPoint.Y()) < abs(rhs.Center().Y() - m_aRefPoint.Y());
+ return std::abs(lhs.Center().Y() - m_aRefPoint.Y()) < std::abs(rhs.Center().Y() - m_aRefPoint.Y());
}
return false;
}
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 161726bd4f34..9ca6852ab092 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -47,6 +47,7 @@
#include <svx/svdundo.hxx>
#include <toolkit/helper/convert.hxx>
#include <algorithm>
+#include <cstdlib>
#include <numeric>
#include <o3tl/compat_functional.hxx>
@@ -1096,8 +1097,8 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi
aNewObjPos.Y() += nSectionHeight;
}
- const sal_Int32 nDeltaX = abs(aLeftTop.X() - aAbsolutePnt.X());
- const sal_Int32 nDeltaY = abs(aLeftTop.Y() - aAbsolutePnt.Y());
+ const sal_Int32 nDeltaX = std::abs(aLeftTop.X() - aAbsolutePnt.X());
+ const sal_Int32 nDeltaY = std::abs(aLeftTop.Y() - aAbsolutePnt.Y());
m_aDragDelta.X() = nDeltaX;
m_aDragDelta.Y() = nDeltaY;