summaryrefslogtreecommitdiffstats
path: root/vcl/generic
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 /vcl/generic
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 'vcl/generic')
-rw-r--r--vcl/generic/print/common_gfx.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx
index e7bb64467c10..9988ea8001ee 100644
--- a/vcl/generic/print/common_gfx.cxx
+++ b/vcl/generic/print/common_gfx.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstdlib>
#include "psputil.hxx"
#include "glyphset.hxx"
@@ -194,8 +197,8 @@ PrinterGfx::JoinVerticalClipRectangles( std::list< Rectangle >::iterator& it,
)
{
if( aLastRect.GetHeight() > 1 ||
- abs( aLastRect.Left() - nextit->Left() ) > 2 ||
- abs( aLastRect.Right() - nextit->Right() ) > 2
+ std::abs( aLastRect.Left() - nextit->Left() ) > 2 ||
+ std::abs( aLastRect.Right() - nextit->Right() ) > 2
)
{
leftside.push_back( Point( aLastRect.Left(), aLastRect.Bottom()+1 ) );