summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-10-16 14:39:29 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-10-16 14:39:29 +0200
commitcb19a1ab5b8e6f1a4fdd90e50d13c106512b4da0 (patch)
treea8e7b64ecff6ce10ef95f857e236c3ab8a7832be /tools
parent11c61b05d1acb44fd6a6fa6a1825f5d4c99c3b20 (diff)
-Werror,-Wtautological-constant-compare (Clang 6)
...making Fraction::HasOverflowValue() always return false on all platforms, regardless of size of long, since 331e2e5ed3bf4e0b2c1fab3b7bca836170317827 "long->sal_Int32 in Fraction" changed Fraction::Impl::value from boost::rational<sal_Int64> to boost::rational<sal_Int32>, and changed the limits to compare with in Fraction::HasOverflowValue from long to sal_Int32. Change-Id: I226ca240d6092ac803a1f65a363b1384903da17a
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/fract.cxx31
1 files changed, 1 insertions, 30 deletions
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index 1a78d4dfc654..d50cffc990aa 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -112,8 +112,6 @@ Fraction::Fraction( double dVal ) : mpImpl(new Impl)
try
{
mpImpl->value = rational_FromDouble( dVal );
- if ( HasOverflowValue() )
- throw boost::bad_rational();
mpImpl->valid = true;
}
catch (const boost::bad_rational&)
@@ -127,15 +125,6 @@ Fraction::~Fraction()
{
}
-bool Fraction::HasOverflowValue()
-{
- //coverity[result_independent_of_operands]
- return mpImpl->value.numerator() < std::numeric_limits<sal_Int32>::min() ||
- mpImpl->value.numerator() > std::numeric_limits<sal_Int32>::max() ||
- mpImpl->value.denominator() < std::numeric_limits<sal_Int32>::min() ||
- mpImpl->value.denominator() > std::numeric_limits<sal_Int32>::max();
-}
-
Fraction::operator double() const
{
if (!mpImpl->valid)
@@ -164,12 +153,6 @@ Fraction& Fraction::operator += ( const Fraction& rVal )
mpImpl->value += rVal.mpImpl->value;
- if ( HasOverflowValue() )
- {
- mpImpl->valid = false;
- SAL_WARN( "tools.fraction", "'operator +=' detected overflow" );
- }
-
return *this;
}
@@ -186,12 +169,6 @@ Fraction& Fraction::operator -= ( const Fraction& rVal )
mpImpl->value -= rVal.mpImpl->value;
- if ( HasOverflowValue() )
- {
- mpImpl->valid = false;
- SAL_WARN( "tools.fraction", "'operator -=' detected overflow" );
- }
-
return *this;
}
@@ -231,7 +208,7 @@ Fraction& Fraction::operator *= ( const Fraction& rVal )
bool bFail = checked_multiply_by(mpImpl->value, rVal.mpImpl->value);
- if (bFail || HasOverflowValue())
+ if (bFail)
{
mpImpl->valid = false;
}
@@ -252,12 +229,6 @@ Fraction& Fraction::operator /= ( const Fraction& rVal )
mpImpl->value /= rVal.mpImpl->value;
- if ( HasOverflowValue() )
- {
- mpImpl->valid = false;
- SAL_WARN( "tools.fraction", "'operator /=' detected overflow" );
- }
-
return *this;
}