diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2009-10-30 11:38:40 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2009-10-30 11:38:40 +0100 |
commit | 953559b4f9446b14280611d35d5391b92640cab6 (patch) | |
tree | 2fa3e3acbe5bef1728b597319f80f8d8f93b05c9 /rsc/inc | |
parent | 979028e7efbcaf1b419040d9bd9df34218b3fca2 (diff) |
#i106475# alias patch (thanks cmc)
Diffstat (limited to 'rsc/inc')
-rw-r--r-- | rsc/inc/rsctools.hxx | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx index eb9f8937b939..fd8e49135eb0 100644 --- a/rsc/inc/rsctools.hxx +++ b/rsc/inc/rsctools.hxx @@ -138,28 +138,41 @@ public: sal_uInt32 Size(){ return( nLen ); }; void Put( sal_uInt64 lVal ) { + union + { + sal_uInt64 lVal64; + sal_uInt32 aVal32[2]; + }; + lVal64 = lVal; if( bSwap ) { - Put( *(((sal_uInt32*)&lVal)+1) ); - Put( *(sal_uInt32*)&lVal ); + Put( aVal32[1] ); + Put( aVal32[0] ); } else { - Put( *(sal_uInt32*)&lVal ); - Put( *(((sal_uInt32*)&lVal)+1) ); + Put( aVal32[0] ); + Put( aVal32[1] ); } } void Put( sal_Int32 lVal ) { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + if( bSwap ) { - Put( *(((sal_uInt16*)&lVal) +1) ); - Put( *(sal_uInt16*)&lVal ); + Put( aVal16[1] ); + Put( aVal16[0] ); } else { - Put( *(sal_uInt16*)&lVal ); - Put( *(((sal_uInt16*)&lVal) +1) ); + Put( aVal16[0] ); + Put( aVal16[1] ); } } void Put( sal_uInt32 nValue ) @@ -171,15 +184,22 @@ public: void PutAt( sal_uInt32 nPos, INT32 lVal ) { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + if( bSwap ) { - PutAt( nPos, *(((sal_uInt16*)&lVal) +1) ); - PutAt( nPos + 2, *(sal_uInt16*)&lVal ); + PutAt( nPos, aVal16[1] ); + PutAt( nPos + 2, aVal16[0] ); } else { - PutAt( nPos, *(sal_uInt16*)&lVal ); - PutAt( nPos + 2, *(((sal_uInt16*)&lVal) +1) ); + PutAt( nPos, aVal16[0] ); + PutAt( nPos + 2, aVal16[1] ); } } void PutAt( sal_uInt32 nPos, sal_uInt32 lVal ) |