TW_IMAGEINFO::ImageWidth,ImageHeight are of type TW_INT32

...and for TW_IMAGEINFO::XResolution,YResolution of type TW_FIX32 it appears
more natural to also convert them to TW_INT32 here, rather than to long

Change-Id: If531f3f3c4778439ae1ba19a5d829eb2ae9c803d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106606
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2020-11-25 17:54:52 +01:00
parent ff75b172cc
commit 8de92fa9bc

View File

@@ -35,9 +35,9 @@
namespace namespace
{ {
long FixToLong(const TW_FIX32& rFix) TW_INT32 FixToInt32(const TW_FIX32& rFix)
{ {
return static_cast<long>(floor(rFix.Whole + rFix.Frac / 65536. + 0.5)); return static_cast<TW_INT32>(floor(rFix.Whole + rFix.Frac / 65536. + 0.5));
} }
const wchar_t sTwainWndClass[] = L"TwainClass"; const wchar_t sTwainWndClass[] = L"TwainClass";
@@ -387,14 +387,14 @@ void ImpTwain::ImplXfer()
{ {
TW_IMAGEINFO aInfo; TW_IMAGEINFO aInfo;
HANDLE hDIB = nullptr; HANDLE hDIB = nullptr;
long nWidth, nHeight, nXRes, nYRes; TW_INT32 nWidth, nHeight, nXRes, nYRes;
if (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &aInfo) == TWRC_SUCCESS) if (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &aInfo) == TWRC_SUCCESS)
{ {
nWidth = aInfo.ImageWidth; nWidth = aInfo.ImageWidth;
nHeight = aInfo.ImageLength; nHeight = aInfo.ImageLength;
nXRes = FixToLong(aInfo.XResolution); nXRes = FixToInt32(aInfo.XResolution);
nYRes = FixToLong(aInfo.YResolution); nYRes = FixToInt32(aInfo.YResolution);
} }
else else
nWidth = nHeight = nXRes = nYRes = -1; nWidth = nHeight = nXRes = nYRes = -1;