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

Stephan Bergmann sbergman at redhat.com
Fri Mar 6 12:31:30 PST 2015


 vcl/source/outdev/map.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit be5a6706b6a34a57774714929b9b7fe06f69173e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Mar 6 21:29:24 2015 +0100

    Handle degenerate case of nMapNum == 0
    
    ...appears to be occasionally necessary, probably since
    d8e7bc042bd0912a66c231b101cecda0f838a80f "Remove hack of replacing 0 with
    1/LONG_MAX"
    
    Change-Id: I1eb7277bfdc9722c761bd03678cd770a3763de1f

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 5a43c07..b359e50 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -374,9 +374,9 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
     }
     else
 #else
-    assert(nMapNum > 0);
+    assert(nMapNum >= 0);
     assert(nDPI > 0);
-    assert(std::abs(n) < std::numeric_limits<long>::max() / nMapNum / nDPI); //detect overflows
+    assert(nMapNum == 0 || std::abs(n) < std::numeric_limits<long>::max() / nMapNum / nDPI); //detect overflows
 #endif
     {
        sal_Int64 n64 = n;
@@ -399,6 +399,10 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
 {
     // To "use" it...
    (void) nThres;
+   if (nMapNum == 0)
+   {
+       return 0;
+   }
 #if (SAL_TYPES_SIZEOFLONG < 8)
     if( (+n < nThres) && (-n < nThres) )
         n = (2 * n * nMapDenom) / (nDPI * nMapNum);


More information about the Libreoffice-commits mailing list