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

Caolán McNamara caolanm at redhat.com
Mon Feb 27 09:25:38 UTC 2017


 vcl/source/outdev/map.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit deaf847f5017bcf7bb345d691be9ae8fa0deff0e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 27 09:24:31 2017 +0000

    ofz#685 floating point exception
    
    Change-Id: I22741241253a6e3dabd0afa331aef2343d5fac77

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index c89aeb6..72d5f92 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -395,13 +395,15 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
                               long nThres )
 {
     assert(nDPI > 0);
-    if (nMapNum == 0)
+    long nDenom = nDPI * nMapNum;
+    if (nDenom == 0)
     {
         return 0;
     }
+
 #if (SAL_TYPES_SIZEOFLONG < 8)
     if( (+n < nThres) && (-n < nThres) )
-        n = (2 * n * nMapDenom) / (nDPI * nMapNum);
+        n = (2 * n * nMapDenom) / nDenom;
     else
 #else
     (void) nThres;
@@ -409,7 +411,6 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
     {
         sal_Int64 n64 = n;
         n64 *= nMapDenom;
-        long nDenom  = nDPI * nMapNum;
         n = (long)(2 * n64 / nDenom);
     }
     if( n < 0 ) --n; else ++n;


More information about the Libreoffice-commits mailing list