[Libreoffice-commits] core.git: rsc/inc rsc/source

Norbert Thiebaud nthiebaud at gmail.com
Sun Apr 19 22:27:53 PDT 2015


 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(-)

New commits:
commit fc0d494b8936ab11abca761810de8a03f579edf5
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Apr 19 22:28:56 2015 -0500

    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 <ci at libreoffice.org>
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/rsc/inc/rsckey.hxx b/rsc/inc/rsckey.hxx
index 099b20c..92df3ce 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 e09c4c6..24ee752 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 a82ae3cb..cddfc01 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<KEY_STRUCT *>(
@@ -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<long>(pClass) );
+    return Put( nName, nTyp, reinterpret_cast<sal_IntPtr>(pClass) );
 };
 
 bool RscNameTable::Get( Atom nName, KEY_STRUCT * pEle )
diff --git a/rsc/source/tools/rsctree.cxx b/rsc/source/tools/rsctree.cxx
index c72c77f..a080349 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<long>(this) < reinterpret_cast<long>(pCompare) )
+    if( reinterpret_cast<sal_uIntPtr>(this) < reinterpret_cast<sal_uIntPtr>(pCompare) )
         return LESS;
-    else if( reinterpret_cast<long>(this) > reinterpret_cast<long>(pCompare) )
+    else if( reinterpret_cast<sal_uIntPtr>(this) > reinterpret_cast<sal_uIntPtr>(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<long>(this) < reinterpret_cast<long>(pCompare) )
+    if( reinterpret_cast<sal_uIntPtr>(this) < reinterpret_cast<sal_uIntPtr>(pCompare) )
         return LESS;
-    else if( reinterpret_cast<long>(this) > reinterpret_cast<long>(pCompare) )
+    else if( reinterpret_cast<sal_uIntPtr>(this) > reinterpret_cast<sal_uIntPtr>(pCompare) )
         return GREATER;
     else
         return EQUAL;


More information about the Libreoffice-commits mailing list