You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pe...@apache.org on 2026/07/25 17:36:27 UTC

(openoffice) 01/18: vcl/basic/sfx2/unixODBC: Win64 (x64) source fixes

This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 30f18d3fb8fe7eacd8ee5f353bc7c60bfbf18ac5
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Wed Jul 22 00:55:30 2026 +0200

    vcl/basic/sfx2/unixODBC: Win64 (x64) source fixes
    
    Source-level fixes needed to compile/link these modules for Windows x86-64
    (VS2008 x64).  Each is arch-neutral or arch-guarded, so the x86 build is
    unchanged; isolated here so they can be cherry-picked onto the dmake
    windows-amd64 branch / upstream.
    
    - vcl/inc/win/wincomp.hxx: the pointer/handle class- and window-long indices
      GCL_HCURSOR/GCL_HICON/GCL_HBRBACKGROUND and GWL_HINSTANCE do not exist on
      Win64; use GCLP_*/GWLP_* with SetClassLongPtr/GetClassLongPtr/
      GetWindowLongPtr and (LONG_PTR) casts (compile on x86 too).
    - vcl/win/source/window/salframe.cxx: PtrToInt(wParam) misused on the integer
      IME request code (WPARAM is 64-bit on x64) -> static_cast<int>.
    - vcl/win/source/gdi/salgdi.cxx: ImplPreparePolyDraw took const sal_uLong* while
      the drawPolyPolygon* callers pass const sal_uInt32* (distinct pointer types on
      x64) -> sal_uInt32*.
    - vcl/source/window/scrwnd.cxx: Max(sal_uIntPtr, 1UL) ambiguous on x64 (sal_uIntPtr
      is 64-bit, 1UL is unsigned long) -> Max(..., sal_uIntPtr(1UL)).
    - basic/source/runtime/dllmgr.cxx: the DllMgr_call32/callFp trampolines (wnt.asm)
      are x86 stdcall only; guard #if defined WNT -> #if defined(WNT) && !defined(_WIN64)
      so x64 uses the existing not-implemented stub (Basic Declare'd DLL calls
      unsupported on x64 until an x64 trampoline is written).
    - sfx2/source/bastyp/progress.cxx: extern Get10ThSec declared sal_uIntPtr but the
      definition returns sal_uInt32; these coincide on x86 but diverge on x64 (link
      error) -> declare sal_uInt32.
    - unixODBC/inc/sqltypes.h: the _WIN64 branch uses INT64/UINT64 for SQLLEN/SQLULEN
      without pulling them in -> #include <basetsd.h> (arch-guarded).
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit ca1383cbf9353b4189783687c37e993025edf764)
    (cherry picked from commit a82fa8aef582f462d3f5518690eb9c6c33e5e8d0)
---
 main/basic/source/runtime/dllmgr.cxx    |  6 +++++-
 main/sfx2/source/bastyp/progress.cxx    |  3 ++-
 main/unixODBC/inc/sqltypes.h            |  1 +
 main/vcl/inc/win/wincomp.hxx            | 14 +++++++-------
 main/vcl/source/window/scrwnd.cxx       |  2 +-
 main/vcl/win/source/gdi/salgdi.cxx      |  4 ++--
 main/vcl/win/source/window/salframe.cxx |  4 ++--
 7 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/main/basic/source/runtime/dllmgr.cxx b/main/basic/source/runtime/dllmgr.cxx
index d31420340b..6a3adcdc7e 100644
--- a/main/basic/source/runtime/dllmgr.cxx
+++ b/main/basic/source/runtime/dllmgr.cxx
@@ -60,7 +60,11 @@
    variables accordingly.
 */
 
-#if defined WNT // only 32-bit Windows, actually
+#if defined(WNT) && !defined(_WIN64) // only 32-bit Windows: the DllMgr_call32/callFp
+                                     // trampolines (wnt.asm) are x86 stdcall only.
+                                     // x64 falls through to the not-implemented stub
+                                     // below (Basic Declare'd DLL calls unsupported on
+                                     // x64 until an x64 trampoline is written).
 
 extern "C" {
 
diff --git a/main/sfx2/source/bastyp/progress.cxx b/main/sfx2/source/bastyp/progress.cxx
index efacc2cfd1..3e189c066a 100644
--- a/main/sfx2/source/bastyp/progress.cxx
+++ b/main/sfx2/source/bastyp/progress.cxx
@@ -110,7 +110,8 @@ struct SfxProgress_Impl
 #define aTypeLibInfo aProgressTypeLibImpl
 
 //========================================================================
-extern sal_uIntPtr Get10ThSec();
+extern sal_uInt32 Get10ThSec();  // must match the definition in sfxbasecontroller.cxx
+                                 // (sal_uInt32); sal_uIntPtr diverges from it on x64
 
 // -----------------------------------------------------------------------
 
diff --git a/main/unixODBC/inc/sqltypes.h b/main/unixODBC/inc/sqltypes.h
index 399f702834..31171490b6 100644
--- a/main/unixODBC/inc/sqltypes.h
+++ b/main/unixODBC/inc/sqltypes.h
@@ -146,6 +146,7 @@ typedef unsigned char		SQLVARCHAR;
  *  New Win64 datatypes
  */
 #ifdef _WIN64
+#include <basetsd.h>			/* INT64 / UINT64 (not otherwise pulled in here) */
 typedef INT64			SQLLEN;
 typedef UINT64			SQLULEN;
 typedef UINT64			SQLSETPOSIROW;
diff --git a/main/vcl/inc/win/wincomp.hxx b/main/vcl/inc/win/wincomp.hxx
index e0bea9893b..60cc88b02c 100644
--- a/main/vcl/inc/win/wincomp.hxx
+++ b/main/vcl/inc/win/wincomp.hxx
@@ -146,37 +146,37 @@ inline HFONT GetWindowFont( HWND hWnd )
 
 inline void SetClassCursor( HWND hWnd, HCURSOR hCursor )
 {
-	SetClassLong( hWnd, GCL_HCURSOR, (DWORD)hCursor );
+	SetClassLongPtr( hWnd, GCLP_HCURSOR, (LONG_PTR)hCursor );
 }
 
 inline HCURSOR GetClassCursor( HWND hWnd )
 {
-	return (HCURSOR)GetClassLong( hWnd, GCL_HCURSOR );
+	return (HCURSOR)GetClassLongPtr( hWnd, GCLP_HCURSOR );
 }
 
 inline void SetClassIcon( HWND hWnd, HICON hIcon )
 {
-	SetClassLong( hWnd, GCL_HICON, (DWORD)hIcon );
+	SetClassLongPtr( hWnd, GCLP_HICON, (LONG_PTR)hIcon );
 }
 
 inline HICON GetClassIcon( HWND hWnd )
 {
-	return (HICON)GetClassLong( hWnd, GCL_HICON );
+	return (HICON)GetClassLongPtr( hWnd, GCLP_HICON );
 }
 
 inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush )
 {
-	return (HBRUSH)SetClassLong( hWnd, GCL_HBRBACKGROUND, (DWORD)hBrush );
+	return (HBRUSH)SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hBrush );
 }
 
 inline HBRUSH GetClassBrush( HWND hWnd )
 {
-	return (HBRUSH)GetClassLong( hWnd, GCL_HBRBACKGROUND );
+	return (HBRUSH)GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND );
 }
 
 inline HINSTANCE GetWindowInstance( HWND hWnd )
 {
-	return (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE );
+	return (HINSTANCE)GetWindowLongPtr( hWnd, GWLP_HINSTANCE );
 }
 
 // ------------------------
diff --git a/main/vcl/source/window/scrwnd.cxx b/main/vcl/source/window/scrwnd.cxx
index eeb0c43811..9cd21452b5 100644
--- a/main/vcl/source/window/scrwnd.cxx
+++ b/main/vcl/source/window/scrwnd.cxx
@@ -394,7 +394,7 @@ IMPL_LINK( ImplWheelWindow, ImplScrollHdl, Timer*, EMPTYARG )
 			pWindow->Command( aCEvt );
 			if( aDel.IsDead() )
 				return 0;
-			mnRepaintTime = Max( Time::GetSystemTicks() - nTime, 1UL );
+			mnRepaintTime = Max( Time::GetSystemTicks() - nTime, sal_uIntPtr(1UL) );
 			ImplRecalcScrollValues();
 		}
 	}
diff --git a/main/vcl/win/source/gdi/salgdi.cxx b/main/vcl/win/source/gdi/salgdi.cxx
index 53453a0ec3..fc033a8844 100644
--- a/main/vcl/win/source/gdi/salgdi.cxx
+++ b/main/vcl/win/source/gdi/salgdi.cxx
@@ -622,7 +622,7 @@ void ImplClearHDCCache( SalData* pData )
 // Make sure pWinPointAry and pWinFlagAry are big enough
 void ImplPreparePolyDraw( bool						bCloseFigures,
                           sal_uLong 					nPoly,
-                          const sal_uLong* 				pPoints,
+                          const sal_uInt32* 				pPoints,
                           const SalPoint* const* 	pPtAry,
                           const BYTE* const* 		pFlgAry,
                           POINT* 					pWinPointAry,
@@ -1601,7 +1601,7 @@ sal_Bool WinSalGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt
 				"WinSalGraphics::DrawPolyPolygonBezier(): POINT != SalPoint" );
 
     sal_uLong nCurrPoly, nTotalPoints;
-    const sal_uLong* pCurrPoints = pPoints;
+    const sal_uInt32* pCurrPoints = pPoints;
     for( nCurrPoly=0, nTotalPoints=0; nCurrPoly<nPoly; ++nCurrPoly )
         nTotalPoints += *pCurrPoints++;
 
diff --git a/main/vcl/win/source/window/salframe.cxx b/main/vcl/win/source/window/salframe.cxx
index 7e0fe04a44..703fd76bef 100644
--- a/main/vcl/win/source/window/salframe.cxx
+++ b/main/vcl/win/source/window/salframe.cxx
@@ -6249,12 +6249,12 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
             break;
 #if WINVER >= 0x0500
         case WM_IME_REQUEST:
-            if ( PtrToInt( wParam ) == IMR_RECONVERTSTRING )
+            if ( static_cast<int>( wParam ) == IMR_RECONVERTSTRING )
             {
                 nRet = ImplHandleIMEReconvertString( hWnd, lParam );
                 rDef = FALSE;
             }
-	    else if( PtrToInt( wParam ) == IMR_CONFIRMRECONVERTSTRING )
+	    else if( static_cast<int>( wParam ) == IMR_CONFIRMRECONVERTSTRING )
 	    {
 		nRet = ImplHandleIMEConfirmReconvertString( hWnd, lParam );
 		rDef = FALSE;