diff options
author | Pedro Giffuni <pfg@apache.org> | 2017-02-08 15:21:17 +0000 |
---|---|---|
committer | Pedro Giffuni <pfg@apache.org> | 2017-02-08 15:21:17 +0000 |
commit | da844070351493b0a4e60db14a1546fb346c1db7 (patch) | |
tree | c7f7e1c11213cf038189c442c95c32d4ee45896c /cppu | |
parent | f4d433e226052e82002ea7012047bf9f6297b0a3 (diff) |
i101100 - Fix some aliasing issues.
This is a very small part of a patch submitted by Caolan McNamara on
2009 to help OOo work with -fstrict-aliasing. It is not complete and for
now I omitted adding -fno-strict-aliasing to many makefiles.
This does require a lot more attention and will have to be completed at
some point because newer versions of GCC enable strict-aliasing with most
optimization levels.
Notes
Notes:
prefer: 11513ddf5b05cb7b3c1e91f9728159b9be3a5da2
Diffstat (limited to 'cppu')
-rw-r--r-- | cppu/inc/com/sun/star/uno/Any.hxx | 95 | ||||
-rw-r--r-- | cppu/source/threadpool/threadident.cxx | 9 | ||||
-rw-r--r-- | cppu/source/uno/copy.hxx | 52 | ||||
-rw-r--r-- | cppu/source/uno/data.cxx | 10 | ||||
-rw-r--r-- | cppu/source/uno/destr.hxx | 2 | ||||
-rw-r--r-- | cppu/source/uno/lbenv.cxx | 16 |
6 files changed, 91 insertions, 93 deletions
diff --git a/cppu/inc/com/sun/star/uno/Any.hxx b/cppu/inc/com/sun/star/uno/Any.hxx index 4e3e7d35dfc1..4246880423d6 100644 --- a/cppu/inc/com/sun/star/uno/Any.hxx +++ b/cppu/inc/com/sun/star/uno/Any.hxx @@ -230,7 +230,7 @@ inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, { if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass) { - value = (* reinterpret_cast< const sal_Bool * >( &rAny.pReserved ) != sal_False); + value = (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False); return sal_True; } return sal_False; @@ -239,7 +239,7 @@ inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW( () ) { return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass && - (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( &rAny.pReserved ) != sal_False)); + (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False)); } //______________________________________________________________________________ @@ -250,7 +250,7 @@ inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value ) if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN) { value = *reinterpret_cast< sal_Bool const * >( - &rAny.pReserved ) != sal_False; + rAny.pData ) != sal_False; return true; } return false; @@ -263,7 +263,7 @@ inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value ) { return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN && (value == - (*reinterpret_cast< sal_Bool const * >( &rAny.pReserved ) + (*reinterpret_cast< sal_Bool const * >( rAny.pData ) != sal_False))); } @@ -273,7 +273,7 @@ inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, { if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass) { - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; } return sal_False; @@ -285,11 +285,11 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SA switch (rAny.pType->eTypeClass) { case typelib_TypeClass_BYTE: - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: - value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int16 * >( rAny.pData ); return sal_True; default: return sal_False; @@ -301,11 +301,11 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) S switch (rAny.pType->eTypeClass) { case typelib_TypeClass_BYTE: - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: - value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData ); return sal_True; default: return sal_False; @@ -318,17 +318,17 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SA switch (rAny.pType->eTypeClass) { case typelib_TypeClass_BYTE: - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; case typelib_TypeClass_SHORT: - value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_SHORT: - value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: - value = * reinterpret_cast< const sal_Int32 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int32 * >( rAny.pData ); return sal_True; default: return sal_False; @@ -340,17 +340,17 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) S switch (rAny.pType->eTypeClass) { case typelib_TypeClass_BYTE: - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; case typelib_TypeClass_SHORT: - value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_SHORT: - value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: - value = * reinterpret_cast< const sal_uInt32 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData ); return sal_True; default: return sal_False; @@ -363,24 +363,23 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SA switch (rAny.pType->eTypeClass) { case typelib_TypeClass_BYTE: - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; case typelib_TypeClass_SHORT: - value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_SHORT: - value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_LONG: - value = * reinterpret_cast< const sal_Int32 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int32 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_LONG: - value = * reinterpret_cast< const sal_uInt32 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData ); return sal_True; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - value = * reinterpret_cast< const sal_Int64 * >( - (sizeof(void *) >= sizeof(sal_Int64)) ? (void *)&rAny.pReserved : rAny.pData ); + value = * reinterpret_cast< const sal_Int64 * >( rAny.pData ); return sal_True; default: @@ -393,24 +392,23 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) S switch (rAny.pType->eTypeClass) { case typelib_TypeClass_BYTE: - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; case typelib_TypeClass_SHORT: - value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_SHORT: - value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_LONG: - value = * reinterpret_cast< const sal_Int32 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int32 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_LONG: - value = * reinterpret_cast< const sal_uInt32 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData ); return sal_True; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - value = * reinterpret_cast< const sal_uInt64 * >( - (sizeof(void *) >= sizeof(sal_uInt64)) ? (void *)&rAny.pReserved : rAny.pData ); + value = * reinterpret_cast< const sal_uInt64 * >( rAny.pData ); return sal_True; default: @@ -424,17 +422,16 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_TH switch (rAny.pType->eTypeClass) { case typelib_TypeClass_BYTE: - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; case typelib_TypeClass_SHORT: - value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_SHORT: - value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_FLOAT: - value = * reinterpret_cast< const float * >( - (sizeof(void *) >= sizeof(float)) ? (void *)&rAny.pReserved : rAny.pData ); + value = * reinterpret_cast< const float * >( rAny.pData ); return sal_True; default: @@ -448,27 +445,25 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_T switch (rAny.pType->eTypeClass) { case typelib_TypeClass_BYTE: - value = * reinterpret_cast< const sal_Int8 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int8 * >( rAny.pData ); return sal_True; case typelib_TypeClass_SHORT: - value = * reinterpret_cast< const sal_Int16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_SHORT: - value = * reinterpret_cast< const sal_uInt16 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData ); return sal_True; case typelib_TypeClass_LONG: - value = * reinterpret_cast< const sal_Int32 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_Int32 * >( rAny.pData ); return sal_True; case typelib_TypeClass_UNSIGNED_LONG: - value = * reinterpret_cast< const sal_uInt32 * >( &rAny.pReserved ); + value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData ); return sal_True; case typelib_TypeClass_FLOAT: - value = * reinterpret_cast< const float * >( - (sizeof(void *) >= sizeof(float)) ? (void *)&rAny.pReserved : rAny.pData ); + value = * reinterpret_cast< const float * >( rAny.pData ); return sal_True; case typelib_TypeClass_DOUBLE: - value = * reinterpret_cast< const double * >( - (sizeof(void *) >= sizeof(double)) ? (void *)&rAny.pReserved : rAny.pData ); + value = * reinterpret_cast< const double * >( rAny.pData ); return sal_True; default: @@ -481,7 +476,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & valu { if (typelib_TypeClass_STRING == rAny.pType->eTypeClass) { - value = * reinterpret_cast< const ::rtl::OUString * >( &rAny.pReserved ); + value = * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ); return sal_True; } return sal_False; @@ -490,7 +485,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & valu inline sal_Bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW( () ) { return (typelib_TypeClass_STRING == rAny.pType->eTypeClass && - value.equals( * reinterpret_cast< const ::rtl::OUString * >( &rAny.pReserved ) )); + value.equals( * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ) )); } // type //__________________________________________________________________________________________________ @@ -498,7 +493,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THR { if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass) { - value = * reinterpret_cast< const Type * >( &rAny.pReserved ); + value = * reinterpret_cast< const Type * >( rAny.pData ); return sal_True; } return sal_False; @@ -507,7 +502,7 @@ inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THR inline sal_Bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW( () ) { return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass && - value.equals( * reinterpret_cast< const Type * >( &rAny.pReserved ) )); + value.equals( * reinterpret_cast< const Type * >( rAny.pData ) )); } // any //__________________________________________________________________________________________________ @@ -527,7 +522,7 @@ inline sal_Bool SAL_CALL operator == ( const Any & rAny, const BaseReference & v { if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass) { - return reinterpret_cast< const BaseReference * >( &rAny.pReserved )->operator == ( value ); + return reinterpret_cast< const BaseReference * >( rAny.pData )->operator == ( value ); } return sal_False; } diff --git a/cppu/source/threadpool/threadident.cxx b/cppu/source/threadpool/threadident.cxx index 2b2161f98dd2..73095892f254 100644 --- a/cppu/source/threadpool/threadident.cxx +++ b/cppu/source/threadpool/threadident.cxx @@ -24,6 +24,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cppu.hxx" #include <stdio.h> +#include <string.h> #include <list> @@ -47,10 +48,12 @@ using namespace ::cppu; static inline void createLocalId( sal_Sequence **ppThreadId ) { - rtl_byte_sequence_constructNoDefault( ppThreadId , 4 + 16 ); - *((sal_Int32*) ((*ppThreadId)->elements)) = osl_getThreadIdentifier(0); + rtl_byte_sequence_constructNoDefault( ppThreadId , sizeof(oslThreadIdentifier) + 16 ); - rtl_getGlobalProcessId( (sal_uInt8 * ) &( (*ppThreadId)->elements[4]) ); + oslThreadIdentifier hIdent = osl_getThreadIdentifier(0); + memcpy((*ppThreadId)->elements, &hIdent, sizeof(oslThreadIdentifier)); + + rtl_getGlobalProcessId( (sal_uInt8 * ) &( (*ppThreadId)->elements[sizeof(oslThreadIdentifier)]) ); } diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index fb4887c1d917..0248f501ee1c 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -179,32 +179,32 @@ inline void _copyConstructAnyFromData( { case typelib_TypeClass_CHAR: pDestAny->pData = &pDestAny->pReserved; - *(sal_Unicode *)&pDestAny->pReserved = *(sal_Unicode *)pSource; + *(sal_Unicode *)pDestAny->pData = *(sal_Unicode *)pSource; break; case typelib_TypeClass_BOOLEAN: pDestAny->pData = &pDestAny->pReserved; - *(sal_Bool *)&pDestAny->pReserved = (*(sal_Bool *)pSource != sal_False); + *(sal_Bool *)pDestAny->pData = (*(sal_Bool *)pSource != sal_False); break; case typelib_TypeClass_BYTE: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int8 *)&pDestAny->pReserved = *(sal_Int8 *)pSource; + *(sal_Int8 *)pDestAny->pData = *(sal_Int8 *)pSource; break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int16 *)&pDestAny->pReserved = *(sal_Int16 *)pSource; + *(sal_Int16 *)pDestAny->pData = *(sal_Int16 *)pSource; break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int32 *)&pDestAny->pReserved = *(sal_Int32 *)pSource; + *(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource; break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: if (sizeof(void *) >= sizeof(sal_Int64)) { pDestAny->pData = &pDestAny->pReserved; - *(sal_Int64 *)&pDestAny->pReserved = *(sal_Int64 *)pSource; + *(sal_Int64 *)pDestAny->pData = *(sal_Int64 *)pSource; } else { @@ -216,7 +216,7 @@ inline void _copyConstructAnyFromData( if (sizeof(void *) >= sizeof(float)) { pDestAny->pData = &pDestAny->pReserved; - *(float *)&pDestAny->pReserved = *(float *)pSource; + *(float *)pDestAny->pData = *(float *)pSource; } else { @@ -228,7 +228,7 @@ inline void _copyConstructAnyFromData( if (sizeof(void *) >= sizeof(double)) { pDestAny->pData = &pDestAny->pReserved; - *(double *)&pDestAny->pReserved = *(double *)pSource; + *(double *)pDestAny->pData = *(double *)pSource; } else { @@ -239,12 +239,12 @@ inline void _copyConstructAnyFromData( case typelib_TypeClass_STRING: ::rtl_uString_acquire( *(rtl_uString **)pSource ); pDestAny->pData = &pDestAny->pReserved; - *(rtl_uString **)&pDestAny->pReserved = *(rtl_uString **)pSource; + *(rtl_uString **)pDestAny->pData = *(rtl_uString **)pSource; break; case typelib_TypeClass_TYPE: TYPE_ACQUIRE( *(typelib_TypeDescriptionReference **)pSource ); pDestAny->pData = &pDestAny->pReserved; - *(typelib_TypeDescriptionReference **)&pDestAny->pReserved = *(typelib_TypeDescriptionReference **)pSource; + *(typelib_TypeDescriptionReference **)pDestAny->pData = *(typelib_TypeDescriptionReference **)pSource; break; case typelib_TypeClass_ANY: OSL_ENSURE( 0, "### unexpected nested any!" ); @@ -252,7 +252,7 @@ inline void _copyConstructAnyFromData( case typelib_TypeClass_ENUM: pDestAny->pData = &pDestAny->pReserved; // enum is forced to 32bit long - *(sal_Int32 *)&pDestAny->pReserved = *(sal_Int32 *)pSource; + *(sal_Int32 *)pDestAny->pData = *(sal_Int32 *)pSource; break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: @@ -313,7 +313,7 @@ inline void _copyConstructAnyFromData( pDestAny->pData = &pDestAny->pReserved; if (pTypeDescr) { - *(uno_Sequence **)&pDestAny->pReserved = copyConstructSequence( + *(uno_Sequence **)pDestAny->pData = copyConstructSequence( *(uno_Sequence **)pSource, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, acquire, mapping ); @@ -321,7 +321,7 @@ inline void _copyConstructAnyFromData( else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(uno_Sequence **)&pDestAny->pReserved = copyConstructSequence( + *(uno_Sequence **)pDestAny->pData = copyConstructSequence( *(uno_Sequence **)pSource, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, acquire, mapping ); @@ -388,32 +388,32 @@ inline void _copyConstructAny( { case typelib_TypeClass_CHAR: pDestAny->pData = &pDestAny->pReserved; - *(sal_Unicode *)&pDestAny->pReserved = '\0'; + *(sal_Unicode *)pDestAny->pData = '\0'; break; case typelib_TypeClass_BOOLEAN: pDestAny->pData = &pDestAny->pReserved; - *(sal_Bool *)&pDestAny->pReserved = sal_False; + *(sal_Bool *)pDestAny->pData = sal_False; break; case typelib_TypeClass_BYTE: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int8 *)&pDestAny->pReserved = 0; + *(sal_Int8 *)pDestAny->pData = 0; break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int16 *)&pDestAny->pReserved = 0; + *(sal_Int16 *)pDestAny->pData = 0; break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: pDestAny->pData = &pDestAny->pReserved; - *(sal_Int32 *)&pDestAny->pReserved = 0; + *(sal_Int32 *)pDestAny->pData = 0; break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: if (sizeof(void *) >= sizeof(sal_Int64)) { pDestAny->pData = &pDestAny->pReserved; - *(sal_Int64 *)&pDestAny->pReserved = 0; + *(sal_Int64 *)pDestAny->pData = 0; } else { @@ -425,7 +425,7 @@ inline void _copyConstructAny( if (sizeof(void *) >= sizeof(float)) { pDestAny->pData = &pDestAny->pReserved; - *(float *)&pDestAny->pReserved = 0.0; + *(float *)pDestAny->pData = 0.0; } else { @@ -437,7 +437,7 @@ inline void _copyConstructAny( if (sizeof(void *) >= sizeof(double)) { pDestAny->pData = &pDestAny->pReserved; - *(double *)&pDestAny->pReserved = 0.0; + *(double *)pDestAny->pData = 0.0; } else { @@ -447,23 +447,23 @@ inline void _copyConstructAny( break; case typelib_TypeClass_STRING: pDestAny->pData = &pDestAny->pReserved; - *(rtl_uString **)&pDestAny->pReserved = 0; + *(rtl_uString **)pDestAny->pData = 0; ::rtl_uString_new( (rtl_uString **)&pDestAny->pReserved ); break; case typelib_TypeClass_TYPE: pDestAny->pData = &pDestAny->pReserved; - *(typelib_TypeDescriptionReference **)&pDestAny->pReserved = _getVoidType(); + *(typelib_TypeDescriptionReference **)pDestAny->pData = _getVoidType(); break; case typelib_TypeClass_ENUM: pDestAny->pData = &pDestAny->pReserved; if (pTypeDescr) { - *(sal_Int32 *)&pDestAny->pReserved = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; + *(sal_Int32 *)pDestAny->pData = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; } else { TYPELIB_DANGER_GET( &pTypeDescr, pType ); - *(sal_Int32 *)&pDestAny->pReserved = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; + *(sal_Int32 *)pDestAny->pData = ((typelib_EnumTypeDescription *)pTypeDescr)->nDefaultEnumValue; TYPELIB_DANGER_RELEASE( pTypeDescr ); } break; @@ -516,7 +516,7 @@ inline void _copyConstructAny( break; case typelib_TypeClass_SEQUENCE: pDestAny->pData = &pDestAny->pReserved; - *(uno_Sequence **)&pDestAny->pReserved = createEmptySequence(); + *(uno_Sequence **)pDestAny->pData = createEmptySequence(); break; case typelib_TypeClass_INTERFACE: pDestAny->pData = &pDestAny->pReserved; diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index be4e38129a8b..fe212c14e7e3 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -64,12 +64,12 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p { typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0; - TYPELIB_DANGER_GET( (typelib_TypeDescription **) &pTXInterfaceDescr, type_XInterface ); - OSL_ASSERT( pTXInterfaceDescr->ppAllMembers ); + typelib_TypeDescription * pTXInterfaceDescr = 0; + TYPELIB_DANGER_GET( &pTXInterfaceDescr, type_XInterface ); + OSL_ASSERT( ((typelib_InterfaceTypeDescription*)pTXInterfaceDescr)->ppAllMembers ); typelib_typedescriptionreference_getDescription( - &g_pQITD, pTXInterfaceDescr->ppAllMembers[ 0 ] ); - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *) pTXInterfaceDescr ); + &g_pQITD, ((typelib_InterfaceTypeDescription*)pTXInterfaceDescr)->ppAllMembers[ 0 ] ); + TYPELIB_DANGER_RELEASE( pTXInterfaceDescr ); } } diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index 3922d18e1603..5b7151547944 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -171,7 +171,7 @@ inline void _destructAny( case typelib_TypeClass_SEQUENCE: { destructSequence( - *(uno_Sequence **) &pAny->pReserved, pType, 0, release ); + *(uno_Sequence **) pAny->pData, pType, 0, release ); break; } case typelib_TypeClass_INTERFACE: diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 0a6a32f2cbc3..b02ad3ab1bc9 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -257,7 +257,7 @@ static void SAL_CALL defenv_registerInterface( rtl_uString * pOId, typelib_InterfaceTypeDescription * pTypeDescr ) { OSL_ENSURE( pEnv && ppInterface && pOId && pTypeDescr, "### null ptr!" ); - OUString const & rOId = OUString::unacquired( &pOId ); + OUString sOId( pOId ); uno_DefaultEnvironment * that = static_cast< uno_DefaultEnvironment * >( pEnv ); @@ -265,10 +265,10 @@ static void SAL_CALL defenv_registerInterface( // try to insert dummy 0: std::pair<OId2ObjectMap::iterator, bool> const insertion( - that->aOId2ObjectMap.insert( OId2ObjectMap::value_type( rOId, 0 ) ) ); + that->aOId2ObjectMap.insert( OId2ObjectMap::value_type( sOId, 0 ) ) ); if (insertion.second) { - ObjectEntry * pOEntry = new ObjectEntry( rOId ); + ObjectEntry * pOEntry = new ObjectEntry( sOId ); insertion.first->second = pOEntry; ++pOEntry->nRef; // another register call on object pOEntry->append( that, *ppInterface, pTypeDescr, 0 ); @@ -305,7 +305,7 @@ static void SAL_CALL defenv_registerProxyInterface( { OSL_ENSURE( pEnv && ppInterface && pOId && pTypeDescr && freeProxy, "### null ptr!" ); - OUString const & rOId = OUString::unacquired( &pOId ); + OUString sOId( pOId ); uno_DefaultEnvironment * that = static_cast< uno_DefaultEnvironment * >( pEnv ); @@ -313,10 +313,10 @@ static void SAL_CALL defenv_registerProxyInterface( // try to insert dummy 0: std::pair<OId2ObjectMap::iterator, bool> const insertion( - that->aOId2ObjectMap.insert( OId2ObjectMap::value_type( rOId, 0 ) ) ); + that->aOId2ObjectMap.insert( OId2ObjectMap::value_type( sOId, 0 ) ) ); if (insertion.second) { - ObjectEntry * pOEntry = new ObjectEntry( rOId ); + ObjectEntry * pOEntry = new ObjectEntry( sOId ); insertion.first->second = pOEntry; ++pOEntry->nRef; // another register call on object pOEntry->append( that, *ppInterface, pTypeDescr, freeProxy ); @@ -494,13 +494,13 @@ static void SAL_CALL defenv_getRegisteredInterface( *ppInterface = 0; } - OUString const & rOId = OUString::unacquired( &pOId ); + OUString sOId( pOId ); uno_DefaultEnvironment * that = static_cast< uno_DefaultEnvironment * >( pEnv ); ::osl::MutexGuard guard( that->mutex ); OId2ObjectMap::const_iterator const iFind - ( that->aOId2ObjectMap.find( rOId ) ); + ( that->aOId2ObjectMap.find( sOId ) ); if (iFind != that->aOId2ObjectMap.end()) { InterfaceEntry const * pIEntry = iFind->second->find( pTypeDescr ); |