summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--writerfilter/source/dmapper/WrapPolygonHandler.hxx4
-rw-r--r--writerfilter/source/resourcemodel/Fraction.cxx4
2 files changed, 5 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.hxx b/writerfilter/source/dmapper/WrapPolygonHandler.hxx
index 9312db792158..c56a524b345e 100644
--- a/writerfilter/source/dmapper/WrapPolygonHandler.hxx
+++ b/writerfilter/source/dmapper/WrapPolygonHandler.hxx
@@ -70,8 +70,8 @@ public:
private:
WrapPolygon::Pointer_t mpPolygon;
- sal_uInt32 mnX;
- sal_uInt32 mnY;
+ sal_Int32 mnX;
+ sal_Int32 mnY;
// Properties
virtual void lcl_attribute(Id Name, Value & val);
diff --git a/writerfilter/source/resourcemodel/Fraction.cxx b/writerfilter/source/resourcemodel/Fraction.cxx
index 9d8a48fa99fc..762b9afed8e6 100644
--- a/writerfilter/source/resourcemodel/Fraction.cxx
+++ b/writerfilter/source/resourcemodel/Fraction.cxx
@@ -22,6 +22,8 @@
namespace writerfilter {
namespace resourcemodel {
+// Stein's binary GCD for non-negative integers
+// https://en.wikipedia.org/wiki/Binary_GCD_algorithm
sal_uInt32 gcd(sal_uInt32 a, sal_uInt32 b)
{
if (a == 0 || b == 0)
@@ -77,7 +79,7 @@ Fraction::~Fraction()
void Fraction::init(sal_Int32 nNumerator, sal_Int32 nDenominator)
{
- sal_uInt32 nGCD = gcd(nNumerator, nDenominator);
+ sal_uInt32 nGCD = gcd(abs(nNumerator), abs(nDenominator));
mnNumerator = nNumerator/ nGCD;
mnDenominator = nDenominator / nGCD;