Kaydet (Commit) e089258f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up conversion to sal_uInt16

Change-Id: I980197dd893dce9800607842f30cdbb4f9893d66
Reviewed-on: https://gerrit.libreoffice.org/48847Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 7a22e8a7
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment