[Libreoffice-commits] core.git: filter/source

Caolán McNamara caolanm at redhat.com
Wed Oct 25 11:05:56 UTC 2017


 filter/source/graphicfilter/icgm/bitmap.cxx |    3 ++-
 filter/source/graphicfilter/icgm/class4.cxx |    1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a24a659d97504a7782574335dd8d1307d727119d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Oct 25 09:04:31 2017 +0100

    ofz#3793 Divide-by-zero
    
    Change-Id: Idc18b194840c8d2646426a0346b49348707be5ad
    Reviewed-on: https://gerrit.libreoffice.org/43806
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index 7208fda0ae97..da83096126a7 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -179,7 +179,8 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
             nX = rDesc.mnR.X - rDesc.mnP.X;
             nY = rDesc.mnR.Y - rDesc.mnP.Y;
 
-            rDesc.mnOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+            const double fSqrt = sqrt(nX * nX + nY * nY);
+            rDesc.mnOrientation = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
             if ( nY > 0 )
                 rDesc.mnOrientation = 360 - rDesc.mnOrientation;
 
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index 813d07b69f4f..d2c155ee25be 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -32,7 +32,6 @@ double CGM::ImplGetOrientation( FloatPoint const & rCenter, FloatPoint const & r
     double nY = rPoint.Y - rCenter.Y;
 
     double fSqrt = sqrt(nX * nX + nY * nY);
-
     double fOrientation = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
     if (nY > 0)
         fOrientation = 360 - fOrientation;


More information about the Libreoffice-commits mailing list