summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-07-04 00:29:55 +0200
committerMichael Stahl <mstahl@redhat.com>2014-07-04 00:39:36 +0200
commitdcbac37efebb9877a72f7c9914b63d60f46a5656 (patch)
tree8ad08060c9e0e839502e8f5044887c3ef1e9ac3b
parent6f92b58987f754de31c9ca756e813deb7462d98e (diff)
fdo#76803: writerfilter: fix image wrap polygon import again
The division in Fraction::init() should be a signed one, to prevent a change in sign, e.g., -220869/9 = +477194047. (regression from f8307e5ae11e8235fa1fb88ed52625bf9c650dc2) Change-Id: Icbbd1721144ff42c53ae71312641bd601ba60762
-rw-r--r--writerfilter/source/resourcemodel/Fraction.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/writerfilter/source/resourcemodel/Fraction.cxx b/writerfilter/source/resourcemodel/Fraction.cxx
index 1f24bb3e5b51..ba76985150a4 100644
--- a/writerfilter/source/resourcemodel/Fraction.cxx
+++ b/writerfilter/source/resourcemodel/Fraction.cxx
@@ -79,9 +79,11 @@ Fraction::~Fraction()
void Fraction::init(sal_Int32 nNumerator, sal_Int32 nDenominator)
{
- sal_uInt32 nGCD = gcd(abs(nNumerator), abs(nDenominator));
+ // fdo#41068 pass non-negative numbers to gcd
+ sal_Int32 const nGCD = gcd(abs(nNumerator), abs(nDenominator));
- mnNumerator = nNumerator/ nGCD;
+ // fdo#76803 do signed division
+ mnNumerator = nNumerator / nGCD;
mnDenominator = nDenominator / nGCD;
}