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

New commits:
commit a339ebca55f53db5f0b72b26fcfbb3aaa2b2a825
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Nov 13 12:19:49 2021 +0200
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Nov 13 12:12:45 2021 +0100

    Drop unused variables
    
    nWidth/nHeight (1) are irrelevant here (we get the correct pixel size
    right in the hDIB), and (2) should not be -1, because we don't use
    ICAP_UNDEFINEDIMAGESIZE capability [1].
    
    [1] 
https://twain.org/wp-content/uploads/2017/03/TWAIN-2.4-Specification.pdf#page=268
    
    Change-Id: I8cb20087944536552326b3e1582e8ef12dcc0d32
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124986
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/extensions/source/scanner/twain32shim.cxx 
b/extensions/source/scanner/twain32shim.cxx
index 0a34fa13ce7e..8821a3b0cabc 100644
--- a/extensions/source/scanner/twain32shim.cxx
+++ b/extensions/source/scanner/twain32shim.cxx
@@ -387,17 +387,15 @@ void ImpTwain::ImplXfer()
     {
         TW_IMAGEINFO aInfo;
         HANDLE hDIB = nullptr;
-        TW_INT32 nWidth, nHeight, nXRes, nYRes;
+        TW_INT32 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 = FixToInt32(aInfo.XResolution);
             nYRes = FixToInt32(aInfo.YResolution);
         }
         else
-            nWidth = nHeight = nXRes = nYRes = -1;
+            nXRes = nYRes = -1;
 
         switch (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGENATIVEXFER, 
MSG_GET, &hDIB))
         {
@@ -417,7 +415,7 @@ void ImpTwain::ImplXfer()
                     {
                         if (LPVOID pBmpMem = GlobalLock(hGlob))
                         {
-                            if ((nXRes != -1) && (nYRes != -1) && (nWidth != 
-1) && (nHeight != -1))
+                            if ((nXRes != -1) && (nYRes != -1))
                             {
                                 // set resolution of bitmap
                                 BITMAPINFOHEADER* pBIH = 
static_cast<BITMAPINFOHEADER*>(pBmpMem);

Reply via email to