diff options
Diffstat (limited to 'extensions/source/scanner/scanwin.cxx')
-rw-r--r-- | extensions/source/scanner/scanwin.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx index 109f2944a3b5..198b092846cd 100644 --- a/extensions/source/scanner/scanwin.cxx +++ b/extensions/source/scanner/scanwin.cxx @@ -253,9 +253,10 @@ void Twain::ShimListenerThread::execute() ThrowLastError("DuplicateHandle"); // we will not need our copy as soon as shim has its own inherited one ScopedHANDLE hScopedDup(hDup); - DWORD nDup = static_cast<DWORD>(reinterpret_cast<sal_uIntPtr>(hDup)); - if (reinterpret_cast<HANDLE>(nDup) != hDup) - throw std::exception("HANDLE does not fit to 32 bit - cannot pass to shim!"); + sal_uIntPtr nDup = reinterpret_cast<sal_uIntPtr>(hDup); + if constexpr (sizeof(sal_uIntPtr) > 4) + if (nDup > 0xFFFFFFFF) + throw std::exception("HANDLE does not fit to 32 bit - cannot pass to shim!"); // Send this thread handle as the first parameter sCmdLine = "\"" + sCmdLine + "\" " + OUString::number(nDup); |