diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-06 21:29:24 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-06 21:29:24 +0100 |
commit | be5a6706b6a34a57774714929b9b7fe06f69173e (patch) | |
tree | 72704b840e9b62866a6c99edbb3dfeab2d3742a0 | |
parent | 9b4abcd1c45a646a1ac9120fe1c489ba6bb44e95 (diff) |
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
-rw-r--r-- | vcl/source/outdev/map.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 5a43c07df54e..b359e504d0a9 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); |