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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 26 16:35:02 UTC 2020


 dbaccess/source/ui/dlg/ConnectionHelper.cxx |    2 +-
 dbaccess/source/ui/dlg/adodatalinks.cxx     |    6 +++---
 dbaccess/source/ui/dlg/adodatalinks.hxx     |    3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 475d4b274b499c2f3c482449df046baa2a483b24
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Nov 26 14:26:40 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Nov 26 17:34:18 2020 +0100

    Use sal_IntPtr to transport HWND to IDataSourceLocator::put_hWnd
    
    The HWND hWnd source is in OConnectionHelper::implInitControls
    (dbaccess/source/ui/dlg/ConnectionHelper.cxx) and the
    IDataSourceLocator::put_hWnd call sinks are in PromptNew and PromptEdit
    (dbaccess/source/ui/dlg/adodatalinks.cxx).  The IDataSourceLocator source code
    has
    
              virtual HRESULT __stdcall put_hWnd(
                             COMPATIBLE_LONG hwndParent) = 0;
    
    with
    
      typedef LONGLONG COMPATIBLE_LONG;
    
    (both C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\msdasc.h),
    so it looks like an integer type large enough to hold pointers is what is
    appropriate here.  (Which matches the fact that HWND aka HANDLE aka PVOID is a
    pointer type.)
    
    Change-Id: I3a18e9a1d2f75a1feac716ef6e7bca78165ffe95
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106695
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 063c5320e566..5ab0d0b850e3 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -272,7 +272,7 @@ namespace dbaui
                     hWnd = reinterpret_cast<HWND>(tmp);
                 }
 
-                sNewDataSource = getAdoDatalink(reinterpret_cast<LONG_PTR>(hWnd),sOldDataSource);
+                sNewDataSource = getAdoDatalink(reinterpret_cast<sal_IntPtr>(hWnd),sOldDataSource);
                 if ( !sNewDataSource.isEmpty() )
                 {
                     setURLNoPrefix(sNewDataSource);
diff --git a/dbaccess/source/ui/dlg/adodatalinks.cxx b/dbaccess/source/ui/dlg/adodatalinks.cxx
index c8bafabf1088..74703b010bcb 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.cxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.cxx
@@ -35,7 +35,7 @@
 
 namespace {
 
-OUString PromptNew(long hWnd)
+OUString PromptNew(sal_IntPtr hWnd)
 {
     HRESULT hr;
     IDataSourceLocator* dlPrompt = nullptr;
@@ -95,7 +95,7 @@ OUString PromptNew(long hWnd)
     return OUString(o3tl::toU(_result));
 }
 
-OUString PromptEdit(long hWnd, OUString const & connstr)
+OUString PromptEdit(sal_IntPtr hWnd, OUString const & connstr)
 {
     HRESULT hr;
     IDataSourceLocator* dlPrompt = nullptr;
@@ -189,7 +189,7 @@ OUString PromptEdit(long hWnd, OUString const & connstr)
 
 }
 
-OUString getAdoDatalink(long hWnd,OUString const & oldLink)
+OUString getAdoDatalink(sal_IntPtr hWnd,OUString const & oldLink)
 {
     OUString dataLink;
     if (!oldLink.isEmpty())
diff --git a/dbaccess/source/ui/dlg/adodatalinks.hxx b/dbaccess/source/ui/dlg/adodatalinks.hxx
index 3cbbd18c3b6c..6b753f62e442 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.hxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <rtl/ustring.hxx>
+#include <sal/types.h>
 
-OUString getAdoDatalink(long hWnd, OUString const& oldLink);
+OUString getAdoDatalink(sal_IntPtr hWnd, OUString const& oldLink);
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list