[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - writerfilter/source

Michael Stahl mstahl at redhat.com
Sat Aug 31 10:55:35 PDT 2013


 writerfilter/source/dmapper/WrapPolygonHandler.hxx |    4 ++--
 writerfilter/source/resourcemodel/Fraction.cxx     |    4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 67ef58d1b338b4a57cae69174de987626250c651
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 30 19:13:40 2013 +0200

    fdo#41068: writerfilter: fix image wrap polygon import
    
    Mainly the problem seems to be that Stein's GCD algorithm requires
    non-negative input parameters, and the document has this:
     <wp:lineTo x="-480" y="6104"/>
    
    (regression from 86898639d4144a078ed295d0a8bef406868802cb)
    
    Change-Id: I8da1272c3caae84f43472aa4acb65ed66dfbd8ae
    (cherry picked from commit f8307e5ae11e8235fa1fb88ed52625bf9c650dc2)
    Reviewed-on: https://gerrit.libreoffice.org/5700
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.hxx b/writerfilter/source/dmapper/WrapPolygonHandler.hxx
index 9312db7..c56a524 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 9d8a48f..762b9af 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;


More information about the Libreoffice-commits mailing list