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

Stephan Bergmann sbergman at redhat.com
Mon Jan 29 21:17:28 UTC 2018


 sw/source/filter/html/swhtml.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit e089258f6d7a270c574783c40808e18fb2d3b202
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 29 16:43:35 2018 +0100

    Clean up conversion to sal_uInt16
    
    Change-Id: I980197dd893dce9800607842f30cdbb4f9893d66
    Reviewed-on: https://gerrit.libreoffice.org/48847
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index c24502019fe1..a02448657dd5 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <algorithm>
 #include <memory>
 #include <config_features.h>
 
@@ -4992,7 +4995,7 @@ sal_uInt16 SwHTMLParser::ToTwips( sal_uInt16 nPixel )
     {
         long nTwips = Application::GetDefaultDevice()->PixelToLogic(
                     Size( nPixel, nPixel ), MapMode( MapUnit::MapTwip ) ).Width();
-        return nTwips <= USHRT_MAX ? static_cast<sal_uInt16>(nTwips) : USHRT_MAX;
+        return static_cast<sal_uInt16>(std::min(nTwips, SwTwips(SAL_MAX_UINT16)));
     }
     else
         return nPixel;


More information about the Libreoffice-commits mailing list