From b2371492dfd5c8003f89ed8acf3dbc690d6af8d0 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 3 Mar 2014 18:27:00 +0100 Subject: Use cstdlib std::abs instead of stdlib.h abs ...because the latter lacks the abs(long) overload in some popular environments, cf. "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 --- extensions/source/propctrlr/standardcontrol.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'extensions/source/propctrlr/standardcontrol.cxx') diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 7d7d38a2d97e..b12261eb560d 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -46,7 +46,7 @@ #include #include - +#include #include #include #include @@ -392,8 +392,8 @@ namespace pcr void HyperlinkInput::impl_checkEndClick( const ::MouseEvent rMEvt ) { const MouseSettings& rMouseSettings( GetSettings().GetMouseSettings() ); - if ( ( abs( rMEvt.GetPosPixel().X() - m_aMouseButtonDownPos.X() ) < rMouseSettings.GetStartDragWidth() ) - && ( abs( rMEvt.GetPosPixel().Y() - m_aMouseButtonDownPos.Y() ) < rMouseSettings.GetStartDragHeight() ) + if ( ( std::abs( rMEvt.GetPosPixel().X() - m_aMouseButtonDownPos.X() ) < rMouseSettings.GetStartDragWidth() ) + && ( std::abs( rMEvt.GetPosPixel().Y() - m_aMouseButtonDownPos.Y() ) < rMouseSettings.GetStartDragHeight() ) ) Application::PostUserEvent( m_aClickHandler ); } -- cgit