Discussion:
svn commit: r1847776 - /openoffice/trunk/main/tools/inc/tools/debug.hxx
d***@apache.org
2018-11-30 04:35:17 UTC
Permalink
Author: damjan
Date: Fri Nov 30 04:35:17 2018
New Revision: 1847776

URL: http://svn.apache.org/viewvc?rev=1847776&view=rev
Log:
On LLP64 systems (eg. Win64) sizeof(long) == 32,
so pointers stored in longs will result in data corruption, and
terrible run-time errors like memory corruption when they are
used to access memory.

Use sal_IntPtr instead.

Patch by: me


Modified:
openoffice/trunk/main/tools/inc/tools/debug.hxx

Modified: openoffice/trunk/main/tools/inc/tools/debug.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/tools/inc/tools/debug.hxx?rev=1847776&r1=1847775&r2=1847776&view=diff
==============================================================================
--- openoffice/trunk/main/tools/inc/tools/debug.hxx (original)
+++ openoffice/trunk/main/tools/inc/tools/debug.hxx Fri Nov 30 04:35:17 2018
@@ -159,27 +159,27 @@ inline void DbgGlobalDebugEnd()

inline void DbgSetPrintMsgBox( DbgPrintLine pProc )
{
- DbgFunc( DBG_FUNC_SETPRINTMSGBOX, (void*)(long)pProc );
+ DbgFunc( DBG_FUNC_SETPRINTMSGBOX, (void*)(sal_IntPtr)pProc );
}

inline DbgPrintLine DbgGetPrintMsgBox()
{
- return (DbgPrintLine)(long)DbgFunc( DBG_FUNC_GETPRINTMSGBOX );
+ return (DbgPrintLine)(sal_IntPtr)DbgFunc( DBG_FUNC_GETPRINTMSGBOX );
}

inline void DbgSetPrintWindow( DbgPrintLine pProc )
{
- DbgFunc( DBG_FUNC_SETPRINTWINDOW, (void*)(long)pProc );
+ DbgFunc( DBG_FUNC_SETPRINTWINDOW, (void*)(sal_IntPtr)pProc );
}

inline void DbgSetPrintTestTool( DbgPrintLine pProc )
{
- DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(long)pProc );
+ DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(sal_IntPtr)pProc );
}

inline void DbgSetAbort( DbgPrintLine pProc )
{
- DbgFunc( DBG_FUNC_SET_ABORT, (void*)(long)pProc );
+ DbgFunc( DBG_FUNC_SET_ABORT, (void*)(sal_IntPtr)pProc );
}

typedef sal_uInt16 DbgChannelId;
@@ -203,7 +203,7 @@ TOOLS_DLLPUBLIC DbgChannelId DbgRegister

inline sal_Bool DbgFilterMessage( const char* pMsg )
{
- return (sal_Bool)(long) DbgFunc( DBG_FUNC_FILTERMESSAGE, (void*)pMsg );
+ return (sal_Bool)(sal_IntPtr) DbgFunc( DBG_FUNC_FILTERMESSAGE, (void*)pMsg );
}

inline int DbgIsAllErrorOut()
@@ -311,7 +311,7 @@ inline void DbgCoreDump()

inline void DbgSetTestSolarMutex( DbgTestSolarMutexProc pProc )
{
- DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, (void*)(long)pProc );
+ DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, (void*)(sal_IntPtr)pProc );
}

inline void DbgTestSolarMutex()

Loading...