From fc0d494b8936ab11abca761810de8a03f579edf5 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Sun, 19 Apr 2015 22:28:56 -0500 Subject: rsc crash on WIN64 due to LP64 rsc stash stuff in a 'value' filed that was defined as 'long' saddly it stash also pointer there... which on WIN64 truncate 64 bits pointers in 32 bits scalar. That went unnoticed for years because on every other platform sizeof(long) = sizeof(void*) Change-Id: I218ae181c9d6b64ade457ee49942d1d07a933bb7 Reviewed-on: https://gerrit.libreoffice.org/15394 Tested-by: Jenkins Reviewed-by: Norbert Thiebaud --- rsc/inc/rsckey.hxx | 6 +++--- rsc/source/parser/rscinit.cxx | 38 +++++++++++++++++++------------------- rsc/source/parser/rsckey.cxx | 8 ++++---- rsc/source/tools/rsctree.cxx | 8 ++++---- 4 files changed, 30 insertions(+), 30 deletions(-) (limited to 'rsc') diff --git a/rsc/inc/rsckey.hxx b/rsc/inc/rsckey.hxx index 099b20cef580..92df3ce70bfd 100644 --- a/rsc/inc/rsckey.hxx +++ b/rsc/inc/rsckey.hxx @@ -28,7 +28,7 @@ typedef struct { Atom nName; sal_uInt32 nTyp; - long yylval; + sal_IntPtr yylval; } KEY_STRUCT; class RscNameTable @@ -40,8 +40,8 @@ public: RscNameTable(); ~RscNameTable(); void SetSort( bool bSorted = true ); - Atom Put( Atom nName, sal_uInt32 nTyp, long nValue ); - Atom Put( const char * pName, sal_uInt32 nTyp, long nValue ); + Atom Put( Atom nName, sal_uInt32 nTyp, sal_IntPtr nValue ); + Atom Put( const char * pName, sal_uInt32 nTyp, sal_IntPtr nValue ); Atom Put( const char * pName, sal_uInt32 nTyp ); Atom Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ); diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx index e09c4c651d9e..24ee7529a1de 100644 --- a/rsc/source/parser/rscinit.cxx +++ b/rsc/source/parser/rscinit.cxx @@ -102,27 +102,27 @@ void RscTypCont::Init() aNmTb.SetSort( false ); { - aNmTb.Put( "LINE", LINE, (long)0 ); - aNmTb.Put( "NOT", NOT, (long)0 ); - aNmTb.Put( "DEFINE", DEFINE, (long)0 ); - aNmTb.Put( "INCLUDE", INCLUDE, (long)0 ); - aNmTb.Put( "DEFAULT", DEFAULT, (long)0 ); - aNmTb.Put( "class", CLASS, (long)0 ); - aNmTb.Put( "extendable", EXTENDABLE, (long)0 ); - aNmTb.Put( "writeifset", WRITEIFSET, (long)0 ); + aNmTb.Put( "LINE", LINE, (sal_IntPtr)0 ); + aNmTb.Put( "NOT", NOT, (sal_IntPtr)0 ); + aNmTb.Put( "DEFINE", DEFINE, (sal_IntPtr)0 ); + aNmTb.Put( "INCLUDE", INCLUDE, (sal_IntPtr)0 ); + aNmTb.Put( "DEFAULT", DEFAULT, (sal_IntPtr)0 ); + aNmTb.Put( "class", CLASS, (sal_IntPtr)0 ); + aNmTb.Put( "extendable", EXTENDABLE, (sal_IntPtr)0 ); + aNmTb.Put( "writeifset", WRITEIFSET, (sal_IntPtr)0 ); /* Werte fuer Aufzaehlungstypen */ - aNmTb.Put( "TRUE", BOOLEAN, (long)sal_True ); - aNmTb.Put( "FALSE", BOOLEAN, (long)sal_False ); - - aNmTb.Put( "XSCALE", XSCALE , (long)0 ); - aNmTb.Put( "YSCALE", YSCALE , (long)0 ); - aNmTb.Put( "RGB", RGB , (long)0 ); - aNmTb.Put( "POSSIZE", GEOMETRY, (long)0 ); - aNmTb.Put( "POS", POSITION, (long)0 ); - aNmTb.Put( "SIZE", DIMENSION, (long)0 ); - aNmTb.Put( "ZoomInOutputSize", INZOOMOUTPUTSIZE,(long)0 ); - aNmTb.Put( "FloatingPos", FLOATINGPOS, (long)0 ); + aNmTb.Put( "TRUE", BOOLEAN, (sal_IntPtr)sal_True ); + aNmTb.Put( "FALSE", BOOLEAN, (sal_IntPtr)sal_False ); + + aNmTb.Put( "XSCALE", XSCALE , (sal_IntPtr)0 ); + aNmTb.Put( "YSCALE", YSCALE , (sal_IntPtr)0 ); + aNmTb.Put( "RGB", RGB , (sal_IntPtr)0 ); + aNmTb.Put( "POSSIZE", GEOMETRY, (sal_IntPtr)0 ); + aNmTb.Put( "POS", POSITION, (sal_IntPtr)0 ); + aNmTb.Put( "SIZE", DIMENSION, (sal_IntPtr)0 ); + aNmTb.Put( "ZoomInOutputSize", INZOOMOUTPUTSIZE,(sal_IntPtr)0 ); + aNmTb.Put( "FloatingPos", FLOATINGPOS, (sal_IntPtr)0 ); } { aShort.SetRange( -32768, 32767 ); diff --git a/rsc/source/parser/rsckey.cxx b/rsc/source/parser/rsckey.cxx index a82ae3cb390e..cddfc0101232 100644 --- a/rsc/source/parser/rsckey.cxx +++ b/rsc/source/parser/rsckey.cxx @@ -69,7 +69,7 @@ void RscNameTable::SetSort( bool bSorted ) } }; -Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, long nValue ) +Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, sal_IntPtr nValue ) { if( pTable ) pTable = static_cast( @@ -90,7 +90,7 @@ Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, long nValue ) return nName; }; -Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, long nValue ) +Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, sal_IntPtr nValue ) { return Put( pHS->getID( pName ), nTyp, nValue ); }; @@ -100,12 +100,12 @@ Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp ) Atom nId; nId = pHS->getID( pName ); - return Put( nId, nTyp, (long)nId ); + return Put( nId, nTyp, (sal_IntPtr)nId ); }; Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ) { - return Put( nName, nTyp, reinterpret_cast(pClass) ); + return Put( nName, nTyp, reinterpret_cast(pClass) ); }; bool RscNameTable::Get( Atom nName, KEY_STRUCT * pEle ) diff --git a/rsc/source/tools/rsctree.cxx b/rsc/source/tools/rsctree.cxx index c72c77f8d5e6..a080349cf80d 100644 --- a/rsc/source/tools/rsctree.cxx +++ b/rsc/source/tools/rsctree.cxx @@ -155,9 +155,9 @@ NameNode * NameNode::Remove( NameNode * pRemove ) COMPARE NameNode::Compare( const NameNode * pCompare ) const { - if( reinterpret_cast(this) < reinterpret_cast(pCompare) ) + if( reinterpret_cast(this) < reinterpret_cast(pCompare) ) return LESS; - else if( reinterpret_cast(this) > reinterpret_cast(pCompare) ) + else if( reinterpret_cast(this) > reinterpret_cast(pCompare) ) return GREATER; else return EQUAL; @@ -165,9 +165,9 @@ COMPARE NameNode::Compare( const NameNode * pCompare ) const COMPARE NameNode::Compare( const void * pCompare ) const { - if( reinterpret_cast(this) < reinterpret_cast(pCompare) ) + if( reinterpret_cast(this) < reinterpret_cast(pCompare) ) return LESS; - else if( reinterpret_cast(this) > reinterpret_cast(pCompare) ) + else if( reinterpret_cast(this) > reinterpret_cast(pCompare) ) return GREATER; else return EQUAL; -- cgit