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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 25 20:42:20 UTC 2020


 extensions/source/scanner/twain32shim.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 8de92fa9bc7b284cb151ec57205bbccda379e379
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Nov 25 17:54:52 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Nov 25 21:41:29 2020 +0100

    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 at redhat.com>

diff --git a/extensions/source/scanner/twain32shim.cxx b/extensions/source/scanner/twain32shim.cxx
index 30cbba8558e4..0a34fa13ce7e 100644
--- a/extensions/source/scanner/twain32shim.cxx
+++ b/extensions/source/scanner/twain32shim.cxx
@@ -35,9 +35,9 @@
 
 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";
@@ -387,14 +387,14 @@ void ImpTwain::ImplXfer()
     {
         TW_IMAGEINFO aInfo;
         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)
         {
             nWidth = aInfo.ImageWidth;
             nHeight = aInfo.ImageLength;
-            nXRes = FixToLong(aInfo.XResolution);
-            nYRes = FixToLong(aInfo.YResolution);
+            nXRes = FixToInt32(aInfo.XResolution);
+            nYRes = FixToInt32(aInfo.YResolution);
         }
         else
             nWidth = nHeight = nXRes = nYRes = -1;


More information about the Libreoffice-commits mailing list